[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 06/25] drm/armada: Compute dumb-buffer sizes with drm_mode_size_dumb()



Call drm_mode_size_dumb() to compute dumb-buffer scanline pitch and
buffer size. No alignment required.

Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
Cc: Russell King <linux@xxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/armada/armada_gem.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_gem.c 
b/drivers/gpu/drm/armada/armada_gem.c
index 1a1680d71486..0f11ae06064a 100644
--- a/drivers/gpu/drm/armada/armada_gem.c
+++ b/drivers/gpu/drm/armada/armada_gem.c
@@ -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;
-- 
2.47.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.