[PATCH 3/5] drm/fb-helper: Calculate damaged area in separate helper

Javier Martinez Canillas javierm at redhat.com
Wed Feb 9 11:02:47 UTC 2022


On 2/6/22 20:29, Thomas Zimmermann wrote:
> Add drm_fb_helper_clip_to_memory_range(), a helper function that
> accepts an linear range of video memory and converts it into a
> rectangle. The computed rectangle describes the damaged area in
> terms of scanlines and pixels per scanline.
> 
> While at it, make the code more readable by using struct drm_rect
> and related helpers.
> 
> The code was previously part of the deferred I/O helpers, but is
> also useful for damage handling of regular write operations. Update
> the deferred I/O code to use the new function.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
>  drivers/gpu/drm/drm_fb_helper.c | 26 ++++++++++++++++++++------
>  1 file changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 87c47093c3a2..ae98990c7b66 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -680,6 +680,19 @@ static void drm_fb_helper_damage(struct fb_info *info, u32 x, u32 y,
>  	schedule_work(&helper->damage_work);
>  }
>  
> +/* Convert memory region into area of scanlines and pixels per scanline */
> +static void drm_fb_helper_clip_to_memory_range(struct fb_info *info, off_t off, size_t len,
> +					       struct drm_rect *clip)
> +{

Shouldn't be called drm_fb_helper_clip_from_memory_range() or
drm_fb_helper_memory_range_to_clip() instead ?

Otherwise it looks good to me.

Reviewed-by: Javier Martinez Canillas <javierm at redhat.com>

Best regards,
-- 
Javier Martinez Canillas
Linux Engineering
Red Hat



More information about the dri-devel mailing list