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

VideoCommon: Add statistics for draw done and token commands #11099

Merged

Conversation

Pokechu22
Copy link
Contributor

No description provided.

@@ -190,13 +192,15 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
}
return;
case BPMEM_PE_TOKEN_ID: // Pixel Engine Token ID
INCSTAT(g_stats.this_frame.num_token);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an aside, any details on what a "token" is?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See these libogc functions. It's used to manage synchronisation; there's a hardware register (0xCC00100E I think, part of the pixel engine) that indicates the current token value, and a graphics command that updates that register when the command is processed. So you can watch the register to know how far along processing has gotten and if you can e.g. replace data in main memory once it's no longer being used. There's also an interrupt associated with it (and actually, there are two commands for it, one for the interrupt and one without it; I'm not entirely sure how that part works or why both commands exist. GX_SetDrawSync uses both of them.)

For what it's worth this PR was motivated by #11098, since Super Mario Galaxy seems to use the token system before using EFB peeks for star bits. (I know TTYD also uses it to determine if the GPU has hung, though I don't fully understand the details of that part.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for the details. 11098 had me curious too (I figured this was for that).

@AdmiralCurtiss AdmiralCurtiss merged commit 4de70f1 into dolphin-emu:master Sep 28, 2022
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants