[Intel-gfx] [PATCH 3/9] drm/i915: Add crtc->plane_ids_mask
Paulo Zanoni
paulo.r.zanoni at intel.com
Thu Nov 17 19:11:44 UTC 2016
Em Ter, 2016-11-08 às 16:47 +0200, ville.syrjala at linux.intel.com
escreveu:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Add a mask of which planes are available for each pipe. This doesn't
> quite work for old platforms with dynamic plane<->pipe assignment,
> but
> as we don't support that sort of stuff (yet) we can get away with it.
>
> The main use I have for this is the for_each_plane_id_on_crtc() macro
> for iterating over all possible planes on the crtc. I suppose we
> could
> not add the mask, and instead iterate by comparing intel_plane->pipe
> but then we'd need a local intel_plane variable which is just
> unnecessary clutter in some cases. But I'm not hung up on this, so if
> people prefer the other option I could be convinced to use it.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 4 ++++
> drivers/gpu/drm/i915/intel_display.c | 3 +++
> drivers/gpu/drm/i915/intel_drv.h | 3 ++-
> 3 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h
> b/drivers/gpu/drm/i915/i915_drv.h
> index 2451b88b1e82..2325efacbd5c 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -201,6 +201,10 @@ enum plane_id {
> I915_MAX_PLANES,
> };
>
> +#define for_each_plane_id_on_crtc(__crtc, __p) \
> + for ((__p) = PLANE_PRIMARY; (__p) < I915_MAX_PLANES;
> (__p)++) \
> + for_each_if ((__crtc)->plane_ids_mask & (1 <<
> (__p)))
> +
Let's be consistent: either use BIT() everywhere or use (1 << bit)
everywhere :).
Reviewed-by: Paulo Zanoni <paulo.r.zanoni at intel.com>.
> enum port {
> PORT_NONE = -1,
> PORT_A = 0,
> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_display.c
> index b318119330e8..e3ed5d1fcf0d 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -15293,6 +15293,7 @@ static int intel_crtc_init(struct
> drm_i915_private *dev_priv, enum pipe pipe)
> ret = PTR_ERR(primary);
> goto fail;
> }
> + intel_crtc->plane_ids_mask |= BIT(primary->id);
>
> for_each_sprite(dev_priv, pipe, sprite) {
> struct intel_plane *plane;
> @@ -15302,6 +15303,7 @@ static int intel_crtc_init(struct
> drm_i915_private *dev_priv, enum pipe pipe)
> ret = PTR_ERR(plane);
> goto fail;
> }
> + intel_crtc->plane_ids_mask |= BIT(plane->id);
> }
>
> cursor = intel_cursor_plane_create(dev_priv, pipe);
> @@ -15309,6 +15311,7 @@ static int intel_crtc_init(struct
> drm_i915_private *dev_priv, enum pipe pipe)
> ret = PTR_ERR(cursor);
> goto fail;
> }
> + intel_crtc->plane_ids_mask |= BIT(cursor->id);
>
> ret = drm_crtc_init_with_planes(&dev_priv->drm, &intel_crtc-
> >base,
> &primary->base, &cursor-
> >base,
> diff --git a/drivers/gpu/drm/i915/intel_drv.h
> b/drivers/gpu/drm/i915/intel_drv.h
> index 58fc8e1d2aa8..a3c696d8bf93 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -689,8 +689,9 @@ struct intel_crtc {
> * some outputs connected to this crtc.
> */
> bool active;
> - unsigned long enabled_power_domains;
> bool lowfreq_avail;
> + u8 plane_ids_mask;
> + unsigned long enabled_power_domains;
> struct intel_overlay *overlay;
> struct intel_flip_work *flip_work;
>
More information about the Intel-gfx
mailing list