Hi Am 09.02.22 um 12:09 schrieb Javier Martinez Canillas:
On 2/6/22 20:29, Thomas Zimmermann wrote:Write helpers used to mark the complete screen as dirty. This is wasteful for writes that only change a small portion of the screen. Fix the problem by computing the damaged area from the written memory range and perform damage handling accordingly. Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> ---Reviewed-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>drivers/gpu/drm/drm_fb_helper.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index ae98990c7b66..bed58be1b205 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -754,11 +754,18 @@ EXPORT_SYMBOL(drm_fb_helper_sys_read); ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf, size_t count, loff_t *ppos) { + loff_t pos = *ppos; ssize_t ret; + struct drm_rect damage_area;ret = fb_sys_write(info, buf, count, ppos);- if (ret > 0) - drm_fb_helper_damage(info, 0, 0, info->var.xres, info->var.yres); + if (ret <= 0) + return ret; +I also like how you cleaned up the error checking here and below to just return early, instead of checking if ret > 0 to perform the damage handling.
It's more readable now IMHO. And I think I read that compilers or CPUs expect this test to fail by default in their branch prediction. So it might even be faster by a few cycles.
Best regards Thomas
Best regards,
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Attachment:
OpenPGP_signature
Description: OpenPGP digital signature