aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_gem.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-01-21 06:39:00 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-03-13 07:48:27 -0400
commit89d61fc0f5d384f07f3e93af2bb52009ce26283a (patch)
treea048f7ae2bb3de2b9236c050c93e5b9c10690b64 /drivers/gpu/drm/drm_gem.c
parentfc66811ce1de3f79cbe3f83c2fdb1ef3e2cdac1c (diff)
drm/doc: Clean up and integrate kerneldoc for drm_gem.c
Fairly incomplete, but at least a start. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/drm_gem.c')
-rw-r--r--drivers/gpu/drm/drm_gem.c63
1 files changed, 59 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 5bbad873c798..2136052ccee1 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -85,9 +85,9 @@
85#endif 85#endif
86 86
87/** 87/**
88 * Initialize the GEM device fields 88 * drm_gem_init - Initialize the GEM device fields
89 * @dev: drm_devic structure to initialize
89 */ 90 */
90
91int 91int
92drm_gem_init(struct drm_device *dev) 92drm_gem_init(struct drm_device *dev)
93{ 93{
@@ -120,6 +120,11 @@ drm_gem_destroy(struct drm_device *dev)
120} 120}
121 121
122/** 122/**
123 * drm_gem_object_init - initialize an allocated shmem-backed GEM object
124 * @dev: drm_device the object should be initialized for
125 * @obj: drm_gem_object to initialize
126 * @size: object size
127 *
123 * Initialize an already allocated GEM object of the specified size with 128 * Initialize an already allocated GEM object of the specified size with
124 * shmfs backing store. 129 * shmfs backing store.
125 */ 130 */
@@ -141,6 +146,11 @@ int drm_gem_object_init(struct drm_device *dev,
141EXPORT_SYMBOL(drm_gem_object_init); 146EXPORT_SYMBOL(drm_gem_object_init);
142 147
143/** 148/**
149 * drm_gem_object_init - initialize an allocated private GEM object
150 * @dev: drm_device the object should be initialized for
151 * @obj: drm_gem_object to initialize
152 * @size: object size
153 *
144 * Initialize an already allocated GEM object of the specified size with 154 * Initialize an already allocated GEM object of the specified size with
145 * no GEM provided backing store. Instead the caller is responsible for 155 * no GEM provided backing store. Instead the caller is responsible for
146 * backing the object and handling it. 156 * backing the object and handling it.
@@ -176,6 +186,9 @@ drm_gem_remove_prime_handles(struct drm_gem_object *obj, struct drm_file *filp)
176} 186}
177 187
178/** 188/**
189 * drm_gem_object_free - release resources bound to userspace handles
190 * @obj: GEM object to clean up.
191 *
179 * Called after the last handle to the object has been closed 192 * Called after the last handle to the object has been closed
180 * 193 *
181 * Removes any name for the object. Note that this must be 194 * Removes any name for the object. Note that this must be
@@ -225,7 +238,12 @@ drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj)
225} 238}
226 239
227/** 240/**
228 * Removes the mapping from handle to filp for this object. 241 * drm_gem_handle_delete - deletes the given file-private handle
242 * @filp: drm file-private structure to use for the handle look up
243 * @handle: userspace handle to delete
244 *
245 * Removes the GEM handle from the @filp lookup table and if this is the last
246 * handle also cleans up linked resources like GEM names.
229 */ 247 */
230int 248int
231drm_gem_handle_delete(struct drm_file *filp, u32 handle) 249drm_gem_handle_delete(struct drm_file *filp, u32 handle)
@@ -270,6 +288,9 @@ EXPORT_SYMBOL(drm_gem_handle_delete);
270 288
271/** 289/**
272 * drm_gem_dumb_destroy - dumb fb callback helper for gem based drivers 290 * drm_gem_dumb_destroy - dumb fb callback helper for gem based drivers
291 * @file: drm file-private structure to remove the dumb handle from
292 * @dev: corresponding drm_device
293 * @handle: the dumb handle to remove
273 * 294 *
274 * This implements the ->dumb_destroy kms driver callback for drivers which use 295 * This implements the ->dumb_destroy kms driver callback for drivers which use
275 * gem to manage their backing storage. 296 * gem to manage their backing storage.
@@ -284,6 +305,9 @@ EXPORT_SYMBOL(drm_gem_dumb_destroy);
284 305
285/** 306/**
286 * drm_gem_handle_create_tail - internal functions to create a handle 307 * drm_gem_handle_create_tail - internal functions to create a handle
308 * @file_priv: drm file-private structure to register the handle for
309 * @obj: object to register
310 * @handlep: pionter to return the created handle to the caller
287 * 311 *
288 * This expects the dev->object_name_lock to be held already and will drop it 312 * This expects the dev->object_name_lock to be held already and will drop it
289 * before returning. Used to avoid races in establishing new handles when 313 * before returning. Used to avoid races in establishing new handles when
@@ -336,6 +360,11 @@ drm_gem_handle_create_tail(struct drm_file *file_priv,
336} 360}
337 361
338/** 362/**
363 * gem_handle_create - create a gem handle for an object
364 * @file_priv: drm file-private structure to register the handle for
365 * @obj: object to register
366 * @handlep: pionter to return the created handle to the caller
367 *
339 * Create a handle for this object. This adds a handle reference 368 * Create a handle for this object. This adds a handle reference
340 * to the object, which includes a regular reference count. Callers 369 * to the object, which includes a regular reference count. Callers
341 * will likely want to dereference the object afterwards. 370 * will likely want to dereference the object afterwards.
@@ -536,6 +565,11 @@ drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp,
536EXPORT_SYMBOL(drm_gem_object_lookup); 565EXPORT_SYMBOL(drm_gem_object_lookup);
537 566
538/** 567/**
568 * drm_gem_close_ioctl - implementation of the GEM_CLOSE ioctl
569 * @dev: drm_device
570 * @data: ioctl data
571 * @file_priv: drm file-private structure
572 *
539 * Releases the handle to an mm object. 573 * Releases the handle to an mm object.
540 */ 574 */
541int 575int
@@ -554,6 +588,11 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data,
554} 588}
555 589
556/** 590/**
591 * drm_gem_flink_ioctl - implementation of the GEM_FLINK ioctl
592 * @dev: drm_device
593 * @data: ioctl data
594 * @file_priv: drm file-private structure
595 *
557 * Create a global name for an object, returning the name. 596 * Create a global name for an object, returning the name.
558 * 597 *
559 * Note that the name does not hold a reference; when the object 598 * Note that the name does not hold a reference; when the object
@@ -601,6 +640,11 @@ err:
601} 640}
602 641
603/** 642/**
643 * drm_gem_open - implementation of the GEM_OPEN ioctl
644 * @dev: drm_device
645 * @data: ioctl data
646 * @file_priv: drm file-private structure
647 *
604 * Open an object using the global name, returning a handle and the size. 648 * Open an object using the global name, returning a handle and the size.
605 * 649 *
606 * This handle (of course) holds a reference to the object, so the object 650 * This handle (of course) holds a reference to the object, so the object
@@ -640,6 +684,10 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,
640} 684}
641 685
642/** 686/**
687 * gem_gem_open - initalizes GEM file-private structures at devnode open time
688 * @dev: drm_device which is being opened by userspace
689 * @file_private: drm file-private structure to set up
690 *
643 * Called at device open time, sets up the structure for handling refcounting 691 * Called at device open time, sets up the structure for handling refcounting
644 * of mm objects. 692 * of mm objects.
645 */ 693 */
@@ -650,7 +698,7 @@ drm_gem_open(struct drm_device *dev, struct drm_file *file_private)
650 spin_lock_init(&file_private->table_lock); 698 spin_lock_init(&file_private->table_lock);
651} 699}
652 700
653/** 701/*
654 * Called at device close to release the file's 702 * Called at device close to release the file's
655 * handle references on objects. 703 * handle references on objects.
656 */ 704 */
@@ -674,6 +722,10 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)
674} 722}
675 723
676/** 724/**
725 * drm_gem_release - release file-private GEM resources
726 * @dev: drm_device which is being closed by userspace
727 * @file_private: drm file-private structure to clean up
728 *
677 * Called at close time when the filp is going away. 729 * Called at close time when the filp is going away.
678 * 730 *
679 * Releases any remaining references on objects by this filp. 731 * Releases any remaining references on objects by this filp.
@@ -697,6 +749,9 @@ drm_gem_object_release(struct drm_gem_object *obj)
697EXPORT_SYMBOL(drm_gem_object_release); 749EXPORT_SYMBOL(drm_gem_object_release);
698 750
699/** 751/**
752 * drm_gem_object_free - free a GEM object
753 * @kref: kref of the object to free
754 *
700 * Called after the last reference to the object has been lost. 755 * Called after the last reference to the object has been lost.
701 * Must be called holding struct_ mutex 756 * Must be called holding struct_ mutex
702 * 757 *