Am Donnerstag, 9. Januar 2025, 15:57:13 CET schrieb Thomas Zimmermann: > Call drm_mode_size_dumb() to compute dumb-buffer scanline pitch and > buffer size. Align the pitch to a multiple of 64. > > Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> > Cc: Sandy Huang <hjc@xxxxxxxxxxxxxx> > Cc: "Heiko Stübner" <heiko@xxxxxxxxx> > Cc: Andy Yan <andy.yan@xxxxxxxxxxxxxx> I've looked up the patch implementing the new functionality - patch2 of this series [0] and that looks really nice to get proper helpers and not having many drivers open-coding the same functionality in different ways. So for the Rockchip adaptation: Acked-by: Heiko Stuebner <heiko@xxxxxxxxx> and looking forward to this getting merged :-) Thanks a lot for working on that Heiko [0] https://patchwork.kernel.org/project/linux-rockchip/patch/20250109150310.219442-3-tzimmermann@xxxxxxx/ > --- > drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c > index 6330b883efc3..3bd06202e232 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c > @@ -9,6 +9,7 @@ > #include <linux/vmalloc.h> > > #include <drm/drm.h> > +#include <drm/drm_dumb_buffers.h> > #include <drm/drm_fb_helper.h> > #include <drm/drm_gem.h> > #include <drm/drm_gem_dma_helper.h> > @@ -403,13 +404,12 @@ int rockchip_gem_dumb_create(struct drm_file *file_priv, > struct drm_mode_create_dumb *args) > { > struct rockchip_gem_object *rk_obj; > - int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8); > + int ret; > > - /* > - * align to 64 bytes since Mali requires it. > - */ > - args->pitch = ALIGN(min_pitch, 64); > - args->size = args->pitch * args->height; > + /* 64-byte alignment required by Mali */ > + ret = drm_mode_size_dumb(dev, args, SZ_64, 0); > + if (ret) > + return ret; > > rk_obj = rockchip_gem_create_with_handle(file_priv, dev, args->size, > &args->handle); >