From 50535aa5694d86d4f1e6f0cfd6764ce7258b419f Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Thu, 3 Dec 2026 10:03:45 -0500 Subject: [PATCH] Add opt-in diagnostics for the Gamescope producer route --- .../0999-probe-present-producer-route.patch | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tools/gamescope/patches/0999-probe-present-producer-route.patch diff --git a/tools/gamescope/patches/0999-probe-present-producer-route.patch b/tools/gamescope/patches/0999-probe-present-producer-route.patch new file mode 100644 index 0000000000..be352ffab7 --- /dev/null +++ b/tools/gamescope/patches/0999-probe-present-producer-route.patch @@ -0,0 +1,55 @@ +--- a/src/Backends/WaylandBackend.cpp ++++ b/src/Backends/WaylandBackend.cpp +@@ -38,6 +38,8 @@ + #include "wlr_end.hpp" + + #include "drm_include.h" ++#include ++#include + + #define WL_FRACTIONAL_SCALE_DENOMINATOR 120 + +@@ -55,7 +57,27 @@ + using namespace std::literals; + + static LogScope xdg_log( "xdg_backend" ); ++ ++// Diagnostic only: no buffer, synchronization or scheduling policy changes. ++static void LogDroidDeckProducerRoute( bool bComposite ) ++{ ++ static const bool bEnabled = [] { ++ const char *pValue = std::getenv( "DROIDDECK_TRACE_PRESENT_PRODUCER" ); ++ return pValue && std::strcmp( pValue, "1" ) == 0; ++ }(); ++ if ( !bEnabled ) ++ return; ++ static thread_local unsigned uForwarded = 0, uComposite = 0; ++ if ( bComposite ) ++ ++uComposite; ++ else ++ ++uForwarded; ++ if ( (uForwarded + uComposite) == 1 || (uForwarded + uComposite) % 240 == 0 ) ++ xdg_log.infof( "DroidDeck producer: forwarded=%u owned-composite=%u (last=%s)", ++ uForwarded, uComposite, bComposite ? "owned-composite" : "forwarded" ); ++} + ++ + static const char *GAMESCOPE_proxy_tag = "gamescope-proxy"; + static const char *GAMESCOPE_plane_tag = "gamescope-plane"; + static const char *GAMESCOPE_toplevel_tag = "gamescope-toplevel"; +@@ -1121,6 +1143,7 @@ + } ); + } + ++ LogDroidDeckProducerRoute( false ); + for ( int i = 0; uCurrentPlane < std::size( m_Planes ); i++ ) + m_Planes[uCurrentPlane++].Present( i < pFrameInfo->layers.count() ? &pFrameInfo->layers.get( i ) : nullptr ); + } +@@ -1135,6 +1158,7 @@ + } + + vulkan_wait( *oCompositeResult, true ); ++ LogDroidDeckProducerRoute( true ); + + FrameInfo_t::Layer_t compositeLayer{}; + compositeLayer.scale.x = 1.0;