2018-04-08 21:17:35 +02:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
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
|
|
|
namespace Ryujinx.Core.Gpu
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
class MacroInterpreter
|
|
|
|
{
|
|
|
|
private enum AssignmentOperation
|
|
|
|
{
|
|
|
|
IgnoreAndFetch = 0,
|
|
|
|
Move = 1,
|
|
|
|
MoveAndSetMaddr = 2,
|
|
|
|
FetchAndSend = 3,
|
|
|
|
MoveAndSend = 4,
|
|
|
|
FetchAndSetMaddr = 5,
|
|
|
|
MoveAndSetMaddrThenFetchAndSend = 6,
|
|
|
|
MoveAndSetMaddrThenSendHigh = 7
|
|
|
|
}
|
|
|
|
|
|
|
|
private enum AluOperation
|
|
|
|
{
|
|
|
|
AluReg = 0,
|
|
|
|
AddImmediate = 1,
|
|
|
|
BitfieldReplace = 2,
|
|
|
|
BitfieldExtractLslImm = 3,
|
|
|
|
BitfieldExtractLslReg = 4,
|
|
|
|
ReadImmediate = 5
|
|
|
|
}
|
|
|
|
|
|
|
|
private enum AluRegOperation
|
|
|
|
{
|
|
|
|
Add = 0,
|
|
|
|
AddWithCarry = 1,
|
|
|
|
Subtract = 2,
|
|
|
|
SubtractWithBorrow = 3,
|
|
|
|
BitwiseExclusiveOr = 8,
|
|
|
|
BitwiseOr = 9,
|
|
|
|
BitwiseAnd = 10,
|
|
|
|
BitwiseAndNot = 11,
|
|
|
|
BitwiseNotAnd = 12
|
|
|
|
}
|
|
|
|
|
|
|
|
private NvGpuFifo PFifo;
|
|
|
|
private INvGpuEngine Engine;
|
|
|
|
|
|
|
|
public Queue<int> Fifo { get; private set; }
|
|
|
|
|
|
|
|
private int[] Gprs;
|
|
|
|
|
|
|
|
private int MethAddr;
|
|
|
|
private int MethIncr;
|
|
|
|
|
|
|
|
private bool Carry;
|
|
|
|
|
|
|
|
private int OpCode;
|
|
|
|
|
|
|
|
private int PipeOp;
|
|
|
|
|
|
|
|
private long Pc;
|
|
|
|
|
|
|
|
public MacroInterpreter(NvGpuFifo PFifo, INvGpuEngine Engine)
|
|
|
|
{
|
|
|
|
this.PFifo = PFifo;
|
|
|
|
this.Engine = Engine;
|
|
|
|
|
|
|
|
Fifo = new Queue<int>();
|
|
|
|
|
|
|
|
Gprs = new int[8];
|
|
|
|
}
|
|
|
|
|
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
|
|
|
public void Execute(NvGpuVmm Vmm, long Position, int Param)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
Reset();
|
|
|
|
|
|
|
|
Gprs[1] = Param;
|
|
|
|
|
|
|
|
Pc = 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
|
|
|
FetchOpCode(Vmm);
|
2018-04-08 21:17:35 +02: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 20:53:23 +02:00
|
|
|
while (Step(Vmm));
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
//Due to the delay slot, we still need to execute
|
|
|
|
//one more instruction before we actually exit.
|
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
|
|
|
Step(Vmm);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void Reset()
|
|
|
|
{
|
|
|
|
for (int Index = 0; Index < Gprs.Length; Index++)
|
|
|
|
{
|
|
|
|
Gprs[Index] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
MethAddr = 0;
|
|
|
|
MethIncr = 0;
|
|
|
|
|
|
|
|
Carry = false;
|
|
|
|
}
|
|
|
|
|
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 bool Step(NvGpuVmm Vmm)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
long BaseAddr = Pc - 4;
|
|
|
|
|
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
|
|
|
FetchOpCode(Vmm);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
if ((OpCode & 7) < 7)
|
|
|
|
{
|
|
|
|
//Operation produces a value.
|
|
|
|
AssignmentOperation AsgOp = (AssignmentOperation)((OpCode >> 4) & 7);
|
|
|
|
|
|
|
|
int Result = GetAluResult();
|
|
|
|
|
|
|
|
switch (AsgOp)
|
|
|
|
{
|
|
|
|
//Fetch parameter and ignore result.
|
|
|
|
case AssignmentOperation.IgnoreAndFetch:
|
|
|
|
{
|
|
|
|
SetDstGpr(FetchParam());
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Move result.
|
|
|
|
case AssignmentOperation.Move:
|
|
|
|
{
|
|
|
|
SetDstGpr(Result);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Move result and use as Method Address.
|
|
|
|
case AssignmentOperation.MoveAndSetMaddr:
|
|
|
|
{
|
|
|
|
SetDstGpr(Result);
|
|
|
|
|
|
|
|
SetMethAddr(Result);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Fetch parameter and send result.
|
|
|
|
case AssignmentOperation.FetchAndSend:
|
|
|
|
{
|
|
|
|
SetDstGpr(FetchParam());
|
|
|
|
|
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
|
|
|
Send(Vmm, Result);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Move and send result.
|
|
|
|
case AssignmentOperation.MoveAndSend:
|
|
|
|
{
|
|
|
|
SetDstGpr(Result);
|
|
|
|
|
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
|
|
|
Send(Vmm, Result);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Fetch parameter and use result as Method Address.
|
|
|
|
case AssignmentOperation.FetchAndSetMaddr:
|
|
|
|
{
|
|
|
|
SetDstGpr(FetchParam());
|
|
|
|
|
|
|
|
SetMethAddr(Result);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Move result and use as Method Address, then fetch and send paramter.
|
|
|
|
case AssignmentOperation.MoveAndSetMaddrThenFetchAndSend:
|
|
|
|
{
|
|
|
|
SetDstGpr(Result);
|
|
|
|
|
|
|
|
SetMethAddr(Result);
|
|
|
|
|
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
|
|
|
Send(Vmm, FetchParam());
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Move result and use as Method Address, then send bits 17:12 of result.
|
|
|
|
case AssignmentOperation.MoveAndSetMaddrThenSendHigh:
|
|
|
|
{
|
|
|
|
SetDstGpr(Result);
|
|
|
|
|
|
|
|
SetMethAddr(Result);
|
|
|
|
|
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
|
|
|
Send(Vmm, (Result >> 12) & 0x3f);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Branch.
|
|
|
|
bool OnNotZero = ((OpCode >> 4) & 1) != 0;
|
|
|
|
|
|
|
|
bool Taken = OnNotZero
|
|
|
|
? GetGprA() != 0
|
|
|
|
: GetGprA() == 0;
|
|
|
|
|
|
|
|
if (Taken)
|
|
|
|
{
|
|
|
|
Pc = BaseAddr + (GetImm() << 2);
|
|
|
|
|
|
|
|
bool NoDelays = (OpCode & 0x20) != 0;
|
|
|
|
|
|
|
|
if (NoDelays)
|
|
|
|
{
|
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
|
|
|
FetchOpCode(Vmm);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Exit = (OpCode & 0x80) != 0;
|
|
|
|
|
|
|
|
return !Exit;
|
|
|
|
}
|
|
|
|
|
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 void FetchOpCode(NvGpuVmm Vmm)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
OpCode = PipeOp;
|
|
|
|
|
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
|
|
|
PipeOp = Vmm.ReadInt32(Pc);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
Pc += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
private int GetAluResult()
|
|
|
|
{
|
|
|
|
AluOperation Op = (AluOperation)(OpCode & 7);
|
|
|
|
|
|
|
|
switch (Op)
|
|
|
|
{
|
|
|
|
case AluOperation.AluReg:
|
|
|
|
{
|
|
|
|
AluRegOperation AluOp = (AluRegOperation)((OpCode >> 17) & 0x1f);
|
|
|
|
|
|
|
|
return GetAluResult(AluOp, GetGprA(), GetGprB());
|
|
|
|
}
|
|
|
|
|
|
|
|
case AluOperation.AddImmediate:
|
|
|
|
{
|
|
|
|
return GetGprA() + GetImm();
|
|
|
|
}
|
|
|
|
|
|
|
|
case AluOperation.BitfieldReplace:
|
|
|
|
case AluOperation.BitfieldExtractLslImm:
|
|
|
|
case AluOperation.BitfieldExtractLslReg:
|
|
|
|
{
|
|
|
|
int BfSrcBit = (OpCode >> 17) & 0x1f;
|
|
|
|
int BfSize = (OpCode >> 22) & 0x1f;
|
|
|
|
int BfDstBit = (OpCode >> 27) & 0x1f;
|
|
|
|
|
|
|
|
int BfMask = (1 << BfSize) - 1;
|
|
|
|
|
|
|
|
int Dst = GetGprA();
|
|
|
|
int Src = GetGprB();
|
|
|
|
|
|
|
|
switch (Op)
|
|
|
|
{
|
|
|
|
case AluOperation.BitfieldReplace:
|
|
|
|
{
|
|
|
|
Src = (int)((uint)Src >> BfSrcBit) & BfMask;
|
|
|
|
|
|
|
|
Dst &= ~(BfMask << BfDstBit);
|
|
|
|
|
|
|
|
Dst |= Src << BfDstBit;
|
|
|
|
|
|
|
|
return Dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
case AluOperation.BitfieldExtractLslImm:
|
|
|
|
{
|
|
|
|
Src = (int)((uint)Src >> Dst) & BfMask;
|
|
|
|
|
|
|
|
return Src << BfDstBit;
|
|
|
|
}
|
|
|
|
|
|
|
|
case AluOperation.BitfieldExtractLslReg:
|
|
|
|
{
|
|
|
|
Src = (int)((uint)Src >> BfSrcBit) & BfMask;
|
|
|
|
|
|
|
|
return Src << Dst;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case AluOperation.ReadImmediate:
|
|
|
|
{
|
|
|
|
return Read(GetGprA() + GetImm());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
throw new ArgumentException(nameof(OpCode));
|
|
|
|
}
|
|
|
|
|
|
|
|
private int GetAluResult(AluRegOperation AluOp, int A, int B)
|
|
|
|
{
|
|
|
|
switch (AluOp)
|
|
|
|
{
|
|
|
|
case AluRegOperation.Add:
|
|
|
|
{
|
|
|
|
ulong Result = (ulong)A + (ulong)B;
|
|
|
|
|
|
|
|
Carry = Result > 0xffffffff;
|
|
|
|
|
|
|
|
return (int)Result;
|
|
|
|
}
|
|
|
|
|
|
|
|
case AluRegOperation.AddWithCarry:
|
|
|
|
{
|
|
|
|
ulong Result = (ulong)A + (ulong)B + (Carry ? 1UL : 0UL);
|
|
|
|
|
|
|
|
Carry = Result > 0xffffffff;
|
|
|
|
|
|
|
|
return (int)Result;
|
|
|
|
}
|
|
|
|
|
|
|
|
case AluRegOperation.Subtract:
|
|
|
|
{
|
|
|
|
ulong Result = (ulong)A - (ulong)B;
|
|
|
|
|
|
|
|
Carry = Result < 0x100000000;
|
|
|
|
|
|
|
|
return (int)Result;
|
|
|
|
}
|
|
|
|
|
|
|
|
case AluRegOperation.SubtractWithBorrow:
|
|
|
|
{
|
|
|
|
ulong Result = (ulong)A - (ulong)B - (Carry ? 0UL : 1UL);
|
|
|
|
|
|
|
|
Carry = Result < 0x100000000;
|
|
|
|
|
|
|
|
return (int)Result;
|
|
|
|
}
|
|
|
|
|
|
|
|
case AluRegOperation.BitwiseExclusiveOr: return A ^ B;
|
|
|
|
case AluRegOperation.BitwiseOr: return A | B;
|
|
|
|
case AluRegOperation.BitwiseAnd: return A & B;
|
|
|
|
case AluRegOperation.BitwiseAndNot: return A & ~B;
|
|
|
|
case AluRegOperation.BitwiseNotAnd: return ~(A & B);
|
|
|
|
}
|
|
|
|
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(AluOp));
|
|
|
|
}
|
|
|
|
|
|
|
|
private int GetImm()
|
|
|
|
{
|
|
|
|
//Note: The immediate is signed, the sign-extension is intended here.
|
|
|
|
return OpCode >> 14;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SetMethAddr(int Value)
|
|
|
|
{
|
|
|
|
MethAddr = (Value >> 0) & 0xfff;
|
|
|
|
MethIncr = (Value >> 12) & 0x3f;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SetDstGpr(int Value)
|
|
|
|
{
|
|
|
|
Gprs[(OpCode >> 8) & 7] = Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
private int GetGprA()
|
|
|
|
{
|
|
|
|
return GetGprValue((OpCode >> 11) & 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
private int GetGprB()
|
|
|
|
{
|
|
|
|
return GetGprValue((OpCode >> 14) & 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
private int GetGprValue(int Index)
|
|
|
|
{
|
|
|
|
return Index != 0 ? Gprs[Index] : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
private int FetchParam()
|
|
|
|
{
|
|
|
|
int Value;
|
|
|
|
|
|
|
|
//If we don't have any parameters in the FIFO,
|
|
|
|
//keep running the PFIFO engine until it writes the parameters.
|
|
|
|
while (!Fifo.TryDequeue(out Value))
|
|
|
|
{
|
|
|
|
if (!PFifo.Step())
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
private int Read(int Reg)
|
|
|
|
{
|
|
|
|
return Engine.Registers[Reg];
|
|
|
|
}
|
|
|
|
|
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 void Send(NvGpuVmm Vmm, int Value)
|
2018-04-08 21:17:35 +02: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 20:53:23 +02:00
|
|
|
NvGpuPBEntry PBEntry = new NvGpuPBEntry(MethAddr, 0, Value);
|
2018-04-08 21:17:35 +02: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 20:53:23 +02:00
|
|
|
Engine.CallMethod(Vmm, PBEntry);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
MethAddr += MethIncr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|