All of lore.kernel.org
 help / color / mirror / Atom feed
From: ville.syrjala@linux.intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 2/9] drm/i915: Add crtc->plane_ids_mask
Date: Tue, 22 Nov 2016 18:01:57 +0200	[thread overview]
Message-ID: <1479830524-7882-3-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1479830524-7882-1-git-send-email-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@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.

v2: Use BIT() in the iterator macro too (Paulo)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@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 6c9864287b29..90bd31d71a81 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -210,6 +210,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 & BIT(__p))
+
 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 dfd3dbe6a92a..6c3032f04d54 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -15277,6 +15277,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;
@@ -15286,6 +15287,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);
@@ -15293,6 +15295,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 b2a0409330a9..c1b245853ba9 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -691,8 +691,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;
 
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-11-22 16:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-22 16:01 [PATCH v2 0/9] drm/i915: Add a per-pipe plane identifier enum (v2) ville.syrjala
2016-11-22 16:01 ` [PATCH 1/9] drm/i915: Add per-pipe plane identifier ville.syrjala
2016-11-22 16:01 ` ville.syrjala [this message]
2016-11-22 16:01 ` [PATCH 3/9] drm/i915: Use enum plane_id in SKL wm code ville.syrjala
2016-11-22 20:27   ` Lyude Paul
2016-11-22 16:01 ` [PATCH 4/9] drm/i915: Use enum plane_id in SKL plane code ville.syrjala
2016-11-22 16:02 ` [PATCH 5/9] drm/i915: Use enum plane_id in VLV/CHV sprite code ville.syrjala
2016-11-22 16:02 ` [PATCH 6/9] drm/i915: Use enum plane_id in VLV/CHV wm code ville.syrjala
2016-11-22 16:02 ` [PATCH 7/9] drm/i915: s/plane/plane_id/ in skl+ plane register defines ville.syrjala
2016-12-15 18:33   ` Paulo Zanoni
2016-11-22 16:02 ` [PATCH 8/9] drm/i915: Don't populate plane->plane for cursors and sprites ville.syrjala
2016-12-15 19:05   ` Paulo Zanoni
2016-12-15 19:11     ` Ville Syrjälä
2016-12-15 19:50       ` Paulo Zanoni
2016-12-15 19:59         ` Ville Syrjälä
2016-12-16 14:07           ` Paulo Zanoni
2016-12-16 14:56             ` Ander Conselvan De Oliveira
2016-12-19 18:24           ` Matt Roper
2016-12-19 18:55             ` Ville Syrjälä
2016-11-22 16:02 ` [PATCH 9/9] drm/i915: Rename the local 'plane' variable to 'plane_id' in primary plane code ville.syrjala
2016-11-22 16:45 ` ✓ Fi.CI.BAT: success for drm/i915: Add a per-pipe plane identifier enum (rev5) Patchwork
2016-11-23 20:16 ` [PATCH v2 0/9] drm/i915: Add a per-pipe plane identifier enum (v2) Ville Syrjälä

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=1479830524-7882-3-git-send-email-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.