diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2021-09-28 19:43:40 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-29 00:43:40 +0200 |
| commit | f4f496cb48a59aae36e3252baa90396e1bfadd2e (patch) | |
| tree | 5594d76b3f1b552f1fecdeda37bd2f6667781a56 /Ryujinx.HLE/HOS | |
| parent | 0d23504e30395ba20d1704da464b41f3fe539062 (diff) | |
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
Diffstat (limited to 'Ryujinx.HLE/HOS')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Nv/Host1xContext.cs | 15 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs | 7 |
2 files changed, 5 insertions, 17 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Nv/Host1xContext.cs b/Ryujinx.HLE/HOS/Services/Nv/Host1xContext.cs index 024b0bb4..14f3389b 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/Host1xContext.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/Host1xContext.cs @@ -22,21 +22,6 @@ namespace Ryujinx.HLE.HOS.Services.Nv var vic = new VicDevice(Smmu); Host1x.RegisterDevice(ClassId.Nvdec, nvdec); Host1x.RegisterDevice(ClassId.Vic, vic); - - nvdec.FrameDecoded += (FrameDecodedEventArgs e) => - { - // FIXME: - // Figure out what is causing frame ordering issues on H264. - // For now this is needed as workaround. - if (e.CodecId == CodecId.H264) - { - vic.SetSurfaceOverride(e.LumaOffset, e.ChromaOffset, 0); - } - else - { - vic.DisableSurfaceOverride(); - } - }; } public void Dispose() diff --git a/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs b/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs index a85fd44c..e11949be 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostChannelDeviceFile.cs @@ -27,6 +27,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel private readonly IVirtualMemoryManager _memory; private readonly Host1xContext _host1xContext; + private readonly long _contextId; public GpuChannel Channel { get; } @@ -52,6 +53,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel _submitTimeout = 0; _timeslice = 0; _host1xContext = GetHost1XContext(context.Device.Gpu, owner); + _contextId = _host1xContext.Host1x.CreateContext(); Channel = _device.Gpu.CreateChannel(); ChannelInitialization.InitializeState(Channel); @@ -167,7 +169,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel var data = _memory.GetSpan(map.Address + commandBuffer.Offset, commandBuffer.WordsCount * 4); - _host1xContext.Host1x.Submit(MemoryMarshal.Cast<byte, int>(data)); + _host1xContext.Host1x.Submit(MemoryMarshal.Cast<byte, int>(data), _contextId); } } @@ -177,7 +179,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel tmpCmdBuff[0] = (4 << 28) | (int)fences[0].Id; - _host1xContext.Host1x.Submit(tmpCmdBuff); + _host1xContext.Host1x.Submit(tmpCmdBuff, _contextId); return NvInternalResult.Success; } @@ -548,6 +550,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel public override void Close() { + _host1xContext.Host1x.DestroyContext(_contextId); Channel.Dispose(); } |
