backend/drm: clip FB damage

The kernel complains when the damage exceeds the FB bounds:

    [73850.448326] i915 0000:00:02.0: [drm:drm_atomic_check_only] [PLANE:31:plane 1A] invalid damage clip 0 0 2147483647 2147483647

Make the DRM backend behave like the Wayland one and allow compositors
to damage (0, 0, INT32_MAX, INT32_MAX) to repaint everything without
needing to know the exact buffer size.

Closes: https://github.com/swaywm/sway/issues/7632
This commit is contained in:
Simon Ser 2023-06-12 12:13:21 +02:00 committed by Kenny Levinsen
parent a09bb1314d
commit 4339c37f99
3 changed files with 34 additions and 15 deletions

View file

@ -324,14 +324,9 @@ static bool crtc_commit(struct wlr_drm_connector *conn,
uint32_t fb_damage_clips = 0;
if ((state->base->committed & WLR_OUTPUT_STATE_DAMAGE) &&
pixman_region32_not_empty(&state->base->damage) &&
crtc->primary->props.fb_damage_clips != 0) {
int rects_len;
const pixman_box32_t *rects = pixman_region32_rectangles(&state->base->damage, &rects_len);
if (drmModeCreatePropertyBlob(drm->fd, rects,
sizeof(*rects) * rects_len, &fb_damage_clips) != 0) {
wlr_log_errno(WLR_ERROR, "Failed to create FB_DAMAGE_CLIPS property blob");
}
create_fb_damage_clips_blob(drm, state->primary_fb,
&state->base->damage, &fb_damage_clips);
}
bool prev_vrr_enabled =