mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
drm/omapdrm: 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 8. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Link: https://lore.kernel.org/r/20250821081918.79786-16-tzimmermann@suse.de
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
#include <drm/drm_dumb_buffers.h>
|
||||
#include <drm/drm_prime.h>
|
||||
#include <drm/drm_vma_manager.h>
|
||||
|
||||
@@ -580,15 +581,13 @@ static int omap_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_struc
|
||||
int omap_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
|
||||
struct drm_mode_create_dumb *args)
|
||||
{
|
||||
union omap_gem_size gsize;
|
||||
union omap_gem_size gsize = { };
|
||||
int ret;
|
||||
|
||||
args->pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
|
||||
|
||||
args->size = PAGE_ALIGN(args->pitch * args->height);
|
||||
|
||||
gsize = (union omap_gem_size){
|
||||
.bytes = args->size,
|
||||
};
|
||||
ret = drm_mode_size_dumb(dev, args, SZ_8, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
gsize.bytes = args->size;
|
||||
|
||||
return omap_gem_new_handle(dev, file, gsize,
|
||||
OMAP_BO_SCANOUT | OMAP_BO_WC, &args->handle);
|
||||
|
||||
Reference in New Issue
Block a user