More GE debugging prep

This commit is contained in:
Henrik Rydgård committed 2024-12-02 10:34:26 +01:00
1 parent 32a5571df5
commit 102d62deab
4 files changed
+40 -14

No files matched your search

+1 -1
View File
@@ -642,7 +642,7 @@ void PSP_RunLoopUntil(u64 globalticks) {
_dbg_assert_(false);
break;
case CORE_RUNNING_GE:
gpu->ProcessDLQueue();
gpu->ProcessDLQueue(DLRunType::Run, DLStepType::None);
coreState = CORE_RUNNING_CPU;
break;
}
+16 -10
View File
@@ -551,9 +551,10 @@ u32 GPUCommon::Continue() {
void GPUCommon::SwitchToGe() {
// Old method, although may make sense for performance if the ImDebugger isn't active.
#if 1
ProcessDLQueue();
// Call ProcessDLQueue directly.
ProcessDLQueue(DLRunType::Run, DLStepType::None);
#else
// New method, will allow ImDebugger to step the GPU
// New method, will allow ImDebugger to step the GPU.
Core_SwitchToGe();
#endif
}
@@ -841,7 +842,10 @@ int GPUCommon::GetNextListIndex() {
// This is now called when coreState == CORE_RUNNING_GE.
// TODO: It should return the next action.. (break into debugger or continue running)
void GPUCommon::ProcessDLQueue() {
DLResult GPUCommon::ProcessDLQueue(DLRunType run, DLStepType step) {
_dbg_assert_(run == DLRunType::Run);
_dbg_assert_(step == DLStepType::None);
startingTicks = CoreTiming::GetTicks();
cyclesExecuted = 0;
@@ -855,13 +859,14 @@ void GPUCommon::ProcessDLQueue() {
DisplayList &l = dls[listIndex];
DEBUG_LOG(Log::G3D, "Starting DL execution at %08x - stall = %08x", l.pc, l.stall);
if (!InterpretList(l)) {
return;
} else {
// Some other list could've taken the spot while we dilly-dallied around.
if (l.state != PSP_GE_DL_STATE_QUEUED) {
// At the end, we can remove it from the queue and continue.
dlQueue.erase(std::remove(dlQueue.begin(), dlQueue.end(), listIndex), dlQueue.end());
}
return DLResult::Error;
}
// Some other list could've taken the spot while we dilly-dallied around.
// LATER: Hm, really? Not unless we start time-slicing...
if (l.state != PSP_GE_DL_STATE_QUEUED) {
// At the end, we can remove it from the queue and continue.
dlQueue.erase(std::remove(dlQueue.begin(), dlQueue.end(), listIndex), dlQueue.end());
}
}
@@ -876,6 +881,7 @@ void GPUCommon::ProcessDLQueue() {
__GeTriggerSync(GPU_SYNC_DRAW, 1, drawCompleteTicks);
// Since the event is in CoreTiming, we're in sync. Just set 0 now.
return DLResult::Done;
}
void GPUCommon::Execute_OffsetAddr(u32 op, u32 diff) {
+1 -2
View File
@@ -78,7 +78,6 @@ inline bool IsTrianglePrim(GEPrimitiveType prim) {
return prim > GE_PRIM_LINE_STRIP && prim != GE_PRIM_RECTANGLES;
}
class GPUCommon : public GPUInterface, public GPUDebugInterface {
public:
GPUCommon(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
@@ -114,7 +113,7 @@ public:
virtual void PreExecuteOp(u32 op, u32 diff) {}
bool InterpretList(DisplayList &list);
void ProcessDLQueue() override;
DLResult ProcessDLQueue(DLRunType run, DLStepType step) override;
u32 UpdateStall(int listid, u32 newstall) override;
u32 EnqueueList(u32 listpc, u32 stall, int subIntrBase, PSPPointer<PspGeListArgs> args, bool head) override;
u32 DequeueList(int listid) override;
+22 -1
View File
@@ -172,6 +172,27 @@ namespace Draw {
class DrawContext;
}
enum class DLRunType {
Run,
RunDebug,
Step,
};
enum class DLStepType {
None,
Single,
Prim,
Draw,
Texture,
Rendertarget,
};
enum class DLResult {
Done,
Error,
Pause, // used for stepping, breakpoints
};
class GPUInterface {
public:
virtual ~GPUInterface() {}
@@ -197,7 +218,7 @@ public:
virtual u32 EnqueueList(u32 listpc, u32 stall, int subIntrBase, PSPPointer<PspGeListArgs> args, bool head) = 0;
virtual u32 DequeueList(int listid) = 0;
virtual u32 UpdateStall(int listid, u32 newstall) = 0;
virtual void ProcessDLQueue() = 0;
virtual DLResult ProcessDLQueue(DLRunType run, DLStepType step) = 0;
virtual u32 DrawSync(int mode) = 0;
virtual int ListSync(int listid, int mode) = 0;