mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 02:53:36 +02:00
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
This commit is contained in:
parent
115d1f3466
commit
42abd3e9aa
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user