diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2020-11-20 13:25:40 +0300 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2020-11-24 11:27:55 +0300 |
commit | 2b5f31aaa8d10b72aa1ca3098ac5427ff2e47cd0 (patch) | |
tree | 5587f84def9d1515ef54bb4f24dd02a5476658db /drivers/gpu/drm/drm_fb_helper.c | |
parent | 9622349ea1b6234d24f2348552bffa1de1c7c2d1 (diff) | |
download | linux-2b5f31aaa8d10b72aa1ca3098ac5427ff2e47cd0.tar.xz |
drm/fb-helper: Return early in damage worker
Returning early in the damage worker if no update is required. Makes the
code more readable. No functional changes are being made.
v3:
* s/dirty/damage in commit message (Sam)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120102545.4047-6-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/drm_fb_helper.c')
-rw-r--r-- | drivers/gpu/drm/drm_fb_helper.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 87d4759de04a..c9018ffff5f9 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -407,24 +407,23 @@ static void drm_fb_helper_damage_work(struct work_struct *work) clip->x2 = clip->y2 = 0; spin_unlock_irqrestore(&helper->damage_lock, flags); - /* call dirty callback only when it has been really touched */ - if (clip_copy.x1 < clip_copy.x2 && clip_copy.y1 < clip_copy.y2) { - - /* Generic fbdev uses a shadow buffer */ - if (helper->buffer) { - ret = drm_client_buffer_vmap(helper->buffer, &map); - if (ret) - return; - drm_fb_helper_damage_blit_real(helper, &clip_copy, &map); - } - - if (helper->fb->funcs->dirty) - helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, - &clip_copy, 1); + /* Call damage handlers only if necessary */ + if (!(clip_copy.x1 < clip_copy.x2 && clip_copy.y1 < clip_copy.y2)) + return; - if (helper->buffer) - drm_client_buffer_vunmap(helper->buffer); + /* Generic fbdev uses a shadow buffer */ + if (helper->buffer) { + ret = drm_client_buffer_vmap(helper->buffer, &map); + if (ret) + return; + drm_fb_helper_damage_blit_real(helper, &clip_copy, &map); } + + if (helper->fb->funcs->dirty) + helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, &clip_copy, 1); + + if (helper->buffer) + drm_client_buffer_vunmap(helper->buffer); } /** |