From: Thomas Zimmermann Date: Thu, 21 Aug 2025 08:17:32 +0000 (+0200) Subject: drm/xlnx: Compute dumb-buffer sizes with drm_mode_size_dumb() X-Git-Tag: v6.19-rc1~157^2~24^2~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d861831836126cfbb6550923a2f480d537a2738e;p=thirdparty%2Flinux.git drm/xlnx: Compute dumb-buffer sizes with drm_mode_size_dumb() 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 Cc: Laurent Pinchart Cc: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen Link: https://lore.kernel.org/r/20250821081918.79786-26-tzimmermann@suse.de --- diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqmp_kms.c index 2bee0a2275ede..02f3a7d78cf8e 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_kms.c +++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -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); }