drm/modes: add connector reference counting. (v2)

This uses the previous changes to add reference counts
to drm connector objects.

v2: move fbdev changes to their own patch.
add some kerneldoc

Reviewed-by: Daniel Vetter <[email protected]>
Reviewed-by: Daniel Stone <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
This commit is contained in:
Dave Airlie 2016-04-27 11:10:09 +10:00
commit b164d31f50
3 changed files with 72 additions and 7 deletions

View file

@ -2571,7 +2571,15 @@ static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev,
return mo ? obj_to_encoder(mo) : NULL;
}
static inline struct drm_connector *drm_connector_find(struct drm_device *dev,
/**
* drm_connector_lookup - lookup connector object
* @dev: DRM device
* @id: connector object id
*
* This function looks up the connector object specified by id
* add takes a reference to it.
*/
static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev,
uint32_t id)
{
struct drm_mode_object *mo;
@ -2639,6 +2647,28 @@ static inline uint32_t drm_framebuffer_read_refcount(struct drm_framebuffer *fb)
return atomic_read(&fb->base.refcount.refcount);
}
/**
* drm_connector_reference - incr the connector refcnt
* @connector: connector
*
* This function increments the connector's refcount.
*/
static inline void drm_connector_reference(struct drm_connector *connector)
{
drm_mode_object_reference(&connector->base);
}
/**
* drm_connector_unreference - unref a connector
* @connector: connector to unref
*
* This function decrements the connector's refcount and frees it if it drops to zero.
*/
static inline void drm_connector_unreference(struct drm_connector *connector)
{
drm_mode_object_unreference(&connector->base);
}
/* Plane list iterator for legacy (overlay only) planes. */
#define drm_for_each_legacy_plane(plane, dev) \
list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) \