backend/drm: check whether clipped damage is empty

We were checking whether the damage region was empty before
clipping. However a non-empty damage region can become empty after
clipping. Instead, check whether the clipped region is empty.

Fixes: 4339c37f99 ("backend/drm: clip FB damage")
master
Simon Ser 4 weeks ago committed by itycodes
parent 0c0628f43e
commit 1372310b5e

@ -156,18 +156,20 @@ static bool create_gamma_lut_blob(struct wlr_drm_backend *drm,
bool create_fb_damage_clips_blob(struct wlr_drm_backend *drm, bool create_fb_damage_clips_blob(struct wlr_drm_backend *drm,
int width, int height, const pixman_region32_t *damage, uint32_t *blob_id) { int width, int height, const pixman_region32_t *damage, uint32_t *blob_id) {
if (!pixman_region32_not_empty(damage)) {
*blob_id = 0;
return true;
}
pixman_region32_t clipped; pixman_region32_t clipped;
pixman_region32_init(&clipped); pixman_region32_init(&clipped);
pixman_region32_intersect_rect(&clipped, damage, 0, 0, width, height); pixman_region32_intersect_rect(&clipped, damage, 0, 0, width, height);
int rects_len; int rects_len;
const pixman_box32_t *rects = pixman_region32_rectangles(&clipped, &rects_len); const pixman_box32_t *rects = pixman_region32_rectangles(&clipped, &rects_len);
int ret = drmModeCreatePropertyBlob(drm->fd, rects, sizeof(*rects) * rects_len, blob_id);
int ret;
if (rects_len > 0) {
ret = drmModeCreatePropertyBlob(drm->fd, rects, sizeof(*rects) * rects_len, blob_id);
} else {
ret = 0;
*blob_id = 0;
}
pixman_region32_fini(&clipped); pixman_region32_fini(&clipped);
if (ret != 0) { if (ret != 0) {
wlr_log_errno(WLR_ERROR, "Failed to create FB_DAMAGE_CLIPS property blob"); wlr_log_errno(WLR_ERROR, "Failed to create FB_DAMAGE_CLIPS property blob");

Loading…
Cancel
Save