steamcompmgr: Add GAMESCOPE_COLOR_APP_WANTS_HDR_FEEDBACK

Tell Steam whether this app is wanting HDR or not.

(Whether it's submitting  HDR buffers)
This commit is contained in:
Joshua Ashton 2023-04-05 19:28:07 +01:00 committed by Joshie
parent 77095cb553
commit b529bba53a
3 changed files with 28 additions and 0 deletions

View file

@ -42,6 +42,12 @@ enum GamescopeAppTextureColorspace {
};
const uint32_t GamescopeAppTextureColorspace_Bits = 2;
inline bool ColorspaceIsHDR( GamescopeAppTextureColorspace colorspace )
{
return colorspace == GAMESCOPE_APP_TEXTURE_COLORSPACE_SCRGB ||
colorspace == GAMESCOPE_APP_TEXTURE_COLORSPACE_HDR10_PQ;
}
extern struct drm_t g_DRM;
void drm_destroy_hdr_metadata_blob(struct drm_t *drm, uint32_t blob);

View file

@ -6100,6 +6100,7 @@ void init_xwayland_ctx(uint32_t serverId, gamescope_xwayland_server_t *xwayland_
ctx->atoms.gamescopeColorSDRGamutWideness = XInternAtom( ctx->dpy, "GAMESCOPE_COLOR_SDR_GAMUT_WIDENESS", false );
ctx->atoms.gamescopeColorNightMode = XInternAtom( ctx->dpy, "GAMESCOPE_COLOR_NIGHT_MODE", false );
ctx->atoms.gamescopeColorManagementDisable = XInternAtom( ctx->dpy, "GAMESCOPE_COLOR_MANAGEMENT_DISABLE", false );
ctx->atoms.gamescopeColorAppWantsHDRFeedback = XInternAtom( ctx->dpy, "GAMESCOPE_COLOR_APP_WANTS_HDR_FEEDBACK", false );
ctx->atoms.gamescopeCreateXWaylandServer = XInternAtom( ctx->dpy, "GAMESCOPE_CREATE_XWAYLAND_SERVER", false );
ctx->atoms.gamescopeCreateXWaylandServerFeedback = XInternAtom( ctx->dpy, "GAMESCOPE_CREATE_XWAYLAND_SERVER_FEEDBACK", false );
@ -6606,6 +6607,26 @@ steamcompmgr_main(int argc, char **argv)
}
}
{
GamescopeAppTextureColorspace current_app_colorspace = GAMESCOPE_APP_TEXTURE_COLORSPACE_SRGB;
if ( g_HeldCommits[HELD_COMMIT_BASE] )
current_app_colorspace = g_HeldCommits[HELD_COMMIT_BASE]->colorspace();
bool app_wants_hdr = ColorspaceIsHDR( current_app_colorspace );
static bool s_bAppWantsHDRCached = false;
if ( app_wants_hdr != s_bAppWantsHDRCached )
{
uint32_t app_wants_hdr_prop = app_wants_hdr ? 1 : 0;
XChangeProperty(root_ctx->dpy, root_ctx->root, root_ctx->atoms.gamescopeColorAppWantsHDRFeedback, XA_CARDINAL, 32, PropModeReplace,
(unsigned char *)&app_wants_hdr_prop, 1 );
s_bAppWantsHDRCached = app_wants_hdr;
}
}
currentOutputWidth = g_nOutputWidth;
currentOutputHeight = g_nOutputHeight;
currentHDROutput = g_bOutputHDREnabled;

View file

@ -191,6 +191,7 @@ struct xwayland_ctx_t
Atom gamescopeColorSDRGamutWideness;
Atom gamescopeColorNightMode; // amount, hue, saturation
Atom gamescopeColorManagementDisable;
Atom gamescopeColorAppWantsHDRFeedback;
Atom gamescopeCreateXWaylandServer;
Atom gamescopeCreateXWaylandServerFeedback;