@@ -9,6 +9,7 @@
#include <linux/shmem_fs.h>
#include <drm/armada_drm.h>
+#include <drm/drm_dumb_buffers.h>
#include <drm/drm_prime.h>
#include "armada_drm.h"
@@ -244,14 +245,13 @@ int armada_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
struct drm_mode_create_dumb *args)
{
struct armada_gem_object *dobj;
- u32 handle;
- size_t size;
int ret;
- args->pitch = armada_pitch(args->width, args->bpp);
- args->size = size = args->pitch * args->height;
+ ret = drm_mode_size_dumb(dev, args, 0, 0);
+ if (ret)
+ return ret;
- dobj = armada_gem_alloc_private_object(dev, size);
+ dobj = armada_gem_alloc_private_object(dev, args->size);
if (dobj == NULL)
return -ENOMEM;
@@ -259,14 +259,12 @@ int armada_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
if (ret)
goto err;
- ret = drm_gem_handle_create(file, &dobj->obj, &handle);
+ ret = drm_gem_handle_create(file, &dobj->obj, &args->handle);
if (ret)
goto err;
- args->handle = handle;
-
/* drop reference from allocate - handle holds it now */
- DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle);
+ DRM_DEBUG_DRIVER("obj %p size %llu handle %#x\n", dobj, args->size, args->handle);
err:
drm_gem_object_put(&dobj->obj);
return ret;
Call drm_mode_size_dumb() to compute dumb-buffer scanline pitch and buffer size. No alignment required. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Cc: Russell King <linux@armlinux.org.uk> --- drivers/gpu/drm/armada/armada_gem.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)