Files
DroidDeck/tools/gamescope/patches/0132-name-hung-up-waitable.patch
T
The412Banner f292274d7f Non-Adreno round 6: PowerVR PRIME on old kernels, thermal, hang-up names, bridge flippable images, Venus Zink variants
- drm.c: PR #570's current PRIME ownership check (F_DUPFD_QUERY, then kcmp,
  then the F_SETOWN_EX owner marker): on a kernel before 6.10 with kcmp
  blocked, drmPrimeFDToHandle answered EOPNOTSUPP for every PowerVR import
  (Pixel 10, Android 17: Zink "failed drmPrimeFDToHandle", Xwayland error 7,
  gamescope X11 I/O error). The Mali stand-in node is kept.
- A /sys/class/thermal the kernel will not list gets an empty directory, so
  mangoapp no longer aborts on it.
- gamescope 0132: a hung-up waitable is named before the abort; 0133: the
  bridge's flippable images use supported-but-unexportable modifiers instead
  of asserting.
- Venus: when Zink does not start, the loader's view is logged and Zink is
  retried without ZINK_DEBUG=compact, with ZINK_DESCRIPTORS=auto and without
  kopper before falling back to llvmpipe.
2026-10-13 11:47:23 -04:00

58 lines
2.1 KiB
Diff

diff --git a/src/Backends/WaylandBackend.cpp b/src/Backends/WaylandBackend.cpp
index a927f69..2c9bd73 100644
--- a/src/Backends/WaylandBackend.cpp
+++ b/src/Backends/WaylandBackend.cpp
@@ -2882,7 +2882,22 @@ namespace gamescope
abort();
}
- CFunctionWaitable waitable( nFD );
+ // The compositor's connection: a hang-up says why (the protocol error, if one was posted).
+ class CDisplayWaitable final : public IWaitable
+ {
+ public:
+ CDisplayWaitable( int nFD, wl_display *pDisplay ) : m_nFD{ nFD }, m_pDisplay{ pDisplay } {}
+ int GetFD() final { return m_nFD; }
+ void OnPollHangUp() final
+ {
+ LogDisplayError( "The Wayland compositor closed gamescope's connection (input thread)", m_pDisplay );
+ IWaitable::OnPollHangUp();
+ }
+ private:
+ int m_nFD;
+ wl_display *m_pDisplay;
+ };
+ CDisplayWaitable waitable( nFD, m_pBackend->GetDisplay() );
m_Waiter.AddWaitable( &waitable );
int nRet = 0;
diff --git a/src/waitable.h b/src/waitable.h
index be54d46..b9116fe 100644
--- a/src/waitable.h
+++ b/src/waitable.h
@@ -9,6 +9,8 @@
#include <functional>
#include <mutex>
+#include <typeinfo>
+#include <stdio.h>
#include "log.hpp"
@@ -30,7 +32,14 @@ namespace gamescope
virtual void OnPollPri() {}
virtual void OnPollHangUp()
{
- g_WaitableLog.errorf( "IWaitable hung up. Aborting." );
+ // Which one: its class and what its descriptor is (a socket, a pipe, an eventfd...).
+ int nFD = GetFD();
+ char szPath[64], szTarget[256] = "?";
+ snprintf( szPath, sizeof( szPath ), "/proc/self/fd/%d", nFD );
+ ssize_t nLen = nFD >= 0 ? readlink( szPath, szTarget, sizeof( szTarget ) - 1 ) : -1;
+ if ( nLen >= 0 )
+ szTarget[nLen] = '\0';
+ g_WaitableLog.errorf( "IWaitable hung up: %s, fd %d -> %s. Aborting.", typeid( *this ).name(), nFD, szTarget );
abort();
}