From c86aacde76b5f8e503e2b412385c8491ecc86b3b Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 3 Dec 2018 00:38:47 -0200 Subject: NVDEC implementation using FFmpeg (#443) * Initial nvdec implementation using FFmpeg * Fix swapped channels on the video decoder and the G8R8 texture format * Fix texture samplers not being set properly (regression) * Rebased * Remove unused code introduced on the rebase * Add support for RGBA8 output format on the video image composer * Correct spacing * Some fixes for rebase and other tweaks * Allow size mismatch on frame copy * Get rid of GetHostAddress calls on VDec --- Ryujinx.Graphics/Memory/NvGpuBufferType.cs | 11 +++++++++++ Ryujinx.Graphics/Memory/NvGpuVmm.cs | 26 ++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 Ryujinx.Graphics/Memory/NvGpuBufferType.cs (limited to 'Ryujinx.Graphics/Memory') diff --git a/Ryujinx.Graphics/Memory/NvGpuBufferType.cs b/Ryujinx.Graphics/Memory/NvGpuBufferType.cs new file mode 100644 index 00000000..6f0d2571 --- /dev/null +++ b/Ryujinx.Graphics/Memory/NvGpuBufferType.cs @@ -0,0 +1,11 @@ +namespace Ryujinx.Graphics.Memory +{ + public enum NvGpuBufferType + { + Index, + Vertex, + Texture, + ConstBuffer, + Count + } +} \ No newline at end of file diff --git a/Ryujinx.Graphics/Memory/NvGpuVmm.cs b/Ryujinx.Graphics/Memory/NvGpuVmm.cs index ccb21950..cfd1aaeb 100644 --- a/Ryujinx.Graphics/Memory/NvGpuVmm.cs +++ b/Ryujinx.Graphics/Memory/NvGpuVmm.cs @@ -72,6 +72,28 @@ namespace Ryujinx.Graphics.Memory } } + public long MapLow(long PA, long Size) + { + lock (PageTable) + { + long VA = GetFreePosition(Size, 1, PageSize); + + if (VA != -1 && (ulong)VA <= uint.MaxValue && (ulong)(VA + Size) <= uint.MaxValue) + { + for (long Offset = 0; Offset < Size; Offset += PageSize) + { + SetPte(VA + Offset, PA + Offset); + } + } + else + { + VA = -1; + } + + return VA; + } + } + public long ReserveFixed(long VA, long Size) { lock (PageTable) @@ -122,11 +144,11 @@ namespace Ryujinx.Graphics.Memory } } - private long GetFreePosition(long Size, long Align = 1) + private long GetFreePosition(long Size, long Align = 1, long Start = 1L << 32) { //Note: Address 0 is not considered valid by the driver, //when 0 is returned it's considered a mapping error. - long Position = PageSize; + long Position = Start; long FreeSize = 0; if (Align < 1) -- cgit v1.2.3