[PATCH 3/5] drm/vgem: Add a drm_vgem_gem_object

Ben Widawsky ben at bwidawsk.net
Wed Feb 8 15:19:29 PST 2012


and use it

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 drivers/gpu/drm/vgem/vgem_drv.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index 3084389..d47bd71 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -40,6 +40,10 @@
 #define DRIVER_MAJOR	1
 #define DRIVER_MINOR	0
 
+struct drm_vgem_gem_object {
+	struct drm_gem_object base;
+};
+
 static int vgem_load(struct drm_device *dev, unsigned long flags)
 {
 	return 0;
@@ -90,15 +94,18 @@ static struct drm_gem_object *vgem_gem_create(struct drm_device *dev,
 					      unsigned int *handle,
 					      unsigned long size)
 {
-	int err;
+	struct drm_vgem_gem_object *obj;
 	struct drm_gem_object *gem_object;
+	int err;
 
 	size = roundup(size, PAGE_SIZE);
 
-	gem_object = kzalloc(sizeof(*gem_object), GFP_KERNEL);
-	if (!gem_object)
+	obj = kzalloc(sizeof(*obj), GFP_KERNEL);
+	if (!obj)
 		return ERR_PTR(-ENOMEM);
 
+	gem_object = &obj->base;
+
 	if ((err = drm_gem_object_init(dev, gem_object, size)))
 		goto out;
 
-- 
1.7.9



More information about the dri-devel mailing list