[RFCv1 05/12] drm: helpers to find mode objects (BEFORE drm: split property values out)

Rob Clark robdclark at gmail.com
Sun Oct 6 02:48:28 CEST 2013


Oh, and this one was half stolen from rmk's Armada driver with a
couple extra helper's that I needed added

BR,
-R

On Sat, Oct 5, 2013 at 8:45 PM, Rob Clark <robdclark at gmail.com> wrote:
> ---
>  include/drm/drm_crtc.h | 40 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
>
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index e042d12..0ea61b3 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -1067,6 +1067,46 @@ drm_property_get_obj(struct drm_property *property, uint64_t value)
>         return drm_mode_object_find(property->dev, value, property->values[0]);
>  }
>
> +static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
> +               uint32_t id)
> +{
> +       struct drm_mode_object *mo;
> +       mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PLANE);
> +       return mo ? obj_to_plane(mo) : NULL;
> +}
> +
> +static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
> +               uint32_t id)
> +{
> +       struct drm_mode_object *mo;
> +       mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CRTC);
> +       return mo ? obj_to_crtc(mo) : NULL;
> +}
> +
> +static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev,
> +               uint32_t id)
> +{
> +       struct drm_mode_object *mo;
> +       mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_ENCODER);
> +       return mo ? obj_to_encoder(mo) : NULL;
> +}
> +
> +static inline struct drm_connector *drm_connector_find(struct drm_device *dev,
> +               uint32_t id)
> +{
> +       struct drm_mode_object *mo;
> +       mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CONNECTOR);
> +       return mo ? obj_to_connector(mo) : NULL;
> +}
> +
> +static inline struct drm_property_blob *
> +drm_property_blob_find(struct drm_device *dev, uint32_t id)
> +{
> +       struct drm_mode_object *mo;
> +       mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_BLOB);
> +       return mo ? obj_to_blob(mo) : NULL;
> +}
> +
>  /* IOCTLs */
>  extern int drm_mode_getresources(struct drm_device *dev,
>                                  void *data, struct drm_file *file_priv);
> --
> 1.8.3.1
>


More information about the dri-devel mailing list