diff --git a/tools/gamescope/PATCHES.md b/tools/gamescope/PATCHES.md index 15f0063580..2f9aac03f2 100644 --- a/tools/gamescope/PATCHES.md +++ b/tools/gamescope/PATCHES.md @@ -56,6 +56,13 @@ library list, before anything is published. own limiter slips such a frame by one refresh. The fixed-refresh branch now paces each window by time, as the VRR branch already did: its next frame goes out on the first refresh a capped interval after its last one, with half a refresh of tolerance so an on-time window keeps every Nth refresh. +- `0116-hold-overlay-repaint-for-next-frame.patch` - this app: on a fixed-refresh output every + mangoapp commit asked for a repaint of its own, and mangoapp draws once per game frame just after + that frame was shown, so a 60 fps game on a 120 Hz panel was composited twice per frame - 75 frames + a second reached the screen, one in two 8 ms after the last with no new picture (Valheim, Stardew + Valley, Among Us). The VRR path already leaves such repaints to the next game frame; on a fixed + refresh output they now wait for it too, for at most `external_overlay_hold_cycles` refreshes (4, + so 30 fps at 120 Hz still merges), and are painted on their own after that. Sixteen more of Armada's patches are DRM/lease/HDR-on-KMS work for a native display, which this app's Wayland-hosted gamescope never reaches, or need a newer gamescope than the runtime has. diff --git a/tools/gamescope/patches/0116-hold-overlay-repaint-for-next-frame.patch b/tools/gamescope/patches/0116-hold-overlay-repaint-for-next-frame.patch new file mode 100644 index 0000000000..3bab65babd --- /dev/null +++ b/tools/gamescope/patches/0116-hold-overlay-repaint-for-next-frame.patch @@ -0,0 +1,64 @@ +diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp +index 214677d..6c9299d 100644 +--- a/src/steamcompmgr.cpp ++++ b/src/steamcompmgr.cpp +@@ -298,6 +298,7 @@ update_runtime_info(); + gamescope::ConVar cv_adaptive_sync( "adaptive_sync", false, "Whether or not adaptive sync is enabled if available." ); + gamescope::ConVar cv_adaptive_sync_ignore_overlay( "adaptive_sync_ignore_overlay", false, "Whether or not to ignore overlay planes for pushing commits with adaptive sync." ); + gamescope::ConVar cv_adaptive_sync_overlay_cycles( "adaptive_sync_overlay_cycles", 1, "Number of vblank cycles to ignore overlay repaints before forcing a commit with adaptive sync." ); ++gamescope::ConVar cv_external_overlay_hold_cycles( "external_overlay_hold_cycles", 4, "Number of vblank cycles an external overlay's repaint waits for the next base plane commit on a fixed refresh output, 0 repaints at once." ); + gamescope::ConVar cv_adaptive_sync_uncapped( "adaptive_sync_uncapped", true, "Whether or not to allow mailbox/immediate clients to run uncapped with adaptive sync by deferring paints until the display can take a new flip." ); + + gamescope::ConVar cv_upscale_preemptive( "upscale_preemptive", true, "Allow pre-emptive upscaling" ); +@@ -1119,6 +1120,7 @@ uint32_t lastPublishedInputCounter; + + std::atomic hasRepaint = false; + bool hasRepaintNonBasePlane = false; ++bool hasRepaintExternalOverlay = false; + + bool g_bUpdateForwardedVROverlays = false; + +@@ -8015,7 +8017,10 @@ bool handle_done_commit( steamcompmgr_win_t *w, xwayland_ctx_t *ctx, uint64_t co + if ( ( w == pFocus->externalOverlayWindow && w->opacity != TRANSLUCENT ) && + ( GetBackend()->GetCurrentConnector() && !GetBackend()->GetCurrentConnector()->IsVRRActive() ) ) + { +- hasRepaintNonBasePlane = true; ++ if ( cv_external_overlay_hold_cycles > 0 ) ++ hasRepaintExternalOverlay = true; ++ else ++ hasRepaintNonBasePlane = true; + } + + // If this is the main plane, repaint +@@ -10573,6 +10578,14 @@ steamcompmgr_main(int argc, char **argv) + hasRepaint = true; + + bool bPainted = false; ++ bool bPaintedOutput = false; ++ ++ static int nHeldExternalOverlayCycles = 0; ++ ++ if ( !hasRepaintExternalOverlay ) ++ nHeldExternalOverlayCycles = 0; ++ else if ( vblank && ++nHeldExternalOverlayCycles >= cv_external_overlay_hold_cycles ) ++ hasRepaintNonBasePlane = true; + + static int nIgnoredOverlayRepaints = 0; + +@@ -10733,6 +10746,7 @@ steamcompmgr_main(int argc, char **argv) + paint_all( pPaintFocus, eFlipType == FlipType::Async ); + + bPainted = true; ++ bPaintedOutput = true; + } + } + +@@ -10751,6 +10765,8 @@ steamcompmgr_main(int argc, char **argv) + + hasRepaint = false; + hasRepaintNonBasePlane = false; ++ if ( bPaintedOutput ) ++ hasRepaintExternalOverlay = false; + nIgnoredOverlayRepaints = 0; + + { diff --git a/tools/gamescope/release.env b/tools/gamescope/release.env index d5fd20c50b..1e741f4aa0 100644 --- a/tools/gamescope/release.env +++ b/tools/gamescope/release.env @@ -1,3 +1,3 @@ GAMESCOPE_REPO=Droid-Deck/DroidDeck-Components -GAMESCOPE_TAG=gamescope-3.16.29-cursor-045e5a31-qa -GAMESCOPE_SHA256=76929e93804450e7352421b76a457c825a6251de8b704d942c363a211bd99424 +GAMESCOPE_TAG=gamescope-3.16.29-p12 +GAMESCOPE_SHA256=07b69944a1ebf2741d4a867afa6327dcc63ec458f432a8f7483089dce2197010