summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_fb_helper.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2020-11-20 13:25:43 +0300
committerThomas Zimmermann <tzimmermann@suse.de>2020-11-24 11:31:21 +0300
commit4270d6f60d68e99e2fefd4da98eead05d2df022c (patch)
tree1969fbf9e7e889ff5bbe24246f49648eb70dc7c6 /drivers/gpu/drm/drm_fb_helper.c
parent1d46491d4a08d7ee657e09808f87d169444a2652 (diff)
downloadlinux-4270d6f60d68e99e2fefd4da98eead05d2df022c.tar.xz
drm/fb-helper: Restore damage area upon errors
If the damage handling fails, restore the damage area. The next invocation of the damage worker will then perform the update. v3: * Use drm_WARN_ONCE() with an error message to print warning v2: * print a single warning if dirty callback fails (Daniel, Sebastian) * update comment Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Maxime Ripard <mripard@kernel.org> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20201120102545.4047-9-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/drm_fb_helper.c')
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index fc709bc59b1a..314352683447 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -432,11 +432,28 @@ static void drm_fb_helper_damage_work(struct work_struct *work)
if (helper->buffer) {
ret = drm_fb_helper_damage_blit(helper, &clip_copy);
if (drm_WARN_ONCE(dev, ret, "Damage blitter failed: ret=%d\n", ret))
- return;
+ goto err;
+ }
+
+ if (helper->fb->funcs->dirty) {
+ ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, &clip_copy, 1);
+ if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", ret))
+ goto err;
}
- if (helper->fb->funcs->dirty)
- helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, &clip_copy, 1);
+ return;
+
+err:
+ /*
+ * Restore damage clip rectangle on errors. The next run
+ * of the damage worker will perform the update.
+ */
+ spin_lock_irqsave(&helper->damage_lock, flags);
+ clip->x1 = min_t(u32, clip->x1, clip_copy.x1);
+ clip->y1 = min_t(u32, clip->y1, clip_copy.y1);
+ clip->x2 = max_t(u32, clip->x2, clip_copy.x2);
+ clip->y2 = max_t(u32, clip->y2, clip_copy.y2);
+ spin_unlock_irqrestore(&helper->damage_lock, flags);
}
/**