Add opt-in diagnostics for the Gamescope producer route

This commit is contained in:
Kurt Himebauch committed 2026-12-03 10:03:45 -05:00
1 parent 17928792bd
commit 50535aa569
1 file changed
+55
@@ -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 <cstdlib>
+#include <cstring>
#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;