Hi Thomas,

Thank you for the patch.

On Fri, Jun 13, 2025 at 11:00:36AM +0200, Thomas Zimmermann wrote:
> Call drm_mode_size_dumb() to compute dumb-buffer scanline pitch and
> buffer size. Align the pitch according to hardware requirements.
> 
> Signed-off-by: Thomas Zimmermann <tzimmerm...@suse.de>
> Cc: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
> Cc: Kieran Bingham <kieran.bingham+rene...@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart+rene...@ideasonboard.com>

> ---
>  drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c 
> b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c
> index 4c8fe83dd610..dd353fb858ef 100644
> --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c
> @@ -11,6 +11,7 @@
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_device.h>
> +#include <drm/drm_dumb_buffers.h>
>  #include <drm/drm_framebuffer.h>
>  #include <drm/drm_gem_dma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
> @@ -407,8 +408,8 @@ int rcar_du_dumb_create(struct drm_file *file, struct 
> drm_device *dev,
>                       struct drm_mode_create_dumb *args)
>  {
>       struct rcar_du_device *rcdu = to_rcar_du_device(dev);
> -     unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
>       unsigned int align;
> +     int ret;
>  
>       /*
>        * The R8A7779 DU requires a 16 pixels pitch alignment as documented,
> @@ -419,7 +420,9 @@ int rcar_du_dumb_create(struct drm_file *file, struct 
> drm_device *dev,
>       else
>               align = 16 * args->bpp / 8;
>  
> -     args->pitch = roundup(min_pitch, align);
> +     ret = drm_mode_size_dumb(dev, args, align, 0);
> +     if (ret)
> +             return ret;
>  
>       return drm_gem_dma_dumb_create_internal(file, dev, args);
>  }

-- 
Regards,

Laurent Pinchart

Reply via email to