steamcompmgr: Implement GAMESCOPE_SCALING_MODE atom

0 = linear
1 = nearest
2 = integer
3 = fsr
This commit is contained in:
Joshua Ashton 2022-02-01 00:26:45 +00:00
parent 7755bb635d
commit d01363e35e
2 changed files with 33 additions and 0 deletions

View file

@ -3495,6 +3495,35 @@ handle_property_notify(xwayland_ctx_t *ctx, XPropertyEvent *ev)
{ {
g_uVBlankRateOfDecayPercentage = (uint64_t)get_prop( ctx, ctx->root, ctx->atoms.gamescopeTuneableRateOfDecay, g_uDefaultVBlankRateOfDecayPercentage ); g_uVBlankRateOfDecayPercentage = (uint64_t)get_prop( ctx, ctx->root, ctx->atoms.gamescopeTuneableRateOfDecay, g_uDefaultVBlankRateOfDecayPercentage );
} }
if ( ev->atom == ctx->atoms.gamescopeScalingFilter )
{
int nScalingMode = get_prop( ctx, ctx->root, ctx->atoms.gamescopeScalingFilter, 0 );
switch ( nScalingMode )
{
default:
case 0:
g_bFilterGameWindow = true;
g_bIntegerScale = false;
g_fsrUpscale = false;
break;
case 1:
g_bFilterGameWindow = false;
g_bIntegerScale = false;
g_fsrUpscale = false;
break;
case 2:
g_bFilterGameWindow = false;
g_bIntegerScale = true;
g_fsrUpscale = false;
break;
case 3:
g_bFilterGameWindow = true;
g_bIntegerScale = false;
g_fsrUpscale = true;
break;
}
hasRepaint = true;
}
} }
static int static int
@ -4338,6 +4367,8 @@ void init_xwayland_ctx(gamescope_xwayland_server_t *xwayland_server)
ctx->atoms.gamescopeTuneableVBlankRedZone = XInternAtom( ctx->dpy, "GAMESCOPE_TUNEABLE_VBLANK_REDZONE", false ); ctx->atoms.gamescopeTuneableVBlankRedZone = XInternAtom( ctx->dpy, "GAMESCOPE_TUNEABLE_VBLANK_REDZONE", false );
ctx->atoms.gamescopeTuneableRateOfDecay = XInternAtom( ctx->dpy, "GAMESCOPE_TUNEABLE_VBLANK_RATE_OF_DECAY_PERCENTAGE", false ); ctx->atoms.gamescopeTuneableRateOfDecay = XInternAtom( ctx->dpy, "GAMESCOPE_TUNEABLE_VBLANK_RATE_OF_DECAY_PERCENTAGE", false );
ctx->atoms.gamescopeScalingFilter = XInternAtom( ctx->dpy, "GAMESCOPE_SCALING_FILTER", false );
ctx->root_width = DisplayWidth(ctx->dpy, ctx->scr); ctx->root_width = DisplayWidth(ctx->dpy, ctx->scr);
ctx->root_height = DisplayHeight(ctx->dpy, ctx->scr); ctx->root_height = DisplayHeight(ctx->dpy, ctx->scr);

View file

@ -112,5 +112,7 @@ struct xwayland_ctx_t
Atom gamescopeTuneableVBlankRedZone; Atom gamescopeTuneableVBlankRedZone;
Atom gamescopeTuneableRateOfDecay; Atom gamescopeTuneableRateOfDecay;
Atom gamescopeScalingFilter;
} atoms; } atoms;
}; };