From c4ec841c0f3c00c2a8b59b4a97ff3e1b5485d31c Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Tue, 29 Aug 2023 18:57:57 +0100 Subject: [PATCH] IPU: Move decode delay to after the decode --- pcsx2/IPU/IPU_MultiISA.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pcsx2/IPU/IPU_MultiISA.cpp b/pcsx2/IPU/IPU_MultiISA.cpp index 23700fe9fe..86faebf846 100644 --- a/pcsx2/IPU/IPU_MultiISA.cpp +++ b/pcsx2/IPU/IPU_MultiISA.cpp @@ -1007,13 +1007,6 @@ __ri static bool mpeg2sliceIDEC() ipu_cmd.pos[0] = 2; while (1) { - if (ready_to_decode == true) - { - ready_to_decode = false; - CPU_INT(IPU_PROCESS, 64); // Should probably be much higher, but myst 3 doesn't like it right now. - ipu_cmd.pos[0] = 2; - return false; - } // IPU0 isn't ready for data, so let's wait for it to be if ((!ipu0ch.chcr.STR || ipuRegs.ctrl.OFC || ipu0ch.qwc == 0) && ipu_cmd.pos[1] <= 2) { @@ -1127,9 +1120,14 @@ __ri static bool mpeg2sliceIDEC() [[fallthrough]]; case 2: { - + if (ready_to_decode == true) + { + ready_to_decode = false; + CPU_INT(IPU_PROCESS, 64); // Should probably be much higher, but myst 3 doesn't like it right now. + ipu_cmd.pos[1] = 2; + return false; + } pxAssert(decoder.ipu0_data > 0); - ready_to_decode = true; uint read = ipu_fifo.out.write((u32*)decoder.GetIpuDataPtr(), decoder.ipu0_data); decoder.AdvanceIpuDataBy(read); @@ -1150,6 +1148,7 @@ __ri static bool mpeg2sliceIDEC() [[fallthrough]]; case 3: + ready_to_decode = true; while (1) { if (!GETWORD()) @@ -1210,7 +1209,6 @@ __ri static bool mpeg2sliceIDEC() ipu_cmd.pos[1] = 0; ipu_cmd.pos[2] = 0; - ready_to_decode = true; } finish_idec: @@ -1306,12 +1304,7 @@ __fi static bool mpeg2_slice() case 2: ipu_cmd.pos[0] = 2; - if (ready_to_decode == true) - { - ready_to_decode = false; - CPU_INT(IPU_PROCESS, 64); // Should probably be much higher, but myst 3 doesn't like it right now. - return false; - } + // IPU0 isn't ready for data, so let's wait for it to be if ((!ipu0ch.chcr.STR || ipuRegs.ctrl.OFC || ipu0ch.qwc == 0) && ipu_cmd.pos[0] <= 3) { @@ -1517,8 +1510,15 @@ __fi static bool mpeg2_slice() [[fallthrough]]; case 3: { + if (ready_to_decode == true) + { + ipu_cmd.pos[0] = 3; + ready_to_decode = false; + CPU_INT(IPU_PROCESS, 64); // Should probably be much higher, but myst 3 doesn't like it right now. + return false; + } + pxAssert(decoder.ipu0_data > 0); - ready_to_decode = true; uint read = ipu_fifo.out.write((u32*)decoder.GetIpuDataPtr(), decoder.ipu0_data); decoder.AdvanceIpuDataBy(read);