Add hdr and refresh rate options

winesync
flightlessmango 6 months ago
parent c51385ab2c
commit 94a8dfb658

@ -357,6 +357,8 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu
| `frame_count` | Display frame count |
| `frametime` | Display frametime next to FPS text |
| `fsr` | Display the status of FSR (only works in gamescope) |
| `hdr` | Display the status of HDR (only works in gamescope) |
| `refresh_rate` | Display the current refresh rate (only works in gamescope) |
| `full` | Enable most of the toggleable parameters (currently excludes `histogram`) |
| `gamemode` | Show if GameMode is on |
| `gpu_color`<br>`cpu_color`<br>`vram_color`<br>`ram_color`<br>`io_color`<br>`engine_color`<br>`frametime_color`<br>`background_color`<br>`text_color`<br>`media_player_color` | Change default colors: `gpu_color=RRGGBB` |

@ -170,6 +170,11 @@ frame_timing
# hide_fsr_sharpness
## Shows the graph of gamescope app frametimes and latency (only on gamescope obviously)
# debug
## Display the status of HDR (only works in gamescope)
# hdr
## Display the current refresh rate (only works in gamescope)
# refresh_rate
### graphs displays one or more graphs that you chose
## seperated by ",", available graphs are

@ -51,7 +51,7 @@ static uint32_t screenWidth, screenHeight;
static unsigned int get_prop(const char* propName){
Display *x11_display = glfwGetX11Display();
Atom gamescope_focused = XInternAtom(x11_display, propName, true);
Atom gamescope_focused = XInternAtom(x11_display, propName, false);
auto scr = DefaultScreen(x11_display);
auto root = RootWindow(x11_display, scr);
Atom actual;
@ -73,7 +73,7 @@ static unsigned int get_prop(const char* propName){
}
return i;
}
return 0;
return -1;
}
static void ctrl_thread(){
@ -242,6 +242,11 @@ static void shutdown(GLFWwindow* window){
glfwDestroyWindow(window);
}
static void get_atom_info(){
HUDElements.hdr_status = get_prop("GAMESCOPE_COLOR_APP_WANTS_HDR_FEEDBACK");
HUDElements.refresh = get_prop("GAMESCOPE_DISPLAY_REFRESH_RATE_FEEDBACK");
}
static bool render(GLFWwindow* window) {
if (HUDElements.colors.update)
HUDElements.convert_colors(params);
@ -253,6 +258,7 @@ static bool render(GLFWwindow* window) {
overlay_new_frame(params);
position_layer(sw_stats, params, window_size);
render_imgui(sw_stats, params, window_size, true);
get_atom_info();
overlay_end_frame();
if (screenWidth && screenHeight)
glfwSetWindowSize(window, screenWidth, screenHeight);

@ -1371,20 +1371,25 @@ void HudElements::fps_metrics(){
ImGui::PopFont();
ImguiNextColumnOrNewRow();
}
// HUDElements.TextColored(HUDElements.colors.engine, "%s", "AVG");
// ImguiNextColumnOrNewRow();
// right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%.0f", HUDElements.fps_avg);
// ImGui::SameLine(0, 1.0f);
// ImGui::PushFont(HUDElements.sw_stats->font1);
// HUDElements.TextColored(HUDElements.colors.text, "FPS");
// ImGui::PopFont();
// ImguiNextColumnOrNewRow();
// right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%.1f", 1000 / HUDElements.fps_avg);
// ImGui::SameLine(0, 1.0f);
// ImGui::PushFont(HUDElements.sw_stats->font1);
// HUDElements.TextColored(HUDElements.colors.text, "ms");
// ImGui::PopFont();
}
void HudElements::hdr() {
if (HUDElements.hdr_status > 0) {
ImguiNextColumnFirstItem();
HUDElements.TextColored(HUDElements.colors.engine, "%s", "HDR");
ImguiNextColumnOrNewRow();
right_aligned_text(HUDElements.colors.fps_value_high, HUDElements.ralign_width, "ON");
}
}
void HudElements::refresh_rate() {
if (HUDElements.refresh > 0) {
ImguiNextColumnFirstItem();
HUDElements.TextColored(HUDElements.colors.engine, "%s", "Display Hz");
ImguiNextColumnOrNewRow();
right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%i", HUDElements.refresh);
}
}
void HudElements::sort_elements(const std::pair<std::string, std::string>& option) {
@ -1429,7 +1434,9 @@ void HudElements::sort_elements(const std::pair<std::string, std::string>& optio
{"exec_name", {exec_name}},
{"duration", {duration}},
{"graphs", {graphs}},
{"fps_metrics", {fps_metrics}}
{"fps_metrics", {fps_metrics}},
{"hdr", {hdr}},
{"refresh_rate", {refresh_rate}}
};
auto check_param = display_params.find(param);
@ -1497,6 +1504,10 @@ void HudElements::legacy_elements(){
ordered_functions.push_back({fan, "fan", value});
if (params->enabled[OVERLAY_PARAM_ENABLED_fsr])
ordered_functions.push_back({gamescope_fsr, "gamescope_fsr", value});
if (params->enabled[OVERLAY_PARAM_ENABLED_hdr])
ordered_functions.push_back({hdr, "hdr", value});
if (params->enabled[OVERLAY_PARAM_ENABLED_refresh_rate])
ordered_functions.push_back({refresh_rate, "refresh_rate", value});
if (params->enabled[OVERLAY_PARAM_ENABLED_throttling_status])
ordered_functions.push_back({throttling_status, "throttling_status", value});
if (params->enabled[OVERLAY_PARAM_ENABLED_fps])

@ -44,6 +44,8 @@ class HudElements{
std::vector<exec_entry> exec_list;
std::chrono::steady_clock::time_point overlay_start = std::chrono::steady_clock::now();
uint32_t vendorID;
int hdr_status = 0;
int refresh = 0;
void sort_elements(const std::pair<std::string, std::string>& option);
void legacy_elements();
@ -85,6 +87,8 @@ class HudElements{
static void exec_name();
static void duration();
static void fps_metrics();
static void hdr();
static void refresh_rate();
void convert_colors(const struct overlay_params& params);
void convert_colors(bool do_conv, const struct overlay_params& params);

@ -106,6 +106,8 @@ typedef unsigned long KeySym;
OVERLAY_PARAM_BOOL(dynamic_frame_timing) \
OVERLAY_PARAM_BOOL(duration) \
OVERLAY_PARAM_BOOL(inherit) \
OVERLAY_PARAM_BOOL(hdr) \
OVERLAY_PARAM_BOOL(refresh_rate) \
OVERLAY_PARAM_CUSTOM(fps_sampling_period) \
OVERLAY_PARAM_CUSTOM(output_folder) \
OVERLAY_PARAM_CUSTOM(output_file) \

Loading…
Cancel
Save