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
This commit is contained in:
Kenny Levinsen 2024-10-28 02:05:49 +01:00
parent 4c74a8843a
commit 7717c92ed0

View File

@ -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);