[Intel-gfx] [PATCH 1/8] drm: Add drm_plane/connector_index
Matt Roper
matthew.d.roper at intel.com
Wed Jul 30 00:59:05 CEST 2014
On Tue, Jul 29, 2014 at 11:32:16PM +0200, Daniel Vetter wrote:
> In the atomic state we'll have an array of states for crtcs, planes
> and connectors and need to be able to at them by their index. We
> already have a drm_crtc_index function so add the missing ones for
> planes and connectors.
>
> If it later on turns out that the list walking is too expensive we can
> add the index to the relevant modeset objects.
>
> Rob Clark doesn't like the loops too much, but we can always add an
> obj->idx parameter later on. And for now reiterating is actually safer
> since nowadays we have hotpluggable connectors (thanks to DP MST).
>
> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
> drivers/gpu/drm/drm_crtc.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> include/drm/drm_crtc.h | 2 ++
> 2 files changed, 48 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 805240b11229..5a494caa8c9a 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -937,6 +937,29 @@ void drm_connector_cleanup(struct drm_connector *connector)
> EXPORT_SYMBOL(drm_connector_cleanup);
>
> /**
> + * drm_plane_index - find the index of a registered CRTC
Looks like some copy/paste that needs an update...your kerneldoc calls
the function drm_*PLANE*_index and then talks about CRTC's, but the
actual function is for connectors...
> + * @plane: CRTC to find index for
> + *
> + * Given a registered CRTC, return the index of that CRTC within a DRM
> + * device's list of CRTCs.
> + */
> +unsigned int drm_connector_index(struct drm_connector *connector)
> +{
> + unsigned int index = 0;
> + struct drm_connector *tmp;
> +
> + list_for_each_entry(tmp, &connector->dev->mode_config.connector_list, head) {
> + if (tmp == connector)
> + return index;
> +
> + index++;
> + }
> +
> + BUG();
> +}
> +EXPORT_SYMBOL(drm_connector_index);
> +
> +/**
> * drm_connector_register - register a connector
> * @connector: the connector to register
> *
> @@ -1239,6 +1262,29 @@ void drm_plane_cleanup(struct drm_plane *plane)
> EXPORT_SYMBOL(drm_plane_cleanup);
>
> /**
> + * drm_plane_index - find the index of a registered CRTC
> + * @plane: CRTC to find index for
> + *
> + * Given a registered CRTC, return the index of that CRTC within a DRM
> + * device's list of CRTCs.
> + */
More copy/paste referenecs to CRTC's.
> +unsigned int drm_plane_index(struct drm_plane *plane)
> +{
> + unsigned int index = 0;
> + struct drm_plane *tmp;
> +
> + list_for_each_entry(tmp, &plane->dev->mode_config.plane_list, head) {
> + if (tmp == plane)
> + return index;
> +
> + index++;
> + }
> +
> + BUG();
> +}
> +EXPORT_SYMBOL(drm_plane_index);
> +
> +/**
> * drm_plane_force_disable - Forcibly disable a plane
> * @plane: plane to disable
> *
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index f1105d0da059..4cae44611ab0 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -903,6 +903,7 @@ int drm_connector_register(struct drm_connector *connector);
> void drm_connector_unregister(struct drm_connector *connector);
>
> extern void drm_connector_cleanup(struct drm_connector *connector);
> +extern unsigned int drm_connector_index(struct drm_connector *crtc);
^^^^
connector?
> /* helper to unplug all connectors from sysfs for device */
> extern void drm_connector_unplug_all(struct drm_device *dev);
>
> @@ -942,6 +943,7 @@ extern int drm_plane_init(struct drm_device *dev,
> const uint32_t *formats, uint32_t format_count,
> bool is_primary);
> extern void drm_plane_cleanup(struct drm_plane *plane);
> +extern unsigned int drm_plane_index(struct drm_plane *crtc);
^^^^
plane?
> extern void drm_plane_force_disable(struct drm_plane *plane);
> extern int drm_crtc_check_viewport(const struct drm_crtc *crtc,
> int x, int y,
> --
> 2.0.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Matt Roper
Graphics Software Engineer
IoTG Platform Enabling & Development
Intel Corporation
(916) 356-2795
More information about the Intel-gfx
mailing list