Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/rockchip: 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 to a multiple of 64.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: "Heiko Stübner" <heiko@sntech.de>
Cc: Andy Yan <andy.yan@rock-chips.com>
Link: https://lore.kernel.org/r/20250821081918.79786-20-tzimmermann@suse.de

+6 -6
+6 -6
drivers/gpu/drm/rockchip/rockchip_drm_gem.c
··· 9 9 #include <linux/vmalloc.h> 10 10 11 11 #include <drm/drm.h> 12 + #include <drm/drm_dumb_buffers.h> 12 13 #include <drm/drm_fb_helper.h> 13 14 #include <drm/drm_gem.h> 14 15 #include <drm/drm_gem_dma_helper.h> ··· 404 403 struct drm_mode_create_dumb *args) 405 404 { 406 405 struct rockchip_gem_object *rk_obj; 407 - int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8); 406 + int ret; 408 407 409 - /* 410 - * align to 64 bytes since Mali requires it. 411 - */ 412 - args->pitch = ALIGN(min_pitch, 64); 413 - args->size = args->pitch * args->height; 408 + /* 64-byte alignment required by Mali */ 409 + ret = drm_mode_size_dumb(dev, args, SZ_64, 0); 410 + if (ret) 411 + return ret; 414 412 415 413 rk_obj = rockchip_gem_create_with_handle(file_priv, dev, args->size, 416 414 &args->handle);