Skip to content

Vulkan & Pixman support #2613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open

Vulkan & Pixman support #2613

wants to merge 37 commits into from

Conversation

ammen99
Copy link
Member

@ammen99 ammen99 commented Mar 30, 2025

This PR aims to make Wayfire use wlr_renderer and wlr_allocator to do as much of the rendering and buffer management as possible. The end result should be that Wayfire is able to work with all of GLES2, Vulkan and Pixman renderers provided by wlroots.

Why this? Wlroots seems to be implementing many new features on the vulkan renderer like color management. Also, vulkan is getting more and more popular. While GLES2 is here to say, we can expect that the wlroots' vulkan renderer may evolve even more in the future, so going in that direction would be beneficial.

The one big downside is that special effects like Cube, Wobbly, Wrot and Blur still require custom rendering code to work. Currently, this PR aims to make the introduction of wlr_renderer gradual so that plugins can still use GLES2 rendering only. A future PR might try to make these plugins work with Vulkan as well, but that will require adding even more abstractions to manage Vulkan shaders, pipelines, etc, as well as figuring out how to mix our rendering with wlroots'.

Steps for this PR:

  • Add basic wlr_renderer support
  • Move buffer management to wlr_allocator
  • Port zoom and invert (invert can be done with vulkan and color management)
  • Port Expo
  • Port color-rect-view
  • Port text helpers (scale-title-filter, etc.)
  • Port default decoration plugin
  • Port crossfade
  • Port fade/zoom animations
  • Ensure all backends work the same (gles2, vulkan, pixman)
  • Ensure special effects like blur still work
  • Investigate failed allocations in fuzzy tests
  • Write a guide for updating plugins to the new render API

Fixes #1672
Fixes #483

@killown
Copy link
Contributor

killown commented May 3, 2025

~ ❯❯❯ wayfire --version ✘ 127
0.10.0-167140c9 (May 3 2025) branch vulkan wlroots-0.18.2

vulkan branch:

wayfire: symbol lookup error: /usr/lib/wayfire/libworkspace-names.so: undefined symbol: _ZN6OpenGL12render_beginEv

@ammen99
Copy link
Member Author

ammen99 commented May 3, 2025

@killown Wayfire-plugins-extra plugins need to be updated to work with the new renderer API, that's why you're getting that error

@killown
Copy link
Contributor

killown commented May 3, 2025

Since you marked it as ready for review, I’m leaving this issue I found during testing here in case you find a solution before merging

 EE 03-05-25 18:09:08.333 - [render/allocator/gbm.c:109] gbm_bo_create_with_modifiers failed
EE 03-05-25 18:09:08.333 - [src/render.cpp:66] Failed to allocate auxilliary buffer!
EE 03-05-25 18:09:08.333 - [src/api/wayfire/dassert.hpp:26] Cannot run a render pass without a valid target!
    #0 0x71c10c3649e5 in __sanitizer_print_stack_trace /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_stack.cpp:87
    #1 0x5637af0328f3 in wf::print_trace(bool) ../src/debug.cpp:256
    #2 0x5637af06769e in wf::dassert(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) ../src/api/wayfire/dassert.hpp:27
    #3 0x5637af06d3dc in wf::render_pass_t::render_pass_t(wf::render_pass_params_t const&) ../src/render.cpp:170
    #4 0x5637af06d60d in wf::render_pass_t::run(wf::render_pass_params_t const&) ../src/render.cpp:175
    #5 0x5637af7f12e5 in wf::scene::transformer_base_node_t::get_updated_contents(wlr_box const&, float, std::vector<std::unique_ptr<wf::scene::render_instance_t, std::default_delete<wf::scene::render_instance_t> >, std::allocator<std::unique_ptr<wf::scene::render_instance_t, std::default_delete<wf::scene::render_instance_t> > > >&) ../src/view/view-3d.cpp:498
    #6 0x5637af7fc4b5 in wf::scene::transformer_render_instance_t<wf::scene::view_2d_transformer_t>::get_texture(float) ../src/api/wayfire/view-transform.hpp:134
    #7 0x5637af7f5990 in wf::scene::view_2d_render_instance_t::render(wf::scene::render_instruction_t const&) ../src/view/view-3d.cpp:207
    #8 0x5637af06ef83 in wf::render_pass_t::run_partial() ../src/render.cpp:225
    #9 0x5637af06d654 in wf::render_pass_t::run(wf::render_pass_params_t const&) ../src/render.cpp:176
    #10 0x5637af7f12e5 in wf::scene::transformer_base_node_t::get_updated_contents(wlr_box const&, float, std::vector<std::unique_ptr<wf::scene::render_instance_t, std::default_delete<wf::scene::render_instance_t> >, std::allocator<std::unique_ptr<wf::scene::render_instance_t, std::default_delete<wf::scene::render_instance_t> > > >&) ../src/view/view-3d.cpp:498
    #11 0x6dc0e7a18e69 in wf::scene::transformer_render_instance_t<wf::move_drag::scale_around_grab_t>::get_texture(float) ../src/api/wayfire/view-transform.hpp:134
    #12 0x6dc0e7a0f4e8 in wf::move_drag::scale_around_grab_t::render_instance_t::render(wf::scene::render_instruction_t const&) ../plugins/common/move-drag-interface.cpp:122
    #13 0x5637af06ef83 in wf::render_pass_t::run_partial() ../src/render.cpp:225
    #14 0x5637af913c0a in wf::render_manager::impl::start_output_pass(std::unique_ptr<wf::swapchain_damage_manager_t::frame_object_t, std::default_delete<wf::swapchain_damage_manager_t::frame_object_t> >&) ../src/output/render-manager.cpp:1112
    #15 0x5637af915d30 in wf::render_manager::impl::paint() ../src/output/render-manager.cpp:1173
    #16 0x5637af90bd13 in wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}::operator()(void*) const ../src/output/render-manager.cpp:943
    #17 0x5637af9472dc in void std::__invoke_impl<void, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*>(std::__invoke_other, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*&&) /usr/include/c++/15.1.1/bits/invoke.h:63
    #18 0x5637af93ae44 in std::enable_if<is_invocable_r_v<void, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*>, void>::type std::__invoke_r<void, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*>(wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*&&) /usr/include/c++/15.1.1/bits/invoke.h:113
    #19 0x5637af92e0fd in std::_Function_handler<void (void*), wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}>::_M_invoke(std::_Any_data const&, void*&&) /usr/include/c++/15.1.1/bits/std_function.h:292
    #20 0x5637af043b7d in std::function<void (void*)>::operator()(void*) const /usr/include/c++/15.1.1/bits/std_function.h:593
    #21 0x5637af0410bf in wf::wl_listener_wrapper::emit(void*) ../src/wl-listener-wrapper.tpp:57
    #22 0x5637af040aa6 in handle_wrapped_listener ../src/wl-listener-wrapper.tpp:10
    #23 0x71c10ca8f62d in wl_signal_emit_mutable (/usr/lib/libwayland-server.so.0+0x862d) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #24 0x71c10c9aa5e8  (/usr/lib/libwlroots-0.18.so+0x535e8) (BuildId: 478b44121c1f2ff0ed5db9dca700cd861a8faf38)
    #25 0x71c10b3ea6b6 in drmHandleEvent (/usr/lib/libdrm.so.2+0x106b6) (BuildId: fe83891eb0c0e1fb8fef614ebf6baf8766dff9d2)
    #26 0x71c10c9aa6ee  (/usr/lib/libwlroots-0.18.so+0x536ee) (BuildId: 478b44121c1f2ff0ed5db9dca700cd861a8faf38)
    #27 0x71c10ca91549 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xa549) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #28 0x71c10ca93da6 in wl_display_run (/usr/lib/libwayland-server.so.0+0xcda6) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #29 0x5637af012c24 in main ../src/main.cpp:492
    #30 0x71c10a827bca  (/usr/lib/libc.so.6+0x27bca) (BuildId: 9b4411160892ba031afbab8bc5d784e68fdb10f2)
    #31 0x71c10a827c8a in __libc_start_main (/usr/lib/libc.so.6+0x27c8a) (BuildId: 9b4411160892ba031afbab8bc5d784e68fdb10f2)
    #32 0x5637af005b14 in _start (/usr/bin/wayfire+0x1dd3b14) (BuildId: 7df8fe5f989b72f66b4c13a465d8efaf8508c310)

failed to read Wayland events: Broken pipe 

@killown
Copy link
Contributor

killown commented May 3, 2025

Disabled wf::move_drag in tests, 30 minutes runtime, zero crashes. Your PR delivers stable code (minus the auxiliary buffer issue).

@killown
Copy link
Contributor

killown commented May 6, 2025

Since you marked it as ready for review, I’m leaving this issue I found during testing here in case you find a solution before merging

 EE 03-05-25 18:09:08.333 - [render/allocator/gbm.c:109] gbm_bo_create_with_modifiers failed
EE 03-05-25 18:09:08.333 - [src/render.cpp:66] Failed to allocate auxilliary buffer!
EE 03-05-25 18:09:08.333 - [src/api/wayfire/dassert.hpp:26] Cannot run a render pass without a valid target!
    #0 0x71c10c3649e5 in __sanitizer_print_stack_trace /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_stack.cpp:87
    #1 0x5637af0328f3 in wf::print_trace(bool) ../src/debug.cpp:256
    #2 0x5637af06769e in wf::dassert(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) ../src/api/wayfire/dassert.hpp:27
    #3 0x5637af06d3dc in wf::render_pass_t::render_pass_t(wf::render_pass_params_t const&) ../src/render.cpp:170
    #4 0x5637af06d60d in wf::render_pass_t::run(wf::render_pass_params_t const&) ../src/render.cpp:175
    #5 0x5637af7f12e5 in wf::scene::transformer_base_node_t::get_updated_contents(wlr_box const&, float, std::vector<std::unique_ptr<wf::scene::render_instance_t, std::default_delete<wf::scene::render_instance_t> >, std::allocator<std::unique_ptr<wf::scene::render_instance_t, std::default_delete<wf::scene::render_instance_t> > > >&) ../src/view/view-3d.cpp:498
    #6 0x5637af7fc4b5 in wf::scene::transformer_render_instance_t<wf::scene::view_2d_transformer_t>::get_texture(float) ../src/api/wayfire/view-transform.hpp:134
    #7 0x5637af7f5990 in wf::scene::view_2d_render_instance_t::render(wf::scene::render_instruction_t const&) ../src/view/view-3d.cpp:207
    #8 0x5637af06ef83 in wf::render_pass_t::run_partial() ../src/render.cpp:225
    #9 0x5637af06d654 in wf::render_pass_t::run(wf::render_pass_params_t const&) ../src/render.cpp:176
    #10 0x5637af7f12e5 in wf::scene::transformer_base_node_t::get_updated_contents(wlr_box const&, float, std::vector<std::unique_ptr<wf::scene::render_instance_t, std::default_delete<wf::scene::render_instance_t> >, std::allocator<std::unique_ptr<wf::scene::render_instance_t, std::default_delete<wf::scene::render_instance_t> > > >&) ../src/view/view-3d.cpp:498
    #11 0x6dc0e7a18e69 in wf::scene::transformer_render_instance_t<wf::move_drag::scale_around_grab_t>::get_texture(float) ../src/api/wayfire/view-transform.hpp:134
    #12 0x6dc0e7a0f4e8 in wf::move_drag::scale_around_grab_t::render_instance_t::render(wf::scene::render_instruction_t const&) ../plugins/common/move-drag-interface.cpp:122
    #13 0x5637af06ef83 in wf::render_pass_t::run_partial() ../src/render.cpp:225
    #14 0x5637af913c0a in wf::render_manager::impl::start_output_pass(std::unique_ptr<wf::swapchain_damage_manager_t::frame_object_t, std::default_delete<wf::swapchain_damage_manager_t::frame_object_t> >&) ../src/output/render-manager.cpp:1112
    #15 0x5637af915d30 in wf::render_manager::impl::paint() ../src/output/render-manager.cpp:1173
    #16 0x5637af90bd13 in wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}::operator()(void*) const ../src/output/render-manager.cpp:943
    #17 0x5637af9472dc in void std::__invoke_impl<void, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*>(std::__invoke_other, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*&&) /usr/include/c++/15.1.1/bits/invoke.h:63
    #18 0x5637af93ae44 in std::enable_if<is_invocable_r_v<void, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*>, void>::type std::__invoke_r<void, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*>(wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*&&) /usr/include/c++/15.1.1/bits/invoke.h:113
    #19 0x5637af92e0fd in std::_Function_handler<void (void*), wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}>::_M_invoke(std::_Any_data const&, void*&&) /usr/include/c++/15.1.1/bits/std_function.h:292
    #20 0x5637af043b7d in std::function<void (void*)>::operator()(void*) const /usr/include/c++/15.1.1/bits/std_function.h:593
    #21 0x5637af0410bf in wf::wl_listener_wrapper::emit(void*) ../src/wl-listener-wrapper.tpp:57
    #22 0x5637af040aa6 in handle_wrapped_listener ../src/wl-listener-wrapper.tpp:10
    #23 0x71c10ca8f62d in wl_signal_emit_mutable (/usr/lib/libwayland-server.so.0+0x862d) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #24 0x71c10c9aa5e8  (/usr/lib/libwlroots-0.18.so+0x535e8) (BuildId: 478b44121c1f2ff0ed5db9dca700cd861a8faf38)
    #25 0x71c10b3ea6b6 in drmHandleEvent (/usr/lib/libdrm.so.2+0x106b6) (BuildId: fe83891eb0c0e1fb8fef614ebf6baf8766dff9d2)
    #26 0x71c10c9aa6ee  (/usr/lib/libwlroots-0.18.so+0x536ee) (BuildId: 478b44121c1f2ff0ed5db9dca700cd861a8faf38)
    #27 0x71c10ca91549 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xa549) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #28 0x71c10ca93da6 in wl_display_run (/usr/lib/libwayland-server.so.0+0xcda6) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #29 0x5637af012c24 in main ../src/main.cpp:492
    #30 0x71c10a827bca  (/usr/lib/libc.so.6+0x27bca) (BuildId: 9b4411160892ba031afbab8bc5d784e68fdb10f2)
    #31 0x71c10a827c8a in __libc_start_main (/usr/lib/libc.so.6+0x27c8a) (BuildId: 9b4411160892ba031afbab8bc5d784e68fdb10f2)
    #32 0x5637af005b14 in _start (/usr/bin/wayfire+0x1dd3b14) (BuildId: 7df8fe5f989b72f66b4c13a465d8efaf8508c310)

failed to read Wayland events: Broken pipe 

I am testing here:

Note: This code isn’t a fix, it actually breaks Wayfire. Just pointing out where the issue might be.

diff --git a/src/view/view-3d.cpp b/src/view/view-3d.cpp
index d0b2f22b..a31058a9 100644
--- a/src/view/view-3d.cpp
+++ b/src/view/view-3d.cpp
@@ -203,6 +203,15 @@ class view_2d_render_instance_t :
     {
         if (std::abs(self->angle) < 1e-3)
         {
+            wlr_renderer* r = wf::get_core().renderer;
+            static uint32_t pixel = 0;
+            wlr_texture* test_tex = wlr_texture_from_pixels(r, WL_SHM_FORMAT_XRGB8888, 4, 1, 1, &pixel);
+            
+            if (!test_tex) {
+                LOGW("Not creating auxiliary buffer: Vulkan backend does not support it.");
+                wlr_texture_destroy(test_tex);
+                return;
+            }
             // No rotation, we can use render-agnostic functions.
             auto tex = this->get_texture(data.target.scale);
             tex.filter_mode = WLR_SCALE_FILTER_BILINEAR;
diff --git a/wayfire.desktop b/wayfire.desktop
index 1982e7e0..998430e2 100644
--- a/wayfire.desktop
+++ b/wayfire.desktop
@@ -1,7 +1,7 @@` 

this won't crash wayfire but the graphical part exit while spamming:
WW 06-05-25 11:32:44.425 - [src/view/view-3d.cpp:211] Not creating auxiliary buffer: Vulkan backend does not support it.
EE 06-05-25 11:32:44.425 - [render/vulkan/texture.c:387] Unsupported pixel format (0x00000001)

Not sure how far along you are with this, but you might want to validate the formats first, before -> get_texture(data.target.scale);

@killown
Copy link
Contributor

killown commented May 6, 2025

Pattern to reach the crash: start view → scale activated → grab and move → scale deactivated → close view → repeat.

from wayfire import WayfireSocket
from wayfire.extra.stipc import Stipc
from subprocess import Popen
from random import randint

sock = WayfireSocket()
stipc = Stipc(sock)

while True:
    try:
        Popen(["alacritty", "--title", "this is an alacritty view"])
        views = sock.list_views()
        alacritty_view = [
            v for v in views if "this is an alacritty view" in v["title"]
        ][0]
        if alacritty_view:
            view_id = alacritty_view["id"]

            def ri():
                return randint(1, 1920)

            sock.scale_toggle()
            stipc.click_and_drag("S-BTN_LEFT", ri(), ri(), ri(), True)
            sock.scale_toggle()
            sock.close_view(view_id)
    except:
        pass

@killown
Copy link
Contributor

killown commented May 7, 2025

No need for code, just toggle scale manually. Grab a view, disable scale while it's grabbed, and wayfire will crash.

@killown
Copy link
Contributor

killown commented May 8, 2025

vulkan backend doesn’t advertise formats correctly, the topic is about zwp_linux_dmabuf_v1, probably it does not send the necessary format/modifier feedback events to clients, then clients like gamescope will fail to determine a valid output format.

~ ❯❯❯ gamescope --hdr-enabled -- glxgears

[gamescope] [Info]  console: gamescope version 3.15.13.plus1 (gcc 14.2.1)
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
[gamescope] [Info]  scriptmgr: Loading scripts from: '/usr/share/gamescope/scripts'
[gamescope] [Info]  scriptmgr: Loading scripts from: '/usr/share/gamescope/scripts/00-gamescope'
[gamescope] [Info]  scriptmgr: Loading scripts from: '/usr/share/gamescope/scripts/00-gamescope/common'
[gamescope] [Info]  scriptmgr: Running script file '/usr/share/gamescope/scripts/00-gamescope/common/inspect.lua' (id: 0)
[gamescope] [Info]  scriptmgr: Running script file '/usr/share/gamescope/scripts/00-gamescope/common/modegen.lua' (id: 1)
[gamescope] [Info]  scriptmgr: Running script file '/usr/share/gamescope/scripts/00-gamescope/common/util.lua' (id: 2)
[gamescope] [Info]  scriptmgr: Loading scripts from: '/usr/share/gamescope/scripts/00-gamescope/displays'
[gamescope] [Info]  scriptmgr: Running script file '/usr/share/gamescope/scripts/00-gamescope/displays/asus.rogally.lcd.lua' (id: 3)
[gamescope] [Info]  scriptmgr: Running script file '/usr/share/gamescope/scripts/00-gamescope/displays/deckhd.steamdeck.deckhd-lcd.lua' (id: 4)
[gamescope] [Info]  scriptmgr: Running script file '/usr/share/gamescope/scripts/00-gamescope/displays/valve.steamdeck.lcd.lua' (id: 5)
[gamescope] [Info]  scriptmgr: Running script file '/usr/share/gamescope/scripts/00-gamescope/displays/valve.steamdeck.oled.lua' (id: 6)
[gamescope] [Info]  scriptmgr: Loading scripts from: '/etc/gamescope/scripts'
[gamescope] [Warn]  scriptmgr: Directory '/etc/gamescope/scripts' does not exist
[gamescope] [Info]  scriptmgr: Loading scripts from: '/home/neo/.config/gamescope/scripts'
[gamescope] [Warn]  scriptmgr: Directory '/home/neo/.config/gamescope/scripts' does not exist
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
[gamescope] [Info]  vulkan: selecting physical device 'AMD Radeon RX 6600 (RADV NAVI23)': queue family 1 (general queue family 0)
[gamescope] [Info]  vulkan: physical device supports DRM format modifiers
[gamescope] [Info]  wlserver: [backend/headless/backend.c:67] Creating headless backend
[gamescope] [Info]  xdg_backend: Seat name: default
[gamescope] [Info]  vulkan: supported DRM formats for sampling usage:
[gamescope] [Info]  vulkan:   AR24 (0x34325241)
[gamescope] [Info]  vulkan:   XR24 (0x34325258)
[gamescope] [Info]  vulkan:   AB24 (0x34324241)
[gamescope] [Info]  vulkan:   XB24 (0x34324258)
[gamescope] [Info]  vulkan:   RG16 (0x36314752)
[gamescope] [Info]  vulkan:   NV12 (0x3231564E)
[gamescope] [Info]  vulkan:   AB4H (0x48344241)
[gamescope] [Info]  vulkan:   XB4H (0x48344258)
[gamescope] [Info]  vulkan:   AB48 (0x38344241)
[gamescope] [Info]  vulkan:   XB48 (0x38344258)
[gamescope] [Info]  vulkan:   AB30 (0x30334241)
[gamescope] [Info]  vulkan:   XB30 (0x30334258)
[gamescope] [Info]  vulkan:   AR30 (0x30335241)
[gamescope] [Info]  vulkan:   XR30 (0x30335258)
gamescope: ../src/Backends/WaylandBackend.cpp:1568: virtual void gamescope::CWaylandBackend::GetPreferredOutputFormat(uint32_t*, uint32_t*) const: Assertion `u8BitFormat != DRM_FORMAT_INVALID' failed.
fish: Tarefa 1, 'gamescope --hdr-enabled -- glxg…' encerrada pelo sinal SIGABRT (Abort)

gamescope works without WLR_RENDERER=vulkan

@killown
Copy link
Contributor

killown commented May 9, 2025

wayfire_view_shot crashing wayfire:

EE 09-05-25 13:16:50.910 - [plugins/window-rules/view-action-interface.cpp:332] View action interface: Invalid arguments. Expected 'set alpha [float|double].
AddressSanitizer:DEADLYSIGNAL
=================================================================
==82961==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000000f (pc 0x74b9a327aa8a bp 0x7ffdc3636850 sp 0x7ffdc36367a0 T0)
==82961==The signal is caused by a READ memory access.
==82961==Hint: address points to the zero page.
    #0 0x74b9a327aa8a in wlr_buffer_drop (/usr/lib/libwlroots-0.18.so+0x86a8a) (BuildId: 478b44121c1f2ff0ed5db9dca700cd861a8faf38)
    #1 0x57928e765e1b in wf::auxilliary_buffer_t::free() ../src/render.cpp:85
    #2 0x57928e765015 in wf::auxilliary_buffer_t::allocate(wf::dimensions_t, float, wf::buffer_allocation_hints_t) ../src/render.cpp:47
    #3 0x57928eca5d6d in wf::view_interface_t::take_snapshot(wf::auxilliary_buffer_t&) ../src/view/view.cpp:100
    #4 0x70b97fdbb552 in wayfire_view_shot::take_snapshot(nonstd::observer_ptr<wf::view_interface_t>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) ../src/view-shot.cpp:117
    #5 0x70b97fdbb0d7 in wayfire_view_shot::on_ipc_capture::{lambda(wf::json_t)#1}::operator()(wf::json_t) const ../src/view-shot.cpp:106
    #6 0x70b97fdc2647 in wf::json_t std::__invoke_impl<wf::json_t, wayfire_view_shot::on_ipc_capture::{lambda(wf::json_t)#1}&, wf::json_t>(std::__invoke_other, wayfire_view_shot::on_ipc_capture::{lambda(wf::json_t)#1}&, wf::json_t&&) /usr/include/c++/14.2.1/bits/invoke.h:61
    #7 0x70b97fdc0ac9 in std::enable_if<is_invocable_r_v<wf::json_t, wayfire_view_shot::on_ipc_capture::{lambda(wf::json_t)#1}&, wf::json_t>, wf::json_t>::type std::__invoke_r<wf::json_t, wayfire_view_shot::on_ipc_capture::{lambda(wf::json_t)#1}&, wf::json_t>(wayfire_view_shot::on_ipc_capture::{lambda(wf::json_t)#1}&, wf::json_t&&) /usr/include/c++/14.2.1/bits/invoke.h:116
    #8 0x70b97fdbe6d4 in std::_Function_handler<wf::json_t (wf::json_t), wayfire_view_shot::on_ipc_capture::{lambda(wf::json_t)#1}>::_M_invoke(std::_Any_data const&, wf::json_t&&) /usr/include/c++/14.2.1/bits/std_function.h:291
    #9 0x70b9826f7a1a in std::function<wf::json_t (wf::json_t)>::operator()(wf::json_t) const /usr/include/c++/15.1.1/bits/std_function.h:593
    #10 0x70b9826d9a50 in wf::ipc::method_repository_t::register_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<wf::json_t (wf::json_t)>)::{lambda(wf::json_t const&, wf::ipc::client_interface_t*)#1}::operator()(wf::json_t const&, wf::ipc::client_interface_t*) const ../plugins/ipc/ipc-method-repository.hpp:81
    #11 0x70b982726bbb in wf::json_t std::__invoke_impl<wf::json_t, wf::ipc::method_repository_t::register_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<wf::json_t (wf::json_t)>)::{lambda(wf::json_t const&, wf::ipc::client_interface_t*)#1}&, wf::json_t, wf::ipc::client_interface_t*>(std::__invoke_other, wf::ipc::method_repository_t::register_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<wf::json_t (wf::json_t)>)::{lambda(wf::json_t const&, wf::ipc::client_interface_t*)#1}&, wf::json_t&&, wf::ipc::client_interface_t*&&) /usr/include/c++/15.1.1/bits/invoke.h:63
    #12 0x70b98271d820 in std::enable_if<is_invocable_r_v<wf::json_t, wf::ipc::method_repository_t::register_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<wf::json_t (wf::json_t)>)::{lambda(wf::json_t const&, wf::ipc::client_interface_t*)#1}&, wf::json_t, wf::ipc::client_interface_t*>, wf::json_t>::type std::__invoke_r<wf::json_t, wf::ipc::method_repository_t::register_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<wf::json_t (wf::json_t)>)::{lambda(wf::json_t const&, wf::ipc::client_interface_t*)#1}&, wf::json_t, wf::ipc::client_interface_t*>(wf::ipc::method_repository_t::register_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<wf::json_t (wf::json_t)>)::{lambda(wf::json_t const&, wf::ipc::client_interface_t*)#1}&, wf::json_t&&, wf::ipc::client_interface_t*&&) /usr/include/c++/15.1.1/bits/invoke.h:118
    #13 0x70b982710180 in std::_Function_handler<wf::json_t (wf::json_t, wf::ipc::client_interface_t*), wf::ipc::method_repository_t::register_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<wf::json_t (wf::json_t)>)::{lambda(wf::json_t const&, wf::ipc::client_interface_t*)#1}>::_M_invoke(std::_Any_data const&, wf::json_t&&, wf::ipc::client_interface_t*&&) /usr/include/c++/15.1.1/bits/std_function.h:293
    #14 0x70b98215d051 in std::function<wf::json_t (wf::json_t, wf::ipc::client_interface_t*)>::operator()(wf::json_t, wf::ipc::client_interface_t*) const /usr/include/c++/15.1.1/bits/std_function.h:593
    #15 0x70b982141345 in wf::ipc::method_repository_t::call_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, wf::json_t, wf::ipc::client_interface_t*) ../plugins/ipc/ipc-method-repository.hpp:103
    #16 0x70b981b328b7 in wf::ipc::server_t::handle_incoming_message(wf::ipc::client_t*, wf::json_t) ../plugins/ipc/ipc.cpp:137
    #17 0x70b981b37bf1 in wf::ipc::client_t::handle_fd_incoming(unsigned int) ../plugins/ipc/ipc.cpp:281
    #18 0x70b981b32bd7 in operator() ../plugins/ipc/ipc.cpp:166
    #19 0x70b981b3de86 in __invoke_impl<void, wf::ipc::client_t::client_t(wf::ipc::server_t*, int)::<lambda(uint32_t)>&, unsigned int> /usr/include/c++/15.1.1/bits/invoke.h:63
    #20 0x70b981b3d57a in __invoke_r<void, wf::ipc::client_t::client_t(wf::ipc::server_t*, int)::<lambda(uint32_t)>&, unsigned int> /usr/include/c++/15.1.1/bits/invoke.h:113
    #21 0x70b981b3c7c8 in _M_invoke /usr/include/c++/15.1.1/bits/std_function.h:292
    #22 0x57928eb16d01 in std::function<void (unsigned int)>::operator()(unsigned int) const /usr/include/c++/15.1.1/bits/std_function.h:593
    #23 0x70b981b32a70 in wl_loop_handle_ipc_client_fd_event(int, unsigned int, void*) ../plugins/ipc/ipc.cpp:144
    #24 0x74b9a332e549 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xa549) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #25 0x74b9a3330da6 in wl_display_run (/usr/lib/libwayland-server.so.0+0xcda6) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #26 0x57928e70ec24 in main ../src/main.cpp:492
    #27 0x74b9a1027bca  (/usr/lib/libc.so.6+0x27bca) (BuildId: 9b4411160892ba031afbab8bc5d784e68fdb10f2)
    #28 0x74b9a1027c8a in __libc_start_main (/usr/lib/libc.so.6+0x27c8a) (BuildId: 9b4411160892ba031afbab8bc5d784e68fdb10f2)
    #29 0x57928e701b14 in _start (/usr/bin/wayfire+0x1dd1b14) (BuildId: 16448b202f9530acfcf190bcf8e2c95d5c44b96b)

==82961==Register values:
rax = 0xffffffffffffffff  rbx = 0x000070b99c5a4640  rcx = 0x00000fffffffffff  rdx = 0x0000000000000000  
rdi = 0xffffffffffffffff  rsi = 0x00007fffffffffff  rbp = 0x00007ffdc3636850  rsp = 0x00007ffdc36367a0  
 r8 = 0x0000000000000000   r9 = 0x0000000000062919  r10 = 0x00000000000048eb  r11 = 0x000057928e736e28  
r12 = 0x000070b99c5a46a0  r13 = 0x00000e17338b48c8  r14 = 0x00007ffdc3636ef0  r15 = 0x00007ffdc36367c0  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/usr/lib/libwlroots-0.18.so+0x86a8a) (BuildId: 478b44121c1f2ff0ed5db9dca700cd861a8faf38) in wlr_buffer_drop
==82961==ABORTING
failed to read Wayland events: Broken pipe

@killown
Copy link
Contributor

killown commented May 9, 2025

wayfire_view_shot crashing wayfire:

EE 09-05-25 13:16:50.910 - [plugins/window-rules/view-action-interface.cpp:332] View action interface: Invalid arguments. Expected 'set alpha [float|double].
AddressSanitizer:DEADLYSIGNAL
=================================================================
==82961==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000000f (pc 0x74b9a327aa8a bp 0x7ffdc3636850 sp 0x7ffdc36367a0 T0)
==82961==The signal is caused by a READ memory access.
==82961==Hint: address points to the zero page.
    #0 0x74b9a327aa8a in wlr_buffer_drop (/usr/lib/libwlroots-0.18.so+0x86a8a) (BuildId: 478b44121c1f2ff0ed5db9dca700cd861a8faf38)
    #1 0x57928e765e1b in wf::auxilliary_buffer_t::free() ../src/render.cpp:85
    #2 0x57928e765015 in wf::auxilliary_buffer_t::allocate(wf::dimensions_t, float, wf::buffer_allocation_hints_t) ../src/render.cpp:47
    #3 0x57928eca5d6d in wf::view_interface_t::take_snapshot(wf::auxilliary_buffer_t&) ../src/view/view.cpp:100
    #4 0x70b97fdbb552 in wayfire_view_shot::take_snapshot(nonstd::observer_ptr<wf::view_interface_t>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) ../src/view-shot.cpp:117
    #5 0x70b97fdbb0d7 in wayfire_view_shot::on_ipc_capture::{lambda(wf::json_t)#1}::operator()(wf::json_t) const ../src/view-shot.cpp:106
    #6 0x70b97fdc2647 in wf::json_t std::__invoke_impl<wf::json_t, wayfire_view_shot::on_ipc_capture::{lambda(wf::json_t)#1}&, wf::json_t>(std::__invoke_other, wayfire_view_shot::on_ipc_capture::{lambda(wf::json_t)#1}&, wf::json_t&&) /usr/include/c++/14.2.1/bits/invoke.h:61
    #7 0x70b97fdc0ac9 in std::enable_if<is_invocable_r_v<wf::json_t, wayfire_view_shot::on_ipc_capture::{lambda(wf::json_t)#1}&, wf::json_t>, wf::json_t>::type std::__invoke_r<wf::json_t, wayfire_view_shot::on_ipc_capture::{lambda(wf::json_t)#1}&, wf::json_t>(wayfire_view_shot::on_ipc_capture::{lambda(wf::json_t)#1}&, wf::json_t&&) /usr/include/c++/14.2.1/bits/invoke.h:116
    #8 0x70b97fdbe6d4 in std::_Function_handler<wf::json_t (wf::json_t), wayfire_view_shot::on_ipc_capture::{lambda(wf::json_t)#1}>::_M_invoke(std::_Any_data const&, wf::json_t&&) /usr/include/c++/14.2.1/bits/std_function.h:291
    #9 0x70b9826f7a1a in std::function<wf::json_t (wf::json_t)>::operator()(wf::json_t) const /usr/include/c++/15.1.1/bits/std_function.h:593
    #10 0x70b9826d9a50 in wf::ipc::method_repository_t::register_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<wf::json_t (wf::json_t)>)::{lambda(wf::json_t const&, wf::ipc::client_interface_t*)#1}::operator()(wf::json_t const&, wf::ipc::client_interface_t*) const ../plugins/ipc/ipc-method-repository.hpp:81
    #11 0x70b982726bbb in wf::json_t std::__invoke_impl<wf::json_t, wf::ipc::method_repository_t::register_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<wf::json_t (wf::json_t)>)::{lambda(wf::json_t const&, wf::ipc::client_interface_t*)#1}&, wf::json_t, wf::ipc::client_interface_t*>(std::__invoke_other, wf::ipc::method_repository_t::register_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<wf::json_t (wf::json_t)>)::{lambda(wf::json_t const&, wf::ipc::client_interface_t*)#1}&, wf::json_t&&, wf::ipc::client_interface_t*&&) /usr/include/c++/15.1.1/bits/invoke.h:63
    #12 0x70b98271d820 in std::enable_if<is_invocable_r_v<wf::json_t, wf::ipc::method_repository_t::register_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<wf::json_t (wf::json_t)>)::{lambda(wf::json_t const&, wf::ipc::client_interface_t*)#1}&, wf::json_t, wf::ipc::client_interface_t*>, wf::json_t>::type std::__invoke_r<wf::json_t, wf::ipc::method_repository_t::register_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<wf::json_t (wf::json_t)>)::{lambda(wf::json_t const&, wf::ipc::client_interface_t*)#1}&, wf::json_t, wf::ipc::client_interface_t*>(wf::ipc::method_repository_t::register_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<wf::json_t (wf::json_t)>)::{lambda(wf::json_t const&, wf::ipc::client_interface_t*)#1}&, wf::json_t&&, wf::ipc::client_interface_t*&&) /usr/include/c++/15.1.1/bits/invoke.h:118
    #13 0x70b982710180 in std::_Function_handler<wf::json_t (wf::json_t, wf::ipc::client_interface_t*), wf::ipc::method_repository_t::register_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<wf::json_t (wf::json_t)>)::{lambda(wf::json_t const&, wf::ipc::client_interface_t*)#1}>::_M_invoke(std::_Any_data const&, wf::json_t&&, wf::ipc::client_interface_t*&&) /usr/include/c++/15.1.1/bits/std_function.h:293
    #14 0x70b98215d051 in std::function<wf::json_t (wf::json_t, wf::ipc::client_interface_t*)>::operator()(wf::json_t, wf::ipc::client_interface_t*) const /usr/include/c++/15.1.1/bits/std_function.h:593
    #15 0x70b982141345 in wf::ipc::method_repository_t::call_method(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, wf::json_t, wf::ipc::client_interface_t*) ../plugins/ipc/ipc-method-repository.hpp:103
    #16 0x70b981b328b7 in wf::ipc::server_t::handle_incoming_message(wf::ipc::client_t*, wf::json_t) ../plugins/ipc/ipc.cpp:137
    #17 0x70b981b37bf1 in wf::ipc::client_t::handle_fd_incoming(unsigned int) ../plugins/ipc/ipc.cpp:281
    #18 0x70b981b32bd7 in operator() ../plugins/ipc/ipc.cpp:166
    #19 0x70b981b3de86 in __invoke_impl<void, wf::ipc::client_t::client_t(wf::ipc::server_t*, int)::<lambda(uint32_t)>&, unsigned int> /usr/include/c++/15.1.1/bits/invoke.h:63
    #20 0x70b981b3d57a in __invoke_r<void, wf::ipc::client_t::client_t(wf::ipc::server_t*, int)::<lambda(uint32_t)>&, unsigned int> /usr/include/c++/15.1.1/bits/invoke.h:113
    #21 0x70b981b3c7c8 in _M_invoke /usr/include/c++/15.1.1/bits/std_function.h:292
    #22 0x57928eb16d01 in std::function<void (unsigned int)>::operator()(unsigned int) const /usr/include/c++/15.1.1/bits/std_function.h:593
    #23 0x70b981b32a70 in wl_loop_handle_ipc_client_fd_event(int, unsigned int, void*) ../plugins/ipc/ipc.cpp:144
    #24 0x74b9a332e549 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xa549) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #25 0x74b9a3330da6 in wl_display_run (/usr/lib/libwayland-server.so.0+0xcda6) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #26 0x57928e70ec24 in main ../src/main.cpp:492
    #27 0x74b9a1027bca  (/usr/lib/libc.so.6+0x27bca) (BuildId: 9b4411160892ba031afbab8bc5d784e68fdb10f2)
    #28 0x74b9a1027c8a in __libc_start_main (/usr/lib/libc.so.6+0x27c8a) (BuildId: 9b4411160892ba031afbab8bc5d784e68fdb10f2)
    #29 0x57928e701b14 in _start (/usr/bin/wayfire+0x1dd1b14) (BuildId: 16448b202f9530acfcf190bcf8e2c95d5c44b96b)

==82961==Register values:
rax = 0xffffffffffffffff  rbx = 0x000070b99c5a4640  rcx = 0x00000fffffffffff  rdx = 0x0000000000000000  
rdi = 0xffffffffffffffff  rsi = 0x00007fffffffffff  rbp = 0x00007ffdc3636850  rsp = 0x00007ffdc36367a0  
 r8 = 0x0000000000000000   r9 = 0x0000000000062919  r10 = 0x00000000000048eb  r11 = 0x000057928e736e28  
r12 = 0x000070b99c5a46a0  r13 = 0x00000e17338b48c8  r14 = 0x00007ffdc3636ef0  r15 = 0x00007ffdc36367c0  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/usr/lib/libwlroots-0.18.so+0x86a8a) (BuildId: 478b44121c1f2ff0ed5db9dca700cd861a8faf38) in wlr_buffer_drop
==82961==ABORTING
failed to read Wayland events: Broken pipe

I don't have wayfire plugins extra installed nor anything related in plugins =

Reproduce that with:


from wayfire import WayfireSocket
sock = WayfireSocket()

def screenshot(id, filename):
    capture = get_msg_template("view-shot/capture")
    if capture is None:
        return
    capture["data"]["view-id"] = id
    capture["data"]["file"] = filename
    sock.send_json(capture)

focused_view_id = sock.get_focused_view()['id']
screenshot(focused_view_id, "/tmp/ammen_is_an_AI_bot.txt")

Maybe you should make any plugin, regardless of its source, gracefully handle non-gles renderer.

@killown
Copy link
Contributor

killown commented May 19, 2025

git pull and "Failed to allocate auxiliary buffer!" is fixed for regular users and light IPC usage, but still exist. gamescope --hdr-enabled -- glxgears works in sway using vulkan renderer but in wayfire/vulkan still the same: gamescope::CWaylandBackend::GetPreferredOutputFormat(uint32_t*, uint32_t*) const: Assertion `u8BitFormat != DRM_FORMAT_INVALID' failed. Ignoring the Gamescope issue now might cause unpredictable random bugs at some point

@killown
Copy link
Contributor

killown commented May 20, 2025

3 seconds to produce this crash with less than 10 views so your fix for increase maximum number of open files for the compositor does not fix this


EE 20-05-25 07:57:24.071 - [render/allocator/gbm.c:109] gbm_bo_create_with_modifiers failed
EE 20-05-25 07:57:24.071 - [src/render.cpp:66] Failed to allocate auxilliary buffer!
EE 20-05-25 07:57:24.071 - [src/api/wayfire/dassert.hpp:26] Cannot run a render pass without a valid target!
    #0 0x751bd5b649e5 in __sanitizer_print_stack_trace /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_stack.cpp:87
    #1 0x59666c144331 in wf::print_trace(bool) ../src/debug.cpp:256
    #2 0x59666c17844e in wf::dassert(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) ../src/api/wayfire/dassert.hpp:27
    #3 0x59666c17ea30 in wf::render_pass_t::render_pass_t(wf::render_pass_params_t const&) ../src/render.cpp:186
    #4 0x59666c17ec61 in wf::render_pass_t::run(wf::render_pass_params_t const&) ../src/render.cpp:191
    #5 0x59666c903fd3 in wf::scene::transformer_base_node_t::get_updated_contents(wlr_box const&, float, std::vector<std::unique_ptr<wf::scene::render_instance_t, std::default_delete<wf::scene::render_instance_t> >, std::allocator<std::unique_ptr<wf::scene::render_instance_t, std::default_delete<wf::scene::render_instance_t> > > >&) ../src/view/view-3d.cpp:498
    #6 0x711bb24190e9 in wf::scene::transformer_render_instance_t<wf::move_drag::scale_around_grab_t>::get_texture(float) ../src/api/wayfire/view-transform.hpp:134
    #7 0x711bb240f768 in wf::move_drag::scale_around_grab_t::render_instance_t::render(wf::scene::render_instruction_t const&) ../plugins/common/move-drag-interface.cpp:122
    #8 0x59666c1805d7 in wf::render_pass_t::run_partial() ../src/render.cpp:241
    #9 0x59666ca2694c in wf::render_manager::impl::start_output_pass(std::unique_ptr<wf::swapchain_damage_manager_t::frame_object_t, std::default_delete<wf::swapchain_damage_manager_t::frame_object_t> >&) ../src/output/render-manager.cpp:1122
    #10 0x59666ca28a72 in wf::render_manager::impl::paint() ../src/output/render-manager.cpp:1183
    #11 0x59666ca1e751 in wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}::operator()(void*) const ../src/output/render-manager.cpp:947
    #12 0x59666ca5a01e in void std::__invoke_impl<void, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*>(std::__invoke_other, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*&&) /usr/include/c++/15.1.1/bits/invoke.h:63
    #13 0x59666ca4db86 in std::enable_if<is_invocable_r_v<void, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*>, void>::type std::__invoke_r<void, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*>(wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*&&) /usr/include/c++/15.1.1/bits/invoke.h:113
    #14 0x59666ca40e3f in std::_Function_handler<void (void*), wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}>::_M_invoke(std::_Any_data const&, void*&&) /usr/include/c++/15.1.1/bits/std_function.h:292
    #15 0x59666c1555bb in std::function<void (void*)>::operator()(void*) const /usr/include/c++/15.1.1/bits/std_function.h:593
    #16 0x59666c152afd in wf::wl_listener_wrapper::emit(void*) ../src/wl-listener-wrapper.tpp:57
    #17 0x59666c1524e4 in handle_wrapped_listener ../src/wl-listener-wrapper.tpp:10
    #18 0x751bd62c462d in wl_signal_emit_mutable (/usr/lib/libwayland-server.so.0+0x862d) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #19 0x751bd61df5e8  (/usr/lib/libwlroots-0.18.so+0x535e8) (BuildId: 478b44121c1f2ff0ed5db9dca700cd861a8faf38)
    #20 0x751bd4f096b6 in drmHandleEvent (/usr/lib/libdrm.so.2+0x106b6) (BuildId: fe83891eb0c0e1fb8fef614ebf6baf8766dff9d2)
    #21 0x751bd61df6ee  (/usr/lib/libwlroots-0.18.so+0x536ee) (BuildId: 478b44121c1f2ff0ed5db9dca700cd861a8faf38)
    #22 0x751bd62c6549 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xa549) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #23 0x751bd62c8da6 in wl_display_run (/usr/lib/libwayland-server.so.0+0xcda6) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #24 0x59666c123c54 in main ../src/main.cpp:492
    #25 0x751bd4027bca  (/usr/lib/libc.so.6+0x27bca) (BuildId: 9b4411160892ba031afbab8bc5d784e68fdb10f2)
    #26 0x751bd4027c8a in __libc_start_main (/usr/lib/libc.so.6+0x27c8a) (BuildId: 9b4411160892ba031afbab8bc5d784e68fdb10f2)
    #27 0x59666c116b44 in _start (/usr/bin/wayfire+0x1dd9b44) (BuildId: 45ad9ed3f54edce2517d213fc3b080112ed61ae2)

failed to read Wayland events: Broken pipe

if you remove gbm_bo_create_with_modifiers from the code to test, it would give hints from which location the crash is comming from

@killown
Copy link
Contributor

killown commented May 20, 2025

3 seconds to produce this crash with less than 10 views so your fix for increase maximum number of open files for the compositor does not fix this


EE 20-05-25 07:57:24.071 - [render/allocator/gbm.c:109] gbm_bo_create_with_modifiers failed
EE 20-05-25 07:57:24.071 - [src/render.cpp:66] Failed to allocate auxilliary buffer!
EE 20-05-25 07:57:24.071 - [src/api/wayfire/dassert.hpp:26] Cannot run a render pass without a valid target!
    #0 0x751bd5b649e5 in __sanitizer_print_stack_trace /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_stack.cpp:87
    #1 0x59666c144331 in wf::print_trace(bool) ../src/debug.cpp:256
    #2 0x59666c17844e in wf::dassert(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) ../src/api/wayfire/dassert.hpp:27
    #3 0x59666c17ea30 in wf::render_pass_t::render_pass_t(wf::render_pass_params_t const&) ../src/render.cpp:186
    #4 0x59666c17ec61 in wf::render_pass_t::run(wf::render_pass_params_t const&) ../src/render.cpp:191
    #5 0x59666c903fd3 in wf::scene::transformer_base_node_t::get_updated_contents(wlr_box const&, float, std::vector<std::unique_ptr<wf::scene::render_instance_t, std::default_delete<wf::scene::render_instance_t> >, std::allocator<std::unique_ptr<wf::scene::render_instance_t, std::default_delete<wf::scene::render_instance_t> > > >&) ../src/view/view-3d.cpp:498
    #6 0x711bb24190e9 in wf::scene::transformer_render_instance_t<wf::move_drag::scale_around_grab_t>::get_texture(float) ../src/api/wayfire/view-transform.hpp:134
    #7 0x711bb240f768 in wf::move_drag::scale_around_grab_t::render_instance_t::render(wf::scene::render_instruction_t const&) ../plugins/common/move-drag-interface.cpp:122
    #8 0x59666c1805d7 in wf::render_pass_t::run_partial() ../src/render.cpp:241
    #9 0x59666ca2694c in wf::render_manager::impl::start_output_pass(std::unique_ptr<wf::swapchain_damage_manager_t::frame_object_t, std::default_delete<wf::swapchain_damage_manager_t::frame_object_t> >&) ../src/output/render-manager.cpp:1122
    #10 0x59666ca28a72 in wf::render_manager::impl::paint() ../src/output/render-manager.cpp:1183
    #11 0x59666ca1e751 in wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}::operator()(void*) const ../src/output/render-manager.cpp:947
    #12 0x59666ca5a01e in void std::__invoke_impl<void, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*>(std::__invoke_other, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*&&) /usr/include/c++/15.1.1/bits/invoke.h:63
    #13 0x59666ca4db86 in std::enable_if<is_invocable_r_v<void, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*>, void>::type std::__invoke_r<void, wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*>(wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}&, void*&&) /usr/include/c++/15.1.1/bits/invoke.h:113
    #14 0x59666ca40e3f in std::_Function_handler<void (void*), wf::render_manager::impl::impl(wf::output_t*)::{lambda(void*)#1}>::_M_invoke(std::_Any_data const&, void*&&) /usr/include/c++/15.1.1/bits/std_function.h:292
    #15 0x59666c1555bb in std::function<void (void*)>::operator()(void*) const /usr/include/c++/15.1.1/bits/std_function.h:593
    #16 0x59666c152afd in wf::wl_listener_wrapper::emit(void*) ../src/wl-listener-wrapper.tpp:57
    #17 0x59666c1524e4 in handle_wrapped_listener ../src/wl-listener-wrapper.tpp:10
    #18 0x751bd62c462d in wl_signal_emit_mutable (/usr/lib/libwayland-server.so.0+0x862d) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #19 0x751bd61df5e8  (/usr/lib/libwlroots-0.18.so+0x535e8) (BuildId: 478b44121c1f2ff0ed5db9dca700cd861a8faf38)
    #20 0x751bd4f096b6 in drmHandleEvent (/usr/lib/libdrm.so.2+0x106b6) (BuildId: fe83891eb0c0e1fb8fef614ebf6baf8766dff9d2)
    #21 0x751bd61df6ee  (/usr/lib/libwlroots-0.18.so+0x536ee) (BuildId: 478b44121c1f2ff0ed5db9dca700cd861a8faf38)
    #22 0x751bd62c6549 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xa549) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #23 0x751bd62c8da6 in wl_display_run (/usr/lib/libwayland-server.so.0+0xcda6) (BuildId: dc81a0069683455ceadd1b95a2712c57627c48d8)
    #24 0x59666c123c54 in main ../src/main.cpp:492
    #25 0x751bd4027bca  (/usr/lib/libc.so.6+0x27bca) (BuildId: 9b4411160892ba031afbab8bc5d784e68fdb10f2)
    #26 0x751bd4027c8a in __libc_start_main (/usr/lib/libc.so.6+0x27c8a) (BuildId: 9b4411160892ba031afbab8bc5d784e68fdb10f2)
    #27 0x59666c116b44 in _start (/usr/bin/wayfire+0x1dd9b44) (BuildId: 45ad9ed3f54edce2517d213fc3b080112ed61ae2)

failed to read Wayland events: Broken pipe

if you remove gbm_bo_create_with_modifiers from the code to test, it would give hints from which location the crash is comming from

No worries, it only happens under specific IPC conditions and doesn’t affect normal use. Vulkan’s still new, so users can always fall back to OpenGL for rock-solid stability. You can’t just drop a massive new feature and expect it to be 100% stable, all you did is more than enough in my opinion.

Your PR looks solid. Ignore the Gamescope issue for now since it doesn't crash anything. Once Wayfire upgrades to wlroots 0.19, you can experiment with new approaches using wlr_allocator_create_buffer to fix this buffer crash.

@killown
Copy link
Contributor

killown commented May 29, 2025

ignore the gamescope issue, tested in sway and the same issue gamescope::CWaylandBackend::GetPreferredOutputFormat(uint32_t*, uint32_t*) const: Assertion `u8BitFormat != DRM_FORMAT_INVALID' failed. seems like the app is broken when using vulkan

ammen99 added 29 commits May 30, 2025 12:08
Example:

```
[output:WL-1]
icc_profile = /path/to/profile.icc
```
These buffers are actually better for performance in vulkan.
We cannot allocate a buffer of size 0 (which makes it easier for
plugins) so instead we set minimum buffer size to 1.
We may need many open files as we now allocate buffers via GBM and each
buffer is a file. So running something like scale with many views
results in many buffers being allocated and this could lead to wayfire
crashes.
This way, we avoid errors at startup where we try to map keyboard
devices or similar.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Re-request: Vulkan support [Feature Request] Is color management planned in an observable future?
2 participants