diff options
-rw-r--r-- | drivers/gpu/drm/drm_gem.c | 26 | ||||
-rw-r--r-- | include/drm/drmP.h | 2 |
2 files changed, 26 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 7c5b5f78f1fa..186d62eb063b 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
@@ -129,7 +129,7 @@ drm_gem_destroy(struct drm_device *dev) | |||
129 | } | 129 | } |
130 | 130 | ||
131 | /** | 131 | /** |
132 | * Initialize an already allocate GEM object of the specified size with | 132 | * Initialize an already allocated GEM object of the specified size with |
133 | * shmfs backing store. | 133 | * shmfs backing store. |
134 | */ | 134 | */ |
135 | int drm_gem_object_init(struct drm_device *dev, | 135 | int drm_gem_object_init(struct drm_device *dev, |
@@ -151,6 +151,27 @@ int drm_gem_object_init(struct drm_device *dev, | |||
151 | EXPORT_SYMBOL(drm_gem_object_init); | 151 | EXPORT_SYMBOL(drm_gem_object_init); |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * Initialize an already allocated GEM object of the specified size with | ||
155 | * no GEM provided backing store. Instead the caller is responsible for | ||
156 | * backing the object and handling it. | ||
157 | */ | ||
158 | int drm_gem_private_object_init(struct drm_device *dev, | ||
159 | struct drm_gem_object *obj, size_t size) | ||
160 | { | ||
161 | BUG_ON((size & (PAGE_SIZE - 1)) != 0); | ||
162 | |||
163 | obj->dev = dev; | ||
164 | obj->filp = NULL; | ||
165 | |||
166 | kref_init(&obj->refcount); | ||
167 | atomic_set(&obj->handle_count, 0); | ||
168 | obj->size = size; | ||
169 | |||
170 | return 0; | ||
171 | } | ||
172 | EXPORT_SYMBOL(drm_gem_private_object_init); | ||
173 | |||
174 | /** | ||
154 | * Allocate a GEM object of the specified size with shmfs backing store | 175 | * Allocate a GEM object of the specified size with shmfs backing store |
155 | */ | 176 | */ |
156 | struct drm_gem_object * | 177 | struct drm_gem_object * |
@@ -444,7 +465,8 @@ drm_gem_release(struct drm_device *dev, struct drm_file *file_private) | |||
444 | void | 465 | void |
445 | drm_gem_object_release(struct drm_gem_object *obj) | 466 | drm_gem_object_release(struct drm_gem_object *obj) |
446 | { | 467 | { |
447 | fput(obj->filp); | 468 | if (obj->filp) |
469 | fput(obj->filp); | ||
448 | } | 470 | } |
449 | EXPORT_SYMBOL(drm_gem_object_release); | 471 | EXPORT_SYMBOL(drm_gem_object_release); |
450 | 472 | ||
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index d9c8c6c4639a..9b7c2bb4bb44 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1541,6 +1541,8 @@ struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, | |||
1541 | size_t size); | 1541 | size_t size); |
1542 | int drm_gem_object_init(struct drm_device *dev, | 1542 | int drm_gem_object_init(struct drm_device *dev, |
1543 | struct drm_gem_object *obj, size_t size); | 1543 | struct drm_gem_object *obj, size_t size); |
1544 | int drm_gem_private_object_init(struct drm_device *dev, | ||
1545 | struct drm_gem_object *obj, size_t size); | ||
1544 | void drm_gem_object_handle_free(struct drm_gem_object *obj); | 1546 | void drm_gem_object_handle_free(struct drm_gem_object *obj); |
1545 | void drm_gem_vm_open(struct vm_area_struct *vma); | 1547 | void drm_gem_vm_open(struct vm_area_struct *vma); |
1546 | void drm_gem_vm_close(struct vm_area_struct *vma); | 1548 | void drm_gem_vm_close(struct vm_area_struct *vma); |