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

Thomas Zimmermann tzimmermann at suse.de
Wed Feb 9 12:58:09 UTC 2022


Hi

Am 09.02.22 um 12:02 schrieb Javier Martinez Canillas:
> 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 ?

I thought that it means to make a clip rectangle from the memory range. 
But I think your name is better and more consistent with the rest of the 
code. I'll use it instead.

Best regards
Thomas

> 
> Otherwise it looks good to me.
> 
> Reviewed-by: Javier Martinez Canillas <javierm at redhat.com>
> 
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20220209/00abba8e/attachment-0001.sig>


More information about the dri-devel mailing list