diff --git a/tools/gamescope/PATCHES.md b/tools/gamescope/PATCHES.md index b0c2823b6..fec0d74e3 100644 --- a/tools/gamescope/PATCHES.md +++ b/tools/gamescope/PATCHES.md @@ -122,6 +122,12 @@ app's Wayland-hosted gamescope never reaches, or need a newer gamescope than the - `0134-flippable-image-no-backend-modifiers.patch`: when the nested backend offers no modifier at all for a flippable image's format, `CVulkanTexture::BInit` tries linear and logs it instead of asserting `!modifiers.empty()`. NieR Replicant ended the session there on a Pixel 9a under Venus. +- `0135-flippable-image-linear-when-driver-rejects-all.patch`: when the driver answers every offered + modifier with `VK_ERROR_FORMAT_NOT_SUPPORTED` and linear was among them, the flippable image tries + linear anyway; if it cannot be made, `BInit` fails as before. An r32p1 Mali-G610 (Vulkan 1.1) behind + the Mali bridge rejected both of the backend's modifiers for AR24, so the session ended at start + (0133's "no usable modifier"); the bridge makes such images without the handle type and exports + them through a dma-heap. The shared DroidDeck patch also includes `0116-release-cursor-shm-buffers.patch`: pointer cursor surfaces have no X11/xdg window association, so routing their commits through `g_PendingCommits` diff --git a/tools/gamescope/patches/0135-flippable-image-linear-when-driver-rejects-all.patch b/tools/gamescope/patches/0135-flippable-image-linear-when-driver-rejects-all.patch new file mode 100644 index 000000000..dd26e94d3 --- /dev/null +++ b/tools/gamescope/patches/0135-flippable-image-linear-when-driver-rejects-all.patch @@ -0,0 +1,38 @@ +--- a/src/rendervulkan.cpp ++++ b/src/rendervulkan.cpp +@@ -2373,6 +2373,7 @@ + + std::vector modifiers = {}; + std::vector unexportable = {}; ++ bool linearRejected = false; + // TODO(JoshA): Move this code to backend for making flippable image. + if ( GetBackend()->UsesModifiers() && flags.bFlippable && g_device.supportsModifiers() && !pDMA ) + { +@@ -2414,7 +2415,10 @@ + }; + res = getModifierProps( &imageInfo, modifier, &externalFormatProps ); + if ( res == VK_ERROR_FORMAT_NOT_SUPPORTED ) ++ { ++ linearRejected |= modifier == DRM_FORMAT_MOD_LINEAR; + continue; ++ } + else if ( res != VK_SUCCESS ) { + vk_errorf( res, "getModifierProps failed" ); + return false; +@@ -2440,6 +2444,16 @@ + drmFormat, unexportable.size() ); + modifiers = unexportable; + } ++ // An r32p1 Mali driver (G610, Vulkan 1.1) behind the Mali bridge answers every modifier query ++ // with VK_ERROR_FORMAT_NOT_SUPPORTED, yet the bridge makes such an image without the handle type ++ // and exports it through a dma-heap. Linear, when the backend offered it, is tried rather than ++ // giving up; if the image cannot be made, BInit fails as before (Xiaomi 13T, AR24). ++ if ( modifiers.empty() && linearRejected ) ++ { ++ vk_log.errorf( "flippable image: the driver supports none of the %zu modifier(s) offered for DRM format 0x%x; trying linear anyway", ++ numPossibleModifiers, drmFormat ); ++ modifiers.push_back( DRM_FORMAT_MOD_LINEAR ); ++ } + if ( modifiers.empty() ) + { + vk_log.errorf( "flippable image: no usable modifier for DRM format 0x%x (%zu offered by the backend)", drmFormat, numPossibleModifiers );