diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-04-25 23:11:26 -0300 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-04-25 23:12:26 -0300 |
| commit | a38a72b0622f89897bdcd01b6d00ea6bc142c34f (patch) | |
| tree | 2025cdddaa7ef6769ac69c51eeede0924ffcba5f /Ryujinx.Core/OsHle/Services | |
| parent | 211f7f69db4d84b82caa3ee62d4ecdfbbd95604d (diff) | |
Some small sync primitive fixes, logging fixes, started to implement the 2D engine on the GPU, fixed DrawArrays, implemented a few more shader instructions, made a start on nvdrv refactor, etc...
Diffstat (limited to 'Ryujinx.Core/OsHle/Services')
| -rw-r--r-- | Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs | 27 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Services/Nv/NvChNvMap.cs | 31 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Services/Nv/NvMap.cs | 7 |
3 files changed, 65 insertions, 0 deletions
diff --git a/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs b/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs index 10d63894..f41a98d0 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs @@ -44,6 +44,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv { { ("/dev/nvhost-as-gpu", 0x4101), NvGpuAsIoctlBindChannel }, { ("/dev/nvhost-as-gpu", 0x4102), NvGpuAsIoctlAllocSpace }, + { ("/dev/nvhost-as-gpu", 0x4105), NvGpuAsIoctlUnmap }, { ("/dev/nvhost-as-gpu", 0x4106), NvGpuAsIoctlMapBufferEx }, { ("/dev/nvhost-as-gpu", 0x4108), NvGpuAsIoctlGetVaRegions }, { ("/dev/nvhost-as-gpu", 0x4109), NvGpuAsIoctlInitializeEx }, @@ -201,6 +202,19 @@ namespace Ryujinx.Core.OsHle.Services.Nv return 0; } + private long NvGpuAsIoctlUnmap(ServiceCtx Context) + { + long Position = Context.Request.GetSendBuffPtr(); + + MemReader Reader = new MemReader(Context.Memory, Position); + + long Offset = Reader.ReadInt64(); + + Context.Ns.Gpu.MemoryMgr.Unmap(Offset, 0x10000); + + return 0; + } + private long NvGpuAsIoctlMapBufferEx(ServiceCtx Context) { long Position = Context.Request.GetSendBuffPtr(); @@ -319,6 +333,19 @@ namespace Ryujinx.Core.OsHle.Services.Nv int Padding = Reader.ReadInt32(); int Offset = Reader.ReadInt32(); int Pages = Reader.ReadInt32(); + + NvMap Map = NvMaps.GetData<NvMap>(Context.Process, Handle); + + if (Map == null) + { + Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"invalid NvMap Handle {Handle}!"); + + return -1; //TODO: Corrent error code. + } + + Context.Ns.Gpu.MapMemory(Map.CpuAddress, + (long)(uint)Offset << 16, + (long)(uint)Pages << 16); } //TODO diff --git a/Ryujinx.Core/OsHle/Services/Nv/NvChNvMap.cs b/Ryujinx.Core/OsHle/Services/Nv/NvChNvMap.cs new file mode 100644 index 00000000..9ea3ae6e --- /dev/null +++ b/Ryujinx.Core/OsHle/Services/Nv/NvChNvMap.cs @@ -0,0 +1,31 @@ +using System.Collections.Concurrent; + +namespace Ryujinx.Core.OsHle.Services.Nv +{ + class NvChNvMap + { + private static ConcurrentDictionary<Process, IdDictionary> NvMaps; + + public void Create(ServiceCtx Context) + { + long InputPosition = Context.Request.GetBufferType0x21Position(); + long OutputPosition = Context.Request.GetBufferType0x22Position(); + + int Size = Context.Memory.ReadInt32(InputPosition); + + int Handle = AddNvMap(Context, new NvMap(Size)); + + Context.Memory.WriteInt32(OutputPosition, Handle); + } + + private int AddNvMap(ServiceCtx Context, NvMap Map) + { + return NvMaps[Context.Process].Add(Map); + } + + public NvMap GetNvMap(ServiceCtx Context, int Handle) + { + return NvMaps[Context.Process].GetData<NvMap>(Handle); + } + } +}
\ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/Nv/NvMap.cs b/Ryujinx.Core/OsHle/Services/Nv/NvMap.cs index f3dd1f47..570cef68 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/NvMap.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/NvMap.cs @@ -9,5 +9,12 @@ namespace Ryujinx.Core.OsHle.Services.Nv public int Kind; public long CpuAddress; public long GpuAddress; + + public NvMap() { } + + public NvMap(int Size) + { + this.Size = Size; + } } }
\ No newline at end of file |
