mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 20:45:43 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4d4610548 | ||
|
|
1c3c9040ac |
No files matched your search
@@ -76,10 +76,8 @@ 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, 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.
|
||||
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.
|
||||
- `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,18 +2,24 @@ 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,25 @@
|
||||
@@ -0,0 +1,31 @@
|
||||
+#pragma once
|
||||
+
|
||||
+#include <vulkan/vulkan_core.h>
|
||||
+
|
||||
+namespace gamescope
|
||||
+{
|
||||
+inline bool ChooseNestedSDRCopySurfaceFormat( bool copy, bool hdr,
|
||||
+// 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 ( !copy || hdr )
|
||||
+ if ( vendorId != 0x1010 || !copy || hdr )
|
||||
+ return true;
|
||||
+
|
||||
+ for ( uint32_t i = 0; i < formatCount; ++i )
|
||||
@@ -43,10 +49,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( config.copy,
|
||||
+ if ( !gamescope::ChooseNestedSDRCopySurfaceFormat( g_device.vendorID(), config.copy,
|
||||
+ g_bOutputHDREnabled, pOutput->surfaceFormats.data(), formatCount, surfaceFormat ) )
|
||||
+ {
|
||||
+ vk_log.errorf( "Copy composition requires an RGBA SDR surface" );
|
||||
+ vk_log.errorf( "PowerVR copy composition requires an RGBA SDR surface" );
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -70,47 +70,53 @@ 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(true, false,
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
bgraFirst, 3, surfaceFormat));
|
||||
assert(surfaceFormat == 1);
|
||||
const VkSurfaceFormatKHR rgbaFirst[] = {rgba, bgra};
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
rgbaFirst, 2, surfaceFormat));
|
||||
assert(surfaceFormat == 0);
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
&rgba, 1, surfaceFormat));
|
||||
assert(surfaceFormat == 0);
|
||||
|
||||
// Reusing a successful index must not hide a missing compatible format.
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
&bgra, 1, surfaceFormat));
|
||||
assert(surfaceFormat == 1);
|
||||
const VkSurfaceFormatKHR wrongColorSpace = {
|
||||
VK_FORMAT_R8G8B8A8_UNORM, VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT};
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
&wrongColorSpace, 1, surfaceFormat));
|
||||
assert(surfaceFormat == 1);
|
||||
const VkSurfaceFormatKHR srgbFormat = {
|
||||
VK_FORMAT_R8G8B8A8_SRGB, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR};
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
&srgbFormat, 1, surfaceFormat));
|
||||
assert(surfaceFormat == 1);
|
||||
const VkSurfaceFormatKHR compatibleLast[] = {wrongColorSpace, srgbFormat, rgba};
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(0x1010, true, false,
|
||||
compatibleLast, 3, surfaceFormat));
|
||||
assert(surfaceFormat == 2);
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(true, false,
|
||||
assert(!ChooseNestedSDRCopySurfaceFormat(0x1010, 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(true, true,
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(0x1010, true, true,
|
||||
&bgra, 1, surfaceFormat));
|
||||
assert(surfaceFormat == 1);
|
||||
surfaceFormat = 0;
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(false, false,
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(0x1010, false, false,
|
||||
&bgra, 1, surfaceFormat));
|
||||
assert(surfaceFormat == 1);
|
||||
surfaceFormat = 0;
|
||||
assert(ChooseNestedSDRCopySurfaceFormat(0x5143, true, false,
|
||||
&bgra, 1, surfaceFormat));
|
||||
assert(surfaceFormat == 1);
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ CLIENT_ENV = {
|
||||
"WEBKIT_DISABLE_COMPOSITING_MODE": "1",
|
||||
"WEBKIT_DISABLE_DMABUF_RENDERER": "1",
|
||||
"WEBKIT_SKIA_ENABLE_CPU_RENDERING": "1",
|
||||
"GDK_BACKEND": "x11",
|
||||
"NO_AT_BRIDGE": "1",
|
||||
"GTK_A11Y": "none",
|
||||
"LIBGL_ALWAYS_SOFTWARE": "1",
|
||||
|
||||
@@ -659,6 +659,17 @@ class DisplayTest(EpicTestCase):
|
||||
self.assertNotIn("WAYLAND_DISPLAY", env)
|
||||
self.assertEqual("unix:path=/b", env["DBUS_SESSION_BUS_ADDRESS"])
|
||||
|
||||
def test_the_launcher_draws_on_its_x_display_not_the_session_compositor(self):
|
||||
base = {"XDG_RUNTIME_DIR": "/run/droiddeck", "WAYLAND_DISPLAY": "wayland-0",
|
||||
"GAMESCOPE_WAYLAND_DISPLAY": "gamescope-0", "XDG_SESSION_TYPE": "wayland", "GDK_BACKEND": "wayland"}
|
||||
with mock.patch.dict(G, {"fex_environment": lambda fex, files, base: {}}):
|
||||
visible = G["client_environment"](base, None, None, ":1", "bus", "broker")
|
||||
hidden = G["client_environment"](base, None, None, ":2", "bus", "broker", hidden=True)
|
||||
for env, display in ((visible, ":1"), (hidden, ":2")):
|
||||
self.assertEqual(("x11", display, "/run/droiddeck"), (env.get("GDK_BACKEND"), env.get("DISPLAY"), env.get("XDG_RUNTIME_DIR")))
|
||||
for name in ("WAYLAND_DISPLAY", "GAMESCOPE_WAYLAND_DISPLAY", "XDG_SESSION_TYPE"):
|
||||
self.assertNotIn(name, env)
|
||||
|
||||
|
||||
class InstallationsTest(EpicTestCase):
|
||||
def add_game(self, guid="G1", app="Fig", store="epic", extra=None):
|
||||
|
||||
Reference in new issue
Block a user