IPU: Slow down BDEC and IDEC so they don't outstrip DMA data writes

This commit is contained in:
refractionpcsx2 2023-06-24 01:27:46 +01:00
parent 8d27c32418
commit 6f9164b986
5 changed files with 20 additions and 5 deletions

View File

@ -94,6 +94,13 @@ __fi void IPUProcessInterrupt()
{
if (ipuRegs.ctrl.BUSY && !CommandExecuteQueued)
IPUWorker();
if (ipuRegs.ctrl.BUSY)
{
CPU_INT(IPU_PROCESS, ProcessedData ? ProcessedData : 64);
}
else
ProcessedData = 0;
}
/////////////////////////////////////////////////////////
@ -460,7 +467,7 @@ __fi void IPUCMD_WRITE(u32 val)
{
// don't process anything if currently busy
//if (ipuRegs.ctrl.BUSY) Console.WriteLn("IPU BUSY!"); // wait for thread
ProcessedData = 0;
ipuRegs.ctrl.ECD = 0;
ipuRegs.ctrl.SCD = 0;
ipu_cmd.clear();

View File

@ -294,6 +294,7 @@ extern bool EnableFMV;
alignas(16) extern tIPU_cmd ipu_cmd;
extern uint eecount_on_last_vdec;
extern bool CommandExecuteQueued;
extern u32 ProcessedData;
extern void ipuReset();

View File

@ -184,7 +184,7 @@ void WriteFIFO_IPUin(const mem128_t* value)
if (ipuRegs.ctrl.BUSY && !CommandExecuteQueued)
{
CommandExecuteQueued = true;
CPU_INT(IPU_PROCESS, 1 * BIAS);
CPU_INT(IPU_PROCESS, 8);
}
}
}

View File

@ -1116,7 +1116,9 @@ __ri static bool mpeg2sliceIDEC()
ipu_dither(rgb32, rgb16, decoder.dte);
decoder.SetOutputTo(rgb16);
}
[[fallthrough]];
ProcessedData += decoder.ipu0_data;
ipu_cmd.pos[1] = 2;
return false;
case 2:
{
@ -1498,7 +1500,9 @@ __fi static bool mpeg2_slice()
coded_block_pattern = decoder.coded_block_pattern;
decoder.SetOutputTo(mb16);
[[fallthrough]];
ProcessedData += decoder.ipu0_data;
ipu_cmd.pos[0] = 3;
return false;
case 3:
{

View File

@ -21,12 +21,14 @@
IPUStatus IPU1Status;
bool CommandExecuteQueued;
u32 ProcessedData;
void ipuDmaReset()
{
IPU1Status.InProgress = false;
IPU1Status.DMAFinished = true;
CommandExecuteQueued = false;
ProcessedData = 0;
}
void SaveStateBase::ipuDmaFreeze()
@ -199,7 +201,7 @@ void IPU0dma()
{
CommandExecuteQueued = true;
CPU_SET_DMASTALL(DMAC_FROM_IPU, true);
CPU_INT(IPU_PROCESS, 4);
CPU_INT(IPU_PROCESS, readsize * BIAS);
}
}
@ -281,6 +283,7 @@ __fi void dmaIPU1() // toIPU
void ipuCMDProcess()
{
CommandExecuteQueued = false;
ProcessedData = 0;
IPUProcessInterrupt();
}