Re: [PATCH v2 3/5] drm/gem: Clear mapping addresses for unused framebuffer planes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 25, 2021 at 07:44:36PM +0200, Thomas Zimmermann wrote:
> Set the returned mapping address to NULL if a framebuffer plane does
> not have a BO associated with it. Likewise, ignore mappings of NULL
> during framebuffer unmap operations. Allows users of the functions to
> perform unmap operations of certain BOs by themselfes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
Reviewed-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/drm_gem_framebuffer_helper.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> index 243affbad437..02928607a716 100644
> --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> @@ -336,8 +336,10 @@ int drm_gem_fb_vmap(struct drm_framebuffer *fb,
>  
>  	for (i = 0; i < DRM_FORMAT_MAX_PLANES; ++i) {
>  		obj = drm_gem_fb_get_obj(fb, i);
> -		if (!obj)
> +		if (!obj) {
> +			dma_buf_map_clear(&map[i]);
>  			continue;
> +		}
>  		ret = drm_gem_vmap(obj, &map[i]);
>  		if (ret)
>  			goto err_drm_gem_vunmap;
> @@ -377,6 +379,8 @@ void drm_gem_fb_vunmap(struct drm_framebuffer *fb,
>  		obj = drm_gem_fb_get_obj(fb, i);
>  		if (!obj)
>  			continue;
> +		if (dma_buf_map_is_null(&map[i]))
> +			continue;
>  		drm_gem_vunmap(obj, &map[i]);
>  	}
>  }
> -- 
> 2.32.0



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux