From da33453174c4157a68413c36d0210e82af76e243 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Tue, 3 Jan 2023 14:53:00 +0000 Subject: [PATCH] steamcompmgr: Add GAMESCOPE_HDR_SDR_CONTENT_BRIGHTNESS atom --- src/steamcompmgr.cpp | 10 +++++++++- src/xwayland_ctx.hpp | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index 2450caa..df64466 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -90,6 +90,7 @@ #define GPUVIS_TRACE_IMPLEMENTATION #include "gpuvis_trace_utils.h" +extern float g_flLinearToNits; const uint32_t WS_OVERLAPPED = 0x00000000u; const uint32_t WS_POPUP = 0x80000000u; @@ -4469,6 +4470,13 @@ handle_property_notify(xwayland_ctx_t *ctx, XPropertyEvent *ev) g_uCompositeDebug |= CompositeDebugFlag::Tonemap_Reinhard; hasRepaint = true; } + if ( ev->atom == ctx->atoms.gamescopeHDRSDRContentBrightness ) + { + g_flLinearToNits = get_prop( ctx, ctx->root, ctx->atoms.gamescopeHDRSDRContentBrightness, 0 ); + if ( g_flLinearToNits < 1.0f ) + g_flLinearToNits = 400.0f; + hasRepaint = true; + } if (ev->atom == ctx->atoms.wineHwndStyle) { win * w = find_win(ctx, ev->window); @@ -5439,6 +5447,7 @@ void init_xwayland_ctx(gamescope_xwayland_server_t *xwayland_server) ctx->atoms.gamescopeDebugHDRHeatmap = XInternAtom( ctx->dpy, "GAMESCOPE_DEBUG_HDR_HEATMAP", false ); ctx->atoms.gamescopeHDROnSDRTonemapOperator = XInternAtom( ctx->dpy, "GAMESCOPE_HDR_ON_SDR_TONEMAP_OPERATOR", false ); ctx->atoms.gamescopeHDROutputFeedback = XInternAtom( ctx->dpy, "GAMESCOPE_HDR_OUTPUT_FEEDBACK", false ); + ctx->atoms.gamescopeHDRSDRContentBrightness = XInternAtom( ctx->dpy, "GAMESCOPE_HDR_SDR_CONTENT_BRIGHTNESS", false ); ctx->atoms.wineHwndStyle = XInternAtom( ctx->dpy, "_WINE_HWND_STYLE", false ); ctx->atoms.wineHwndStyleEx = XInternAtom( ctx->dpy, "_WINE_HWND_EXSTYLE", false ); @@ -5560,7 +5569,6 @@ extern int g_nPreferredOutputWidth; extern int g_nPreferredOutputHeight; static bool g_bWasFSRActive = false; -extern float g_flLinearToNits; extern std::atomic g_nCompletedPageFlipCount; diff --git a/src/xwayland_ctx.hpp b/src/xwayland_ctx.hpp index 302d7c5..01a40a8 100644 --- a/src/xwayland_ctx.hpp +++ b/src/xwayland_ctx.hpp @@ -177,6 +177,7 @@ struct xwayland_ctx_t Atom gamescopeDebugHDRHeatmap_MSWCG; Atom gamescopeHDROnSDRTonemapOperator; Atom gamescopeHDROutputFeedback; + Atom gamescopeHDRSDRContentBrightness; Atom wineHwndStyle; Atom wineHwndStyleEx;