aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2013-10-05 16:36:52 -0400
committerDave Airlie <airlied@redhat.com>2014-06-03 23:22:44 -0400
commita2b34e226ac9fbd20179091fad0ee1a24ad48669 (patch)
tree0b6b696d834373a1dbdeaab4c1bd8c644d5d873a /include/drm
parentd5ab2b430b3cec65ba5b30b2e1de8ea46715cb93 (diff)
drm: helpers to find mode objects
Add a few more useful helpers to find mode objects. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drm_crtc.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e8fe9d8e135c..90bd1a25e2c6 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1061,6 +1061,15 @@ extern int drm_format_vert_chroma_subsampling(uint32_t format);
1061extern const char *drm_get_format_name(uint32_t format); 1061extern const char *drm_get_format_name(uint32_t format);
1062 1062
1063/* Helpers */ 1063/* Helpers */
1064
1065static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
1066 uint32_t id)
1067{
1068 struct drm_mode_object *mo;
1069 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PLANE);
1070 return mo ? obj_to_plane(mo) : NULL;
1071}
1072
1064static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev, 1073static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
1065 uint32_t id) 1074 uint32_t id)
1066{ 1075{
@@ -1077,6 +1086,30 @@ static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev,
1077 return mo ? obj_to_encoder(mo) : NULL; 1086 return mo ? obj_to_encoder(mo) : NULL;
1078} 1087}
1079 1088
1089static inline struct drm_connector *drm_connector_find(struct drm_device *dev,
1090 uint32_t id)
1091{
1092 struct drm_mode_object *mo;
1093 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CONNECTOR);
1094 return mo ? obj_to_connector(mo) : NULL;
1095}
1096
1097static inline struct drm_property *drm_property_find(struct drm_device *dev,
1098 uint32_t id)
1099{
1100 struct drm_mode_object *mo;
1101 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PROPERTY);
1102 return mo ? obj_to_property(mo) : NULL;
1103}
1104
1105static inline struct drm_property_blob *
1106drm_property_blob_find(struct drm_device *dev, uint32_t id)
1107{
1108 struct drm_mode_object *mo;
1109 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_BLOB);
1110 return mo ? obj_to_blob(mo) : NULL;
1111}
1112
1080/* Plane list iterator for legacy (overlay only) planes. */ 1113/* Plane list iterator for legacy (overlay only) planes. */
1081#define drm_for_each_legacy_plane(plane, planelist) \ 1114#define drm_for_each_legacy_plane(plane, planelist) \
1082 list_for_each_entry(plane, planelist, head) \ 1115 list_for_each_entry(plane, planelist, head) \