[PATCH 2/2] drm/fbdev: Move damage clip check to higher level

Thomas Zimmermann tzimmermann at suse.de
Wed Dec 21 12:05:07 UTC 2022


Hi

Am 21.12.22 um 12:19 schrieb Jouni Högander:
> Checking if damage clip is valid is common to all fb helpers.
> Makes more sense to check it in higher level than adding into
> all helpers.

It was a deliberate decision to separate damage clipping and dirty 
updates; done in [1]. Clipping is an optional hint in our regular damage 
handling via drm_framebuffer_funcs.dirty. The fb_dirty callback now 
follows that semantics.

I mentioned that it would be better to implement those fb_ops callbacks 
for i915. But if you go with fb_dirty, please implement the clipping 
test in your callback.

Best regards
Thomas

[1] https://patchwork.freedesktop.org/patch/509958/?series=109943&rev=3

> 
> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Cc: Thomas Zimmermann <tzimmermann at suse.de>
> Cc: Jani Nikula <jani.nikula at intel.com>
> Signed-off-by: Jouni Högander <jouni.hogander at intel.com>
> ---
>   drivers/gpu/drm/drm_fb_helper.c     | 4 ++++
>   drivers/gpu/drm/drm_fbdev_generic.c | 4 ----
>   2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index b3a731b9170a..78c889dbc610 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -384,6 +384,10 @@ static void drm_fb_helper_fb_dirty(struct drm_fb_helper *helper)
>   	clip->x2 = clip->y2 = 0;
>   	spin_unlock_irqrestore(&helper->damage_lock, flags);
>   
> +	/* Call damage handlers only if necessary */
> +	if (!(clip_copy.x1 < clip_copy.x2 && clip_copy.y1 < clip_copy.y2))
> +		return;
> +
>   	ret = helper->funcs->fb_dirty(helper, &clip_copy);
>   	if (ret)
>   		goto err;
> diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
> index 0a4c160e0e58..6c6bb0dd2ea8 100644
> --- a/drivers/gpu/drm/drm_fbdev_generic.c
> +++ b/drivers/gpu/drm/drm_fbdev_generic.c
> @@ -334,10 +334,6 @@ static int drm_fbdev_fb_dirty(struct drm_fb_helper *helper, struct drm_clip_rect
>   	if (!drm_fbdev_use_shadow_fb(helper))
>   		return 0;
>   
> -	/* Call damage handlers only if necessary */
> -	if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
> -		return 0;
> -
>   	if (helper->buffer) {
>   		ret = drm_fbdev_damage_blit(helper, clip);
>   		if (drm_WARN_ONCE(dev, ret, "Damage blitter failed: ret=%d\n", ret))

-- 
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/20221221/82fb1556/attachment.sig>


More information about the dri-devel mailing list