NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
using ChocolArm64.Memory;
|
2018-06-24 02:39:25 +02:00
|
|
|
using Ryujinx.HLE.Gpu.Memory;
|
2018-08-17 01:47:36 +02:00
|
|
|
using Ryujinx.HLE.HOS.Services.Nv.NvGpuAS;
|
2018-06-11 02:46:42 +02:00
|
|
|
using Ryujinx.HLE.Logging;
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
using System;
|
2018-07-15 05:04:46 +02:00
|
|
|
using System.Collections.Concurrent;
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
2018-08-17 01:47:36 +02:00
|
|
|
namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
{
|
|
|
|
class NvHostChannelIoctl
|
|
|
|
{
|
2018-07-15 05:04:46 +02:00
|
|
|
private class ChannelsPerProcess
|
|
|
|
{
|
|
|
|
public ConcurrentDictionary<NvChannelName, NvChannel> Channels { get; private set; }
|
|
|
|
|
|
|
|
public ChannelsPerProcess()
|
|
|
|
{
|
|
|
|
Channels = new ConcurrentDictionary<NvChannelName, NvChannel>();
|
|
|
|
|
|
|
|
Channels.TryAdd(NvChannelName.Gpu, new NvChannel());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private static ConcurrentDictionary<Process, ChannelsPerProcess> Channels;
|
|
|
|
|
|
|
|
static NvHostChannelIoctl()
|
|
|
|
{
|
|
|
|
Channels = new ConcurrentDictionary<Process, ChannelsPerProcess>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static int ProcessIoctlGpu(ServiceCtx Context, int Cmd)
|
|
|
|
{
|
|
|
|
return ProcessIoctl(Context, NvChannelName.Gpu, Cmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static int ProcessIoctl(ServiceCtx Context, NvChannelName Channel, int Cmd)
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
{
|
|
|
|
switch (Cmd & 0xffff)
|
|
|
|
{
|
2018-07-15 05:04:46 +02:00
|
|
|
case 0x4714: return SetUserData (Context);
|
|
|
|
case 0x4801: return SetNvMap (Context);
|
|
|
|
case 0x4803: return SetTimeout (Context, Channel);
|
|
|
|
case 0x4808: return SubmitGpfifo (Context);
|
|
|
|
case 0x4809: return AllocObjCtx (Context);
|
|
|
|
case 0x480b: return ZcullBind (Context);
|
|
|
|
case 0x480c: return SetErrorNotifier (Context);
|
|
|
|
case 0x480d: return SetPriority (Context);
|
|
|
|
case 0x481a: return AllocGpfifoEx2 (Context);
|
|
|
|
case 0x481b: return KickoffPbWithAttr(Context);
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
throw new NotImplementedException(Cmd.ToString("x8"));
|
|
|
|
}
|
|
|
|
|
|
|
|
private static int SetUserData(ServiceCtx Context)
|
|
|
|
{
|
2018-06-03 00:46:09 +02:00
|
|
|
long InputPosition = Context.Request.GetBufferType0x21().Position;
|
|
|
|
long OutputPosition = Context.Request.GetBufferType0x22().Position;
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
2018-08-17 01:47:36 +02:00
|
|
|
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
|
|
|
return NvResult.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static int SetNvMap(ServiceCtx Context)
|
|
|
|
{
|
2018-06-03 00:46:09 +02:00
|
|
|
long InputPosition = Context.Request.GetBufferType0x21().Position;
|
|
|
|
long OutputPosition = Context.Request.GetBufferType0x22().Position;
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
2018-08-17 01:47:36 +02:00
|
|
|
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
|
|
|
return NvResult.Success;
|
|
|
|
}
|
|
|
|
|
2018-07-15 05:04:46 +02:00
|
|
|
private static int SetTimeout(ServiceCtx Context, NvChannelName Channel)
|
|
|
|
{
|
|
|
|
long InputPosition = Context.Request.GetBufferType0x21().Position;
|
|
|
|
|
|
|
|
GetChannel(Context, Channel).Timeout = Context.Memory.ReadInt32(InputPosition);
|
|
|
|
|
|
|
|
return NvResult.Success;
|
|
|
|
}
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
private static int SubmitGpfifo(ServiceCtx Context)
|
|
|
|
{
|
2018-06-03 00:46:09 +02:00
|
|
|
long InputPosition = Context.Request.GetBufferType0x21().Position;
|
|
|
|
long OutputPosition = Context.Request.GetBufferType0x22().Position;
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
|
|
|
NvHostChannelSubmitGpfifo Args = AMemoryHelper.Read<NvHostChannelSubmitGpfifo>(Context.Memory, InputPosition);
|
|
|
|
|
2018-08-15 20:59:51 +02:00
|
|
|
NvGpuVmm Vmm = NvGpuASIoctl.GetASCtx(Context).Vmm;;
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
|
|
|
for (int Index = 0; Index < Args.NumEntries; Index++)
|
|
|
|
{
|
|
|
|
long Gpfifo = Context.Memory.ReadInt64(InputPosition + 0x18 + Index * 8);
|
|
|
|
|
2018-07-15 05:04:46 +02:00
|
|
|
PushGpfifo(Context, Vmm, Gpfifo);
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Args.SyncptId = 0;
|
|
|
|
Args.SyncptValue = 0;
|
|
|
|
|
|
|
|
AMemoryHelper.Write(Context.Memory, OutputPosition, Args);
|
|
|
|
|
|
|
|
return NvResult.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static int AllocObjCtx(ServiceCtx Context)
|
|
|
|
{
|
2018-06-03 00:46:09 +02:00
|
|
|
long InputPosition = Context.Request.GetBufferType0x21().Position;
|
|
|
|
long OutputPosition = Context.Request.GetBufferType0x22().Position;
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
2018-08-17 01:47:36 +02:00
|
|
|
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
|
|
|
return NvResult.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static int ZcullBind(ServiceCtx Context)
|
|
|
|
{
|
2018-06-03 00:46:09 +02:00
|
|
|
long InputPosition = Context.Request.GetBufferType0x21().Position;
|
|
|
|
long OutputPosition = Context.Request.GetBufferType0x22().Position;
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
2018-08-17 01:47:36 +02:00
|
|
|
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
|
|
|
return NvResult.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static int SetErrorNotifier(ServiceCtx Context)
|
|
|
|
{
|
2018-06-03 00:46:09 +02:00
|
|
|
long InputPosition = Context.Request.GetBufferType0x21().Position;
|
|
|
|
long OutputPosition = Context.Request.GetBufferType0x22().Position;
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
2018-08-17 01:47:36 +02:00
|
|
|
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
|
|
|
return NvResult.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static int SetPriority(ServiceCtx Context)
|
|
|
|
{
|
2018-06-03 00:46:09 +02:00
|
|
|
long InputPosition = Context.Request.GetBufferType0x21().Position;
|
|
|
|
long OutputPosition = Context.Request.GetBufferType0x22().Position;
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
2018-08-17 01:47:36 +02:00
|
|
|
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
|
|
|
return NvResult.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static int AllocGpfifoEx2(ServiceCtx Context)
|
|
|
|
{
|
2018-06-03 00:46:09 +02:00
|
|
|
long InputPosition = Context.Request.GetBufferType0x21().Position;
|
|
|
|
long OutputPosition = Context.Request.GetBufferType0x22().Position;
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
2018-08-17 01:47:36 +02:00
|
|
|
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
|
|
|
return NvResult.Success;
|
|
|
|
}
|
2018-07-15 05:04:46 +02:00
|
|
|
|
|
|
|
private static int KickoffPbWithAttr(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
long InputPosition = Context.Request.GetBufferType0x21().Position;
|
|
|
|
long OutputPosition = Context.Request.GetBufferType0x22().Position;
|
|
|
|
|
|
|
|
NvHostChannelSubmitGpfifo Args = AMemoryHelper.Read<NvHostChannelSubmitGpfifo>(Context.Memory, InputPosition);
|
|
|
|
|
2018-08-15 20:59:51 +02:00
|
|
|
NvGpuVmm Vmm = NvGpuASIoctl.GetASCtx(Context).Vmm;;
|
2018-07-15 05:04:46 +02:00
|
|
|
|
|
|
|
for (int Index = 0; Index < Args.NumEntries; Index++)
|
|
|
|
{
|
|
|
|
long Gpfifo = Context.Memory.ReadInt64(Args.Address + Index * 8);
|
|
|
|
|
|
|
|
PushGpfifo(Context, Vmm, Gpfifo);
|
|
|
|
}
|
|
|
|
|
|
|
|
Args.SyncptId = 0;
|
|
|
|
Args.SyncptValue = 0;
|
|
|
|
|
|
|
|
AMemoryHelper.Write(Context.Memory, OutputPosition, Args);
|
|
|
|
|
|
|
|
return NvResult.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void PushGpfifo(ServiceCtx Context, NvGpuVmm Vmm, long Gpfifo)
|
|
|
|
{
|
|
|
|
long VA = Gpfifo & 0xff_ffff_ffff;
|
|
|
|
|
|
|
|
int Size = (int)(Gpfifo >> 40) & 0x7ffffc;
|
|
|
|
|
|
|
|
byte[] Data = Vmm.ReadBytes(VA, Size);
|
|
|
|
|
|
|
|
NvGpuPBEntry[] PushBuffer = NvGpuPushBuffer.Decode(Data);
|
|
|
|
|
2018-08-17 01:47:36 +02:00
|
|
|
Context.Device.Gpu.Fifo.PushBuffer(Vmm, PushBuffer);
|
2018-07-15 05:04:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static NvChannel GetChannel(ServiceCtx Context, NvChannelName Channel)
|
|
|
|
{
|
|
|
|
ChannelsPerProcess Cpp = Channels.GetOrAdd(Context.Process, (Key) =>
|
|
|
|
{
|
|
|
|
return new ChannelsPerProcess();
|
|
|
|
});
|
|
|
|
|
|
|
|
return Cpp.Channels[Channel];
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void UnloadProcess(Process Process)
|
|
|
|
{
|
|
|
|
Channels.TryRemove(Process, out _);
|
|
|
|
}
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
}
|
|
|
|
}
|