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. Best regards, -- Javier Martinez Canillas Linux Engineering Red Hat