From 7717c92ed04ab0310a58391cb8955063661cbd54 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Mon, 28 Oct 2024 02:05:49 +0100 Subject: [PATCH] backend/drm: Skip plane props if buffer is not committed If our session is re-activated during scanout, restore_drm_device will reset planes and then attempt an enabling modeset commit without a buffer. The new plane transform logic requires a committed buffer to be present to calculate the boxes if they were not explicitly provided, and at least amdgpu rejects commits that try to use 0 as default. Skip updating plane props instead of segfaulting if no buffer is set. A better fix would be to not rely on restore_drm_device at all and instead require compositors to modeset in response to session activation. Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3912 --- backend/drm/atomic.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index a3297bda5..b52230f90 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -439,14 +439,15 @@ static void atomic_connector_add(struct atomic *atom, if (crtc->props.vrr_enabled != 0) { atomic_add(atom, crtc->id, crtc->props.vrr_enabled, state->vrr_enabled); } + if (state->base->committed & WLR_OUTPUT_STATE_BUFFER) { + struct wlr_fbox src_box; + struct wlr_box dst_box; + output_state_get_buffer_src_box(state->base, &src_box); + output_state_get_buffer_dst_box(state->base, &dst_box); - struct wlr_fbox src_box; - struct wlr_box dst_box; - output_state_get_buffer_src_box(state->base, &src_box); - output_state_get_buffer_dst_box(state->base, &dst_box); - - set_plane_props(atom, drm, crtc->primary, state->primary_fb, crtc->id, - &dst_box, &src_box); + set_plane_props(atom, drm, crtc->primary, state->primary_fb, crtc->id, + &dst_box, &src_box); + } if (crtc->primary->props.fb_damage_clips != 0) { atomic_add(atom, crtc->primary->id, crtc->primary->props.fb_damage_clips, state->fb_damage_clips);