diff options
author | Dave Airlie <airlied@redhat.com> | 2014-03-18 05:09:10 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-03-18 05:09:10 -0400 |
commit | 978c6050165bba52eab7ef3581d447eb215def77 (patch) | |
tree | f34ccf67a789fe7e8ec88b054b33a6c2e688fdf7 /drivers/gpu/drm/drm_gem.c | |
parent | 8ad2bc9796994ecba9f4ba2fc9abca27ee9d193d (diff) | |
parent | fc1645ac826c82ebad4402aabbf65595b671ecca (diff) |
Merge branch 'drm-docs' of ssh://people.freedesktop.org/~danvet/drm into drm-next
Here's my drm documentation update and driver api polish pull request.
Alex reviewed the entire pile, I've applied a little bit of spelling
polish in a few places since then and otherwise the Usual Suspects (David,
Rob, ...) don't seem up to have another look at it (I've poked them on
irc). So I think it's as good as it gets ;-)
Note that I've dropped the final imx breaker patch since that's blocked on
imx getting sane. Once that's landed I'll ping you to pick up that
straggler.
* 'drm-docs' of ssh://people.freedesktop.org/~danvet/drm: (34 commits)
drm/imx: remove drm_mode_connector_detach_encoder harder
drm: kerneldoc polish for drm_crtc.c
drm: kerneldoc polish for drm_crtc_helper.c
drm: drop error code for drm_helper_resume_force_mode
drm/crtc-helper: remove LOCKING from kerneldoc
drm: remove return value from drm_helper_mode_fill_fb_struct
drm/doc: Fix misplaced </para>
drm: remove drm_display_mode->private_size
drm: polish function kerneldoc for drm_modes.[hc]
drm/modes: drop maxPitch from drm_mode_validate_size
drm/modes: drop return value from drm_display_mode_from_videomode
drm/modes: remove drm_mode_height/width
drm: extract drm_modes.h for drm_crtc.h functions
drm: move drm_mode related functions into drm_modes.c
drm/doc: Repleace LOCKING kerneldoc sections in drm_modes.c
drm/doc: Integrate drm_modes.c kerneldoc
drm/kms: rip out drm_mode_connector_detach_encoder
drm/doc: Add function reference documentation for drm_mm.c
drm/doc: Overview documentation for drm_mm.c
drm/mm: Remove MM_UNUSED_TARGET
...
Diffstat (limited to 'drivers/gpu/drm/drm_gem.c')
-rw-r--r-- | drivers/gpu/drm/drm_gem.c | 63 |
1 files changed, 59 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 154d6c6955c1..9909bef59800 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 | |||
91 | int | 91 | int |
92 | drm_gem_init(struct drm_device *dev) | 92 | drm_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, | |||
141 | EXPORT_SYMBOL(drm_gem_object_init); | 146 | EXPORT_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 | */ |
230 | int | 248 | int |
231 | drm_gem_handle_delete(struct drm_file *filp, u32 handle) | 249 | drm_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, | |||
536 | EXPORT_SYMBOL(drm_gem_object_lookup); | 565 | EXPORT_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 | */ |
541 | int | 575 | int |
@@ -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. |
@@ -699,6 +751,9 @@ drm_gem_object_release(struct drm_gem_object *obj) | |||
699 | EXPORT_SYMBOL(drm_gem_object_release); | 751 | EXPORT_SYMBOL(drm_gem_object_release); |
700 | 752 | ||
701 | /** | 753 | /** |
754 | * drm_gem_object_free - free a GEM object | ||
755 | * @kref: kref of the object to free | ||
756 | * | ||
702 | * Called after the last reference to the object has been lost. | 757 | * Called after the last reference to the object has been lost. |
703 | * Must be called holding struct_ mutex | 758 | * Must be called holding struct_ mutex |
704 | * | 759 | * |