[PATCH v5 25/25] drm/xlnx: Compute dumb-buffer sizes with drm_mode_size_dumb()
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Jun 16 15:13:09 UTC 2025
Hi Thomas,
Thank you for the patch.
On Fri, Jun 13, 2025 at 11:00:44AM +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 <tzimmermann at suse.de>
> Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> Cc: Tomi Valkeinen <tomi.valkeinen at ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> drivers/gpu/drm/xlnx/zynqmp_kms.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqmp_kms.c
> index b47463473472..7ea0cd4f71d3 100644
> --- a/drivers/gpu/drm/xlnx/zynqmp_kms.c
> +++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c
> @@ -19,6 +19,7 @@
> #include <drm/drm_crtc.h>
> #include <drm/drm_device.h>
> #include <drm/drm_drv.h>
> +#include <drm/drm_dumb_buffers.h>
> #include <drm/drm_encoder.h>
> #include <drm/drm_fbdev_dma.h>
> #include <drm/drm_fourcc.h>
> @@ -363,10 +364,12 @@ static int zynqmp_dpsub_dumb_create(struct drm_file *file_priv,
> struct drm_mode_create_dumb *args)
> {
> struct zynqmp_dpsub *dpsub = to_zynqmp_dpsub(drm);
> - unsigned int pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
> + int ret;
>
> /* Enforce the alignment constraints of the DMA engine. */
> - args->pitch = ALIGN(pitch, dpsub->dma_align);
> + ret = drm_mode_size_dumb(drm, args, dpsub->dma_align, 0);
> + if (ret)
> + return ret;
>
> return drm_gem_dma_dumb_create_internal(file_priv, drm, args);
> }
--
Regards,
Laurent Pinchart
More information about the Nouveau
mailing list