Commit a2511a55 authored by Daniel Vetter's avatar Daniel Vetter

drm/doc: Polish docs for drm_mode_object

I figured an overview section here is overkill, and better
to just document the 2 structures themselves well enough.

v2: Review from Archit:
- Appease checkpatch in moved code.
- Spelling fixes in the kerneldoc.
Reviewed-by: default avatarArchit Taneja <architt@codeaurora.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20160829082757.17913-5-daniel.vetter@ffwll.ch
parent f094d881
...@@ -152,7 +152,7 @@ EXPORT_SYMBOL(drm_mode_object_find); ...@@ -152,7 +152,7 @@ EXPORT_SYMBOL(drm_mode_object_find);
* drm_mode_object_unreference - decr the object refcnt * drm_mode_object_unreference - decr the object refcnt
* @obj: mode_object * @obj: mode_object
* *
* This functions decrements the object's refcount if it is a refcounted modeset * This function decrements the object's refcount if it is a refcounted modeset
* object. It is a no-op on any other object. This is used to drop references * object. It is a no-op on any other object. This is used to drop references
* acquired with drm_mode_object_reference(). * acquired with drm_mode_object_reference().
*/ */
...@@ -169,7 +169,7 @@ EXPORT_SYMBOL(drm_mode_object_unreference); ...@@ -169,7 +169,7 @@ EXPORT_SYMBOL(drm_mode_object_unreference);
* drm_mode_object_reference - incr the object refcnt * drm_mode_object_reference - incr the object refcnt
* @obj: mode_object * @obj: mode_object
* *
* This functions increments the object's refcount if it is a refcounted modeset * This function increments the object's refcount if it is a refcounted modeset
* object. It is a no-op on any other object. References should be dropped again * object. It is a no-op on any other object. References should be dropped again
* by calling drm_mode_object_unreference(). * by calling drm_mode_object_unreference().
*/ */
...@@ -218,10 +218,16 @@ EXPORT_SYMBOL(drm_object_attach_property); ...@@ -218,10 +218,16 @@ EXPORT_SYMBOL(drm_object_attach_property);
* @property: property to set * @property: property to set
* @val: value the property should be set to * @val: value the property should be set to
* *
* This functions sets a given property on a given object. This function only * This function sets a given property on a given object. This function only
* changes the software state of the property, it does not call into the * changes the software state of the property, it does not call into the
* driver's ->set_property callback. * driver's ->set_property callback.
* *
* Note that atomic drivers should not have any need to call this, the core will
* ensure consistency of values reported back to userspace through the
* appropriate ->atomic_get_property callback. Only legacy drivers should call
* this function to update the tracked value (after clamping and other
* restrictions have been applied).
*
* Returns: * Returns:
* Zero on success, error code on failure. * Zero on success, error code on failure.
*/ */
...@@ -252,6 +258,9 @@ EXPORT_SYMBOL(drm_object_property_set_value); ...@@ -252,6 +258,9 @@ EXPORT_SYMBOL(drm_object_property_set_value);
* value this might be out of sync with the hardware, depending upon the driver * value this might be out of sync with the hardware, depending upon the driver
* and property. * and property.
* *
* Atomic drivers should never call this function directly, the core will read
* out property values through the various ->atomic_get_property callbacks.
*
* Returns: * Returns:
* Zero on success, error code on failure. * Zero on success, error code on failure.
*/ */
......
...@@ -27,6 +27,28 @@ ...@@ -27,6 +27,28 @@
struct drm_object_properties; struct drm_object_properties;
struct drm_property; struct drm_property;
/**
* struct drm_mode_object - base structure for modeset objects
* @id: userspace visible identifier
* @type: type of the object, one of DRM_MODE_OBJECT\_\*
* @properties: properties attached to this object, including values
* @refcount: reference count for objects which with dynamic lifetime
* @free_cb: free function callback, only set for objects with dynamic lifetime
*
* Base structure for modeset objects visible to userspace. Objects can be
* looked up using drm_mode_object_find(). Besides basic uapi interface
* properties like @id and @type it provides two services:
*
* - It tracks attached properties and their values. This is used by &drm_crtc,
* &drm_plane and &drm_connector. Properties are attached by calling
* drm_object_attach_property() before the object is visible to userspace.
*
* - For objects with dynamic lifetimes (as indicated by a non-NULL @free_cb) it
* provides reference counting through drm_mode_object_reference() and
* drm_mode_object_unreference(). This is used by &drm_framebuffer,
* &drm_connector and &drm_property_blob. These objects provide specialized
* reference counting wrappers.
*/
struct drm_mode_object { struct drm_mode_object {
uint32_t id; uint32_t id;
uint32_t type; uint32_t type;
...@@ -36,16 +58,38 @@ struct drm_mode_object { ...@@ -36,16 +58,38 @@ struct drm_mode_object {
}; };
#define DRM_OBJECT_MAX_PROPERTY 24 #define DRM_OBJECT_MAX_PROPERTY 24
/**
* struct drm_object_properties - property tracking for &drm_mode_object
*/
struct drm_object_properties { struct drm_object_properties {
/**
* @count: number of valid properties, must be less than or equal to
* DRM_OBJECT_MAX_PROPERTY.
*/
int count; int count;
/* NOTE: if we ever start dynamically destroying properties (ie. /**
* @properties: Array of pointers to &drm_property.
*
* NOTE: if we ever start dynamically destroying properties (ie.
* not at drm_mode_config_cleanup() time), then we'd have to do * not at drm_mode_config_cleanup() time), then we'd have to do
* a better job of detaching property from mode objects to avoid * a better job of detaching property from mode objects to avoid
* dangling property pointers: * dangling property pointers:
*/ */
struct drm_property *properties[DRM_OBJECT_MAX_PROPERTY]; struct drm_property *properties[DRM_OBJECT_MAX_PROPERTY];
/* do not read/write values directly, but use drm_object_property_get_value()
* and drm_object_property_set_value(): /**
* @values: Array to store the property values, matching @properties. Do
* not read/write values directly, but use
* drm_object_property_get_value() and drm_object_property_set_value().
*
* Note that atomic drivers do not store mutable properties in this
* array, but only the decoded values in the corresponding state
* structure. The decoding is done using the ->atomic_get_property and
* ->atomic_set_property hooks of the corresponding object. Hence atomic
* drivers should not use drm_object_property_set_value() and
* drm_object_property_get_value() on mutable objects, i.e. those
* without the DRM_MODE_PROP_IMMUTABLE flag set.
*/ */
uint64_t values[DRM_OBJECT_MAX_PROPERTY]; uint64_t values[DRM_OBJECT_MAX_PROPERTY];
}; };
......
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