Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@ static void msg_read_thread(){
if (msg_bytes > offsetof(mangoapp_msg_v1, latency_ns))
gamescope_frametime(mangoapp_v1->app_frametime_ns, mangoapp_v1->latency_ns);

if (msg_bytes > offsetof(mangoapp_msg_v1, scanoutRefreshmHz))
HUDElements.scanout_refresh = mangoapp_v1->scanoutRefreshmHz / 1000.f;

if (should_new_frame)
{
{
Expand Down
1 change: 1 addition & 0 deletions src/app/mangoapp_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct mangoapp_msg_v1 {
char engineName[40];
uint8_t upscaler; // mangoapp_upscaler that produced the frame, LINEAR for none
uint8_t wantedUpscaler; // mangoapp_upscaler the user selected
uint32_t scanoutRefreshmHz; // refreshes the panel actually scanned out, follows VRR, 0 when unknown
// WARNING: Always ADD fields, never remove or repurpose fields
} __attribute__((packed));

Expand Down
8 changes: 6 additions & 2 deletions src/hud_elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1700,12 +1700,16 @@ void HudElements::hdr() {
}

void HudElements::refresh_rate() {
if (HUDElements.refresh > 0) {
if (HUDElements.refresh > 0 || HUDElements.scanout_refresh > 0) {
ImGui::PushFont(HUDElements.sw_stats->font_secondary);
ImguiNextColumnFirstItem();
HUDElements.TextColored(HUDElements.colors.engine, "%s", "Display Hz");
ImguiNextColumnOrNewRow();
right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%i", HUDElements.refresh);
// gamescope measures the panel's real rate, which VRR moves away from the mode's.
if (HUDElements.scanout_refresh > 0)
right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%.1f", HUDElements.scanout_refresh);
else
right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%i", HUDElements.refresh);
ImGui::PopFont();
}
}
Expand Down
1 change: 1 addition & 0 deletions src/hud_elements.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class HudElements{
uint32_t vendorID;
int hdr_status = 0;
int refresh = 0;
float scanout_refresh = 0.f;
unsigned int vsync = 10;

enum display_servers {
Expand Down
Loading