summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/udl/udl_gem.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2019-11-07 12:43:05 +0300
committerThomas Zimmermann <tzimmermann@suse.de>2019-11-08 14:29:56 +0300
commit1d48b9e988a8874225e38fc1ac9967666e7eafd7 (patch)
treec92c57405183818ee8bfbda2450442d9d5db7c45 /drivers/gpu/drm/udl/udl_gem.c
parent92c4eeb0c9d2e7cc2d9ebd734bdd78cb69f72f88 (diff)
downloadlinux-1d48b9e988a8874225e38fc1ac9967666e7eafd7.tar.xz
drm/udl: Allocate GEM object via struct drm_driver.gem_create_object
In preparation of a switch to SHMEM, udl now allocates its GEM objects via struct drm_driver.gem_create_object. No functional changes are made. For SHMEM GEM objects, udl will require the use of a special mmap function, which we set though the create-object function. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191107094307.19870-3-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/udl/udl_gem.c')
-rw-r--r--drivers/gpu/drm/udl/udl_gem.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c
index 7d3c1b73ea02..628749cc1143 100644
--- a/drivers/gpu/drm/udl/udl_gem.c
+++ b/drivers/gpu/drm/udl/udl_gem.c
@@ -6,26 +6,43 @@
#include <linux/dma-buf.h>
#include <linux/vmalloc.h>
+#include <drm/drm_drv.h>
#include <drm/drm_mode.h>
#include <drm/drm_prime.h>
#include "udl_drv.h"
-struct udl_gem_object *udl_gem_alloc_object(struct drm_device *dev,
- size_t size)
+/*
+ * Helpers for struct drm_driver
+ */
+
+struct drm_gem_object *udl_driver_gem_create_object(struct drm_device *dev,
+ size_t size)
{
struct udl_gem_object *obj;
obj = kzalloc(sizeof(*obj), GFP_KERNEL);
+ if (!obj)
+ return NULL;
+
+ return &obj->base;
+}
+
+struct udl_gem_object *udl_gem_alloc_object(struct drm_device *dev,
+ size_t size)
+{
+ struct drm_gem_object *obj;
+
+ obj = dev->driver->gem_create_object(dev, size);
if (obj == NULL)
return NULL;
- if (drm_gem_object_init(dev, &obj->base, size) != 0) {
+ if (drm_gem_object_init(dev, obj, size) != 0) {
kfree(obj);
return NULL;
}
- return obj;
+ return to_udl_bo(obj);
}
static int