From 0e959ef11d687f0ba650820b3a4f5d75da4fb58f Mon Sep 17 00:00:00 2001 From: Kyle Gospodnetich Date: Sun, 7 Jul 2024 22:43:50 -0700 Subject: [PATCH] chore: Pull 1335.patch due to reported crash with it in place. Thanks @matte_schwartz --- spec_files/gamescope/1335.patch | 127 ---------------------------- spec_files/gamescope/gamescope.spec | 6 +- 2 files changed, 2 insertions(+), 131 deletions(-) delete mode 100644 spec_files/gamescope/1335.patch diff --git a/spec_files/gamescope/1335.patch b/spec_files/gamescope/1335.patch deleted file mode 100644 index 515c829a..00000000 --- a/spec_files/gamescope/1335.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 35f5ba8bb9297d06b7d8238295ae3601367d91ad Mon Sep 17 00:00:00 2001 -From: sharkautarch <128002472+sharkautarch@users.noreply.github.com> -Date: Fri, 24 May 2024 15:43:09 -0400 -Subject: [PATCH 1/2] sdlwindow.cpp: close m_thread w/o std::terminate being - called - ---- - src/Backends/SDLBackend.cpp | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/src/Backends/SDLBackend.cpp b/src/Backends/SDLBackend.cpp -index d7456b6a4..5420683a3 100644 ---- a/src/Backends/SDLBackend.cpp -+++ b/src/Backends/SDLBackend.cpp -@@ -53,6 +53,7 @@ namespace gamescope - GAMESCOPE_SDL_EVENT_CURSOR, - - GAMESCOPE_SDL_EVENT_COUNT, -+ GAMESCOPE_SDL_EVENT_REQ_EXIT, - }; - - class CSDLConnector final : public IBackendConnector -@@ -111,6 +112,7 @@ namespace gamescope - { - public: - CSDLBackend(); -+ ~CSDLBackend(); - - ///////////// - // IBackend -@@ -548,7 +550,12 @@ namespace gamescope - { - // Do nothing. - } -- -+ -+ CSDLBackend::~CSDLBackend() { -+ PushUserEvent(GAMESCOPE_SDL_EVENT_REQ_EXIT); -+ m_SDLThread.join(); -+ } -+ - void CSDLBackend::SDLThreadFunc() - { - pthread_setname_np( pthread_self(), "gamescope-sdl" ); -@@ -944,6 +951,9 @@ namespace gamescope - - SDL_SetCursor( m_pCursor ); - } -+ else if ( event.type == GetUserEventIndex( GAMESCOPE_SDL_EVENT_REQ_EXIT ) ) { -+ return; -+ } - } - break; - } - -From 61392a9e545e0a3341c0d510aaa453c08826cc5b Mon Sep 17 00:00:00 2001 -From: sharkautarch <128002472+sharkautarch@users.noreply.github.com> -Date: Thu, 30 May 2024 14:02:00 -0400 -Subject: [PATCH 2/2] steamcompmgr, rendervulkan: prevent segfault that occured - when closing gamescope, due to a race condition between present thread @ - present_wait_thread_func & compositor thread @ steamcompmgr_exit - ---- - src/rendervulkan.cpp | 7 ++++++- - src/rendervulkan.hpp | 4 ++++ - src/steamcompmgr.cpp | 8 ++++++++ - 3 files changed, 18 insertions(+), 1 deletion(-) - -diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp -index ffd0783da..094141839 100644 ---- a/src/rendervulkan.cpp -+++ b/src/rendervulkan.cpp -@@ -2669,7 +2669,8 @@ bool acquire_next_image( void ) - } - - --static std::atomic g_currentPresentWaitId = {0u}; -+inline std::atomic g_currentPresentWaitId = {0u}; -+inline std::atomic g_presentThreadShouldExit = {false}; - static std::mutex present_wait_lock; - - extern void mangoapp_output_update( uint64_t vblanktime ); -@@ -2693,6 +2694,10 @@ static void present_wait_thread_func( void ) - uint64_t vblanktime = get_time_in_nanos(); - GetVBlankTimer().MarkVBlank( vblanktime, true ); - mangoapp_output_update( vblanktime ); -+ } else if ( g_presentThreadShouldExit.load(std::memory_order_acquire)) { -+ g_presentThreadShouldExit = 0; -+ g_presentThreadShouldExit.notify_all(); -+ return; - } - } - } -diff --git a/src/rendervulkan.hpp b/src/rendervulkan.hpp -index 177468228..a2e0dd972 100644 ---- a/src/rendervulkan.hpp -+++ b/src/rendervulkan.hpp -@@ -74,6 +74,10 @@ enum EStreamColorspace : int - #include - #include - -+extern std::atomic g_currentPresentWaitId; -+ -+extern std::atomic g_presentThreadShouldExit; -+ - struct VulkanRenderer_t - { - struct wlr_renderer base; -diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp -index 910ed3912..f6539829e 100644 ---- a/src/steamcompmgr.cpp -+++ b/src/steamcompmgr.cpp -@@ -5840,6 +5840,14 @@ steamcompmgr_exit(void) - } - } - -+ //request the present_wait thread to exit -+ //needed to avoid getting a segfault at exit due to race condition: -+ g_presentThreadShouldExit.store(true, std::memory_order_release); -+ g_currentPresentWaitId = 0; //present thread will check if it should exit if this is zero -+ g_currentPresentWaitId.notify_all(); -+ g_presentThreadShouldExit.wait(true); //present thread will toggle this atomic when it sees the exit request -+ //this allows us to wait for present thread to close before deleting the backend -+ - gamescope::IBackend::Set( nullptr ); - - wlserver_lock(); diff --git a/spec_files/gamescope/gamescope.spec b/spec_files/gamescope/gamescope.spec index 65e73f2a..fe6eaba3 100644 --- a/spec_files/gamescope/gamescope.spec +++ b/spec_files/gamescope/gamescope.spec @@ -6,7 +6,7 @@ Name: gamescope Version: 100.%{gamescope_tag} -Release: 11.bazzite +Release: 12.bazzite Summary: Micro-compositor for video games on Wayland License: BSD @@ -25,10 +25,8 @@ Patch2: deckhd.patch Patch3: drm-Separate-BOE-and-SDC-OLED-Deck-panel-rates.patch # https://github.com/ValveSoftware/gamescope/issues/1369 Patch4: revert-299bc34.patch -# https://github.com/ValveSoftware/gamescope/pull/1335 -Patch5: 1335.patch # https://github.com/ValveSoftware/gamescope/pull/1231 -Patch6: 1231.patch +Patch5: 1231.patch BuildRequires: meson >= 0.54.0 BuildRequires: ninja-build