public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 1/8] drm: Add drm_plane/connector_index
Date: Tue, 29 Jul 2014 15:59:05 -0700	[thread overview]
Message-ID: <20140729225905.GR16114@intel.com> (raw)
In-Reply-To: <1406669543-31213-2-git-send-email-daniel.vetter@ffwll.ch>

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@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@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

  reply	other threads:[~2014-07-29 22:59 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-29 21:32 [PATCH 0/8] atomic prep work Daniel Vetter
2014-07-29 21:32 ` [PATCH 1/8] drm: Add drm_plane/connector_index Daniel Vetter
2014-07-29 22:59   ` Matt Roper [this message]
2014-07-30  8:31   ` [PATCH] " Daniel Vetter
2014-07-29 21:32 ` [PATCH 2/8] drm: Move modeset_lock_all helpers to drm_modeset_lock.[hc] Daniel Vetter
2014-07-29 23:27   ` Dave Airlie
2014-07-29 21:32 ` [PATCH 3/8] drm: Handle legacy per-crtc locking with full acquire ctx Daniel Vetter
2014-07-29 23:28   ` Dave Airlie
2014-07-30  8:34   ` [PATCH] " Daniel Vetter
2014-07-29 21:32 ` [PATCH 4/8] drm: Move ->old_fb from crtc to plane Daniel Vetter
2014-07-29 23:30   ` Dave Airlie
2014-07-29 23:46   ` [Intel-gfx] " Matt Roper
2014-07-30  8:14     ` Daniel Vetter
2014-07-30  8:34   ` [PATCH] " Daniel Vetter
2014-07-29 21:32 ` [PATCH 5/8] drm: trylock modest locking for fbdev panics Daniel Vetter
2014-07-30 15:56   ` Matt Roper
2014-07-30 16:12     ` Daniel Vetter
2014-07-29 21:32 ` [PATCH 6/8] drm: Add a plane->reset hook Daniel Vetter
2014-07-29 21:32 ` [PATCH 7/8] drm/irq: Implement a generic vblank_wait function Daniel Vetter
2014-07-30  2:59   ` Michel Dänzer
2014-07-30  8:22     ` Daniel Vetter
2014-07-30  8:32       ` Michel Dänzer
2014-07-30 14:20         ` Thierry Reding
2014-07-30 14:36           ` [Intel-gfx] " Ville Syrjälä
2014-07-30 15:07             ` Daniel Vetter
2014-07-30 15:21             ` [Intel-gfx] " Thierry Reding
2014-07-31  1:14               ` Michel Dänzer
2014-07-31  7:54                 ` Daniel Vetter
2014-07-31  8:56                   ` Michel Dänzer
2014-07-31  9:46                     ` Daniel Vetter
2014-07-30  9:25   ` [PATCH] " Daniel Vetter
2014-07-30  9:52     ` Michel Dänzer
2014-07-30 14:24   ` [PATCH 7/8] " Thierry Reding
2014-07-30 15:06     ` Daniel Vetter
2014-07-30 15:10       ` Thierry Reding
2014-07-29 21:32 ` [PATCH 8/8] drm/i915: Use generic vblank wait Daniel Vetter
2014-07-30  9:25   ` [PATCH] " Daniel Vetter
2014-07-30 13:36 ` [PATCH] drm: Docbook fixes Daniel Vetter
2014-08-05  2:51   ` [Intel-gfx] " Dave Airlie
2014-08-05  7:28     ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140729225905.GR16114@intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox