2018-02-20 20:09:23 +00:00
|
|
|
using Ryujinx.Graphics.Gal;
|
2018-04-08 19:17:35 +00:00
|
|
|
using System.Threading;
|
2018-02-20 20:09:23 +00:00
|
|
|
|
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 18:53:23 +00:00
|
|
|
namespace Ryujinx.Core.Gpu
|
2018-02-20 20:09:23 +00:00
|
|
|
{
|
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 18:53:23 +00:00
|
|
|
public class NvGpu
|
2018-02-20 20:09:23 +00:00
|
|
|
{
|
|
|
|
public IGalRenderer Renderer { get; private set; }
|
|
|
|
|
2018-04-13 18:12:58 +00:00
|
|
|
public NvGpuFifo Fifo { get; private set; }
|
2018-04-08 19:17:35 +00:00
|
|
|
|
2018-04-26 02:11:26 +00:00
|
|
|
public NvGpuEngine2d Engine2d { get; private set; }
|
2018-04-13 18:12:58 +00:00
|
|
|
public NvGpuEngine3d Engine3d { get; private set; }
|
2018-04-08 19:17:35 +00:00
|
|
|
|
|
|
|
private Thread FifoProcessing;
|
|
|
|
|
|
|
|
private bool KeepRunning;
|
2018-02-20 20:09:23 +00:00
|
|
|
|
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 18:53:23 +00:00
|
|
|
public NvGpu(IGalRenderer Renderer)
|
2018-02-20 20:09:23 +00:00
|
|
|
{
|
|
|
|
this.Renderer = Renderer;
|
|
|
|
|
2018-04-08 19:17:35 +00:00
|
|
|
Fifo = new NvGpuFifo(this);
|
|
|
|
|
2018-04-26 02:11:26 +00:00
|
|
|
Engine2d = new NvGpuEngine2d(this);
|
2018-04-08 19:17:35 +00:00
|
|
|
Engine3d = new NvGpuEngine3d(this);
|
|
|
|
|
|
|
|
KeepRunning = true;
|
|
|
|
|
2018-04-13 18:12:58 +00:00
|
|
|
FifoProcessing = new Thread(ProcessFifo);
|
2018-04-08 19:17:35 +00:00
|
|
|
|
|
|
|
FifoProcessing.Start();
|
2018-02-20 20:09:23 +00:00
|
|
|
}
|
|
|
|
|
2018-04-08 19:17:35 +00:00
|
|
|
private void ProcessFifo()
|
|
|
|
{
|
|
|
|
while (KeepRunning)
|
|
|
|
{
|
|
|
|
Fifo.DispatchCalls();
|
|
|
|
|
|
|
|
Thread.Yield();
|
|
|
|
}
|
|
|
|
}
|
2018-02-20 20:09:23 +00:00
|
|
|
}
|
|
|
|
}
|