mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
Keep the Qualcomm-only gamescope patches out of the regular gamescope
0120 (nested swapchain capability fallback) and 0124 (SDL explicit refresh) only matter for gamescope's SDL backend, which only Qualcomm sessions use. In tools/gamescope/patches they would go into the next regular gamescope release for every user. They now live in tools/qualcomm/gamescope-patches; build_gamescope.py reads both folders in name order, so the Qualcomm build applies the same series as before. 0121 and 0123 only change anything on PowerVR (vendor 0x1010) and are dropped. 0122 is renamed 0122-dmabuf-import-memory-type: it keeps the part every vendor uses (the imported DMA-BUF's memory type must also be allowed by vkGetMemoryFdPropertiesKHR) and drops the PowerVR-only query retry. The full series still applies to gamescope 8f212644 (3.16.29).
This commit is contained in:
1 parent
614f2d4ec1
commit
18735361d7
6 files changed
+35
-146
No files matched your search
@@ -54,7 +54,7 @@ The same lock pins a vendor-neutral X11 WSI layer and upstream Gamescope shader
|
||||
|
||||
Qualcomm 0.842.44 traps in its LLVM shader compiler when Gamescope dynamically indexes YUV sampler arrays. The constant-index switch preserves the eight-layer selection. The inner X11 WSI layer uses shared-memory copies; this is a compatibility path with additional CPU and memory-bandwidth cost. Steam additionally needs a larger `glibc.rtld.optional_static_tls` reserve because it loads the Bionic TLS bridge late.
|
||||
|
||||
The private Gamescope is built from Valve revision `8f212644c46460549035971ab914421180f61a7c` with the regular DroidDeck patches, the additional SHM/cursor patches in `gamescope-patches`, the constant YUV sampler patch, and `gamescope-no-dmabuf.patch`. The additional integration patches were taken from `wallentx/DroidDeck` revision `c931c4de26339c50f92354b9b06f6fdf7043ca8f`. The corresponding source is packaged in the APK. Upstream integration references:
|
||||
The private Gamescope is built from Valve revision `8f212644c46460549035971ab914421180f61a7c` with the regular DroidDeck patches, the additional patches in `gamescope-patches` (nested SDL swapchain and refresh handling, DMA-BUF import memory types, SHM/cursor presentation), the constant YUV sampler patch, and `gamescope-no-dmabuf.patch`. The additional integration patches were taken from `wallentx/DroidDeck` revision `c931c4de26339c50f92354b9b06f6fdf7043ca8f`. The corresponding source is packaged in the APK. Upstream integration references:
|
||||
|
||||
- [DroidDeck fork at the producer revision](https://github.com/wallentx/DroidDeck/tree/af320dd86c7de5738ff16cfeeefbcf42581c199e/tools/gamescope)
|
||||
- [libhybris runtime builder and patches](https://github.com/wallentx/DroidDeck/tree/4ed93fb9ee6e2a0b24ff087196f2e93d247fd985/tools/hybris)
|
||||
|
||||
File renamed without changes.
@@ -1,15 +0,0 @@
|
||||
diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp
|
||||
--- a/src/rendervulkan.cpp
|
||||
+++ b/src/rendervulkan.cpp
|
||||
@@ -996,8 +996,9 @@
|
||||
SHADER(BLUR, cs_composite_blur);
|
||||
SHADER(BLUR_COND, cs_composite_blur_cond);
|
||||
SHADER(BLUR_FIRST_PASS, cs_gaussian_blur_horizontal);
|
||||
- // The one pixel layout is only measured on Adreno, every other vendor keeps the quad swizzle.
|
||||
- if (m_uVendorID == 0x5143) /* Qualcomm */
|
||||
+ // PowerVR rejects the quad-swizzled RCAS for 3+ layers with YCbCr mask 2.
|
||||
+ // The existing one-pixel shader compiles those variants and covers the same 16x16 tile.
|
||||
+ if (m_uVendorID == 0x5143 || m_uVendorID == 0x1010) /* Qualcomm or Imagination */
|
||||
{
|
||||
SHADER(RCAS, cs_composite_rcas_1px);
|
||||
}
|
||||
+34
-69
@@ -1,4 +1,32 @@
|
||||
diff --git a/src/dmabuf_import.hpp b/src/dmabuf_import.hpp
|
||||
new file mode 100644
|
||||
index 0000000..ffa002b
|
||||
--- /dev/null
|
||||
+++ b/src/dmabuf_import.hpp
|
||||
@@ -0,0 +1,21 @@
|
||||
+#pragma once
|
||||
+#include <vulkan/vulkan_core.h>
|
||||
+
|
||||
+namespace gamescope
|
||||
+{
|
||||
+inline uint32_t DmabufMemoryType( const VkPhysicalDeviceMemoryProperties &memory,
|
||||
+ uint32_t imageBits, uint32_t fdBits, VkMemoryPropertyFlags preferred )
|
||||
+{
|
||||
+ uint32_t fallback = UINT32_MAX;
|
||||
+ const uint32_t compatible = imageBits & fdBits;
|
||||
+ for ( uint32_t i = 0; i < memory.memoryTypeCount; ++i )
|
||||
+ {
|
||||
+ if ( !( compatible & ( 1u << i ) ) ) continue;
|
||||
+ if ( fallback == UINT32_MAX ) fallback = i;
|
||||
+ if ( ( memory.memoryTypes[i].propertyFlags & preferred ) == preferred ) return i;
|
||||
+ }
|
||||
+ // Device-local is a preference for an existing imported buffer. CPU mapping
|
||||
+ // properties are requirements and must never be silently relaxed.
|
||||
+ return preferred == VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT ? fallback : UINT32_MAX;
|
||||
+}
|
||||
+}
|
||||
diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp
|
||||
index a5d9bbb..8d9f8f9 100644
|
||||
--- a/src/rendervulkan.cpp
|
||||
+++ b/src/rendervulkan.cpp
|
||||
@@ -13,6 +13,7 @@
|
||||
@@ -9,37 +37,7 @@ diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp
|
||||
#include "Utils/Algorithm.h"
|
||||
|
||||
#if defined(__linux__)
|
||||
@@ -2229,8 +2230,27 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
- if ( res == VK_SUCCESS &&
|
||||
- ( externalImageProperties.externalMemoryProperties.externalMemoryFeatures & VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT ) )
|
||||
+ bool importable = res == VK_SUCCESS &&
|
||||
+ ( externalImageProperties.externalMemoryProperties.externalMemoryFeatures & VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT );
|
||||
+ if ( gamescope::RetryPowerVRLinearQuery( g_device.vendorID(), imageInfo.format,
|
||||
+ pDMA->modifier, pDMA->n_planes, imageInfo.flags, res ) )
|
||||
+ {
|
||||
+ // PowerVR's mutable-format query rejects this linear import even though
|
||||
+ // explicit-layout imports and UNORM/sRGB GPU sampling work. Query the base
|
||||
+ // format without changing the image we actually create or its supplied stride.
|
||||
+ VkImageCreateInfo baseFormat = imageInfo;
|
||||
+ baseFormat.flags &= ~VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
|
||||
+ baseFormat.pNext = nullptr;
|
||||
+ res = getModifierProps( &baseFormat, pDMA->modifier, &externalImageProperties );
|
||||
+ importable = res == VK_SUCCESS &&
|
||||
+ ( externalImageProperties.externalMemoryProperties.externalMemoryFeatures & VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT );
|
||||
+ }
|
||||
+ if ( !importable && g_device.vendorID() == 0x1010 )
|
||||
+ {
|
||||
+ vk_log.errorf( "PowerVR DMA-BUF modifier is not importable; refusing a different tiling" );
|
||||
+ return false;
|
||||
+ }
|
||||
+ if ( importable )
|
||||
{
|
||||
modifierInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT,
|
||||
@@ -2348,6 +2368,22 @@
|
||||
@@ -2347,6 +2348,22 @@ bool CVulkanTexture::BInit( uint32_t width, uint32_t height, uint32_t depth, uin
|
||||
|
||||
m_format = imageInfo.format;
|
||||
|
||||
@@ -62,7 +60,7 @@ diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp
|
||||
res = g_device.vk.CreateImage(g_device.device(), &imageInfo, nullptr, &m_vkImage);
|
||||
if (res != VK_SUCCESS) {
|
||||
vk_errorf( res, "vkCreateImage failed" );
|
||||
@@ -2357,10 +2393,22 @@
|
||||
@@ -2356,10 +2373,22 @@ bool CVulkanTexture::BInit( uint32_t width, uint32_t height, uint32_t depth, uin
|
||||
VkMemoryRequirements memRequirements;
|
||||
g_device.vk.GetImageMemoryRequirements(g_device.device(), m_vkImage, &memRequirements);
|
||||
|
||||
@@ -86,7 +84,7 @@ diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp
|
||||
};
|
||||
|
||||
m_size = allocInfo.allocationSize;
|
||||
@@ -2453,6 +2501,13 @@
|
||||
@@ -2452,6 +2481,13 @@ bool CVulkanTexture::BInit( uint32_t width, uint32_t height, uint32_t depth, uin
|
||||
if ( res != VK_SUCCESS )
|
||||
{
|
||||
vk_errorf( res, "vkBindImageMemory failed" );
|
||||
@@ -101,9 +99,10 @@ diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp
|
||||
}
|
||||
|
||||
diff --git a/src/rendervulkan.hpp b/src/rendervulkan.hpp
|
||||
index 674a3b4..5ffec4a 100644
|
||||
--- a/src/rendervulkan.hpp
|
||||
+++ b/src/rendervulkan.hpp
|
||||
@@ -791,6 +791,7 @@
|
||||
@@ -791,6 +791,7 @@ static inline uint32_t div_roundup(uint32_t x, uint32_t y)
|
||||
VK_FUNC(GetImageMemoryRequirements) \
|
||||
VK_FUNC(GetImageSubresourceLayout) \
|
||||
VK_FUNC(GetMemoryFdKHR) \
|
||||
@@ -111,7 +110,7 @@ diff --git a/src/rendervulkan.hpp b/src/rendervulkan.hpp
|
||||
VK_FUNC(GetQueryPoolResults) \
|
||||
VK_FUNC(GetSemaphoreCounterValue) \
|
||||
VK_FUNC(GetSwapchainImagesKHR) \
|
||||
@@ -865,6 +866,8 @@
|
||||
@@ -865,6 +866,8 @@ public:
|
||||
inline VkPipelineLayout pipelineLayout() {return m_pipelineLayout;}
|
||||
inline int drmRenderFd() {return m_drmRendererFd;}
|
||||
inline bool supportsModifiers() {return m_bSupportsModifiers;}
|
||||
@@ -120,37 +119,3 @@ diff --git a/src/rendervulkan.hpp b/src/rendervulkan.hpp
|
||||
inline bool supportsMutableSwapchain() {return m_bSupportsMutableSwapchain;}
|
||||
inline bool supportsPresentWait() {return m_bSupportsPresentWait;}
|
||||
inline bool hasDrmPrimaryDevId() {return m_bHasDrmPrimaryDevId;}
|
||||
diff --git a/src/dmabuf_import.hpp b/src/dmabuf_import.hpp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/src/dmabuf_import.hpp
|
||||
@@ -0,0 +1,29 @@
|
||||
+#pragma once
|
||||
+#include <vulkan/vulkan_core.h>
|
||||
+
|
||||
+namespace gamescope
|
||||
+{
|
||||
+inline bool RetryPowerVRLinearQuery( uint32_t vendor, VkFormat format, uint64_t modifier,
|
||||
+ uint32_t planes, VkImageCreateFlags flags, VkResult result )
|
||||
+{
|
||||
+ return vendor == 0x1010 && modifier == 0 && planes == 1 &&
|
||||
+ flags == VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT && result == VK_ERROR_FORMAT_NOT_SUPPORTED &&
|
||||
+ ( format == VK_FORMAT_R8G8B8A8_UNORM || format == VK_FORMAT_B8G8R8A8_UNORM );
|
||||
+}
|
||||
+
|
||||
+inline uint32_t DmabufMemoryType( const VkPhysicalDeviceMemoryProperties &memory,
|
||||
+ uint32_t imageBits, uint32_t fdBits, VkMemoryPropertyFlags preferred )
|
||||
+{
|
||||
+ uint32_t fallback = UINT32_MAX;
|
||||
+ const uint32_t compatible = imageBits & fdBits;
|
||||
+ for ( uint32_t i = 0; i < memory.memoryTypeCount; ++i )
|
||||
+ {
|
||||
+ if ( !( compatible & ( 1u << i ) ) ) continue;
|
||||
+ if ( fallback == UINT32_MAX ) fallback = i;
|
||||
+ if ( ( memory.memoryTypes[i].propertyFlags & preferred ) == preferred ) return i;
|
||||
+ }
|
||||
+ // Device-local is a preference for an existing imported buffer. CPU mapping
|
||||
+ // properties are requirements and must never be silently relaxed.
|
||||
+ return preferred == VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT ? fallback : UINT32_MAX;
|
||||
+}
|
||||
+}
|
||||
@@ -1,61 +0,0 @@
|
||||
diff --git a/src/nested_surface_format.hpp b/src/nested_surface_format.hpp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/src/nested_surface_format.hpp
|
||||
@@ -0,0 +1,31 @@
|
||||
+#pragma once
|
||||
+
|
||||
+#include <vulkan/vulkan_core.h>
|
||||
+
|
||||
+namespace gamescope
|
||||
+{
|
||||
+// The SDR composition shader declares rgba8, which requires an R8G8B8A8_UNORM
|
||||
+// storage view. Binding a BGRA view is a format mismatch; a same-format copy
|
||||
+// cannot correct it. Keep the workaround scoped to the PowerVR SDR copy path
|
||||
+// where the channel reversal was reproduced, not game-facing texture formats.
|
||||
+// On success, formatCount means the existing selector should choose the format.
|
||||
+// On failure, no matching RGBA SDR surface was advertised for this scoped path.
|
||||
+inline bool ChooseNestedSDRCopySurfaceFormat( uint32_t vendorId, bool copy, bool hdr,
|
||||
+ const VkSurfaceFormatKHR *formats, uint32_t formatCount, uint32_t &surfaceFormat )
|
||||
+{
|
||||
+ surfaceFormat = formatCount;
|
||||
+ if ( vendorId != 0x1010 || !copy || hdr )
|
||||
+ return true;
|
||||
+
|
||||
+ for ( uint32_t i = 0; i < formatCount; ++i )
|
||||
+ {
|
||||
+ if ( formats[i].format == VK_FORMAT_R8G8B8A8_UNORM &&
|
||||
+ formats[i].colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR )
|
||||
+ {
|
||||
+ surfaceFormat = i;
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+}
|
||||
diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp
|
||||
--- a/src/rendervulkan.cpp
|
||||
+++ b/src/rendervulkan.cpp
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "vulkan_include.h"
|
||||
#include "nested_swapchain.hpp"
|
||||
#include "dmabuf_import.hpp"
|
||||
+#include "nested_surface_format.hpp"
|
||||
#include "Utils/Algorithm.h"
|
||||
|
||||
#if defined(__linux__)
|
||||
@@ -3330,6 +3331,13 @@
|
||||
uint32_t surfaceFormat = formatCount;
|
||||
VkColorSpaceKHR preferredColorSpace = g_bOutputHDREnabled ? VK_COLOR_SPACE_HDR10_ST2084_EXT : VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
|
||||
|
||||
+ if ( !gamescope::ChooseNestedSDRCopySurfaceFormat( g_device.vendorID(), config.copy,
|
||||
+ g_bOutputHDREnabled, pOutput->surfaceFormats.data(), formatCount, surfaceFormat ) )
|
||||
+ {
|
||||
+ vk_log.errorf( "PowerVR copy composition requires an RGBA SDR surface" );
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
if ( surfaceFormat == formatCount )
|
||||
{
|
||||
for ( surfaceFormat = 0; surfaceFormat < formatCount; surfaceFormat++ )
|
||||
Reference in new issue
Block a user