Files
DroidDeck/tools/qualcomm/gamescope-patches/0127-refresh-shm-buffer-contents.patch
T
K11MCH1 7873adcb23 Support older Qualcomm drivers without DMA-BUF or maintenance5
(cherry picked from commit 10939e6bc31e50dcf18ce0fcad4b48d5874b4af6)
2026-10-25 02:10:34 +09:00

55 lines
1.8 KiB
Diff

diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp
--- a/src/steamcompmgr.cpp
+++ b/src/steamcompmgr.cpp
@@ -1851,16 +1851,22 @@
commit->fifo = false;
}
- if ( gamescope::OwningRc<CVulkanTexture> pTexture = s_BufferMemos.LookupVulkanTexture( buf ) )
- {
- // Going from OwningRc -> Rc now.
- commit->vulkanTex = pTexture;
- return commit;
- }
-
struct wlr_dmabuf_attributes dmabuf = {0};
+ const bool bIsDmabuf = wlr_buffer_get_dmabuf( buf, &dmabuf );
+ // DMA-BUF textures reference the producer's live allocation. SHM textures are
+ // snapshots uploaded into separate memory and must be refreshed every commit.
+ if ( bIsDmabuf )
+ {
+ if ( gamescope::OwningRc<CVulkanTexture> pTexture = s_BufferMemos.LookupVulkanTexture( buf ) )
+ {
+ // Going from OwningRc -> Rc now.
+ commit->vulkanTex = pTexture;
+ return commit;
+ }
+ }
+
gamescope::OwningRc<gamescope::IBackendFb> pBackendFb;
- if ( wlr_buffer_get_dmabuf( buf, &dmabuf ) )
+ if ( bIsDmabuf )
{
pBackendFb = GetBackend()->ImportDmabufToBackend( &dmabuf );
}
@@ -1874,7 +1880,8 @@
commit->vulkanTex = pOwnedTexture;
- s_BufferMemos.MemoizeBuffer( buf, std::move( pOwnedTexture ) );
+ if ( bIsDmabuf )
+ s_BufferMemos.MemoizeBuffer( buf, std::move( pOwnedTexture ) );
return commit;
}
@@ -8599,7 +8606,8 @@
} );
if ( commitSync.source == gamescope::BufferCommitSyncSource::SynchronousUpload )
{
- // vulkan_create_texture_from_wlr_buffer waited for this SHM upload to finish.
+ // Every SHM commit is uploaded synchronously; only DMA-BUF textures are memoized.
+ // vulkan_create_texture_from_wlr_buffer waited for this upload to finish.
// Exporting its image memory as a DMA-BUF does not produce a sync fence and can
// return an invalid fd on drivers that do not export the allocation.
static bool loggedSynchronousUpload = false;