Core: Minor changes to stepping (and some log changes)

This commit is contained in:
Henrik Rydgård 2024-12-09 23:49:37 +01:00
parent c842e3f137
commit b2a8b4168b
5 changed files with 28 additions and 11 deletions

View file

@ -129,6 +129,7 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR
double taken_ms_since_scheduling = (now - scheduleTime) * 1000.0;
double taken_ms = (now - start) * 1000.0;
#ifndef _DEBUG
if (taken_ms < 0.1) {
DEBUG_LOG(Log::G3D, "Pipeline (x/%d) time on %s: %0.2f ms, %0.2f ms since scheduling (fast) rpType: %04x sampleBits: %d (%s)",
countToCompile, GetCurrentThreadName(), taken_ms, taken_ms_since_scheduling, (u32)rpType, (u32)sampleCount, tag_.c_str());
@ -136,6 +137,7 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR
INFO_LOG(Log::G3D, "Pipeline (x/%d) time on %s: %0.2f ms, %0.2f ms since scheduling rpType: %04x sampleBits: %d (%s)",
countToCompile, GetCurrentThreadName(), taken_ms, taken_ms_since_scheduling, (u32)rpType, (u32)sampleCount, tag_.c_str());
}
#endif
bool success = true;
if (result == VK_INCOMPLETE) {

View file

@ -90,7 +90,7 @@ static bool g_breakAfterFrame = false;
static MIPSExceptionInfo g_exceptionInfo;
// This is called on EmuThread before RunLoop.
static void Core_ProcessStepping(MIPSDebugInterface *cpu);
static bool Core_ProcessStepping(MIPSDebugInterface *cpu);
void Core_SetGraphicsContext(GraphicsContext *ctx) {
PSP_CoreParameter().graphicsContext = ctx;
@ -173,8 +173,10 @@ void Core_RunLoopUntil(u64 globalticks) {
return;
case CORE_STEPPING_CPU:
case CORE_STEPPING_GE:
Core_ProcessStepping(currentDebugMIPS);
return;
if (Core_ProcessStepping(currentDebugMIPS)) {
return;
}
break;
case CORE_RUNNING_CPU:
mipsr4k.RunLoopUntil(globalticks);
if (g_breakAfterFrame && coreState == CORE_NEXTFRAME) {
@ -327,7 +329,7 @@ static void Core_PerformCPUStep(MIPSDebugInterface *cpu, CPUStepType stepType, i
}
}
static void Core_ProcessStepping(MIPSDebugInterface *cpu) {
static bool Core_ProcessStepping(MIPSDebugInterface *cpu) {
Core_StateProcessed();
// Check if there's any pending save state actions.
@ -336,17 +338,23 @@ static void Core_ProcessStepping(MIPSDebugInterface *cpu) {
switch (coreState) {
case CORE_STEPPING_CPU:
case CORE_STEPPING_GE:
case CORE_RUNNING_GE:
// All good
break;
default:
// Nothing to do.
return;
return true;
}
// Or any GPU actions.
// Legacy stepping code.
GPUStepping::ProcessStepping();
if (coreState == CORE_RUNNING_GE) {
// Retry, to get it done this frame.
return false;
}
// We're not inside jit now, so it's safe to clear the breakpoints.
static int lastSteppingCounter = -1;
if (lastSteppingCounter != steppingCounter) {
@ -360,7 +368,7 @@ static void Core_ProcessStepping(MIPSDebugInterface *cpu) {
std::lock_guard<std::mutex> guard(g_stepMutex);
if (coreState != CORE_STEPPING_CPU || g_cpuStepCommand.empty()) {
return;
return true;
}
Core_ResetException();
@ -377,6 +385,7 @@ static void Core_ProcessStepping(MIPSDebugInterface *cpu) {
// Update disasm dialog.
System_Notify(SystemNotification::MEM_VIEW);
return true;
}
// Free-threaded (hm, possibly except tracing).
@ -434,11 +443,16 @@ bool Core_NextFrame() {
_dbg_assert_(coreState != CORE_STEPPING_GE && coreState != CORE_RUNNING_GE);
if (coreState == CORE_RUNNING_CPU || coreState == CORE_STEPPING_CPU) {
if (coreState == CORE_RUNNING_CPU) {
::coreState = CORE_NEXTFRAME;
return true;
} else if (coreState == CORE_STEPPING_CPU) {
// All good, just stepping through so no need to switch to the NextFrame coreState though, that'd
// just lose our stepping state.
INFO_LOG(Log::System, "Reached end-of-frame while stepping the CPU (this is ok)");
return true;
} else {
ERROR_LOG(Log::System, "Core_NextFrame called with core state %s", CoreStateToString(coreState));
ERROR_LOG(Log::System, "Core_NextFrame called with wrong core state %s", CoreStateToString(coreState));
return false;
}
}

View file

@ -596,6 +596,7 @@ void PSP_RunLoopWhileState() {
int blockTicks = usToCycles(1000000 / 10);
// Run until CORE_NEXTFRAME
PSP_RunLoopFor(blockTicks);
// TODO: Check for frame timeout?
}
void PSP_RunLoopFor(int cycles) {

View file

@ -1851,9 +1851,9 @@ void FramebufferManagerCommon::ResizeFramebufFBO(VirtualFramebuffer *vfb, int w,
bool creating = old.bufferWidth == 0;
if (creating) {
WARN_LOG(Log::FrameBuf, "Creating %s FBO at %08x/%08x stride=%d %dx%d (force=%d)", GeBufferFormatToString(vfb->fb_format), vfb->fb_address, vfb->z_address, vfb->fb_stride, vfb->bufferWidth, vfb->bufferHeight, (int)force);
INFO_LOG(Log::FrameBuf, "Creating %s FBO at %08x/%08x stride=%d %dx%d (force=%d)", GeBufferFormatToString(vfb->fb_format), vfb->fb_address, vfb->z_address, vfb->fb_stride, vfb->bufferWidth, vfb->bufferHeight, (int)force);
} else {
WARN_LOG(Log::FrameBuf, "Resizing %s FBO at %08x/%08x stride=%d from %dx%d to %dx%d (force=%d, skipCopy=%d)", GeBufferFormatToString(vfb->fb_format), vfb->fb_address, vfb->z_address, vfb->fb_stride, old.bufferWidth, old.bufferHeight, vfb->bufferWidth, vfb->bufferHeight, (int)force, (int)skipCopy);
INFO_LOG(Log::FrameBuf, "Resizing %s FBO at %08x/%08x stride=%d from %dx%d to %dx%d (force=%d, skipCopy=%d)", GeBufferFormatToString(vfb->fb_format), vfb->fb_address, vfb->z_address, vfb->fb_stride, old.bufferWidth, old.bufferHeight, vfb->bufferWidth, vfb->bufferHeight, (int)force, (int)skipCopy);
}
// During hardware rendering, we always render at full color depth even if the game wouldn't on real hardware.

View file

@ -855,7 +855,7 @@ DLResult GPUCommon::ProcessDLQueue() {
for (int listIndex = GetNextListIndex(); listIndex != -1; listIndex = GetNextListIndex()) {
DisplayList &l = dls[listIndex];
DEBUG_LOG(Log::G3D, "Starting DL execution at %08x - stall = %08x (startingTicks=%d)", l.pc, l.stall, startingTicks);
DEBUG_LOG(Log::G3D, "%s DL execution at %08x - stall = %08x (startingTicks=%d)", l.pc == l.startpc ? "Starting" : "Resuming", l.pc, l.stall, startingTicks);
if (!InterpretList(l)) {
switch (gpuState) {
case GPURunState::GPUSTATE_STALL: