All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs
@ 2018-06-15 16:49 Ville Syrjala
  2018-06-15 16:49 ` [PATCH 01/14] drm: Add drm_encoder_mask() Ville Syrjala
                   ` (19 more replies)
  0 siblings, 20 replies; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel
  Cc: Joonyoung Shim, intel-gfx, Seung-Woo Kim, Inki Dae,
	Kyungmin Park, Benjamin Gaignard, Philipp Zabel, Vincent Abriou

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Apparently several drivers fill encoder->possible_clones with bogus
data, which means userspace can't trust that information at all.
Let's try to fix up some of the problems and add some sanity checks
into the core to persuade drivers to get it right from now on.
What we can't enforce is drivers actually implementing what they
advertize, so userspace would still have to take this information
with a grain of salt. But at least the information should be self
consistent.

I also figured we migth do something similar for possible_crtcs.
Although that is less important as there is no need for this to
match between two encoders. I also suspect the validation WARNs
would trip on some drivers. So we might not even want this part,
and instead we should just filter out bits for non-existing
crtcs.

Smoke tested on i915, and compile tested otherwise.

Pushed the lot here:
git://github.com/vsyrjala/linux.git possible_clones_clean

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>

Ville Syrjälä (14):
  drm: Add drm_encoder_mask()
  drm: Include the encoder itself in possible_clones
  drm/gma500: Sanitize possible_clones
  drm/sti: Remove pointless casts
  drm/sti: Try to fix up the tvout possible clones
  drm/exynos: Use drm_encoder_mask()
  drm/imx: Remove the bogus possible_clones setup
  drm: Validate encoder->possible_clones
  drm/i915: Use drm_encoder_mask()
  drm/i915: Populate possible_crtcs correctly
  drm/i915: Fix DP-MST crtc_mask
  drm/i915: Clean up encoder->crtc_mask setup
  drm/i915: Simplfy LVDS crtc_mask setup
  drm: Validate encoder->possible_crtcs

 drivers/gpu/drm/drm_encoder.c           | 66 ++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/exynos/exynos_drm_drv.c |  5 +--
 drivers/gpu/drm/gma500/framebuffer.c    | 16 ++++----
 drivers/gpu/drm/gma500/mdfld_dsi_dpi.c  |  4 +-
 drivers/gpu/drm/i915/intel_crt.c        |  4 +-
 drivers/gpu/drm/i915/intel_ddi.c        |  2 +-
 drivers/gpu/drm/i915/intel_display.c    | 20 ++++++++--
 drivers/gpu/drm/i915/intel_dp.c         |  6 +--
 drivers/gpu/drm/i915/intel_dp_mst.c     |  2 +-
 drivers/gpu/drm/i915/intel_dvo.c        |  2 +-
 drivers/gpu/drm/i915/intel_hdmi.c       |  6 +--
 drivers/gpu/drm/i915/intel_lvds.c       |  8 ++--
 drivers/gpu/drm/i915/intel_sdvo.c       |  2 +-
 drivers/gpu/drm/i915/intel_tv.c         |  3 +-
 drivers/gpu/drm/imx/imx-drm-core.c      |  2 +-
 drivers/gpu/drm/sti/sti_tvout.c         | 15 +++++---
 include/drm/drm_encoder.h               | 14 ++++++-
 17 files changed, 132 insertions(+), 45 deletions(-)

-- 
2.16.4

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

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 01/14] drm: Add drm_encoder_mask()
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
@ 2018-06-15 16:49 ` Ville Syrjala
  2018-06-15 16:49 ` [PATCH 02/14] drm: Include the encoder itself in possible_clones Ville Syrjala
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add drm_encoder_mask() which returns the 1<<index for the encoder.
We already have an identical drm_crtc_mask() for crtcs.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 include/drm/drm_encoder.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h
index fb299696c7c4..d804a6897f4b 100644
--- a/include/drm/drm_encoder.h
+++ b/include/drm/drm_encoder.h
@@ -191,11 +191,23 @@ int drm_encoder_init(struct drm_device *dev,
  * Given a registered encoder, return the index of that encoder within a DRM
  * device's list of encoders.
  */
-static inline unsigned int drm_encoder_index(struct drm_encoder *encoder)
+static inline unsigned int drm_encoder_index(const struct drm_encoder *encoder)
 {
 	return encoder->index;
 }
 
+/**
+ * drm_encoder_mask - find the mask of a registered encoder
+ * @encoder: encoder to find mask for
+ *
+ * Given a registered encoder, return the mask bit of that encoder for an
+ * encoder's possible_clones field.
+ */
+static inline uint32_t drm_encoder_mask(const struct drm_encoder *encoder)
+{
+	return 1 << drm_encoder_index(encoder);
+}
+
 /**
  * drm_encoder_crtc_ok - can a given crtc drive a given encoder?
  * @encoder: encoder to test
-- 
2.16.4

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

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 02/14] drm: Include the encoder itself in possible_clones
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
  2018-06-15 16:49 ` [PATCH 01/14] drm: Add drm_encoder_mask() Ville Syrjala
@ 2018-06-15 16:49 ` Ville Syrjala
  2018-06-15 16:49 ` [PATCH 03/14] drm/gma500: Sanitize possible_clones Ville Syrjala
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The docs say possible_clones should always include the encoder itself.
Since most drivers don't want to deal with the complexities of cloning
let's allow them to set possible_clones=0 and instead we'll fix that
up in the core.

We can't put this special case into drm_encoder_init() because drivers
will have to fill up possible_clones after adding all the relevant
encoders. Otherwise they wouldn't know the proper encoder indexes to
use. So we'll just do the fallback whenever someone wants to look
at possible_clones. Or maybe we could do it in the late register?

TODO: Should we add the bit even if possible_clones was otherwise
populated by the driver?

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_encoder.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c
index 273e1c59c54a..ad13c9cf4312 100644
--- a/drivers/gpu/drm/drm_encoder.c
+++ b/drivers/gpu/drm/drm_encoder.c
@@ -63,6 +63,19 @@ static const struct drm_prop_enum_list drm_encoder_enum_list[] = {
 	{ DRM_MODE_ENCODER_DPI, "DPI" },
 };
 
+/*
+ * For some reason we want the encoder itself included in
+ * possible_clones. Make life easy for drivers by allowing them
+ * to leave possible_clones unset if no cloning is possible.
+ */
+static u32 encoder_possible_clones(struct drm_encoder *encoder)
+{
+	if (encoder->possible_clones)
+		return encoder->possible_clones;
+	else
+		return drm_encoder_mask(encoder);
+}
+
 int drm_encoder_register_all(struct drm_device *dev)
 {
 	struct drm_encoder *encoder;
@@ -240,7 +253,7 @@ int drm_mode_getencoder(struct drm_device *dev, void *data,
 	enc_resp->encoder_id = encoder->base.id;
 	enc_resp->possible_crtcs = drm_lease_filter_crtcs(file_priv,
 							  encoder->possible_crtcs);
-	enc_resp->possible_clones = encoder->possible_clones;
+	enc_resp->possible_clones = encoder_possible_clones(encoder);
 
 	return 0;
 }
-- 
2.16.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 03/14] drm/gma500: Sanitize possible_clones
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
  2018-06-15 16:49 ` [PATCH 01/14] drm: Add drm_encoder_mask() Ville Syrjala
  2018-06-15 16:49 ` [PATCH 02/14] drm: Include the encoder itself in possible_clones Ville Syrjala
@ 2018-06-15 16:49 ` Ville Syrjala
  2018-06-15 16:49 ` [PATCH 04/14] drm/sti: Remove pointless casts Ville Syrjala
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

I double the DP+DP and SDVO+SDVO cloning works for this driver.
i915 at least doesn't do those. Truthfully there could be some very specific
circumstances where some of them would do doable, but genereally it's
too much pain to deal with so we've chose not to bother. Let's use the
same approach for gma500.

Also the LVDS+LVDS and DSI+DSI cases probably don't really exist as
there is one of each at most.

This does mean we'll now leave possible_clones at 0 for these encoder
types whereas previosuly we included the encoder itself in the bitmask.
But that's fine as the core now treaks 0 as a special case and adds
the encoder itself into the final bitmask reported to userspace.

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/gma500/framebuffer.c   | 16 ++++++++--------
 drivers/gpu/drm/gma500/mdfld_dsi_dpi.c |  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index 8fa4ef192c1e..4072dc3dfe23 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -606,31 +606,31 @@ static void psb_setup_outputs(struct drm_device *dev)
 			break;
 		case INTEL_OUTPUT_SDVO:
 			crtc_mask = dev_priv->ops->sdvo_mask;
-			clone_mask = (1 << INTEL_OUTPUT_SDVO);
+			clone_mask = 0;
 			break;
 		case INTEL_OUTPUT_LVDS:
-		        crtc_mask = dev_priv->ops->lvds_mask;
-			clone_mask = (1 << INTEL_OUTPUT_LVDS);
+			crtc_mask = dev_priv->ops->lvds_mask;
+			clone_mask = 0;
 			break;
 		case INTEL_OUTPUT_MIPI:
 			crtc_mask = (1 << 0);
-			clone_mask = (1 << INTEL_OUTPUT_MIPI);
+			clone_mask = 0;
 			break;
 		case INTEL_OUTPUT_MIPI2:
 			crtc_mask = (1 << 2);
-			clone_mask = (1 << INTEL_OUTPUT_MIPI2);
+			clone_mask = 0;
 			break;
 		case INTEL_OUTPUT_HDMI:
-		        crtc_mask = dev_priv->ops->hdmi_mask;
+			crtc_mask = dev_priv->ops->hdmi_mask;
 			clone_mask = (1 << INTEL_OUTPUT_HDMI);
 			break;
 		case INTEL_OUTPUT_DISPLAYPORT:
 			crtc_mask = (1 << 0) | (1 << 1);
-			clone_mask = (1 << INTEL_OUTPUT_DISPLAYPORT);
+			clone_mask = 0;
 			break;
 		case INTEL_OUTPUT_EDP:
 			crtc_mask = (1 << 1);
-			clone_mask = (1 << INTEL_OUTPUT_EDP);
+			clone_mask = 0;
 		}
 		encoder->possible_crtcs = crtc_mask;
 		encoder->possible_clones =
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
index a05c020602bd..94e362da3384 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
@@ -1004,10 +1004,10 @@ struct mdfld_dsi_encoder *mdfld_dsi_dpi_init(struct drm_device *dev,
 	/*set possible crtcs and clones*/
 	if (dsi_connector->pipe) {
 		encoder->possible_crtcs = (1 << 2);
-		encoder->possible_clones = (1 << 1);
+		encoder->possible_clones = 0;
 	} else {
 		encoder->possible_crtcs = (1 << 0);
-		encoder->possible_clones = (1 << 0);
+		encoder->possible_clones = 0;
 	}
 
 	dsi_connector->base.encoder = &dpi_output->base.base;
-- 
2.16.4

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

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 04/14] drm/sti: Remove pointless casts
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (2 preceding siblings ...)
  2018-06-15 16:49 ` [PATCH 03/14] drm/gma500: Sanitize possible_clones Ville Syrjala
@ 2018-06-15 16:49 ` Ville Syrjala
  2018-06-18  7:53   ` Benjamin Gaignard
  2018-06-15 16:49 ` [PATCH 05/14] drm/sti: Try to fix up the tvout possible clones Ville Syrjala
                   ` (15 subsequent siblings)
  19 siblings, 1 reply; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Vincent Abriou

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

There's no point in the cast for accessing the base class. Just
take the address of the struct instead.

Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/sti/sti_tvout.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index ea4a3b87fa55..7d495307fe79 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -665,7 +665,7 @@ sti_tvout_create_dvo_encoder(struct drm_device *dev,
 
 	encoder->tvout = tvout;
 
-	drm_encoder = (struct drm_encoder *)encoder;
+	drm_encoder = &encoder->encoder;
 
 	drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
 	drm_encoder->possible_clones = 1 << 0;
@@ -718,7 +718,7 @@ static struct drm_encoder *sti_tvout_create_hda_encoder(struct drm_device *dev,
 
 	encoder->tvout = tvout;
 
-	drm_encoder = (struct drm_encoder *) encoder;
+	drm_encoder = &encoder->encoder;
 
 	drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
 	drm_encoder->possible_clones = 1 << 0;
@@ -767,7 +767,7 @@ static struct drm_encoder *sti_tvout_create_hdmi_encoder(struct drm_device *dev,
 
 	encoder->tvout = tvout;
 
-	drm_encoder = (struct drm_encoder *) encoder;
+	drm_encoder = &encoder->encoder;
 
 	drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
 	drm_encoder->possible_clones = 1 << 1;
-- 
2.16.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 05/14] drm/sti: Try to fix up the tvout possible clones
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (3 preceding siblings ...)
  2018-06-15 16:49 ` [PATCH 04/14] drm/sti: Remove pointless casts Ville Syrjala
@ 2018-06-15 16:49 ` Ville Syrjala
  2018-06-18  8:16   ` Benjamin Gaignard
  2018-06-18 12:38   ` [PATCH v2 " Ville Syrjala
  2018-06-15 16:49 ` [PATCH 06/14] drm/exynos: Use drm_encoder_mask() Ville Syrjala
                   ` (14 subsequent siblings)
  19 siblings, 2 replies; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Vincent Abriou, Benjamin Gaignard

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The current possible_clones setup doesn't look sensible. I'm assuming
the 0 and 1 are supposed to refer to the indexes of the hdmi and hda
encoders? So it kinda looks like we want hda+hdmi cloning, but then
dvo also claims to be cloneable with hdmi, but hdmi won't recipricate.

So let's assume we just want hdmi+hda and nothing more and populate the
possible_clones to match. The docs say the encoder itself should always
be included in the possible_clones bitmask so we'll throw it in there
as well. For hda we'll leave possible_clones==0 and we'll add a global
fallback for that case to add the encoder itself to the bitmask since
that makes life easier for most drivers.

Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/sti/sti_tvout.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index 7d495307fe79..2359c111c7ed 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -668,7 +668,6 @@ sti_tvout_create_dvo_encoder(struct drm_device *dev,
 	drm_encoder = &encoder->encoder;
 
 	drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
-	drm_encoder->possible_clones = 1 << 0;
 
 	drm_encoder_init(dev, drm_encoder,
 			 &sti_tvout_encoder_funcs, DRM_MODE_ENCODER_LVDS,
@@ -721,7 +720,6 @@ static struct drm_encoder *sti_tvout_create_hda_encoder(struct drm_device *dev,
 	drm_encoder = &encoder->encoder;
 
 	drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
-	drm_encoder->possible_clones = 1 << 0;
 
 	drm_encoder_init(dev, drm_encoder,
 			&sti_tvout_encoder_funcs, DRM_MODE_ENCODER_DAC, NULL);
@@ -770,7 +768,6 @@ static struct drm_encoder *sti_tvout_create_hdmi_encoder(struct drm_device *dev,
 	drm_encoder = &encoder->encoder;
 
 	drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
-	drm_encoder->possible_clones = 1 << 1;
 
 	drm_encoder_init(dev, drm_encoder,
 			&sti_tvout_encoder_funcs, DRM_MODE_ENCODER_TMDS, NULL);
@@ -786,6 +783,12 @@ static void sti_tvout_create_encoders(struct drm_device *dev,
 	tvout->hdmi = sti_tvout_create_hdmi_encoder(dev, tvout);
 	tvout->hda = sti_tvout_create_hda_encoder(dev, tvout);
 	tvout->dvo = sti_tvout_create_dvo_encoder(dev, tvout);
+
+	/* FIXME what's the correct thing here? */
+	tvout->hdmi->possible_clones =
+		drm_encoder_mask(tvout->hdmi) | drm_encoder_mask(tvout->hda);
+	tvout->hda->possible_clones =
+		drm_encoder_mask(tvout->hdmi) | drm_encoder_mask(tvout->hda);
 }
 
 static void sti_tvout_destroy_encoders(struct sti_tvout *tvout)
-- 
2.16.4

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

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 06/14] drm/exynos: Use drm_encoder_mask()
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (4 preceding siblings ...)
  2018-06-15 16:49 ` [PATCH 05/14] drm/sti: Try to fix up the tvout possible clones Ville Syrjala
@ 2018-06-15 16:49 ` Ville Syrjala
  2018-06-15 16:49 ` [PATCH 07/14] drm/imx: Remove the bogus possible_clones setup Ville Syrjala
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: Kyungmin Park, intel-gfx, Seung-Woo Kim

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Replace the hand rolled encoder bitmask thing with drm_encoder_mask()

Cc: Inki Dae <inki.dae@samsung.com>
Cc: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index a81b4a5e24a7..f76ae48c1156 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -319,7 +319,7 @@ static int exynos_drm_bind(struct device *dev)
 	struct drm_encoder *encoder;
 	struct drm_device *drm;
 	unsigned int clone_mask;
-	int cnt, ret;
+	int ret;
 
 	drm = drm_dev_alloc(&exynos_drm_driver, dev);
 	if (IS_ERR(drm))
@@ -359,10 +359,9 @@ static int exynos_drm_bind(struct device *dev)
 	exynos_drm_mode_config_init(drm);
 
 	/* setup possible_clones. */
-	cnt = 0;
 	clone_mask = 0;
 	list_for_each_entry(encoder, &drm->mode_config.encoder_list, head)
-		clone_mask |= (1 << (cnt++));
+		clone_mask |= drm_encoder_mask(encoder);
 
 	list_for_each_entry(encoder, &drm->mode_config.encoder_list, head)
 		encoder->possible_clones = clone_mask;
-- 
2.16.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 07/14] drm/imx: Remove the bogus possible_clones setup
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (5 preceding siblings ...)
  2018-06-15 16:49 ` [PATCH 06/14] drm/exynos: Use drm_encoder_mask() Ville Syrjala
@ 2018-06-15 16:49 ` Ville Syrjala
  2018-06-15 16:49 ` [PATCH 08/14] drm: Validate encoder->possible_clones Ville Syrjala
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Philipp Zabel

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

dw_hdmi_imx_bind() does not call so the possible_clones mask being set
here is entirely bogus, not to mention the bits set for non-existent
encoders. Just clear possible_clones until someone fixes this properly.

Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/imx/imx-drm-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 1d053bbefc02..032cdc310a88 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -158,7 +158,7 @@ int imx_drm_encoder_parse_of(struct drm_device *drm,
 	encoder->possible_crtcs = crtc_mask;
 
 	/* FIXME: this is the mask of outputs which can clone this output. */
-	encoder->possible_clones = ~0;
+	encoder->possible_clones = 0;
 
 	return 0;
 }
-- 
2.16.4

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

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 08/14] drm: Validate encoder->possible_clones
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (6 preceding siblings ...)
  2018-06-15 16:49 ` [PATCH 07/14] drm/imx: Remove the bogus possible_clones setup Ville Syrjala
@ 2018-06-15 16:49 ` Ville Syrjala
  2018-06-15 16:49 ` [PATCH 09/14] drm/i915: Use drm_encoder_mask() Ville Syrjala
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Many drivers are populating encoder->possible_clones wrong. Let's
persuade them to get it right by adding some loud WARNs.

We'll cross check the bits between any two encoders. So either
both encoders can clone with the other, or neither can.

We'll also complain about effectively empty possible_clones, and
possible_clones containing bits for encoders that don't exist.

TODO: Or should we just silently filter out any bits for non-existing
encoders?

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_encoder.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c
index ad13c9cf4312..1c289b227bbc 100644
--- a/drivers/gpu/drm/drm_encoder.c
+++ b/drivers/gpu/drm/drm_encoder.c
@@ -76,12 +76,45 @@ static u32 encoder_possible_clones(struct drm_encoder *encoder)
 		return drm_encoder_mask(encoder);
 }
 
+static void validate_possible_clones(struct drm_encoder *encoder)
+{
+	u32 possible_clones = encoder_possible_clones(encoder);
+	struct drm_device *dev = encoder->dev;
+	struct drm_encoder *other;
+	u32 encoder_mask = 0;
+
+	drm_for_each_encoder(other, dev) {
+		u32 other_possible_clones = encoder_possible_clones(other);
+
+		encoder_mask |= drm_encoder_mask(other);
+
+		WARN(!(possible_clones & drm_encoder_mask(other)) !=
+		     !(other_possible_clones & drm_encoder_mask(encoder)),
+		     "possible_clones mismatch: "
+		     "[ENCODER:%d:%s] index=%d, possible_clones=0x%x vs. "
+		     "[ENCODER:%d:%s] index=%d possible_clones=0x%x\n",
+		     encoder->base.id, encoder->name,
+		     drm_encoder_index(encoder), possible_clones,
+		     other->base.id, other->name,
+		     drm_encoder_index(other), other_possible_clones);
+	}
+
+	WARN((possible_clones & drm_encoder_mask(encoder)) == 0 ||
+	     (possible_clones & ~encoder_mask) != 0,
+	     "Bogus possible_clones: "
+	     "[ENCODER:%d:%s] possible_clones=0x%x (full encoder mask=0x%x)\n",
+	     encoder->base.id, encoder->name,
+	     possible_clones, encoder_mask);
+}
+
 int drm_encoder_register_all(struct drm_device *dev)
 {
 	struct drm_encoder *encoder;
 	int ret = 0;
 
 	drm_for_each_encoder(encoder, dev) {
+		validate_possible_clones(encoder);
+
 		if (encoder->funcs->late_register)
 			ret = encoder->funcs->late_register(encoder);
 		if (ret)
-- 
2.16.4

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

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 09/14] drm/i915: Use drm_encoder_mask()
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (7 preceding siblings ...)
  2018-06-15 16:49 ` [PATCH 08/14] drm: Validate encoder->possible_clones Ville Syrjala
@ 2018-06-15 16:49 ` Ville Syrjala
  2018-06-15 16:49 ` [PATCH 10/14] drm/i915: Populate possible_crtcs correctly Ville Syrjala
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Replace the hand rolled stuff with drm_encoder_mask() when populating
possible_clones.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8251e189a8bb..b095899d68a9 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13950,13 +13950,10 @@ static int intel_encoder_clones(struct intel_encoder *encoder)
 	struct drm_device *dev = encoder->base.dev;
 	struct intel_encoder *source_encoder;
 	int index_mask = 0;
-	int entry = 0;
 
 	for_each_intel_encoder(dev, source_encoder) {
 		if (encoders_cloneable(encoder, source_encoder))
-			index_mask |= (1 << entry);
-
-		entry++;
+			index_mask |= drm_encoder_mask(&source_encoder->base);
 	}
 
 	return index_mask;
-- 
2.16.4

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

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 10/14] drm/i915: Populate possible_crtcs correctly
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (8 preceding siblings ...)
  2018-06-15 16:49 ` [PATCH 09/14] drm/i915: Use drm_encoder_mask() Ville Syrjala
@ 2018-06-15 16:49 ` Ville Syrjala
  2018-06-22  1:26   ` Dhinakaran Pandiyan
  2018-06-15 16:49 ` [PATCH 11/14] drm/i915: Fix DP-MST crtc_mask Ville Syrjala
                   ` (9 subsequent siblings)
  19 siblings, 1 reply; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Don't advertize non-exisiting crtcs in the encoder possible_crtcs
bitmask.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b095899d68a9..3fa9da714403 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13959,6 +13959,20 @@ static int intel_encoder_clones(struct intel_encoder *encoder)
 	return index_mask;
 }
 
+static int intel_encoder_crtcs(struct intel_encoder *encoder)
+{
+	struct drm_device *dev = encoder->base.dev;
+	struct intel_crtc *crtc;
+	int index_mask = 0;
+
+	for_each_intel_crtc(dev, crtc) {
+		if (encoder->crtc_mask & BIT(crtc->pipe))
+			index_mask |= drm_crtc_mask(&crtc->base);
+	}
+
+	return index_mask;
+}
+
 static bool has_edp_a(struct drm_i915_private *dev_priv)
 {
 	if (!IS_MOBILE(dev_priv))
@@ -14211,7 +14225,8 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 	intel_psr_init(dev_priv);
 
 	for_each_intel_encoder(&dev_priv->drm, encoder) {
-		encoder->base.possible_crtcs = encoder->crtc_mask;
+		encoder->base.possible_crtcs =
+			intel_encoder_crtcs(encoder);
 		encoder->base.possible_clones =
 			intel_encoder_clones(encoder);
 	}
-- 
2.16.4

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

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 11/14] drm/i915: Fix DP-MST crtc_mask
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (9 preceding siblings ...)
  2018-06-15 16:49 ` [PATCH 10/14] drm/i915: Populate possible_crtcs correctly Ville Syrjala
@ 2018-06-15 16:49 ` Ville Syrjala
  2018-06-15 18:33   ` Dhinakaran Pandiyan
  2018-06-15 16:49 ` [PATCH 12/14] drm/i915: Clean up encoder->crtc_mask setup Ville Syrjala
                   ` (8 subsequent siblings)
  19 siblings, 1 reply; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Each fake MST encoder is tied to a specific pipe. Fix the encoder's
crtc_mask to reflect that fact.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 5890500a3a8b..8e30765402b4 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -565,7 +565,7 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum
 	intel_encoder->type = INTEL_OUTPUT_DP_MST;
 	intel_encoder->power_domain = intel_dig_port->base.power_domain;
 	intel_encoder->port = intel_dig_port->base.port;
-	intel_encoder->crtc_mask = 0x7;
+	intel_encoder->crtc_mask = BIT(pipe);
 	intel_encoder->cloneable = 0;
 
 	intel_encoder->compute_config = intel_dp_mst_compute_config;
-- 
2.16.4

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

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 12/14] drm/i915: Clean up encoder->crtc_mask setup
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (10 preceding siblings ...)
  2018-06-15 16:49 ` [PATCH 11/14] drm/i915: Fix DP-MST crtc_mask Ville Syrjala
@ 2018-06-15 16:49 ` Ville Syrjala
  2018-06-18 18:27   ` Jani Nikula
  2018-06-15 16:49 ` [PATCH 13/14] drm/i915: Simplfy LVDS crtc_mask setup Ville Syrjala
                   ` (7 subsequent siblings)
  19 siblings, 1 reply; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Use BIT(pipe) for better legibility when populating the crtc_mask
for encoders.

Also remove the redundant possible_crtcs setup for the TV encoder.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_crt.c  | 4 ++--
 drivers/gpu/drm/i915/intel_ddi.c  | 2 +-
 drivers/gpu/drm/i915/intel_dp.c   | 6 +++---
 drivers/gpu/drm/i915/intel_dvo.c  | 2 +-
 drivers/gpu/drm/i915/intel_hdmi.c | 6 +++---
 drivers/gpu/drm/i915/intel_lvds.c | 6 +++---
 drivers/gpu/drm/i915/intel_sdvo.c | 2 +-
 drivers/gpu/drm/i915/intel_tv.c   | 3 +--
 8 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 95aa29cf2d9c..b6b1464a47b2 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -967,9 +967,9 @@ void intel_crt_init(struct drm_i915_private *dev_priv)
 	crt->base.type = INTEL_OUTPUT_ANALOG;
 	crt->base.cloneable = (1 << INTEL_OUTPUT_DVO) | (1 << INTEL_OUTPUT_HDMI);
 	if (IS_I830(dev_priv))
-		crt->base.crtc_mask = (1 << 0);
+		crt->base.crtc_mask = BIT(PIPE_A);
 	else
-		crt->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
+		crt->base.crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C);
 
 	if (IS_GEN2(dev_priv))
 		connector->interlace_allowed = 0;
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index ca73387bd596..0462d9b31f7d 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -3514,7 +3514,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 	intel_encoder->type = INTEL_OUTPUT_DDI;
 	intel_encoder->power_domain = intel_port_to_power_domain(port);
 	intel_encoder->port = port;
-	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
+	intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C);
 	intel_encoder->cloneable = 0;
 
 	if (INTEL_GEN(dev_priv) >= 11)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index a58bac01aeea..d983924ed69a 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -6474,11 +6474,11 @@ bool intel_dp_init(struct drm_i915_private *dev_priv,
 	intel_encoder->power_domain = intel_port_to_power_domain(port);
 	if (IS_CHERRYVIEW(dev_priv)) {
 		if (port == PORT_D)
-			intel_encoder->crtc_mask = 1 << 2;
+			intel_encoder->crtc_mask = BIT(PIPE_C);
 		else
-			intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
+			intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B);
 	} else {
-		intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
+		intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C);
 	}
 	intel_encoder->cloneable = 0;
 	intel_encoder->port = port;
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index 27f16db8953a..27c18680deb4 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -499,7 +499,7 @@ void intel_dvo_init(struct drm_i915_private *dev_priv)
 		intel_encoder->type = INTEL_OUTPUT_DVO;
 		intel_encoder->power_domain = POWER_DOMAIN_PORT_OTHER;
 		intel_encoder->port = port;
-		intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
+		intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B);
 
 		switch (dvo->type) {
 		case INTEL_DVO_CHIP_TMDS:
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 09d7d38f0d4e..666bcc1a4660 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -2405,11 +2405,11 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv,
 	intel_encoder->port = port;
 	if (IS_CHERRYVIEW(dev_priv)) {
 		if (port == PORT_D)
-			intel_encoder->crtc_mask = 1 << 2;
+			intel_encoder->crtc_mask = BIT(PIPE_C);
 		else
-			intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
+			intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B);
 	} else {
-		intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
+		intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C);
 	}
 	intel_encoder->cloneable = 1 << INTEL_OUTPUT_ANALOG;
 	/*
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index bb06744d28a4..753df8dd9a03 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -1085,11 +1085,11 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	intel_encoder->port = PORT_NONE;
 	intel_encoder->cloneable = 0;
 	if (HAS_PCH_SPLIT(dev_priv))
-		intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
+		intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C);
 	else if (IS_GEN4(dev_priv))
-		intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
+		intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B);
 	else
-		intel_encoder->crtc_mask = (1 << 1);
+		intel_encoder->crtc_mask = BIT(PIPE_B);
 
 	drm_connector_helper_add(connector, &intel_lvds_connector_helper_funcs);
 	connector->display_info.subpixel_order = SubPixelHorizontalRGB;
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index e6a64b3ecd91..ef540cf00373 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2741,7 +2741,7 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, uint16_t flags)
 			      bytes[0], bytes[1]);
 		return false;
 	}
-	intel_sdvo->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
+	intel_sdvo->base.crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C);
 
 	return true;
 }
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 24dc368fdaa1..7a68c132d08c 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1520,9 +1520,8 @@ intel_tv_init(struct drm_i915_private *dev_priv)
 	intel_encoder->type = INTEL_OUTPUT_TVOUT;
 	intel_encoder->power_domain = POWER_DOMAIN_PORT_OTHER;
 	intel_encoder->port = PORT_NONE;
-	intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
+	intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B);
 	intel_encoder->cloneable = 0;
-	intel_encoder->base.possible_crtcs = ((1 << 0) | (1 << 1));
 	intel_tv->type = DRM_MODE_CONNECTOR_Unknown;
 
 	/* BIOS margin values */
-- 
2.16.4

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

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 13/14] drm/i915: Simplfy LVDS crtc_mask setup
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (11 preceding siblings ...)
  2018-06-15 16:49 ` [PATCH 12/14] drm/i915: Clean up encoder->crtc_mask setup Ville Syrjala
@ 2018-06-15 16:49 ` Ville Syrjala
  2018-06-15 16:49 ` [PATCH 14/14] drm: Validate encoder->possible_crtcs Ville Syrjala
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We don't need to special case PCH vs. gen4 when setting up the LVDS
crtc_mask. Just claim pipes A|B|C work and intel_encoder_crtcs() drop
out any crtc that doesn't exist.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_lvds.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 753df8dd9a03..5b8a9d14edbe 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -1084,10 +1084,8 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	intel_encoder->power_domain = POWER_DOMAIN_PORT_OTHER;
 	intel_encoder->port = PORT_NONE;
 	intel_encoder->cloneable = 0;
-	if (HAS_PCH_SPLIT(dev_priv))
+	if (INTEL_GEN(dev_priv) >= 4)
 		intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C);
-	else if (IS_GEN4(dev_priv))
-		intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B);
 	else
 		intel_encoder->crtc_mask = BIT(PIPE_B);
 
-- 
2.16.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 14/14] drm: Validate encoder->possible_crtcs
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (12 preceding siblings ...)
  2018-06-15 16:49 ` [PATCH 13/14] drm/i915: Simplfy LVDS crtc_mask setup Ville Syrjala
@ 2018-06-15 16:49 ` Ville Syrjala
  2018-06-15 17:36 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Try to fix encoder possible_clones/crtcs Patchwork
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 32+ messages in thread
From: Ville Syrjala @ 2018-06-15 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

WARN if the encoder possible_crtcs is effectively empty or contains
bits for non-existing crtcs.

TODO: Or should we perhapst just filter out any bit for a
non-exisiting crtc?

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_encoder.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c
index 1c289b227bbc..cfe6e719ee2b 100644
--- a/drivers/gpu/drm/drm_encoder.c
+++ b/drivers/gpu/drm/drm_encoder.c
@@ -107,12 +107,30 @@ static void validate_possible_clones(struct drm_encoder *encoder)
 	     possible_clones, encoder_mask);
 }
 
+static void validate_possible_crtcs(struct drm_encoder *encoder)
+{
+	struct drm_device *dev = encoder->dev;
+	struct drm_crtc *crtc;
+	u32 crtc_mask = 0;
+
+	drm_for_each_crtc(crtc, dev)
+		crtc_mask |= drm_crtc_mask(crtc);
+
+	WARN((encoder->possible_crtcs & crtc_mask) == 0 ||
+	     (encoder->possible_crtcs & ~crtc_mask) != 0,
+	     "Bogus possible_crtcs: "
+	     "[ENCODER:%d:%s] possible_crtcs=0x%x (full crtc mask=0x%x)\n",
+	     encoder->base.id, encoder->name,
+	     encoder->possible_crtcs, crtc_mask);
+}
+
 int drm_encoder_register_all(struct drm_device *dev)
 {
 	struct drm_encoder *encoder;
 	int ret = 0;
 
 	drm_for_each_encoder(encoder, dev) {
+		validate_possible_crtcs(encoder);
 		validate_possible_clones(encoder);
 
 		if (encoder->funcs->late_register)
-- 
2.16.4

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

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for drm: Try to fix encoder possible_clones/crtcs
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (13 preceding siblings ...)
  2018-06-15 16:49 ` [PATCH 14/14] drm: Validate encoder->possible_crtcs Ville Syrjala
@ 2018-06-15 17:36 ` Patchwork
  2018-06-15 17:53 ` ✓ Fi.CI.BAT: success " Patchwork
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 32+ messages in thread
From: Patchwork @ 2018-06-15 17:36 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm: Try to fix encoder possible_clones/crtcs
URL   : https://patchwork.freedesktop.org/series/44848/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
a211728791ac drm: Add drm_encoder_mask()
bd9b5da2d267 drm: Include the encoder itself in possible_clones
d1e03d830ad9 drm/gma500: Sanitize possible_clones
-:10: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#10: 
i915 at least doesn't do those. Truthfully there could be some very specific

total: 0 errors, 1 warnings, 0 checks, 51 lines checked
5ed1e96a2eca drm/sti: Remove pointless casts
b882396cca5f drm/sti: Try to fix up the tvout possible clones
3fc064037602 drm/exynos: Use drm_encoder_mask()
d52e0c649b66 drm/imx: Remove the bogus possible_clones setup
eccb4f7387f5 drm: Validate encoder->possible_clones
81c7d42a18a0 drm/i915: Use drm_encoder_mask()
8bf8a86249e7 drm/i915: Populate possible_crtcs correctly
69707ce7bc90 drm/i915: Fix DP-MST crtc_mask
8774448a35fd drm/i915: Clean up encoder->crtc_mask setup
e9b3015d38d4 drm/i915: Simplfy LVDS crtc_mask setup
cc2dcc1b61ff drm: Validate encoder->possible_crtcs

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

^ permalink raw reply	[flat|nested] 32+ messages in thread

* ✓ Fi.CI.BAT: success for drm: Try to fix encoder possible_clones/crtcs
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (14 preceding siblings ...)
  2018-06-15 17:36 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Try to fix encoder possible_clones/crtcs Patchwork
@ 2018-06-15 17:53 ` Patchwork
  2018-06-16  5:41 ` ✗ Fi.CI.IGT: failure " Patchwork
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 32+ messages in thread
From: Patchwork @ 2018-06-15 17:53 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm: Try to fix encoder possible_clones/crtcs
URL   : https://patchwork.freedesktop.org/series/44848/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4325 -> Patchwork_9333 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/44848/revisions/1/mbox/

== Known issues ==

  Here are the changes found in Patchwork_9333 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@prime_vgem@basic-fence-flip:
      fi-ilk-650:         PASS -> FAIL (fdo#104008)

    
    ==== Possible fixes ====

    igt@kms_flip@basic-plain-flip:
      fi-glk-j4005:       DMESG-WARN (fdo#106097) -> PASS

    
  fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
  fdo#106097 https://bugs.freedesktop.org/show_bug.cgi?id=106097


== Participating hosts (43 -> 38) ==

  Missing    (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u 


== Build changes ==

    * Linux: CI_DRM_4325 -> Patchwork_9333

  CI_DRM_4325: 4275ebe85ad179007c49b7bcf78d340b7681871e @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4520: 91f5d4665b07f073c78abd3cd4b8e0e347dbf638 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_9333: cc2dcc1b61ff79080ecb39d29b20384fdb062873 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

cc2dcc1b61ff drm: Validate encoder->possible_crtcs
e9b3015d38d4 drm/i915: Simplfy LVDS crtc_mask setup
8774448a35fd drm/i915: Clean up encoder->crtc_mask setup
69707ce7bc90 drm/i915: Fix DP-MST crtc_mask
8bf8a86249e7 drm/i915: Populate possible_crtcs correctly
81c7d42a18a0 drm/i915: Use drm_encoder_mask()
eccb4f7387f5 drm: Validate encoder->possible_clones
d52e0c649b66 drm/imx: Remove the bogus possible_clones setup
3fc064037602 drm/exynos: Use drm_encoder_mask()
b882396cca5f drm/sti: Try to fix up the tvout possible clones
5ed1e96a2eca drm/sti: Remove pointless casts
d1e03d830ad9 drm/gma500: Sanitize possible_clones
bd9b5da2d267 drm: Include the encoder itself in possible_clones
a211728791ac drm: Add drm_encoder_mask()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9333/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 11/14] drm/i915: Fix DP-MST crtc_mask
  2018-06-15 16:49 ` [PATCH 11/14] drm/i915: Fix DP-MST crtc_mask Ville Syrjala
@ 2018-06-15 18:33   ` Dhinakaran Pandiyan
  2018-06-15 18:43     ` Ville Syrjälä
  0 siblings, 1 reply; 32+ messages in thread
From: Dhinakaran Pandiyan @ 2018-06-15 18:33 UTC (permalink / raw)
  To: Ville Syrjala, dri-devel; +Cc: intel-gfx

On Fri, 2018-06-15 at 19:49 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Each fake MST encoder is tied to a specific pipe. Fix the encoder's
> crtc_mask to reflect that fact.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c
> b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 5890500a3a8b..8e30765402b4 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -565,7 +565,7 @@ intel_dp_create_fake_mst_encoder(struct
> intel_digital_port *intel_dig_port, enum
>  	intel_encoder->type = INTEL_OUTPUT_DP_MST;
>  	intel_encoder->power_domain = intel_dig_port-
> >base.power_domain;
>  	intel_encoder->port = intel_dig_port->base.port;
> -	intel_encoder->crtc_mask = 0x7;
> +	intel_encoder->crtc_mask = BIT(pipe);

How did this not cause any problems? Does this mean this field was/is
unused?
Disclaimer: I didn't look at the whole series.

>  	intel_encoder->cloneable = 0;
>  
>  	intel_encoder->compute_config = intel_dp_mst_compute_config;
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 11/14] drm/i915: Fix DP-MST crtc_mask
  2018-06-15 18:33   ` Dhinakaran Pandiyan
@ 2018-06-15 18:43     ` Ville Syrjälä
  2018-06-22  0:36       ` [Intel-gfx] " Dhinakaran Pandiyan
  0 siblings, 1 reply; 32+ messages in thread
From: Ville Syrjälä @ 2018-06-15 18:43 UTC (permalink / raw)
  To: Dhinakaran Pandiyan; +Cc: intel-gfx, dri-devel

On Fri, Jun 15, 2018 at 11:33:01AM -0700, Dhinakaran Pandiyan wrote:
> On Fri, 2018-06-15 at 19:49 +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Each fake MST encoder is tied to a specific pipe. Fix the encoder's
> > crtc_mask to reflect that fact.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c
> > b/drivers/gpu/drm/i915/intel_dp_mst.c
> > index 5890500a3a8b..8e30765402b4 100644
> > --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> > @@ -565,7 +565,7 @@ intel_dp_create_fake_mst_encoder(struct
> > intel_digital_port *intel_dig_port, enum
> >  	intel_encoder->type = INTEL_OUTPUT_DP_MST;
> >  	intel_encoder->power_domain = intel_dig_port-
> > >base.power_domain;
> >  	intel_encoder->port = intel_dig_port->base.port;
> > -	intel_encoder->crtc_mask = 0x7;
> > +	intel_encoder->crtc_mask = BIT(pipe);
> 
> How did this not cause any problems? Does this mean this field was/is
> unused?

This is a hint to userspace. So userspace would pick the connector
and crtc based on the hints, and then the kernel gets to pick the
actual encoder. In this case the bogus hint was good enough to tell
userspace that it can pick any crtc for any MST connector.

Hmm. Why on earth do we have .atomic_best_encoder() and .best_encoder()
for MST? The fb_helper appears to want to use the non-atomic one for
some reason... On boy, I guess I'll need to do something about that.
As is this patch would probably break it :(

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

^ permalink raw reply	[flat|nested] 32+ messages in thread

* ✗ Fi.CI.IGT: failure for drm: Try to fix encoder possible_clones/crtcs
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (15 preceding siblings ...)
  2018-06-15 17:53 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2018-06-16  5:41 ` Patchwork
  2018-06-18 12:45 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Try to fix encoder possible_clones/crtcs (rev2) Patchwork
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 32+ messages in thread
From: Patchwork @ 2018-06-16  5:41 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: drm: Try to fix encoder possible_clones/crtcs
URL   : https://patchwork.freedesktop.org/series/44848/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_4325_full -> Patchwork_9333_full =

== Summary - FAILURE ==

  Serious unknown changes coming with Patchwork_9333_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_9333_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  

== Possible new issues ==

  Here are the unknown changes that may have been introduced in Patchwork_9333_full:

  === IGT changes ===

    ==== Possible regressions ====

    igt@drv_selftest@live_hangcheck:
      shard-kbl:          PASS -> DMESG-FAIL

    
    ==== Warnings ====

    igt@drv_selftest@live_execlists:
      shard-apl:          SKIP -> PASS +1

    igt@gem_exec_schedule@deep-render:
      shard-kbl:          SKIP -> PASS

    
== Known issues ==

  Here are the changes found in Patchwork_9333_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_gtt:
      shard-kbl:          PASS -> FAIL (fdo#105347)

    igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
      shard-glk:          PASS -> FAIL (fdo#105189)

    igt@kms_flip@2x-modeset-vs-vblank-race-interruptible:
      shard-glk:          PASS -> FAIL (fdo#103060)

    igt@kms_setmode@basic:
      shard-apl:          PASS -> FAIL (fdo#99912)

    
    ==== Possible fixes ====

    igt@drv_selftest@live_hangcheck:
      shard-apl:          DMESG-FAIL -> PASS
      shard-glk:          DMESG-FAIL -> PASS

    igt@kms_atomic_transition@1x-modeset-transitions-nonblocking:
      shard-glk:          FAIL (fdo#105703) -> PASS

    igt@kms_flip@flip-vs-expired-vblank-interruptible:
      shard-glk:          FAIL (fdo#105363) -> PASS

    igt@kms_flip_tiling@flip-to-x-tiled:
      shard-glk:          FAIL (fdo#103822, fdo#104724) -> PASS

    igt@kms_flip_tiling@flip-x-tiled:
      shard-glk:          FAIL (fdo#104724) -> PASS

    igt@kms_setmode@basic:
      shard-kbl:          FAIL (fdo#99912) -> PASS

    igt@kms_vblank@pipe-c-accuracy-idle:
      shard-glk:          FAIL (fdo#102583) -> PASS

    
  fdo#102583 https://bugs.freedesktop.org/show_bug.cgi?id=102583
  fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
  fdo#103822 https://bugs.freedesktop.org/show_bug.cgi?id=103822
  fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
  fdo#105189 https://bugs.freedesktop.org/show_bug.cgi?id=105189
  fdo#105347 https://bugs.freedesktop.org/show_bug.cgi?id=105347
  fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
  fdo#105703 https://bugs.freedesktop.org/show_bug.cgi?id=105703
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * Linux: CI_DRM_4325 -> Patchwork_9333

  CI_DRM_4325: 4275ebe85ad179007c49b7bcf78d340b7681871e @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4520: 91f5d4665b07f073c78abd3cd4b8e0e347dbf638 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_9333: cc2dcc1b61ff79080ecb39d29b20384fdb062873 @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9333/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 04/14] drm/sti: Remove pointless casts
  2018-06-15 16:49 ` [PATCH 04/14] drm/sti: Remove pointless casts Ville Syrjala
@ 2018-06-18  7:53   ` Benjamin Gaignard
  0 siblings, 0 replies; 32+ messages in thread
From: Benjamin Gaignard @ 2018-06-18  7:53 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: Intel Graphics Development, Vincent Abriou, dri-devel

2018-06-15 18:49 GMT+02:00 Ville Syrjala <ville.syrjala@linux.intel.com>:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> There's no point in the cast for accessing the base class. Just
> take the address of the struct instead.
>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Vincent Abriou <vincent.abriou@st.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

Thanks.

> ---
>  drivers/gpu/drm/sti/sti_tvout.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
> index ea4a3b87fa55..7d495307fe79 100644
> --- a/drivers/gpu/drm/sti/sti_tvout.c
> +++ b/drivers/gpu/drm/sti/sti_tvout.c
> @@ -665,7 +665,7 @@ sti_tvout_create_dvo_encoder(struct drm_device *dev,
>
>         encoder->tvout = tvout;
>
> -       drm_encoder = (struct drm_encoder *)encoder;
> +       drm_encoder = &encoder->encoder;
>
>         drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
>         drm_encoder->possible_clones = 1 << 0;
> @@ -718,7 +718,7 @@ static struct drm_encoder *sti_tvout_create_hda_encoder(struct drm_device *dev,
>
>         encoder->tvout = tvout;
>
> -       drm_encoder = (struct drm_encoder *) encoder;
> +       drm_encoder = &encoder->encoder;
>
>         drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
>         drm_encoder->possible_clones = 1 << 0;
> @@ -767,7 +767,7 @@ static struct drm_encoder *sti_tvout_create_hdmi_encoder(struct drm_device *dev,
>
>         encoder->tvout = tvout;
>
> -       drm_encoder = (struct drm_encoder *) encoder;
> +       drm_encoder = &encoder->encoder;
>
>         drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
>         drm_encoder->possible_clones = 1 << 1;
> --
> 2.16.4
>



-- 
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 05/14] drm/sti: Try to fix up the tvout possible clones
  2018-06-15 16:49 ` [PATCH 05/14] drm/sti: Try to fix up the tvout possible clones Ville Syrjala
@ 2018-06-18  8:16   ` Benjamin Gaignard
  2018-06-18 12:38   ` [PATCH v2 " Ville Syrjala
  1 sibling, 0 replies; 32+ messages in thread
From: Benjamin Gaignard @ 2018-06-18  8:16 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: Intel Graphics Development, Vincent Abriou, dri-devel

2018-06-15 18:49 GMT+02:00 Ville Syrjala <ville.syrjala@linux.intel.com>:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> The current possible_clones setup doesn't look sensible. I'm assuming
> the 0 and 1 are supposed to refer to the indexes of the hdmi and hda
> encoders? So it kinda looks like we want hda+hdmi cloning, but then
> dvo also claims to be cloneable with hdmi, but hdmi won't recipricate.

All cloning combinaisons are possible: hdmi+hda, hda+dvo, hdmi+dvo.
The correct solution should be:
possible_clones = drm_encoder_mask(tvout->hdmi) |
drm_encoder_mask(tvout->hda) | drm_encoder_mask(tvout->dvo);

Thanks,
Benjamin

>
> So let's assume we just want hdmi+hda and nothing more and populate the
> possible_clones to match. The docs say the encoder itself should always
> be included in the possible_clones bitmask so we'll throw it in there
> as well. For hda we'll leave possible_clones==0 and we'll add a global
> fallback for that case to add the encoder itself to the bitmask since
> that makes life easier for most drivers.
>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Vincent Abriou <vincent.abriou@st.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/sti/sti_tvout.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
> index 7d495307fe79..2359c111c7ed 100644
> --- a/drivers/gpu/drm/sti/sti_tvout.c
> +++ b/drivers/gpu/drm/sti/sti_tvout.c
> @@ -668,7 +668,6 @@ sti_tvout_create_dvo_encoder(struct drm_device *dev,
>         drm_encoder = &encoder->encoder;
>
>         drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
> -       drm_encoder->possible_clones = 1 << 0;
>
>         drm_encoder_init(dev, drm_encoder,
>                          &sti_tvout_encoder_funcs, DRM_MODE_ENCODER_LVDS,
> @@ -721,7 +720,6 @@ static struct drm_encoder *sti_tvout_create_hda_encoder(struct drm_device *dev,
>         drm_encoder = &encoder->encoder;
>
>         drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
> -       drm_encoder->possible_clones = 1 << 0;
>
>         drm_encoder_init(dev, drm_encoder,
>                         &sti_tvout_encoder_funcs, DRM_MODE_ENCODER_DAC, NULL);
> @@ -770,7 +768,6 @@ static struct drm_encoder *sti_tvout_create_hdmi_encoder(struct drm_device *dev,
>         drm_encoder = &encoder->encoder;
>
>         drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
> -       drm_encoder->possible_clones = 1 << 1;
>
>         drm_encoder_init(dev, drm_encoder,
>                         &sti_tvout_encoder_funcs, DRM_MODE_ENCODER_TMDS, NULL);
> @@ -786,6 +783,12 @@ static void sti_tvout_create_encoders(struct drm_device *dev,
>         tvout->hdmi = sti_tvout_create_hdmi_encoder(dev, tvout);
>         tvout->hda = sti_tvout_create_hda_encoder(dev, tvout);
>         tvout->dvo = sti_tvout_create_dvo_encoder(dev, tvout);
> +
> +       /* FIXME what's the correct thing here? */
> +       tvout->hdmi->possible_clones =
> +               drm_encoder_mask(tvout->hdmi) | drm_encoder_mask(tvout->hda);
> +       tvout->hda->possible_clones =
> +               drm_encoder_mask(tvout->hdmi) | drm_encoder_mask(tvout->hda);
>  }
>
>  static void sti_tvout_destroy_encoders(struct sti_tvout *tvout)
> --
> 2.16.4
>



-- 
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH v2 05/14] drm/sti: Try to fix up the tvout possible clones
  2018-06-15 16:49 ` [PATCH 05/14] drm/sti: Try to fix up the tvout possible clones Ville Syrjala
  2018-06-18  8:16   ` Benjamin Gaignard
@ 2018-06-18 12:38   ` Ville Syrjala
  2018-06-20  9:02     ` Benjamin Gaignard
  1 sibling, 1 reply; 32+ messages in thread
From: Ville Syrjala @ 2018-06-18 12:38 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Vincent Abriou

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The current possible_clones setup doesn't look sensible. I'm assuming
the 0 and 1 are supposed to refer to the indexes of the hdmi and hda
encoders? So it kinda looks like we want hda+hdmi cloning, but then
dvo also claims to be cloneable with hdmi, but hdmi won't recipricate.

Benjamin tells me all encoders should be cloneable with each other,
so let's fix up the masks to indicate that.

Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/sti/sti_tvout.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index 7d495307fe79..8bca519b3bfe 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -668,7 +668,6 @@ sti_tvout_create_dvo_encoder(struct drm_device *dev,
 	drm_encoder = &encoder->encoder;
 
 	drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
-	drm_encoder->possible_clones = 1 << 0;
 
 	drm_encoder_init(dev, drm_encoder,
 			 &sti_tvout_encoder_funcs, DRM_MODE_ENCODER_LVDS,
@@ -721,7 +720,6 @@ static struct drm_encoder *sti_tvout_create_hda_encoder(struct drm_device *dev,
 	drm_encoder = &encoder->encoder;
 
 	drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
-	drm_encoder->possible_clones = 1 << 0;
 
 	drm_encoder_init(dev, drm_encoder,
 			&sti_tvout_encoder_funcs, DRM_MODE_ENCODER_DAC, NULL);
@@ -770,7 +768,6 @@ static struct drm_encoder *sti_tvout_create_hdmi_encoder(struct drm_device *dev,
 	drm_encoder = &encoder->encoder;
 
 	drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
-	drm_encoder->possible_clones = 1 << 1;
 
 	drm_encoder_init(dev, drm_encoder,
 			&sti_tvout_encoder_funcs, DRM_MODE_ENCODER_TMDS, NULL);
@@ -786,6 +783,13 @@ static void sti_tvout_create_encoders(struct drm_device *dev,
 	tvout->hdmi = sti_tvout_create_hdmi_encoder(dev, tvout);
 	tvout->hda = sti_tvout_create_hda_encoder(dev, tvout);
 	tvout->dvo = sti_tvout_create_dvo_encoder(dev, tvout);
+
+	tvout->hdmi->possible_clones = drm_encoder_mask(tvout->hdmi) |
+		drm_encoder_mask(tvout->hda) | drm_encoder_mask(tvout->dvo);
+	tvout->hda->possible_clones = drm_encoder_mask(tvout->hdmi) |
+		drm_encoder_mask(tvout->hda) | drm_encoder_mask(tvout->dvo);
+	tvout->dvo->possible_clones = drm_encoder_mask(tvout->hdmi) |
+		drm_encoder_mask(tvout->hda) | drm_encoder_mask(tvout->dvo);
 }
 
 static void sti_tvout_destroy_encoders(struct sti_tvout *tvout)
-- 
2.16.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for drm: Try to fix encoder possible_clones/crtcs (rev2)
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (16 preceding siblings ...)
  2018-06-16  5:41 ` ✗ Fi.CI.IGT: failure " Patchwork
@ 2018-06-18 12:45 ` Patchwork
  2018-06-18 13:02 ` ✓ Fi.CI.BAT: success " Patchwork
  2018-06-18 17:07 ` ✓ Fi.CI.IGT: " Patchwork
  19 siblings, 0 replies; 32+ messages in thread
From: Patchwork @ 2018-06-18 12:45 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm: Try to fix encoder possible_clones/crtcs (rev2)
URL   : https://patchwork.freedesktop.org/series/44848/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
3006d0e17c54 drm: Add drm_encoder_mask()
a610ab10aea4 drm: Include the encoder itself in possible_clones
eae1fc52497d drm/gma500: Sanitize possible_clones
-:10: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#10: 
i915 at least doesn't do those. Truthfully there could be some very specific

total: 0 errors, 1 warnings, 0 checks, 51 lines checked
2a97e6dc397a drm/sti: Remove pointless casts
651aafd32889 drm/sti: Try to fix up the tvout possible clones
c9d2398f8ca3 drm/exynos: Use drm_encoder_mask()
e27809347273 drm/imx: Remove the bogus possible_clones setup
d6c79671aca4 drm: Validate encoder->possible_clones
15dc5f6a09c2 drm/i915: Use drm_encoder_mask()
0a51f88f7a37 drm/i915: Populate possible_crtcs correctly
46d63ba9a949 drm/i915: Fix DP-MST crtc_mask
24ad65a02b7e drm/i915: Clean up encoder->crtc_mask setup
ed39c3f62c9c drm/i915: Simplfy LVDS crtc_mask setup
0674e5f40f99 drm: Validate encoder->possible_crtcs

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

^ permalink raw reply	[flat|nested] 32+ messages in thread

* ✓ Fi.CI.BAT: success for drm: Try to fix encoder possible_clones/crtcs (rev2)
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (17 preceding siblings ...)
  2018-06-18 12:45 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Try to fix encoder possible_clones/crtcs (rev2) Patchwork
@ 2018-06-18 13:02 ` Patchwork
  2018-06-18 17:07 ` ✓ Fi.CI.IGT: " Patchwork
  19 siblings, 0 replies; 32+ messages in thread
From: Patchwork @ 2018-06-18 13:02 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm: Try to fix encoder possible_clones/crtcs (rev2)
URL   : https://patchwork.freedesktop.org/series/44848/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4334 -> Patchwork_9352 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/44848/revisions/2/mbox/

== Known issues ==

  Here are the changes found in Patchwork_9352 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_suspend@basic-s4-devices:
      fi-kbl-7500u:       PASS -> DMESG-WARN (fdo#105128)

    igt@kms_flip@basic-flip-vs-dpms:
      fi-glk-j4005:       PASS -> DMESG-WARN (fdo#106000, fdo#106097)

    igt@kms_flip@basic-flip-vs-modeset:
      fi-skl-6700hq:      PASS -> DMESG-WARN (fdo#105998)

    
    ==== Possible fixes ====

    igt@gem_ctx_create@basic-files:
      fi-kbl-guc:         DMESG-WARN -> PASS

    igt@gem_ctx_switch@basic-default-heavy:
      fi-glk-j4005:       DMESG-WARN (fdo#105719, fdo#106745) -> PASS

    igt@kms_flip@basic-flip-vs-modeset:
      fi-glk-j4005:       DMESG-WARN (fdo#106000, fdo#106097) -> PASS

    igt@kms_flip@basic-plain-flip:
      fi-glk-j4005:       DMESG-WARN (fdo#106097) -> PASS

    igt@kms_pipe_crc_basic@read-crc-pipe-c-frame-sequence:
      fi-glk-j4005:       DMESG-WARN (fdo#106238) -> PASS

    
  fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128
  fdo#105719 https://bugs.freedesktop.org/show_bug.cgi?id=105719
  fdo#105998 https://bugs.freedesktop.org/show_bug.cgi?id=105998
  fdo#106000 https://bugs.freedesktop.org/show_bug.cgi?id=106000
  fdo#106097 https://bugs.freedesktop.org/show_bug.cgi?id=106097
  fdo#106238 https://bugs.freedesktop.org/show_bug.cgi?id=106238
  fdo#106745 https://bugs.freedesktop.org/show_bug.cgi?id=106745


== Participating hosts (42 -> 38) ==

  Additional (1): fi-ilk-650 
  Missing    (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u 


== Build changes ==

    * Linux: CI_DRM_4334 -> Patchwork_9352

  CI_DRM_4334: e2635b9253c80ae63fcea5b3382351aa34e5f056 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4523: 778497e7965dc8662c770a89ebbd741778feb71e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_9352: 0674e5f40f9980a1a9042f70d454e0c97a7169b1 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

0674e5f40f99 drm: Validate encoder->possible_crtcs
ed39c3f62c9c drm/i915: Simplfy LVDS crtc_mask setup
24ad65a02b7e drm/i915: Clean up encoder->crtc_mask setup
46d63ba9a949 drm/i915: Fix DP-MST crtc_mask
0a51f88f7a37 drm/i915: Populate possible_crtcs correctly
15dc5f6a09c2 drm/i915: Use drm_encoder_mask()
d6c79671aca4 drm: Validate encoder->possible_clones
e27809347273 drm/imx: Remove the bogus possible_clones setup
c9d2398f8ca3 drm/exynos: Use drm_encoder_mask()
651aafd32889 drm/sti: Try to fix up the tvout possible clones
2a97e6dc397a drm/sti: Remove pointless casts
eae1fc52497d drm/gma500: Sanitize possible_clones
a610ab10aea4 drm: Include the encoder itself in possible_clones
3006d0e17c54 drm: Add drm_encoder_mask()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9352/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* ✓ Fi.CI.IGT: success for drm: Try to fix encoder possible_clones/crtcs (rev2)
  2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
                   ` (18 preceding siblings ...)
  2018-06-18 13:02 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2018-06-18 17:07 ` Patchwork
  19 siblings, 0 replies; 32+ messages in thread
From: Patchwork @ 2018-06-18 17:07 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: drm: Try to fix encoder possible_clones/crtcs (rev2)
URL   : https://patchwork.freedesktop.org/series/44848/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4334_full -> Patchwork_9352_full =

== Summary - WARNING ==

  Minor unknown changes coming with Patchwork_9352_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_9352_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  

== Possible new issues ==

  Here are the unknown changes that may have been introduced in Patchwork_9352_full:

  === IGT changes ===

    ==== Warnings ====

    igt@gem_mocs_settings@mocs-rc6-blt:
      shard-kbl:          SKIP -> PASS

    
== Known issues ==

  Here are the changes found in Patchwork_9352_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_hangcheck:
      shard-kbl:          PASS -> DMESG-FAIL (fdo#106947)

    igt@gem_wait@await-default:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@kms_flip_tiling@flip-to-y-tiled:
      shard-glk:          PASS -> FAIL (fdo#104724)

    
    ==== Possible fixes ====

    igt@drv_selftest@live_gtt:
      shard-glk:          FAIL (fdo#105347) -> PASS

    igt@drv_selftest@live_hangcheck:
      shard-glk:          DMESG-FAIL (fdo#106947) -> PASS

    igt@kms_flip@2x-plain-flip-ts-check-interruptible:
      shard-glk:          FAIL (fdo#100368) -> PASS +2

    igt@kms_flip_tiling@flip-x-tiled:
      shard-glk:          FAIL (fdo#104724) -> PASS

    igt@kms_setmode@basic:
      shard-apl:          FAIL (fdo#99912) -> PASS
      shard-kbl:          FAIL (fdo#99912) -> PASS

    
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
  fdo#105347 https://bugs.freedesktop.org/show_bug.cgi?id=105347
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#106947 https://bugs.freedesktop.org/show_bug.cgi?id=106947
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * Linux: CI_DRM_4334 -> Patchwork_9352

  CI_DRM_4334: e2635b9253c80ae63fcea5b3382351aa34e5f056 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4523: 778497e7965dc8662c770a89ebbd741778feb71e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_9352: 0674e5f40f9980a1a9042f70d454e0c97a7169b1 @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9352/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 12/14] drm/i915: Clean up encoder->crtc_mask setup
  2018-06-15 16:49 ` [PATCH 12/14] drm/i915: Clean up encoder->crtc_mask setup Ville Syrjala
@ 2018-06-18 18:27   ` Jani Nikula
  0 siblings, 0 replies; 32+ messages in thread
From: Jani Nikula @ 2018-06-18 18:27 UTC (permalink / raw)
  To: Ville Syrjala, dri-devel; +Cc: intel-gfx

On Fri, 15 Jun 2018, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Use BIT(pipe) for better legibility when populating the crtc_mask
> for encoders.
>
> Also remove the redundant possible_crtcs setup for the TV encoder.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


> ---
>  drivers/gpu/drm/i915/intel_crt.c  | 4 ++--
>  drivers/gpu/drm/i915/intel_ddi.c  | 2 +-
>  drivers/gpu/drm/i915/intel_dp.c   | 6 +++---
>  drivers/gpu/drm/i915/intel_dvo.c  | 2 +-
>  drivers/gpu/drm/i915/intel_hdmi.c | 6 +++---
>  drivers/gpu/drm/i915/intel_lvds.c | 6 +++---
>  drivers/gpu/drm/i915/intel_sdvo.c | 2 +-
>  drivers/gpu/drm/i915/intel_tv.c   | 3 +--
>  8 files changed, 15 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index 95aa29cf2d9c..b6b1464a47b2 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -967,9 +967,9 @@ void intel_crt_init(struct drm_i915_private *dev_priv)
>  	crt->base.type = INTEL_OUTPUT_ANALOG;
>  	crt->base.cloneable = (1 << INTEL_OUTPUT_DVO) | (1 << INTEL_OUTPUT_HDMI);
>  	if (IS_I830(dev_priv))
> -		crt->base.crtc_mask = (1 << 0);
> +		crt->base.crtc_mask = BIT(PIPE_A);
>  	else
> -		crt->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
> +		crt->base.crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C);
>  
>  	if (IS_GEN2(dev_priv))
>  		connector->interlace_allowed = 0;
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index ca73387bd596..0462d9b31f7d 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -3514,7 +3514,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  	intel_encoder->type = INTEL_OUTPUT_DDI;
>  	intel_encoder->power_domain = intel_port_to_power_domain(port);
>  	intel_encoder->port = port;
> -	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
> +	intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C);
>  	intel_encoder->cloneable = 0;
>  
>  	if (INTEL_GEN(dev_priv) >= 11)
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index a58bac01aeea..d983924ed69a 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -6474,11 +6474,11 @@ bool intel_dp_init(struct drm_i915_private *dev_priv,
>  	intel_encoder->power_domain = intel_port_to_power_domain(port);
>  	if (IS_CHERRYVIEW(dev_priv)) {
>  		if (port == PORT_D)
> -			intel_encoder->crtc_mask = 1 << 2;
> +			intel_encoder->crtc_mask = BIT(PIPE_C);
>  		else
> -			intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
> +			intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B);
>  	} else {
> -		intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
> +		intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C);
>  	}
>  	intel_encoder->cloneable = 0;
>  	intel_encoder->port = port;
> diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
> index 27f16db8953a..27c18680deb4 100644
> --- a/drivers/gpu/drm/i915/intel_dvo.c
> +++ b/drivers/gpu/drm/i915/intel_dvo.c
> @@ -499,7 +499,7 @@ void intel_dvo_init(struct drm_i915_private *dev_priv)
>  		intel_encoder->type = INTEL_OUTPUT_DVO;
>  		intel_encoder->power_domain = POWER_DOMAIN_PORT_OTHER;
>  		intel_encoder->port = port;
> -		intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
> +		intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B);
>  
>  		switch (dvo->type) {
>  		case INTEL_DVO_CHIP_TMDS:
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 09d7d38f0d4e..666bcc1a4660 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -2405,11 +2405,11 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv,
>  	intel_encoder->port = port;
>  	if (IS_CHERRYVIEW(dev_priv)) {
>  		if (port == PORT_D)
> -			intel_encoder->crtc_mask = 1 << 2;
> +			intel_encoder->crtc_mask = BIT(PIPE_C);
>  		else
> -			intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
> +			intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B);
>  	} else {
> -		intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
> +		intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C);
>  	}
>  	intel_encoder->cloneable = 1 << INTEL_OUTPUT_ANALOG;
>  	/*
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index bb06744d28a4..753df8dd9a03 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -1085,11 +1085,11 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
>  	intel_encoder->port = PORT_NONE;
>  	intel_encoder->cloneable = 0;
>  	if (HAS_PCH_SPLIT(dev_priv))
> -		intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
> +		intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C);
>  	else if (IS_GEN4(dev_priv))
> -		intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
> +		intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B);
>  	else
> -		intel_encoder->crtc_mask = (1 << 1);
> +		intel_encoder->crtc_mask = BIT(PIPE_B);
>  
>  	drm_connector_helper_add(connector, &intel_lvds_connector_helper_funcs);
>  	connector->display_info.subpixel_order = SubPixelHorizontalRGB;
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index e6a64b3ecd91..ef540cf00373 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -2741,7 +2741,7 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, uint16_t flags)
>  			      bytes[0], bytes[1]);
>  		return false;
>  	}
> -	intel_sdvo->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
> +	intel_sdvo->base.crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C);
>  
>  	return true;
>  }
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index 24dc368fdaa1..7a68c132d08c 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -1520,9 +1520,8 @@ intel_tv_init(struct drm_i915_private *dev_priv)
>  	intel_encoder->type = INTEL_OUTPUT_TVOUT;
>  	intel_encoder->power_domain = POWER_DOMAIN_PORT_OTHER;
>  	intel_encoder->port = PORT_NONE;
> -	intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
> +	intel_encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B);
>  	intel_encoder->cloneable = 0;
> -	intel_encoder->base.possible_crtcs = ((1 << 0) | (1 << 1));
>  	intel_tv->type = DRM_MODE_CONNECTOR_Unknown;
>  
>  	/* BIOS margin values */

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v2 05/14] drm/sti: Try to fix up the tvout possible clones
  2018-06-18 12:38   ` [PATCH v2 " Ville Syrjala
@ 2018-06-20  9:02     ` Benjamin Gaignard
  0 siblings, 0 replies; 32+ messages in thread
From: Benjamin Gaignard @ 2018-06-20  9:02 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: Intel Graphics Development, Vincent Abriou, dri-devel

2018-06-18 14:38 GMT+02:00 Ville Syrjala <ville.syrjala@linux.intel.com>:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> The current possible_clones setup doesn't look sensible. I'm assuming
> the 0 and 1 are supposed to refer to the indexes of the hdmi and hda
> encoders? So it kinda looks like we want hda+hdmi cloning, but then
> dvo also claims to be cloneable with hdmi, but hdmi won't recipricate.
>
> Benjamin tells me all encoders should be cloneable with each other,
> so let's fix up the masks to indicate that.
>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Vincent Abriou <vincent.abriou@st.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

Thanks

> ---
>  drivers/gpu/drm/sti/sti_tvout.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
> index 7d495307fe79..8bca519b3bfe 100644
> --- a/drivers/gpu/drm/sti/sti_tvout.c
> +++ b/drivers/gpu/drm/sti/sti_tvout.c
> @@ -668,7 +668,6 @@ sti_tvout_create_dvo_encoder(struct drm_device *dev,
>         drm_encoder = &encoder->encoder;
>
>         drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
> -       drm_encoder->possible_clones = 1 << 0;
>
>         drm_encoder_init(dev, drm_encoder,
>                          &sti_tvout_encoder_funcs, DRM_MODE_ENCODER_LVDS,
> @@ -721,7 +720,6 @@ static struct drm_encoder *sti_tvout_create_hda_encoder(struct drm_device *dev,
>         drm_encoder = &encoder->encoder;
>
>         drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
> -       drm_encoder->possible_clones = 1 << 0;
>
>         drm_encoder_init(dev, drm_encoder,
>                         &sti_tvout_encoder_funcs, DRM_MODE_ENCODER_DAC, NULL);
> @@ -770,7 +768,6 @@ static struct drm_encoder *sti_tvout_create_hdmi_encoder(struct drm_device *dev,
>         drm_encoder = &encoder->encoder;
>
>         drm_encoder->possible_crtcs = ENCODER_CRTC_MASK;
> -       drm_encoder->possible_clones = 1 << 1;
>
>         drm_encoder_init(dev, drm_encoder,
>                         &sti_tvout_encoder_funcs, DRM_MODE_ENCODER_TMDS, NULL);
> @@ -786,6 +783,13 @@ static void sti_tvout_create_encoders(struct drm_device *dev,
>         tvout->hdmi = sti_tvout_create_hdmi_encoder(dev, tvout);
>         tvout->hda = sti_tvout_create_hda_encoder(dev, tvout);
>         tvout->dvo = sti_tvout_create_dvo_encoder(dev, tvout);
> +
> +       tvout->hdmi->possible_clones = drm_encoder_mask(tvout->hdmi) |
> +               drm_encoder_mask(tvout->hda) | drm_encoder_mask(tvout->dvo);
> +       tvout->hda->possible_clones = drm_encoder_mask(tvout->hdmi) |
> +               drm_encoder_mask(tvout->hda) | drm_encoder_mask(tvout->dvo);
> +       tvout->dvo->possible_clones = drm_encoder_mask(tvout->hdmi) |
> +               drm_encoder_mask(tvout->hda) | drm_encoder_mask(tvout->dvo);
>  }
>
>  static void sti_tvout_destroy_encoders(struct sti_tvout *tvout)
> --
> 2.16.4
>



-- 
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Intel-gfx] [PATCH 11/14] drm/i915: Fix DP-MST crtc_mask
  2018-06-15 18:43     ` Ville Syrjälä
@ 2018-06-22  0:36       ` Dhinakaran Pandiyan
  0 siblings, 0 replies; 32+ messages in thread
From: Dhinakaran Pandiyan @ 2018-06-22  0:36 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel

On Fri, 2018-06-15 at 21:43 +0300, Ville Syrjälä wrote:
> On Fri, Jun 15, 2018 at 11:33:01AM -0700, Dhinakaran Pandiyan wrote:
> > 
> > On Fri, 2018-06-15 at 19:49 +0300, Ville Syrjala wrote:
> > > 
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > 
> > > Each fake MST encoder is tied to a specific pipe. Fix the
> > > encoder's
> > > crtc_mask to reflect that fact.
> > > 
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c
> > > b/drivers/gpu/drm/i915/intel_dp_mst.c
> > > index 5890500a3a8b..8e30765402b4 100644
> > > --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> > > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> > > @@ -565,7 +565,7 @@ intel_dp_create_fake_mst_encoder(struct
> > > intel_digital_port *intel_dig_port, enum
> > >  	intel_encoder->type = INTEL_OUTPUT_DP_MST;
> > >  	intel_encoder->power_domain = intel_dig_port-
> > > > 
> > > > base.power_domain;
> > >  	intel_encoder->port = intel_dig_port->base.port;
> > > -	intel_encoder->crtc_mask = 0x7;
> > > +	intel_encoder->crtc_mask = BIT(pipe);
> > How did this not cause any problems? Does this mean this field
> > was/is
> > unused?
> This is a hint to userspace. So userspace would pick the connector
> and crtc based on the hints, and then the kernel gets to pick the
> actual encoder. In this case the bogus hint was good enough to tell
> userspace that it can pick any crtc for any MST connector.
> 
> Hmm. Why on earth do we have .atomic_best_encoder() and
> .best_encoder()
> for MST? The fb_helper appears to want to use the non-atomic one for
> some reason... On boy, I guess I'll need to do something about that.
> As is this patch would probably break it :(
> 
So we end up picking crtc-0 for all MST connectors with the same
primary.

Since this patch does the right thing and assuming
https://patchwork.freedesktop.org/patch/229905/ gets merged before this

Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>



_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 10/14] drm/i915: Populate possible_crtcs correctly
  2018-06-15 16:49 ` [PATCH 10/14] drm/i915: Populate possible_crtcs correctly Ville Syrjala
@ 2018-06-22  1:26   ` Dhinakaran Pandiyan
  2018-06-25 11:10     ` Ville Syrjälä
  0 siblings, 1 reply; 32+ messages in thread
From: Dhinakaran Pandiyan @ 2018-06-22  1:26 UTC (permalink / raw)
  To: Ville Syrjala, dri-devel; +Cc: intel-gfx

On Fri, 2018-06-15 at 19:49 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Don't advertize non-exisiting crtcs in the encoder possible_crtcs
> bitmask.
> 
How do we end up advertising non-existing CRTCs? encoder->crtc_mask
seems to be populated in the encoder init functions based on possible
pipes. Do you mean pipe and crtc->index can potentially differ?


> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_display.c
> index b095899d68a9..3fa9da714403 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -13959,6 +13959,20 @@ static int intel_encoder_clones(struct
> intel_encoder *encoder)
>  	return index_mask;
>  }
>  
> +static int intel_encoder_crtcs(struct intel_encoder *encoder)
> +{
> +	struct drm_device *dev = encoder->base.dev;
> +	struct intel_crtc *crtc;
> +	int index_mask = 0;
> +
> +	for_each_intel_crtc(dev, crtc) {
> +		if (encoder->crtc_mask & BIT(crtc->pipe))
> +			index_mask |= drm_crtc_mask(&crtc->base);
> +	}
> +
> +	return index_mask;
> +}
> +
>  static bool has_edp_a(struct drm_i915_private *dev_priv)
>  {
>  	if (!IS_MOBILE(dev_priv))
> @@ -14211,7 +14225,8 @@ static void intel_setup_outputs(struct
> drm_i915_private *dev_priv)
>  	intel_psr_init(dev_priv);
>  
>  	for_each_intel_encoder(&dev_priv->drm, encoder) {
> -		encoder->base.possible_crtcs = encoder->crtc_mask;
> +		encoder->base.possible_crtcs =
> +			intel_encoder_crtcs(encoder);
>  		encoder->base.possible_clones =
>  			intel_encoder_clones(encoder);
>  	}
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 10/14] drm/i915: Populate possible_crtcs correctly
  2018-06-22  1:26   ` Dhinakaran Pandiyan
@ 2018-06-25 11:10     ` Ville Syrjälä
  2018-06-25 18:37       ` Dhinakaran Pandiyan
  0 siblings, 1 reply; 32+ messages in thread
From: Ville Syrjälä @ 2018-06-25 11:10 UTC (permalink / raw)
  To: Dhinakaran Pandiyan; +Cc: intel-gfx, dri-devel

On Thu, Jun 21, 2018 at 06:26:04PM -0700, Dhinakaran Pandiyan wrote:
> On Fri, 2018-06-15 at 19:49 +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Don't advertize non-exisiting crtcs in the encoder possible_crtcs
> > bitmask.
> > 
> How do we end up advertising non-existing CRTCs? encoder->crtc_mask
> seems to be populated in the encoder init functions based on possible
> pipes. Do you mean pipe and crtc->index can potentially differ?

No. Just that we may sometimes set BIT(PIPE_C) in crtc_mask when
there are only two pipes on the device.

> 
> 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 17 ++++++++++++++++-
> >  1 file changed, 16 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c
> > b/drivers/gpu/drm/i915/intel_display.c
> > index b095899d68a9..3fa9da714403 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -13959,6 +13959,20 @@ static int intel_encoder_clones(struct
> > intel_encoder *encoder)
> >  	return index_mask;
> >  }
> >  
> > +static int intel_encoder_crtcs(struct intel_encoder *encoder)
> > +{
> > +	struct drm_device *dev = encoder->base.dev;
> > +	struct intel_crtc *crtc;
> > +	int index_mask = 0;
> > +
> > +	for_each_intel_crtc(dev, crtc) {
> > +		if (encoder->crtc_mask & BIT(crtc->pipe))
> > +			index_mask |= drm_crtc_mask(&crtc->base);
> > +	}
> > +
> > +	return index_mask;
> > +}
> > +
> >  static bool has_edp_a(struct drm_i915_private *dev_priv)
> >  {
> >  	if (!IS_MOBILE(dev_priv))
> > @@ -14211,7 +14225,8 @@ static void intel_setup_outputs(struct
> > drm_i915_private *dev_priv)
> >  	intel_psr_init(dev_priv);
> >  
> >  	for_each_intel_encoder(&dev_priv->drm, encoder) {
> > -		encoder->base.possible_crtcs = encoder->crtc_mask;
> > +		encoder->base.possible_crtcs =
> > +			intel_encoder_crtcs(encoder);
> >  		encoder->base.possible_clones =
> >  			intel_encoder_clones(encoder);
> >  	}

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

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 10/14] drm/i915: Populate possible_crtcs correctly
  2018-06-25 11:10     ` Ville Syrjälä
@ 2018-06-25 18:37       ` Dhinakaran Pandiyan
  0 siblings, 0 replies; 32+ messages in thread
From: Dhinakaran Pandiyan @ 2018-06-25 18:37 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel

On Mon, 2018-06-25 at 14:10 +0300, Ville Syrjälä wrote:
> On Thu, Jun 21, 2018 at 06:26:04PM -0700, Dhinakaran Pandiyan wrote:
> > 
> > On Fri, 2018-06-15 at 19:49 +0300, Ville Syrjala wrote:
> > > 
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > 
> > > Don't advertize non-exisiting crtcs in the encoder possible_crtcs
> > > bitmask.
> > > 
> > How do we end up advertising non-existing CRTCs? encoder->crtc_mask
> > seems to be populated in the encoder init functions based on
> > possible
> > pipes. Do you mean pipe and crtc->index can potentially differ?
> No. Just that we may sometimes set BIT(PIPE_C) in crtc_mask when
> there are only two pipes on the device.
> 
Got it, thanks.
Since crtc_mask seems to be initialized based on the platform, we
should probably warn if we find out a bit is set incorrectly.

With or without that, this patch is
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>



> > 
> > 
> > 
> > > 
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/intel_display.c | 17 ++++++++++++++++-
> > >  1 file changed, 16 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/intel_display.c
> > > b/drivers/gpu/drm/i915/intel_display.c
> > > index b095899d68a9..3fa9da714403 100644
> > > --- a/drivers/gpu/drm/i915/intel_display.c
> > > +++ b/drivers/gpu/drm/i915/intel_display.c
> > > @@ -13959,6 +13959,20 @@ static int intel_encoder_clones(struct
> > > intel_encoder *encoder)
> > >  	return index_mask;
> > >  }
> > >  
> > > +static int intel_encoder_crtcs(struct intel_encoder *encoder)
> > > +{
> > > +	struct drm_device *dev = encoder->base.dev;
> > > +	struct intel_crtc *crtc;
> > > +	int index_mask = 0;
> > > +
> > > +	for_each_intel_crtc(dev, crtc) {
> > > +		if (encoder->crtc_mask & BIT(crtc->pipe))
> > > +			index_mask |= drm_crtc_mask(&crtc-
> > > >base);
> > > +	}
> > > +
> > > +	return index_mask;
> > > +}
> > > +
> > >  static bool has_edp_a(struct drm_i915_private *dev_priv)
> > >  {
> > >  	if (!IS_MOBILE(dev_priv))
> > > @@ -14211,7 +14225,8 @@ static void intel_setup_outputs(struct
> > > drm_i915_private *dev_priv)
> > >  	intel_psr_init(dev_priv);
> > >  
> > >  	for_each_intel_encoder(&dev_priv->drm, encoder) {
> > > -		encoder->base.possible_crtcs = encoder-
> > > >crtc_mask;
> > > +		encoder->base.possible_crtcs =
> > > +			intel_encoder_crtcs(encoder);
> > >  		encoder->base.possible_clones =
> > >  			intel_encoder_clones(encoder);
> > >  	}
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2018-06-25 18:37 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-15 16:49 [PATCH 00/14] drm: Try to fix encoder possible_clones/crtcs Ville Syrjala
2018-06-15 16:49 ` [PATCH 01/14] drm: Add drm_encoder_mask() Ville Syrjala
2018-06-15 16:49 ` [PATCH 02/14] drm: Include the encoder itself in possible_clones Ville Syrjala
2018-06-15 16:49 ` [PATCH 03/14] drm/gma500: Sanitize possible_clones Ville Syrjala
2018-06-15 16:49 ` [PATCH 04/14] drm/sti: Remove pointless casts Ville Syrjala
2018-06-18  7:53   ` Benjamin Gaignard
2018-06-15 16:49 ` [PATCH 05/14] drm/sti: Try to fix up the tvout possible clones Ville Syrjala
2018-06-18  8:16   ` Benjamin Gaignard
2018-06-18 12:38   ` [PATCH v2 " Ville Syrjala
2018-06-20  9:02     ` Benjamin Gaignard
2018-06-15 16:49 ` [PATCH 06/14] drm/exynos: Use drm_encoder_mask() Ville Syrjala
2018-06-15 16:49 ` [PATCH 07/14] drm/imx: Remove the bogus possible_clones setup Ville Syrjala
2018-06-15 16:49 ` [PATCH 08/14] drm: Validate encoder->possible_clones Ville Syrjala
2018-06-15 16:49 ` [PATCH 09/14] drm/i915: Use drm_encoder_mask() Ville Syrjala
2018-06-15 16:49 ` [PATCH 10/14] drm/i915: Populate possible_crtcs correctly Ville Syrjala
2018-06-22  1:26   ` Dhinakaran Pandiyan
2018-06-25 11:10     ` Ville Syrjälä
2018-06-25 18:37       ` Dhinakaran Pandiyan
2018-06-15 16:49 ` [PATCH 11/14] drm/i915: Fix DP-MST crtc_mask Ville Syrjala
2018-06-15 18:33   ` Dhinakaran Pandiyan
2018-06-15 18:43     ` Ville Syrjälä
2018-06-22  0:36       ` [Intel-gfx] " Dhinakaran Pandiyan
2018-06-15 16:49 ` [PATCH 12/14] drm/i915: Clean up encoder->crtc_mask setup Ville Syrjala
2018-06-18 18:27   ` Jani Nikula
2018-06-15 16:49 ` [PATCH 13/14] drm/i915: Simplfy LVDS crtc_mask setup Ville Syrjala
2018-06-15 16:49 ` [PATCH 14/14] drm: Validate encoder->possible_crtcs Ville Syrjala
2018-06-15 17:36 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Try to fix encoder possible_clones/crtcs Patchwork
2018-06-15 17:53 ` ✓ Fi.CI.BAT: success " Patchwork
2018-06-16  5:41 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-06-18 12:45 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Try to fix encoder possible_clones/crtcs (rev2) Patchwork
2018-06-18 13:02 ` ✓ Fi.CI.BAT: success " Patchwork
2018-06-18 17:07 ` ✓ Fi.CI.IGT: " Patchwork

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.