mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
drm/renesas/rcar-du: 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 <tzimmermann@suse.de> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com> Link: https://lore.kernel.org/r/20250821081918.79786-18-tzimmermann@suse.de
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_device.h>
|
||||
#include <drm/drm_dumb_buffers.h>
|
||||
#include <drm/drm_framebuffer.h>
|
||||
#include <drm/drm_gem_dma_helper.h>
|
||||
#include <drm/drm_gem_framebuffer_helper.h>
|
||||
@@ -407,8 +408,8 @@ int rcar_du_dumb_create(struct drm_file *file, struct drm_device *dev,
|
||||
struct drm_mode_create_dumb *args)
|
||||
{
|
||||
struct rcar_du_device *rcdu = to_rcar_du_device(dev);
|
||||
unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
|
||||
unsigned int align;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* The R8A7779 DU requires a 16 pixels pitch alignment as documented,
|
||||
@@ -419,7 +420,9 @@ int rcar_du_dumb_create(struct drm_file *file, struct drm_device *dev,
|
||||
else
|
||||
align = 16 * args->bpp / 8;
|
||||
|
||||
args->pitch = roundup(min_pitch, align);
|
||||
ret = drm_mode_size_dumb(dev, args, align, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return drm_gem_dma_dumb_create_internal(file, dev, args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user