gsp_gpu: Convert vaddr to paddr from GSP service

This commit is contained in:
GPUCode 2023-07-18 11:51:52 +03:00
commit 072faead41
2 changed files with 6 additions and 6 deletions

View file

@ -336,7 +336,7 @@ void GPU::writeInternalReg(u32 index, u32 value, u32 mask) {
} }
void GPU::startCommandList(u32 addr, u32 size) { void GPU::startCommandList(u32 addr, u32 size) {
cmdBuffStart = static_cast<u32*>(mem.getReadPointer(addr)); cmdBuffStart = getPointerPhys<u32>(addr);
if (!cmdBuffStart) Helpers::panic("Couldn't get buffer for command list"); if (!cmdBuffStart) Helpers::panic("Couldn't get buffer for command list");
// TODO: This is very memory unsafe. We get a pointer to FCRAM and just keep writing without checking if we're gonna go OoB // TODO: This is very memory unsafe. We get a pointer to FCRAM and just keep writing without checking if we're gonna go OoB
@ -384,4 +384,4 @@ void GPU::startCommandList(u32 addr, u32 size) {
writeInternalReg(id, param, mask); writeInternalReg(id, param, mask);
} }
} }
} }

View file

@ -379,11 +379,11 @@ void GPUService::flushCacheRegions(u32* cmd) {
void GPUService::processCommandList(u32* cmd) { void GPUService::processCommandList(u32* cmd) {
const u32 address = cmd[1] & ~7; // Buffer address const u32 address = cmd[1] & ~7; // Buffer address
const u32 size = cmd[2] & ~3; // Buffer size in bytes const u32 size = cmd[2] & ~3; // Buffer size in bytes
const bool updateGas = cmd[3] == 1; // Update gas additive blend results (0 = don't update, 1 = update) [[maybe_unused]] const bool updateGas = cmd[3] == 1; // Update gas additive blend results (0 = don't update, 1 = update)
const bool flushBuffer = cmd[7] == 1; // Flush buffer (0 = don't flush, 1 = flush) [[maybe_unused]] const bool flushBuffer = cmd[7] == 1; // Flush buffer (0 = don't flush, 1 = flush)
log("GPU::GSP::processCommandList. Address: %08X, size in bytes: %08X\n", address, size); log("GPU::GSP::processCommandList. Address: %08X, size in bytes: %08X\n", address, size);
gpu.startCommandList(address, size); gpu.startCommandList(VaddrToPaddr(address), size);
requestInterrupt(GPUInterrupt::P3D); // Send an IRQ when command list processing is over requestInterrupt(GPUInterrupt::P3D); // Send an IRQ when command list processing is over
} }
@ -394,4 +394,4 @@ void GPUService::triggerTextureCopy(u32* cmd) {
// This uses the transfer engine and thus needs to fire a PPF interrupt. // This uses the transfer engine and thus needs to fire a PPF interrupt.
// NSMB2 relies on this // NSMB2 relies on this
requestInterrupt(GPUInterrupt::PPF); requestInterrupt(GPUInterrupt::PPF);
} }