From f4f496cb48a59aae36e3252baa90396e1bfadd2e Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 28 Sep 2021 19:43:40 -0300 Subject: NVDEC (H264): Use separate contexts per channel and decode frames in DTS order (#2671) * Use separate NVDEC contexts per channel (for FFMPEG) * Remove NVDEC -> VIC frame override hack * Add missing bottom_field_pic_order_in_frame_present_flag * Make FFMPEG logging static * nit: Remove empty lines * New FFMPEG decoding approach -- call h264_decode_frame directly, trim surface cache to reduce memory usage * Fix case * Silence warnings * PR feedback * Per-decoder rather than per-codec ownership of surfaces on the cache --- Ryujinx.Graphics.Vic/VicDevice.cs | 38 +----------------------------------- Ryujinx.Graphics.Vic/VicRegisters.cs | 2 ++ 2 files changed, 3 insertions(+), 37 deletions(-) (limited to 'Ryujinx.Graphics.Vic') diff --git a/Ryujinx.Graphics.Vic/VicDevice.cs b/Ryujinx.Graphics.Vic/VicDevice.cs index db4fe513..21021c58 100644 --- a/Ryujinx.Graphics.Vic/VicDevice.cs +++ b/Ryujinx.Graphics.Vic/VicDevice.cs @@ -1,9 +1,7 @@ -using Ryujinx.Common.Logging; -using Ryujinx.Graphics.Device; +using Ryujinx.Graphics.Device; using Ryujinx.Graphics.Gpu.Memory; using Ryujinx.Graphics.Vic.Image; using Ryujinx.Graphics.Vic.Types; -using System; using System.Collections.Generic; namespace Ryujinx.Graphics.Vic @@ -14,9 +12,6 @@ namespace Ryujinx.Graphics.Vic private readonly ResourceManager _rm; private readonly DeviceState _state; - private PlaneOffsets _overrideOffsets; - private bool _hasOverride; - public VicDevice(MemoryManager gmm) { _gmm = gmm; @@ -27,32 +22,6 @@ namespace Ryujinx.Graphics.Vic }); } - /// - /// Overrides all input surfaces with a custom surface. - /// - /// Offset of the luma plane or packed data for this surface - /// Offset of the U chroma plane (for planar formats) or both chroma planes (for semiplanar formats) - /// Offset of the V chroma plane for planar formats - public void SetSurfaceOverride(uint lumaOffset, uint chromaUOffset, uint chromaVOffset) - { - _overrideOffsets.LumaOffset = lumaOffset; - _overrideOffsets.ChromaUOffset = chromaUOffset; - _overrideOffsets.ChromaVOffset = chromaVOffset; - _hasOverride = true; - } - - /// - /// Disables overriding input surfaces. - /// - /// - /// Surface overrides are disabled by default. - /// Call this if you previously called and which to disable it. - /// - public void DisableSurfaceOverride() - { - _hasOverride = false; - } - public int Read(int offset) => _state.Read(offset); public void Write(int offset, int data) => _state.Write(offset, data); @@ -76,11 +45,6 @@ namespace Ryujinx.Graphics.Vic var offsets = _state.State.SetSurfacexSlotx[i][0]; - if (_hasOverride) - { - offsets = _overrideOffsets; - } - using Surface src = SurfaceReader.Read(_rm, ref slot.SlotSurfaceConfig, ref offsets); Blender.BlendOne(output, src, ref slot); diff --git a/Ryujinx.Graphics.Vic/VicRegisters.cs b/Ryujinx.Graphics.Vic/VicRegisters.cs index 74d41ade..1c11b554 100644 --- a/Ryujinx.Graphics.Vic/VicRegisters.cs +++ b/Ryujinx.Graphics.Vic/VicRegisters.cs @@ -4,9 +4,11 @@ namespace Ryujinx.Graphics.Vic { struct PlaneOffsets { +#pragma warning disable CS0649 public uint LumaOffset; public uint ChromaUOffset; public uint ChromaVOffset; +#pragma warning restore CS0649 } struct VicRegisters -- cgit v1.2.3