diff options
author | gdkchan <gab.dark.100@gmail.com> | 2022-03-23 17:09:32 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-23 17:09:32 -0300 |
commit | 1402d8391d84f912110104e3e6c1a50a8c000d59 (patch) | |
tree | 20c22eb021a92d0256c45ba676d05a7504460bfa /Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs | |
parent | e3b36db71c62a34a26b30683dd5ad5410c97cc9c (diff) |
Support NVDEC H264 interlaced video decoding and VIC deinterlacing (#3225)1.1.84
* Support NVDEC H264 interlaced video decoding and VIC deinterlacing
* Remove unused code
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs b/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs index c57f1a6f..ae27c712 100644 --- a/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs +++ b/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs @@ -256,6 +256,49 @@ namespace Ryujinx.Graphics.Gpu.Memory } /// <summary> + /// Writes data to GPU mapped memory, stopping at the first unmapped page at the memory region, if any. + /// </summary> + /// <param name="va">GPU virtual address to write the data into</param> + /// <param name="data">The data to be written</param> + public void WriteMapped(ulong va, ReadOnlySpan<byte> data) + { + if (IsContiguous(va, data.Length)) + { + Physical.Write(Translate(va), data); + } + else + { + int offset = 0, size; + + if ((va & PageMask) != 0) + { + ulong pa = Translate(va); + + size = Math.Min(data.Length, (int)PageSize - (int)(va & PageMask)); + + if (pa != PteUnmapped && Physical.IsMapped(pa)) + { + Physical.Write(pa, data.Slice(0, size)); + } + + offset += size; + } + + for (; offset < data.Length; offset += size) + { + ulong pa = Translate(va + (ulong)offset); + + size = Math.Min(data.Length - offset, (int)PageSize); + + if (pa != PteUnmapped && Physical.IsMapped(pa)) + { + Physical.Write(pa, data.Slice(offset, size)); + } + } + } + } + + /// <summary> /// Maps a given range of pages to the specified CPU virtual address. /// </summary> /// <remarks> |