Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4daf49097 | ||
|
|
0764d7365a |
No files matched your search
@@ -76,8 +76,10 @@ The system PowerVR driver uses the existing SDL/Wayland swapchain backend. Its a
|
||||
- `0922-powervr-linear-dmabuf-import.patch`: retain the explicit linear layout when PowerVR
|
||||
rejects the mutable-format query, and intersect imported-image and FD memory-type masks.
|
||||
- `0923-powervr-rgba-copy-surface.patch`: require an advertised RGBA SDR copy surface matching
|
||||
the shader's `rgba8` storage view. The tested workaround leaves other vendors, HDR and direct
|
||||
composition unchanged; it does not restrict game-facing BGRA formats.
|
||||
the shader's `rgba8` storage view, on every GPU that composes offscreen and copies. Writing
|
||||
through a BGRA view of that image swapped red and blue on PowerVR and on the Xclipse 950's
|
||||
system driver; libhybris always offers RGBA next to BGRA. HDR and direct composition keep the
|
||||
existing selector; it does not restrict game-facing BGRA formats.
|
||||
- `0924-sdl-preserve-explicit-refresh.patch` and `0925-sdl-wait-before-present.patch`: preserve
|
||||
configured refresh across SDL events and finish composition before presenting without a
|
||||
render-finished semaphore. The build runs the focused capability, format and refresh tests.
|
||||
|
||||
@@ -2,24 +2,18 @@ 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 @@
|
||||
@@ -0,0 +1,25 @@
|
||||
+#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,
|
||||
+inline bool ChooseNestedSDRCopySurfaceFormat( bool copy, bool hdr,
|
||||
+ const VkSurfaceFormatKHR *formats, uint32_t formatCount, uint32_t &surfaceFormat )
|
||||
+{
|
||||
+ surfaceFormat = formatCount;
|
||||
+ if ( vendorId != 0x1010 || !copy || hdr )
|
||||
+ if ( !copy || hdr )
|
||||
+ return true;
|
||||
+
|
||||
+ for ( uint32_t i = 0; i < formatCount; ++i )
|
||||
@@ -49,10 +43,10 @@ diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp
|
||||
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,
|
||||
+ if ( !gamescope::ChooseNestedSDRCopySurfaceFormat( config.copy,
|
||||
+ g_bOutputHDREnabled, pOutput->surfaceFormats.data(), formatCount, surfaceFormat ) )
|
||||
+ {
|
||||
+ vk_log.errorf( "PowerVR copy composition requires an RGBA SDR surface" );
|
||||
+ vk_log.errorf( "Copy composition requires an RGBA SDR surface" );
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -70,53 +70,47 @@ int main()
|
||||
VK_FORMAT_B8G8R8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR};
|
||||
uint32_t surfaceFormat = UINT32_MAX;
|
||||
|
||||
// PowerVR SDR copy output needs the RGBA view matching the rgba8 shader.
|
||||
const VkSurfaceFormatKHR bgraFirst[] = {bgra, rgba, rgba};
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
bgraFirst, 3, surfaceFormat));
|
||||
assert(surfaceFormat == 1);
|
||||
const VkSurfaceFormatKHR rgbaFirst[] = {rgba, bgra};
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
rgbaFirst, 2, surfaceFormat));
|
||||
assert(surfaceFormat == 0);
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
&rgba, 1, surfaceFormat));
|
||||
assert(surfaceFormat == 0);
|
||||
|
||||
// Reusing a successful index must not hide a missing compatible format.
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
&bgra, 1, surfaceFormat));
|
||||
assert(surfaceFormat == 1);
|
||||
const VkSurfaceFormatKHR wrongColorSpace = {
|
||||
VK_FORMAT_R8G8B8A8_UNORM, VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT};
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
&wrongColorSpace, 1, surfaceFormat));
|
||||
assert(surfaceFormat == 1);
|
||||
const VkSurfaceFormatKHR srgbFormat = {
|
||||
VK_FORMAT_R8G8B8A8_SRGB, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR};
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
&srgbFormat, 1, surfaceFormat));
|
||||
assert(surfaceFormat == 1);
|
||||
const VkSurfaceFormatKHR compatibleLast[] = {wrongColorSpace, srgbFormat, rgba};
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
compatibleLast, 3, surfaceFormat));
|
||||
assert(surfaceFormat == 2);
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
nullptr, 0, surfaceFormat));
|
||||
assert(surfaceFormat == 0);
|
||||
|
||||
// The existing selector still owns HDR, direct output, and other vendors.
|
||||
// Each call clears a stale index even when BGRA is the only advertised format.
|
||||
surfaceFormat = 0;
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(0x1010, true, true,
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(true, true,
|
||||
&bgra, 1, surfaceFormat));
|
||||
assert(surfaceFormat == 1);
|
||||
surfaceFormat = 0;
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(0x1010, false, false,
|
||||
&bgra, 1, surfaceFormat));
|
||||
assert(surfaceFormat == 1);
|
||||
surfaceFormat = 0;
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(0x5143, true, false,
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(false, false,
|
||||
&bgra, 1, surfaceFormat));
|
||||
assert(surfaceFormat == 1);
|
||||
|
||||
|
||||
Reference in new issue
Block a user