Commit 2b5f31aa authored by Thomas Zimmermann's avatar Thomas Zimmermann

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: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Acked-by: default avatarMaxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120102545.4047-6-tzimmermann@suse.de
parent 9622349e
...@@ -407,8 +407,9 @@ static void drm_fb_helper_damage_work(struct work_struct *work) ...@@ -407,8 +407,9 @@ static void drm_fb_helper_damage_work(struct work_struct *work)
clip->x2 = clip->y2 = 0; clip->x2 = clip->y2 = 0;
spin_unlock_irqrestore(&helper->damage_lock, flags); spin_unlock_irqrestore(&helper->damage_lock, flags);
/* call dirty callback only when it has been really touched */ /* Call damage handlers only if necessary */
if (clip_copy.x1 < clip_copy.x2 && clip_copy.y1 < clip_copy.y2) { if (!(clip_copy.x1 < clip_copy.x2 && clip_copy.y1 < clip_copy.y2))
return;
/* Generic fbdev uses a shadow buffer */ /* Generic fbdev uses a shadow buffer */
if (helper->buffer) { if (helper->buffer) {
...@@ -419,12 +420,10 @@ static void drm_fb_helper_damage_work(struct work_struct *work) ...@@ -419,12 +420,10 @@ static void drm_fb_helper_damage_work(struct work_struct *work)
} }
if (helper->fb->funcs->dirty) if (helper->fb->funcs->dirty)
helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, &clip_copy, 1);
&clip_copy, 1);
if (helper->buffer) if (helper->buffer)
drm_client_buffer_vunmap(helper->buffer); drm_client_buffer_vunmap(helper->buffer);
}
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment