Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GE Debugger: Record only one flip if display framebuf not changed, step on vsync #15894

Merged
merged 4 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
GE Debugger: Record 1 flip if no display calls.
Before we were waiting 4 flips before ending recording.
  • Loading branch information
unknownbrackets committed Aug 24, 2022
commit 86085335ca3841aa64c5c459a99749ef6a6cfcab
12 changes: 9 additions & 3 deletions GPU/Debugger/Record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace GPURecord {
static bool active = false;
static bool nextFrame = false;
static int flipLastAction = -1;
static int flipFinishAt = -1;
static std::function<void(const Path &)> writeCallback;

static std::vector<u8> pushbuf;
Expand Down Expand Up @@ -145,6 +146,7 @@ static void BeginRecording() {
lastTextures.clear();
lastRenderTargets.clear();
flipLastAction = gpuStats.numFlips;
flipFinishAt = -1;

u32 ptr = (u32)pushbuf.size();
u32 sz = 512 * 4;
Expand Down Expand Up @@ -494,6 +496,7 @@ bool Activate() {
if (!nextFrame) {
nextFrame = true;
flipLastAction = gpuStats.numFlips;
flipFinishAt = -1;
return true;
}
return false;
Expand All @@ -512,6 +515,7 @@ static void FinishRecording() {
NOTICE_LOG(SYSTEM, "Recording finished");
active = false;
flipLastAction = gpuStats.numFlips;
flipFinishAt = -1;

if (writeCallback)
writeCallback(filename);
Expand Down Expand Up @@ -673,10 +677,10 @@ void NotifyDisplay(u32 framebuf, int stride, int fmt) {
}
}

void NotifyFrame() {
void NotifyBeginFrame() {
const bool noDisplayAction = flipLastAction + 4 < gpuStats.numFlips;
// We do this only to catch things that don't call NotifyFrame.
if (active && HasDrawCommands() && noDisplayAction) {
// We do this only to catch things that don't call NotifyDisplay.
if (active && HasDrawCommands() && (noDisplayAction || gpuStats.numFlips == flipFinishAt)) {
NOTICE_LOG(SYSTEM, "Recording complete on frame");

struct DisplayBufData {
Expand All @@ -700,6 +704,8 @@ void NotifyFrame() {
if (nextFrame && (gstate_c.skipDrawReason & SKIPDRAW_SKIPFRAME) == 0 && noDisplayAction) {
NOTICE_LOG(SYSTEM, "Recording starting on frame...");
BeginRecording();
// If we began on a BeginFrame, end on a BeginFrame.
flipFinishAt = gpuStats.numFlips + 1;
}
}

Expand Down
2 changes: 1 addition & 1 deletion GPU/Debugger/Record.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void NotifyMemcpy(u32 dest, u32 src, u32 sz);
void NotifyMemset(u32 dest, int v, u32 sz);
void NotifyUpload(u32 dest, u32 sz);
void NotifyDisplay(u32 addr, int stride, int fmt);
void NotifyFrame();
void NotifyBeginFrame();
void NotifyCPU();

};
2 changes: 1 addition & 1 deletion GPU/GPUCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ void GPUCommon::BeginFrame() {
} else if (dumpThisFrame_) {
dumpThisFrame_ = false;
}
GPURecord::NotifyFrame();
GPURecord::NotifyBeginFrame();
}

void GPUCommon::SlowRunLoop(DisplayList &list)
Expand Down