wlroots/types
Simon Ser 92eedb84c1 output: don't attach buffer on first commit if disabled
In output_ensure_buffer() we create a swapchain and attach an empty
buffer to the output if necessary. We do that during the first commit.
This is fine when the first commit enables the output, however this breaks
when the first commit disables the output. A commit which disables an
output and has a buffer attached is invalid (see output_basic_test()), and
makes the DRM backend crash:

    00:00:00.780 [wlr] [backend/drm/drm.c:622] connector eDP-1: Turning off
    ../subprojects/wlroots/backend/drm/drm.c:652:44: runtime error: member access within null pointer of type 'struct wlr_drm_crtc'
    AddressSanitizer:DEADLYSIGNAL
    =================================================================
    ==2524==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f22e894afc1 bp 0x7ffe1d57c550 sp 0x7ffe1d57c420 T0)
    ==2524==The signal is caused by a READ memory access.
    ==2524==Hint: address points to the zero page.
        #0 0x7f22e894afc1 in drm_connector_commit_state ../subprojects/wlroots/backend/drm/drm.c:652
        #1 0x7f22e894b1f5 in drm_connector_commit ../subprojects/wlroots/backend/drm/drm.c:674
        #2 0x7f22e89e8da9 in wlr_output_commit_state ../subprojects/wlroots/types/output/output.c:756
        #3 0x555ab325624d in apply_output_config ../sway/config/output.c:517
        #4 0x555ab31a1aa1 in handle_new_output ../sway/desktop/output.c:974
        #5 0x7f22e9272f6d in wl_signal_emit_mutable (/usr/lib/libwayland-server.so.0+0x9f6d)
        #6 0x7f22e899b012 in new_output_reemit ../subprojects/wlroots/backend/multi/backend.c:161
        #7 0x7f22e9272f6d in wl_signal_emit_mutable (/usr/lib/libwayland-server.so.0+0x9f6d)
        #8 0x7f22e895a153 in scan_drm_connectors ../subprojects/wlroots/backend/drm/drm.c:1488
        #9 0x7f22e893c2e4 in backend_start ../subprojects/wlroots/backend/drm/backend.c:24
        #10 0x7f22e892ed00 in wlr_backend_start ../subprojects/wlroots/backend/backend.c:56
        #11 0x7f22e8999b83 in multi_backend_start ../subprojects/wlroots/backend/multi/backend.c:31
        #12 0x7f22e892ed00 in wlr_backend_start ../subprojects/wlroots/backend/backend.c:56
        #13 0x555ab317d5cc in server_start ../sway/server.c:316
        #14 0x555ab317748d in main ../sway/main.c:400
        #15 0x7f22e783c28f  (/usr/lib/libc.so.6+0x2328f)
        #16 0x7f22e783c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
        #17 0x555ab3134c84 in _start (/home/simon/src/sway/build/sway/sway+0x377c84)

Fixes: 3be6658ee7 ("output: allocate swapchain on first commit")
Closes: https://github.com/swaywm/sway/issues/7373
2023-02-02 16:48:35 +00:00
..
buffer wl-drm: use resource interface 2022-11-17 19:55:19 +00:00
data_device seat/keyboard: constify wlr_seat_keyboard_notify_enter() 2023-01-26 15:06:45 +00:00
output output: don't attach buffer on first commit if disabled 2023-02-02 16:48:35 +00:00
scene wlr_scene: Send intersecting list of scene outputs for outputs_update signal 2023-01-21 16:23:30 -05:00
seat seat/keyboard: constify wlr_seat_keyboard_notify_enter() 2023-01-26 15:06:45 +00:00
tablet_v2 tablet-v2: fix event parameters 2022-10-07 20:19:41 +03:00
xdg_shell xdg-shell: convert to try_from 2023-02-01 20:12:49 +01:00
meson.build buffer: drop wlr_shm_client_buffer 2022-11-15 16:30:00 +00:00
wlr_compositor.c subcompositor: convert to try_from 2023-02-01 20:14:39 +01:00
wlr_content_type_v1.c content-type-v1: add version param to wlr_content_type_manager_v1_create() 2022-11-15 16:43:04 +01:00
wlr_cursor.c cursor: Don't warp to (0,0) when last output is disconnected 2022-09-21 14:25:09 -04:00
wlr_damage_ring.c damage-ring: constify wlr_damage_ring_add() 2022-11-11 23:11:17 +00:00
wlr_data_control_v1.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_drm_lease_v1.c drm-lease-v1: reject the lease request by default 2022-10-07 19:49:28 +00:00
wlr_drm.c wl-drm: only advertise formats supporting implicit modifiers 2022-12-02 14:27:07 +00:00
wlr_export_dmabuf_v1.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_foreign_toplevel_management_v1.c foreign-toplevel-management: fix indentation 2022-10-01 19:57:32 +00:00
wlr_fullscreen_shell_v1.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_gamma_control_v1.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_idle_inhibit_v1.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_idle_notify_v1.c idle-notify-v1: new protocol implementation 2022-10-14 13:36:15 +00:00
wlr_idle.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_input_device.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_input_inhibitor.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_input_method_v2.c input-method-v2: convert to try_from 2023-02-01 20:13:30 +01:00
wlr_keyboard_group.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_keyboard_shortcuts_inhibit_v1.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_keyboard.c keyboard: only update LEDs when changed 2022-12-14 17:51:06 +01:00
wlr_layer_shell_v1.c layer-shell-v1: convert to try_from 2023-02-01 20:13:53 +01:00
wlr_linux_dmabuf_v1.c linux-dmabuf-v1: introduce wlr_linux_dmabuf_v1_create() 2022-11-30 14:19:46 +01:00
wlr_matrix.c matrix: remove wlr_matrix_projection() 2022-06-08 19:27:36 +00:00
wlr_output_damage.c output-damage: stop listening for output mode events 2022-12-01 20:05:04 +00:00
wlr_output_layout.c output-layout: improve closest point for no outputs case 2023-01-21 12:48:43 +00:00
wlr_output_management_v1.c wlr-output-management: implement adaptive sync 2022-10-24 16:19:25 +00:00
wlr_output_power_management_v1.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_pointer_constraints_v1.c region: constify 2022-11-11 23:11:17 +00:00
wlr_pointer_gestures_v1.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_pointer.c wlr_input_device: remove anon union field 2022-06-21 18:42:07 +00:00
wlr_presentation_time.c presentation-time: finish surface addon 2022-12-22 18:35:53 +03:00
wlr_primary_selection_v1.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_primary_selection.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_region.c region: constify 2022-11-11 23:11:17 +00:00
wlr_relative_pointer_v1.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_screencopy_v1.c render: drop wlr_renderer_read_pixels() flags 2022-10-04 09:15:19 +02:00
wlr_server_decoration.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_session_lock_v1.c ext-session-lock-v1: convert to try_from 2023-02-01 20:14:12 +01:00
wlr_shm.c shm: add create() function without a wlr_renderer 2022-11-25 15:16:42 +00:00
wlr_single_pixel_buffer_v1.c single-pixel-buffer-v1: new protocol implementation 2022-08-03 10:35:23 +00:00
wlr_subcompositor.c subcompositor: fix mapped parent check 2023-02-02 17:26:25 +03:00
wlr_switch.c wlr_input_device: remove anon union field 2022-06-21 18:42:07 +00:00
wlr_tablet_pad.c wlr_input_device: remove anon union field 2022-06-21 18:42:07 +00:00
wlr_tablet_tool.c wlr_input_device: remove anon union field 2022-06-21 18:42:07 +00:00
wlr_text_input_v3.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_touch.c wlr_input_device: remove anon union field 2022-06-21 18:42:07 +00:00
wlr_viewporter.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_virtual_keyboard_v1.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_virtual_pointer_v1.c wlr_virtual_pointer_v1: fix discrete scrolling 2022-09-08 05:33:28 +02:00
wlr_xcursor_manager.c Make wlr_xcursor_manager_load() return a bool 2020-05-18 16:48:44 +02:00
wlr_xdg_activation_v1.c wlr_xdg_activation_v1: add new_token event 2022-12-06 05:45:37 +00:00
wlr_xdg_decoration_v1.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_xdg_foreign_registry.c Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
wlr_xdg_foreign_v1.c xdg-shell: convert to try_from 2023-02-01 20:12:49 +01:00
wlr_xdg_foreign_v2.c xdg-shell: convert to try_from 2023-02-01 20:12:49 +01:00
wlr_xdg_output_v1.c types/wlr_xdg_output_v1: Fix wl_output.done bug. 2022-08-19 14:22:23 +00:00