diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index 1844d024..a3297bda 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -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, 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_init(&clipped); pixman_region32_intersect_rect(&clipped, damage, 0, 0, width, height); int 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); if (ret != 0) { wlr_log_errno(WLR_ERROR, "Failed to create FB_DAMAGE_CLIPS property blob");