From 711285a20e76ca72446aba224972d54df8bbacc0 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Tue, 7 Nov 2023 17:19:33 +0000 Subject: [PATCH] steamcompmgr: Add GAMESCOPE_DISPLAY_REFRESH_RATE_FEEDBACK --- src/steamcompmgr.cpp | 12 ++++++++++++ src/xwayland_ctx.hpp | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index 7d7891c4ec..0d37b336f6 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -294,6 +294,7 @@ bool g_bSupportsST2084_CachedValue = false; bool g_bForceHDR10OutputDebug = false; bool g_bHDREnabled = false; bool g_bHDRItmEnable = false; +int g_nCurrentRefreshRate_CachedValue = 0; static void update_color_mgmt() @@ -7082,6 +7083,8 @@ void init_xwayland_ctx(uint32_t serverId, gamescope_xwayland_server_t *xwayland_ ctx->atoms.gamescopeReshadeEffect = XInternAtom( ctx->dpy, "GAMESCOPE_RESHADE_EFFECT", false ); ctx->atoms.gamescopeReshadeTechniqueIdx = XInternAtom( ctx->dpy, "GAMESCOPE_RESHADE_TECHNIQUE_IDX", false ); + ctx->atoms.gamescopeDisplayRefreshRateFeedback = XInternAtom( ctx->dpy, "GAMESCOPE_DISPLAY_REFRESH_RATE_FEEDBACK", false ); + ctx->atoms.wineHwndStyle = XInternAtom( ctx->dpy, "_WINE_HWND_STYLE", false ); ctx->atoms.wineHwndStyleEx = XInternAtom( ctx->dpy, "_WINE_HWND_EXSTYLE", false ); @@ -7191,6 +7194,15 @@ void update_vrr_atoms(xwayland_ctx_t *root_ctx, bool force, bool* needs_flush = *needs_flush = true; } + if ( g_nOutputRefresh != g_nCurrentRefreshRate_CachedValue || force ) + { + XChangeProperty(root_ctx->dpy, root_ctx->root, root_ctx->atoms.gamescopeDisplayRefreshRateFeedback, XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&g_nOutputRefresh, 1 ); + g_nCurrentRefreshRate_CachedValue = g_nOutputRefresh; + if (needs_flush) + *needs_flush = true; + } + // Don't update this in-sync with DRM vrr usage. // Keep this as a preference, starting with off. if ( force ) diff --git a/src/xwayland_ctx.hpp b/src/xwayland_ctx.hpp index cd6c35d737..a687bdb0d6 100644 --- a/src/xwayland_ctx.hpp +++ b/src/xwayland_ctx.hpp @@ -218,6 +218,8 @@ struct xwayland_ctx_t Atom gamescopeReshadeEffect; Atom gamescopeReshadeTechniqueIdx; + Atom gamescopeDisplayRefreshRateFeedback; + Atom wineHwndStyle; Atom wineHwndStyleEx;