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...
This commit is contained in:
@@ -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
|
||||
|
31
Ryujinx.Core/OsHle/Services/Nv/NvChNvMap.cs
Normal file
31
Ryujinx.Core/OsHle/Services/Nv/NvChNvMap.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user