summaryrefslogtreecommitdiff
path: root/include/drm
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-04-27 11:10:09 +1000
committerDave Airlie <airlied@redhat.com>2016-05-05 12:51:53 +1000
commitb164d31f50b2923a7a92c2a40cb46973a6ba8c36 (patch)
treeb4bd813e86002fc6aabfb11ebe9c13d01958df85 /include/drm
parente76d399f21f3fd20c470233af73cab2e5307d566 (diff)
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 <daniel.vetter@ffwll.ch> Reviewed-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drm_crtc.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 0cc1eb7b4fd2..4acdaf5e283d 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -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) \