Commit 89d61fc0 authored by Daniel Vetter's avatar Daniel Vetter

drm/doc: Clean up and integrate kerneldoc for drm_gem.c

Fairly incomplete, but at least a start.
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent fc66811c
...@@ -868,7 +868,11 @@ char *date;</synopsis> ...@@ -868,7 +868,11 @@ char *date;</synopsis>
abstracted from the client in libdrm. abstracted from the client in libdrm.
</para> </para>
</sect3> </sect3>
</sect2> <sect2>
<title>GEM Function Reference</title>
!Edrivers/gpu/drm/drm_gem.c
</sect2>
</sect2>
</sect1> </sect1>
<!-- Internals: mode setting --> <!-- Internals: mode setting -->
......
...@@ -85,9 +85,9 @@ ...@@ -85,9 +85,9 @@
#endif #endif
/** /**
* Initialize the GEM device fields * drm_gem_init - Initialize the GEM device fields
* @dev: drm_devic structure to initialize
*/ */
int int
drm_gem_init(struct drm_device *dev) drm_gem_init(struct drm_device *dev)
{ {
...@@ -120,6 +120,11 @@ drm_gem_destroy(struct drm_device *dev) ...@@ -120,6 +120,11 @@ drm_gem_destroy(struct drm_device *dev)
} }
/** /**
* drm_gem_object_init - initialize an allocated shmem-backed GEM object
* @dev: drm_device the object should be initialized for
* @obj: drm_gem_object to initialize
* @size: object size
*
* Initialize an already allocated GEM object of the specified size with * Initialize an already allocated GEM object of the specified size with
* shmfs backing store. * shmfs backing store.
*/ */
...@@ -141,6 +146,11 @@ int drm_gem_object_init(struct drm_device *dev, ...@@ -141,6 +146,11 @@ int drm_gem_object_init(struct drm_device *dev,
EXPORT_SYMBOL(drm_gem_object_init); EXPORT_SYMBOL(drm_gem_object_init);
/** /**
* drm_gem_object_init - initialize an allocated private GEM object
* @dev: drm_device the object should be initialized for
* @obj: drm_gem_object to initialize
* @size: object size
*
* Initialize an already allocated GEM object of the specified size with * Initialize an already allocated GEM object of the specified size with
* no GEM provided backing store. Instead the caller is responsible for * no GEM provided backing store. Instead the caller is responsible for
* backing the object and handling it. * 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,6 +186,9 @@ drm_gem_remove_prime_handles(struct drm_gem_object *obj, struct drm_file *filp)
} }
/** /**
* drm_gem_object_free - release resources bound to userspace handles
* @obj: GEM object to clean up.
*
* Called after the last handle to the object has been closed * Called after the last handle to the object has been closed
* *
* Removes any name for the object. Note that this must be * 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,7 +238,12 @@ drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj)
} }
/** /**
* Removes the mapping from handle to filp for this object. * drm_gem_handle_delete - deletes the given file-private handle
* @filp: drm file-private structure to use for the handle look up
* @handle: userspace handle to delete
*
* Removes the GEM handle from the @filp lookup table and if this is the last
* handle also cleans up linked resources like GEM names.
*/ */
int int
drm_gem_handle_delete(struct drm_file *filp, u32 handle) drm_gem_handle_delete(struct drm_file *filp, u32 handle)
...@@ -270,6 +288,9 @@ EXPORT_SYMBOL(drm_gem_handle_delete); ...@@ -270,6 +288,9 @@ EXPORT_SYMBOL(drm_gem_handle_delete);
/** /**
* drm_gem_dumb_destroy - dumb fb callback helper for gem based drivers * drm_gem_dumb_destroy - dumb fb callback helper for gem based drivers
* @file: drm file-private structure to remove the dumb handle from
* @dev: corresponding drm_device
* @handle: the dumb handle to remove
* *
* This implements the ->dumb_destroy kms driver callback for drivers which use * This implements the ->dumb_destroy kms driver callback for drivers which use
* gem to manage their backing storage. * gem to manage their backing storage.
...@@ -284,6 +305,9 @@ EXPORT_SYMBOL(drm_gem_dumb_destroy); ...@@ -284,6 +305,9 @@ EXPORT_SYMBOL(drm_gem_dumb_destroy);
/** /**
* drm_gem_handle_create_tail - internal functions to create a handle * drm_gem_handle_create_tail - internal functions to create a handle
* @file_priv: drm file-private structure to register the handle for
* @obj: object to register
* @handlep: pionter to return the created handle to the caller
* *
* This expects the dev->object_name_lock to be held already and will drop it * This expects the dev->object_name_lock to be held already and will drop it
* before returning. Used to avoid races in establishing new handles when * 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,6 +360,11 @@ drm_gem_handle_create_tail(struct drm_file *file_priv,
} }
/** /**
* gem_handle_create - create a gem handle for an object
* @file_priv: drm file-private structure to register the handle for
* @obj: object to register
* @handlep: pionter to return the created handle to the caller
*
* Create a handle for this object. This adds a handle reference * Create a handle for this object. This adds a handle reference
* to the object, which includes a regular reference count. Callers * to the object, which includes a regular reference count. Callers
* will likely want to dereference the object afterwards. * 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,6 +565,11 @@ drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp,
EXPORT_SYMBOL(drm_gem_object_lookup); EXPORT_SYMBOL(drm_gem_object_lookup);
/** /**
* drm_gem_close_ioctl - implementation of the GEM_CLOSE ioctl
* @dev: drm_device
* @data: ioctl data
* @file_priv: drm file-private structure
*
* Releases the handle to an mm object. * Releases the handle to an mm object.
*/ */
int int
...@@ -554,6 +588,11 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data, ...@@ -554,6 +588,11 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data,
} }
/** /**
* drm_gem_flink_ioctl - implementation of the GEM_FLINK ioctl
* @dev: drm_device
* @data: ioctl data
* @file_priv: drm file-private structure
*
* Create a global name for an object, returning the name. * Create a global name for an object, returning the name.
* *
* Note that the name does not hold a reference; when the object * Note that the name does not hold a reference; when the object
...@@ -601,6 +640,11 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data, ...@@ -601,6 +640,11 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
} }
/** /**
* drm_gem_open - implementation of the GEM_OPEN ioctl
* @dev: drm_device
* @data: ioctl data
* @file_priv: drm file-private structure
*
* Open an object using the global name, returning a handle and the size. * Open an object using the global name, returning a handle and the size.
* *
* This handle (of course) holds a reference to the object, so the object * 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,6 +684,10 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,
} }
/** /**
* gem_gem_open - initalizes GEM file-private structures at devnode open time
* @dev: drm_device which is being opened by userspace
* @file_private: drm file-private structure to set up
*
* Called at device open time, sets up the structure for handling refcounting * Called at device open time, sets up the structure for handling refcounting
* of mm objects. * of mm objects.
*/ */
...@@ -650,7 +698,7 @@ drm_gem_open(struct drm_device *dev, struct drm_file *file_private) ...@@ -650,7 +698,7 @@ drm_gem_open(struct drm_device *dev, struct drm_file *file_private)
spin_lock_init(&file_private->table_lock); spin_lock_init(&file_private->table_lock);
} }
/** /*
* Called at device close to release the file's * Called at device close to release the file's
* handle references on objects. * handle references on objects.
*/ */
...@@ -674,6 +722,10 @@ drm_gem_object_release_handle(int id, void *ptr, void *data) ...@@ -674,6 +722,10 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)
} }
/** /**
* drm_gem_release - release file-private GEM resources
* @dev: drm_device which is being closed by userspace
* @file_private: drm file-private structure to clean up
*
* Called at close time when the filp is going away. * Called at close time when the filp is going away.
* *
* Releases any remaining references on objects by this filp. * Releases any remaining references on objects by this filp.
...@@ -697,6 +749,9 @@ drm_gem_object_release(struct drm_gem_object *obj) ...@@ -697,6 +749,9 @@ drm_gem_object_release(struct drm_gem_object *obj)
EXPORT_SYMBOL(drm_gem_object_release); EXPORT_SYMBOL(drm_gem_object_release);
/** /**
* drm_gem_object_free - free a GEM object
* @kref: kref of the object to free
*
* Called after the last reference to the object has been lost. * Called after the last reference to the object has been lost.
* Must be called holding struct_ mutex * Must be called holding struct_ mutex
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment