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
This commit is contained in:
parent
0d23504e30
commit
f4f496cb48
18 changed files with 358 additions and 200 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue