Skip to contentSkip to conversation

drm: Add __drm_atomic_helper_crtc_state_reset() & co.

PATCH New José Roberto de Souza 3 participants 13 messages Dec 11, 2019 – Dec 16, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/11 drm: Add __drm_atomic_helper_crtc_state_reset() & co.

From: Ville Syrjälä <[email protected]>

Annoyingly __drm_atomic_helper_crtc_reset() does two totally separate things:
a) reset the state to defaults values
b) assign the crtc->state pointer

I just want a) without the b) so let's split out part
a) into __drm_atomic_helper_crtc_state_reset(). And of course we'll do the same thing for planes and connectors.

---
 drivers/gpu/drm/drm_atomic_state_helper.c | 70 ++++++++++++++++++++---
 include/drm/drm_atomic_state_helper.h     |  6 ++
 2 files changed, 67 insertions(+), 9 deletions(-)
drivers/gpu/drm/drm_atomic_state_helper.c +61 -9
index d0a937fb0c56..a972068d58cf 100644
@@ -57,6 +57,22 @@
  * for these functions.
  */
 
+/**
+ * __drm_atomic_helper_crtc_state_reset - reset the CRTC state
+ * @crtc_state: atomic CRTC state, must not be NULL
+ * @crtc: CRTC object, must not be NULL
+ *
+ * Initializes the newly allocated @crtc_state with default
+ * values. This is useful for drivers that subclass the CRTC state.
+ */
+void
+__drm_atomic_helper_crtc_state_reset(struct drm_crtc_state *crtc_state,
+				     struct drm_crtc *crtc)
+{
+	crtc_state->crtc = crtc;
+}
+EXPORT_SYMBOL(__drm_atomic_helper_crtc_state_reset);
+
 /**
  * __drm_atomic_helper_crtc_reset - reset state on CRTC
  * @crtc: drm CRTC
@@ -74,7 +90,7 @@ __drm_atomic_helper_crtc_reset(struct drm_crtc *crtc,
 			       struct drm_crtc_state *crtc_state)
 {
 	if (crtc_state)
-		crtc_state->crtc = crtc;
+		__drm_atomic_helper_crtc_state_reset(crtc_state, crtc);
 
 	crtc->state = crtc_state;
 }
@@ -212,23 +228,43 @@ void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
 EXPORT_SYMBOL(drm_atomic_helper_crtc_destroy_state);
 
 /**
- * __drm_atomic_helper_plane_reset - resets planes state to default values
+ * __drm_atomic_helper_plane_state_reset - resets plane state to default values
+ * @plane_state: atomic plane state, must not be NULL
  * @plane: plane object, must not be NULL
- * @state: atomic plane state, must not be NULL
  *
- * Initializes plane state to default. This is useful for drivers that subclass
- * the plane state.
+ * Initializes the newly allocated @plane_state with default
+ * values. This is useful for drivers that subclass the CRTC state.
  */
-void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
-				     struct drm_plane_state *state)
+void __drm_atomic_helper_plane_state_reset(struct drm_plane_state *state,
+					   struct drm_plane *plane)
 {
 	state->plane = plane;
 	state->rotation = DRM_MODE_ROTATE_0;
 
 	state->alpha = DRM_BLEND_ALPHA_OPAQUE;
 	state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI;
+}
+EXPORT_SYMBOL(__drm_atomic_helper_plane_state_reset);
 
-	plane->state = state;
+/**
+ * __drm_atomic_helper_plane_reset - reset state on plane
+ * @plane: drm plane
+ * @plane_state: plane state to assign
+ *
+ * Initializes the newly allocated @plane_state and assigns it to
+ * the &drm_crtc->state pointer of @plane, usually required when
+ * initializing the drivers or when called from the &drm_plane_funcs.reset
+ * hook.
+ *
+ * This is useful for drivers that subclass the plane state.
+ */
+void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
+				     struct drm_plane_state *plane_state)
+{
+	if (plane_state)
+		__drm_atomic_helper_plane_state_reset(plane_state, plane);
+
+	plane->state = plane_state;
 }
 EXPORT_SYMBOL(__drm_atomic_helper_plane_reset);
 
@@ -335,6 +371,22 @@ void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
 }
 EXPORT_SYMBOL(drm_atomic_helper_plane_destroy_state);
 
+/**
+ * __drm_atomic_helper_connector_state_reset - reset the connector state
+ * @conn__state: atomic connector state, must not be NULL
+ * @connector: connectotr object, must not be NULL
+ *
+ * Initializes the newly allocated @conn_state with default
+ * values. This is useful for drivers that subclass the connector state.
+ */
+void
+__drm_atomic_helper_connector_state_reset(struct drm_connector_state *conn_state,
+					  struct drm_connector *connector)
+{
+	conn_state->connector = connector;
+}
+EXPORT_SYMBOL(__drm_atomic_helper_connector_state_reset);
+
 /**
  * __drm_atomic_helper_connector_reset - reset state on connector
  * @connector: drm connector
@@ -352,7 +404,7 @@ __drm_atomic_helper_connector_reset(struct drm_connector *connector,
 				    struct drm_connector_state *conn_state)
 {
 	if (conn_state)
-		conn_state->connector = connector;
+		__drm_atomic_helper_connector_state_reset(conn_state, connector);
 
 	connector->state = conn_state;
 }
include/drm/drm_atomic_state_helper.h +6 -0
index e4577cc11689..8171dea4cc22 100644
@@ -37,6 +37,8 @@ struct drm_private_state;
 struct drm_modeset_acquire_ctx;
 struct drm_device;
 
+void __drm_atomic_helper_crtc_state_reset(struct drm_crtc_state *state,
+					  struct drm_crtc *crtc);
 void __drm_atomic_helper_crtc_reset(struct drm_crtc *crtc,
 				    struct drm_crtc_state *state);
 void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc);
@@ -48,6 +50,8 @@ void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state);
 void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
 					  struct drm_crtc_state *state);
 
+void __drm_atomic_helper_plane_state_reset(struct drm_plane_state *state,
+					   struct drm_plane *plane);
 void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
 				     struct drm_plane_state *state);
 void drm_atomic_helper_plane_reset(struct drm_plane *plane);
@@ -59,6 +63,8 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state);
 void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
 					  struct drm_plane_state *state);
 
+void __drm_atomic_helper_connector_state_reset(struct drm_connector_state *conn_state,
+					       struct drm_connector *connector);
 void __drm_atomic_helper_connector_reset(struct drm_connector *connector,
 					 struct drm_connector_state *conn_state);
 void drm_atomic_helper_connector_reset(struct drm_connector *connector);
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v2 2/11 drm/i915: s/intel_crtc/crtc/ in intel_crtc_init()

From: Ville Syrjälä <[email protected]>

Let's get rid of the redundant intel_ prefix on our variables.

---
 drivers/gpu/drm/i915/display/intel_display.c | 32 ++++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +16 -16
index 1d2fad1610ef..e1d8daec4bfa 100644
@@ -15790,14 +15790,14 @@ static const struct drm_crtc_funcs i8xx_crtc_funcs = {
 static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 {
 	const struct drm_crtc_funcs *funcs;
-	struct intel_crtc *intel_crtc;
+	struct intel_crtc *crtc;
 	struct intel_crtc_state *crtc_state = NULL;
 	struct intel_plane *primary = NULL;
 	struct intel_plane *cursor = NULL;
 	int sprite, ret;
 
-	intel_crtc = kzalloc(sizeof(*intel_crtc), GFP_KERNEL);
-	if (!intel_crtc)
+	crtc = kzalloc(sizeof(*crtc), GFP_KERNEL);
+	if (!crtc)
 		return -ENOMEM;
 
 	crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL);
@@ -15805,15 +15805,15 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 		ret = -ENOMEM;
 		goto fail;
 	}
-	__drm_atomic_helper_crtc_reset(&intel_crtc->base, &crtc_state->uapi);
-	intel_crtc->config = crtc_state;
+	__drm_atomic_helper_crtc_reset(&crtc->base, &crtc_state->uapi);
+	crtc->config = crtc_state;
 
 	primary = intel_primary_plane_create(dev_priv, pipe);
 	if (IS_ERR(primary)) {
 		ret = PTR_ERR(primary);
 		goto fail;
 	}
-	intel_crtc->plane_ids_mask |= BIT(primary->id);
+	crtc->plane_ids_mask |= BIT(primary->id);
 
 	for_each_sprite(dev_priv, pipe, sprite) {
 		struct intel_plane *plane;
@@ -15823,7 +15823,7 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 			ret = PTR_ERR(plane);
 			goto fail;
 		}
-		intel_crtc->plane_ids_mask |= BIT(plane->id);
+		crtc->plane_ids_mask |= BIT(plane->id);
 	}
 
 	cursor = intel_cursor_plane_create(dev_priv, pipe);
@@ -15831,7 +15831,7 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 		ret = PTR_ERR(cursor);
 		goto fail;
 	}
-	intel_crtc->plane_ids_mask |= BIT(cursor->id);
+	crtc->plane_ids_mask |= BIT(cursor->id);
 
 	if (HAS_GMCH(dev_priv)) {
 		if (IS_CHERRYVIEW(dev_priv) ||
@@ -15852,32 +15852,32 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 			funcs = &ilk_crtc_funcs;
 	}
 
-	ret = drm_crtc_init_with_planes(&dev_priv->drm, &intel_crtc->base,
+	ret = drm_crtc_init_with_planes(&dev_priv->drm, &crtc->base,
 					&primary->base, &cursor->base,
 					funcs, "pipe %c", pipe_name(pipe));
 	if (ret)
 		goto fail;
 
-	intel_crtc->pipe = pipe;
+	crtc->pipe = pipe;
 
 	/* initialize shared scalers */
-	intel_crtc_init_scalers(intel_crtc, crtc_state);
+	intel_crtc_init_scalers(crtc, crtc_state);
 
 	BUG_ON(pipe >= ARRAY_SIZE(dev_priv->pipe_to_crtc_mapping) ||
 	       dev_priv->pipe_to_crtc_mapping[pipe] != NULL);
-	dev_priv->pipe_to_crtc_mapping[pipe] = intel_crtc;
+	dev_priv->pipe_to_crtc_mapping[pipe] = crtc;
 
 	if (INTEL_GEN(dev_priv) < 9) {
 		enum i9xx_plane_id i9xx_plane = primary->i9xx_plane;
 
 		BUG_ON(i9xx_plane >= ARRAY_SIZE(dev_priv->plane_to_crtc_mapping) ||
 		       dev_priv->plane_to_crtc_mapping[i9xx_plane] != NULL);
-		dev_priv->plane_to_crtc_mapping[i9xx_plane] = intel_crtc;
+		dev_priv->plane_to_crtc_mapping[i9xx_plane] = crtc;
 	}
 
-	intel_color_init(intel_crtc);
+	intel_color_init(crtc);
 
-	WARN_ON(drm_crtc_index(&intel_crtc->base) != intel_crtc->pipe);
+	WARN_ON(drm_crtc_index(&crtc->base) != crtc->pipe);
 
 	return 0;
 
@@ -15887,7 +15887,7 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 	 * crtcs/planes already initialized.
 	 */
 	kfree(crtc_state);
-	kfree(intel_crtc);
+	kfree(crtc);
 
 	return ret;
 }
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH v2 3/11 drm/i915: Introduce intel_crtc_{alloc, free}()

In reply to José Roberto de Souza

From: Ville Syrjälä <[email protected]>

We already have alloc/free helpers for planes, add the same for crtcs. The main benefit is we get to move all the annoying state initialization out of the main crtc_init() flow.

---
 drivers/gpu/drm/i915/display/intel_display.c | 74 ++++++++++----------
 1 file changed, 36 insertions(+), 38 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +36 -38
index e1d8daec4bfa..8c7ce459f01b 100644
@@ -164,8 +164,7 @@ static void vlv_prepare_pll(struct intel_crtc *crtc,
 			    const struct intel_crtc_state *pipe_config);
 static void chv_prepare_pll(struct intel_crtc *crtc,
 			    const struct intel_crtc_state *pipe_config);
-static void intel_crtc_init_scalers(struct intel_crtc *crtc,
-				    struct intel_crtc_state *crtc_state);
+static void intel_crtc_init_scalers(struct intel_crtc_state *crtc_state);
 static void skylake_pfit_enable(const struct intel_crtc_state *crtc_state);
 static void ironlake_pfit_disable(const struct intel_crtc_state *old_crtc_state);
 static void ironlake_pfit_enable(const struct intel_crtc_state *crtc_state);
@@ -10631,7 +10630,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 	u64 power_domain_mask;
 	bool active;
 
-	intel_crtc_init_scalers(crtc, pipe_config);
+	intel_crtc_init_scalers(pipe_config);
 
 	pipe_config->master_transcoder = INVALID_TRANSCODER;
 
@@ -15698,25 +15697,12 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv,
 	return ERR_PTR(ret);
 }
 
-static void intel_crtc_init_scalers(struct intel_crtc *crtc,
-				    struct intel_crtc_state *crtc_state)
+static void intel_crtc_init_scalers(struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc_scaler_state *scaler_state =
 		&crtc_state->scaler_state;
-	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
-	int i;
-
-	crtc->num_scalers = RUNTIME_INFO(dev_priv)->num_scalers[crtc->pipe];
-	if (!crtc->num_scalers)
-		return;
-
-	for (i = 0; i < crtc->num_scalers; i++) {
-		struct intel_scaler *scaler = &scaler_state->scalers[i];
-
-		scaler->in_use = 0;
-		scaler->mode = 0;
-	}
 
+	memset(scaler_state, 0, sizeof(*scaler_state));
 	scaler_state->scaler_id = -1;
 }
 
@@ -15787,27 +15773,49 @@ static const struct drm_crtc_funcs i8xx_crtc_funcs = {
 	.disable_vblank = i8xx_disable_vblank,
 };
 
-static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
+static struct intel_crtc *intel_crtc_alloc(void)
 {
-	const struct drm_crtc_funcs *funcs;
+	struct intel_crtc_state *crtc_state;
 	struct intel_crtc *crtc;
-	struct intel_crtc_state *crtc_state = NULL;
-	struct intel_plane *primary = NULL;
-	struct intel_plane *cursor = NULL;
-	int sprite, ret;
 
 	crtc = kzalloc(sizeof(*crtc), GFP_KERNEL);
 	if (!crtc)
-		return -ENOMEM;
+		return ERR_PTR(-ENOMEM);
 
 	crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL);
 	if (!crtc_state) {
-		ret = -ENOMEM;
-		goto fail;
+		kfree(crtc);
+		return ERR_PTR(-ENOMEM);
 	}
+
 	__drm_atomic_helper_crtc_reset(&crtc->base, &crtc_state->uapi);
+	intel_crtc_init_scalers(crtc_state);
+
 	crtc->config = crtc_state;
 
+	return crtc;
+}
+
+static void intel_crtc_free(struct intel_crtc *crtc)
+{
+	intel_crtc_destroy_state(&crtc->base, crtc->base.state);
+	kfree(crtc);
+}
+
+static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
+{
+	struct intel_plane *primary, *cursor;
+	const struct drm_crtc_funcs *funcs;
+	struct intel_crtc *crtc;
+	int sprite, ret;
+
+	crtc = intel_crtc_alloc();
+	if (IS_ERR(crtc))
+		return PTR_ERR(crtc);
+
+	crtc->pipe = pipe;
+	crtc->num_scalers = RUNTIME_INFO(dev_priv)->num_scalers[pipe];
+
 	primary = intel_primary_plane_create(dev_priv, pipe);
 	if (IS_ERR(primary)) {
 		ret = PTR_ERR(primary);
@@ -15858,11 +15866,6 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 	if (ret)
 		goto fail;
 
-	crtc->pipe = pipe;
-
-	/* initialize shared scalers */
-	intel_crtc_init_scalers(crtc, crtc_state);
-
 	BUG_ON(pipe >= ARRAY_SIZE(dev_priv->pipe_to_crtc_mapping) ||
 	       dev_priv->pipe_to_crtc_mapping[pipe] != NULL);
 	dev_priv->pipe_to_crtc_mapping[pipe] = crtc;
@@ -15882,12 +15885,7 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 	return 0;
 
 fail:
-	/*
-	 * drm_mode_config_cleanup() will free up any
-	 * crtcs/planes already initialized.
-	 */
-	kfree(crtc_state);
-	kfree(crtc);
+	intel_crtc_free(crtc);
 
 	return ret;
 }
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH v2 4/11 drm/i915: Introduce intel_crtc_state_reset()

In reply to José Roberto de Souza

From: Ville Syrjälä <[email protected]>

We have a few places where we want to reset a crtc state to its default values. Let's add a helper for that. We'll need the new __drm_atomic_helper_crtc_state_reset() helper for this to allow us to just reset the state itself without clobbering the crtc->state pointer.

And while at it let's zero out the whole thing, except a few choice member which we'll mark as "invalid". And thanks to this we can now nuke intel_crtc_init_scalers().

---
 drivers/gpu/drm/i915/display/intel_display.c | 47 +++++++++-----------
 1 file changed, 22 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +22 -25
index 8c7ce459f01b..a729e0fd389b 100644
@@ -164,7 +164,6 @@ static void vlv_prepare_pll(struct intel_crtc *crtc,
 			    const struct intel_crtc_state *pipe_config);
 static void chv_prepare_pll(struct intel_crtc *crtc,
 			    const struct intel_crtc_state *pipe_config);
-static void intel_crtc_init_scalers(struct intel_crtc_state *crtc_state);
 static void skylake_pfit_enable(const struct intel_crtc_state *crtc_state);
 static void ironlake_pfit_disable(const struct intel_crtc_state *old_crtc_state);
 static void ironlake_pfit_enable(const struct intel_crtc_state *crtc_state);
@@ -10630,8 +10629,6 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 	u64 power_domain_mask;
 	bool active;
 
-	intel_crtc_init_scalers(pipe_config);
-
 	pipe_config->master_transcoder = INVALID_TRANSCODER;
 
 	power_domain = POWER_DOMAIN_PIPE(crtc->pipe);
@@ -11679,6 +11676,20 @@ static void ironlake_pch_clock_get(struct intel_crtc *crtc,
 					 &pipe_config->fdi_m_n);
 }
 
+static void intel_crtc_state_reset(struct intel_crtc_state *crtc_state,
+				   struct intel_crtc *crtc)
+{
+	memset(crtc_state, 0, sizeof(*crtc_state));
+
+	__drm_atomic_helper_crtc_state_reset(&crtc_state->uapi, &crtc->base);
+
+	crtc_state->cpu_transcoder = INVALID_TRANSCODER;
+	crtc_state->master_transcoder = INVALID_TRANSCODER;
+	crtc_state->hsw_workaround_pipe = INVALID_PIPE;
+	crtc_state->output_format = INTEL_OUTPUT_FORMAT_INVALID;
+	crtc_state->scaler_state.scaler_id = -1;
+}
+
 /* Returns the currently programmed mode of the given encoder. */
 struct drm_display_mode *
 intel_encoder_current_mode(struct intel_encoder *encoder)
@@ -11704,7 +11715,7 @@ intel_encoder_current_mode(struct intel_encoder *encoder)
 		return NULL;
 	}
 
-	crtc_state->uapi.crtc = &crtc->base;
+	intel_crtc_state_reset(crtc_state, crtc);
 
 	if (!dev_priv->display.get_pipe_config(crtc, crtc_state)) {
 		kfree(crtc_state);
@@ -13552,18 +13563,14 @@ verify_crtc_state(struct intel_crtc *crtc,
 	struct drm_device *dev = crtc->base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_encoder *encoder;
-	struct intel_crtc_state *pipe_config;
-	struct drm_atomic_state *state;
+	struct intel_crtc_state *pipe_config = old_crtc_state;
+	struct drm_atomic_state *state = old_crtc_state->uapi.state;
 	bool active;
 
-	state = old_crtc_state->uapi.state;
 	__drm_atomic_helper_crtc_destroy_state(&old_crtc_state->uapi);
 	intel_crtc_free_hw_state(old_crtc_state);
-
-	pipe_config = old_crtc_state;
-	memset(pipe_config, 0, sizeof(*pipe_config));
-	pipe_config->uapi.crtc = &crtc->base;
-	pipe_config->uapi.state = state;
+	intel_crtc_state_reset(old_crtc_state, crtc);
+	old_crtc_state->uapi.state = state;
 
 	DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.base.id, crtc->base.name);
 
@@ -15697,15 +15704,6 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv,
 	return ERR_PTR(ret);
 }
 
-static void intel_crtc_init_scalers(struct intel_crtc_state *crtc_state)
-{
-	struct intel_crtc_scaler_state *scaler_state =
-		&crtc_state->scaler_state;
-
-	memset(scaler_state, 0, sizeof(*scaler_state));
-	scaler_state->scaler_id = -1;
-}
-
 #define INTEL_CRTC_FUNCS \
 	.gamma_set = drm_atomic_helper_legacy_gamma_set, \
 	.set_config = drm_atomic_helper_set_config, \
@@ -15788,9 +15786,9 @@ static struct intel_crtc *intel_crtc_alloc(void)
 		return ERR_PTR(-ENOMEM);
 	}
 
-	__drm_atomic_helper_crtc_reset(&crtc->base, &crtc_state->uapi);
-	intel_crtc_init_scalers(crtc_state);
+	intel_crtc_state_reset(crtc_state, crtc);
 
+	crtc->base.state = &crtc_state->uapi;
 	crtc->config = crtc_state;
 
 	return crtc;
@@ -17411,8 +17409,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 
 		__drm_atomic_helper_crtc_destroy_state(&crtc_state->uapi);
 		intel_crtc_free_hw_state(crtc_state);
-		memset(crtc_state, 0, sizeof(*crtc_state));
-		__drm_atomic_helper_crtc_reset(&crtc->base, &crtc_state->uapi);
+		intel_crtc_state_reset(crtc_state, crtc);
 
 		crtc_state->hw.active = crtc_state->hw.enable =
 			dev_priv->display.get_pipe_config(crtc, crtc_state);
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH v2 5/11 drm/i915: Introduce intel_plane_state_reset()

In reply to José Roberto de Souza

From: Ville Syrjälä <[email protected]>

For the sake of symmetry with the crtc stuff let's add a helper to reset the plane state to sane default values. For the moment this only gets caller from the plane init.

---
 drivers/gpu/drm/i915/display/intel_atomic_plane.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_atomic_plane.c +13 -2
index 42b3b3449d2e..9429b8e17270 100644
@@ -41,6 +41,16 @@
 #include "intel_pm.h"
 #include "intel_sprite.h"
 
+static void intel_plane_state_reset(struct intel_plane_state *plane_state,
+				    struct intel_plane *plane)
+{
+	memset(plane_state, 0, sizeof(*plane_state));
+
+	__drm_atomic_helper_plane_state_reset(&plane_state->uapi, &plane->base);
+
+	plane_state->scaler_id = -1;
+}
+
 struct intel_plane *intel_plane_alloc(void)
 {
 	struct intel_plane_state *plane_state;
@@ -56,8 +66,9 @@ struct intel_plane *intel_plane_alloc(void)
 		return ERR_PTR(-ENOMEM);
 	}
 
-	__drm_atomic_helper_plane_reset(&plane->base, &plane_state->uapi);
-	plane_state->scaler_id = -1;
+	intel_plane_state_reset(plane_state, plane);
+
+	plane->base.state = &plane_state->uapi;
 
 	return plane;
 }
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH v2 6/11 drm/i915/display: Share intel_connector_needs_modeset()

In reply to José Roberto de Souza

intel_connector_needs_modeset() will be used outside of intel_display.c in a future patch so it would only be necessary to remove the state and add the prototype to the header file.

But while at it, I simplified the arguments and changed to intel types and moved it to a better place intel_atomic.c.

That allowed us to convert the whole intel_encoders_update_prepare/complete to intel type too.

No behavior changes intended here.

---
 drivers/gpu/drm/i915/display/intel_atomic.c  | 32 ++++++++++++
 drivers/gpu/drm/i915/display/intel_atomic.h  |  3 ++
 drivers/gpu/drm/i915/display/intel_display.c | 53 ++++++--------------
 3 files changed, 51 insertions(+), 37 deletions(-)
drivers/gpu/drm/i915/display/intel_atomic.c +32 -0
index fd0026fc3618..6e93a39a6fec 100644
@@ -174,6 +174,38 @@ intel_digital_connector_duplicate_state(struct drm_connector *connector)
 	return &state->base;
 }
 
+/**
+ * intel_digital_connector_needs_modeset - check if connector needs a modeset
+ */
+bool
+intel_digital_connector_needs_modeset(struct intel_atomic_state *state,
+				      struct intel_connector *connector)
+{
+	struct intel_digital_connector_state *old_connector_state, *new_connector_state;
+	struct intel_crtc *old_crtc, *new_crtc;
+	struct intel_crtc_state *new_crtc_state;
+
+	old_connector_state = intel_atomic_get_old_connector_state(state,
+								   connector);
+	if (old_connector_state->base.crtc)
+		old_crtc = to_intel_crtc(old_connector_state->base.crtc);
+	else
+		old_crtc = NULL;
+
+	new_connector_state = intel_atomic_get_new_connector_state(state,
+								   connector);
+	if (new_connector_state->base.crtc) {
+		new_crtc = to_intel_crtc(new_connector_state->base.crtc);
+		new_crtc_state = intel_atomic_get_new_crtc_state(state, new_crtc);
+	} else {
+		new_crtc_state = NULL;
+		new_crtc = NULL;
+	}
+
+	return new_crtc != old_crtc ||
+	       (new_crtc && drm_atomic_crtc_needs_modeset(&new_crtc_state->uapi));
+}
+
 /**
  * intel_crtc_duplicate_state - duplicate crtc state
  * @crtc: drm crtc
drivers/gpu/drm/i915/display/intel_atomic.h +3 -0
index 7b49623419ba..ba9cc29a5865 100644
@@ -17,6 +17,7 @@ struct drm_device;
 struct drm_i915_private;
 struct drm_property;
 struct intel_atomic_state;
+struct intel_connector;
 struct intel_crtc;
 struct intel_crtc_state;
 
@@ -32,6 +33,8 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
 					 struct drm_atomic_state *state);
 struct drm_connector_state *
 intel_digital_connector_duplicate_state(struct drm_connector *connector);
+bool intel_digital_connector_needs_modeset(struct intel_atomic_state *state,
+					   struct intel_connector *connector);
 
 struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc);
 void intel_crtc_destroy_state(struct drm_crtc *crtc,
drivers/gpu/drm/i915/display/intel_display.c +16 -37

87 lines not on this page · raw message

Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH v2 7/11 drm/i915/tgl: Select master transcoder for MST stream

In reply to José Roberto de Souza

On TGL the blending of all the streams have moved from DDI to transcoder, so now every transcoder working over the same MST port must send its stream to a master transcoder and master will send to DDI respecting the time slots.

So here adding all the CRTCs that shares the same MST stream if needed and computing their state again, it will pick the lowest pipe/transcoder among the ones in the same stream to be master.

Most of the time skl_commit_modeset_enables() enables pipes in a crescent order but due DDB overlapping it might not happen, this scenarios will be handled in the next patch.

v2:
- Using recently added intel_crtc_state_reset() to set mst_master_transcoder to invalid transcoder for all non gen12 & MST code paths
- Setting lowest pipe/transcoder as master, previously it was the first one but setting a predictable one will help in future MST e port sync integration
- Moving to intel type as much as we can

BSpec: 50493
BSpec: 49190

Cc Ville Syrjälä <[email protected]>
Cc Lucas De Marchi <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_atomic.c   |  14 ++
 drivers/gpu/drm/i915/display/intel_atomic.h   |   3 +
 drivers/gpu/drm/i915/display/intel_ddi.c      |  14 +-
 drivers/gpu/drm/i915/display/intel_display.c  |  13 +-
 .../drm/i915/display/intel_display_types.h    |   3 +
 drivers/gpu/drm/i915/display/intel_dp_mst.c   | 139 ++++++++++++++++--
 drivers/gpu/drm/i915/display/intel_dp_mst.h   |   5 +
 7 files changed, 178 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/display/intel_atomic.c +14 -0
index 6e93a39a6fec..69a0430c4638 100644
@@ -206,6 +206,20 @@ intel_digital_connector_needs_modeset(struct intel_atomic_state *state,
 	       (new_crtc && drm_atomic_crtc_needs_modeset(&new_crtc_state->uapi));
 }
 
+struct intel_digital_connector_state *
+intel_atomic_get_digital_connector_state(struct intel_atomic_state *state,
+					 struct intel_connector *connector)
+{
+	struct drm_connector_state *connector_state;
+
+	connector_state = drm_atomic_get_connector_state(&state->base,
+							 &connector->base);
+	if (IS_ERR(connector_state))
+		return ERR_CAST(connector_state);
+
+	return to_intel_digital_connector_state(connector_state);
+}
+
 /**
  * intel_crtc_duplicate_state - duplicate crtc state
  * @crtc: drm crtc
drivers/gpu/drm/i915/display/intel_atomic.h +3 -0
index ba9cc29a5865..6e8638d83d28 100644
@@ -35,6 +35,9 @@ struct drm_connector_state *
 intel_digital_connector_duplicate_state(struct drm_connector *connector);
 bool intel_digital_connector_needs_modeset(struct intel_atomic_state *state,
 					   struct intel_connector *connector);
+struct intel_digital_connector_state *
+intel_atomic_get_digital_connector_state(struct intel_atomic_state *state,
+					 struct intel_connector *connector);
 
 struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc);
 void intel_crtc_destroy_state(struct drm_crtc *crtc,
drivers/gpu/drm/i915/display/intel_ddi.c +12 -2
index 3e81c54c349e..e29bde21066e 100644
@@ -1903,8 +1903,13 @@ intel_ddi_transcoder_func_reg_val_get(const struct intel_crtc_state *crtc_state)
 		temp |= TRANS_DDI_MODE_SELECT_DP_MST;
 		temp |= DDI_PORT_WIDTH(crtc_state->lane_count);
 
-		if (INTEL_GEN(dev_priv) >= 12)
-			temp |= TRANS_DDI_MST_TRANSPORT_SELECT(crtc_state->cpu_transcoder);
+		if (INTEL_GEN(dev_priv) >= 12) {
+			enum transcoder master;
+
+			master = crtc_state->mst_master_transcoder;
+			WARN_ON(master == INVALID_TRANSCODER);
+			temp |= TRANS_DDI_MST_TRANSPORT_SELECT(master);
+		}
 	} else {
 		temp |= TRANS_DDI_MODE_SELECT_DP_SST;
 		temp |= DDI_PORT_WIDTH(crtc_state->lane_count);
@@ -4375,6 +4380,11 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
 		pipe_config->output_types |= BIT(INTEL_OUTPUT_DP_MST);
 		pipe_config->lane_count =
 			((temp & DDI_PORT_WIDTH_MASK) >> DDI_PORT_WIDTH_SHIFT) + 1;
+
+		if (INTEL_GEN(dev_priv) >= 12)
+			pipe_config->mst_master_transcoder =
+					REG_FIELD_GET(TRANS_DDI_MST_TRANSPORT_SELECT_MASK, temp);
+
 		intel_dp_get_m_n(intel_crtc, pipe_config);
 		break;
 	default:
drivers/gpu/drm/i915/display/intel_display.c +11 -2
index fe863f961067..d059948eec9a 100644
@@ -46,6 +46,7 @@
 #include "display/intel_crt.h"
 #include "display/intel_ddi.h"
 #include "display/intel_dp.h"
+#include "display/intel_dp_mst.h"
 #include "display/intel_dsi.h"
 #include "display/intel_dvo.h"
 #include "display/intel_gmbus.h"
@@ -11667,6 +11668,7 @@ static void intel_crtc_state_reset(struct intel_crtc_state *crtc_state,
 	crtc_state->hsw_workaround_pipe = INVALID_PIPE;
 	crtc_state->output_format = INTEL_OUTPUT_FORMAT_INVALID;
 	crtc_state->scaler_state.scaler_id = -1;
+	crtc_state->mst_master_transcoder = INVALID_TRANSCODER;
 }
 
 /* Returns the currently programmed mode of the given encoder. */
@@ -12514,6 +12516,9 @@ static void intel_dump_pipe_config(const struct intel_crtc_state *pipe_config,
 			      pipe_config->csc_mode, pipe_config->gamma_mode,
 			      pipe_config->gamma_enable, pipe_config->csc_enable);
 
+	DRM_DEBUG_KMS("MST master transcoder: %s\n",
+		      transcoder_name(pipe_config->mst_master_transcoder));
+
 dump_planes:
 	if (!state)
 		return;
@@ -12655,6 +12660,7 @@ intel_crtc_prepare_cleared_state(struct intel_crtc_state *crtc_state)
 	memcpy(saved_state->icl_port_dplls, crtc_state->icl_port_dplls,
 	       sizeof(saved_state->icl_port_dplls));
 	saved_state->crc_enabled = crtc_state->crc_enabled;
+	saved_state->mst_master_transcoder = INVALID_TRANSCODER;
 	if (IS_G4X(dev_priv) ||
 	    IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
 		saved_state->wm = crtc_state->wm;
@@ -13290,6 +13296,8 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 	PIPE_CONF_CHECK_I(sync_mode_slaves_mask);
 	PIPE_CONF_CHECK_I(master_transcoder);
 
+	PIPE_CONF_CHECK_I(mst_master_transcoder);
+
 #undef PIPE_CONF_CHECK_X
 #undef PIPE_CONF_CHECK_I
 #undef PIPE_CONF_CHECK_BOOL
@@ -14374,7 +14382,7 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)
 	u32 handled = 0;
 	int i;
 
-	/* Only disable port sync slaves */
+	/* Only disable port sync and MST slaves */
 	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
 					    new_crtc_state, i) {
 		if (!needs_modeset(new_crtc_state))
@@ -14388,7 +14396,8 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)
 		 * slave CRTCs are disabled first and then master CRTC since
 		 * Slave vblanks are masked till Master Vblanks.
 		 */
-		if (!is_trans_port_sync_slave(old_crtc_state))
+		if (!is_trans_port_sync_slave(old_crtc_state) &&
+		    !intel_dp_mst_is_slave_trans(old_crtc_state))
 			continue;
 
 		intel_pre_plane_update(state, crtc);
drivers/gpu/drm/i915/display/intel_display_types.h +3 -0
index 83ea04149b77..630a94892b7b 100644
@@ -1054,6 +1054,9 @@ struct intel_crtc_state {
 
 	/* Bitmask to indicate slaves attached */
 	u8 sync_mode_slaves_mask;
+
+	/* Only valid on TGL+ */
+	enum transcoder mst_master_transcoder;
 };
 
 struct intel_crtc {
drivers/gpu/drm/i915/display/intel_dp_mst.c +130 -9

194 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_dp_mst.h +5 -0
index f660ad80db04..e40767f78343 100644
@@ -6,10 +6,15 @@
 #ifndef __INTEL_DP_MST_H__
 #define __INTEL_DP_MST_H__
 
+#include <stdbool.h>
+
 struct intel_digital_port;
+struct intel_crtc_state;
 
 int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
 void intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port);
 int intel_dp_mst_encoder_active_links(struct intel_digital_port *intel_dig_port);
+bool intel_dp_mst_is_master_trans(const struct intel_crtc_state *crtc_state);
+bool intel_dp_mst_is_slave_trans(const struct intel_crtc_state *crtc_state);
 
 #endif /* __INTEL_DP_MST_H__ */
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH v2 8/11 drm/i915/display: Always enables MST master pipe first

In reply to José Roberto de Souza

Due to DDB overlaps the pipe enabling sequence is not always crescent. As the previous patch selects the smallest pipe/transcoder in the MST stream to be master and it needs to be enabled first this changes were needed to guarantee that.

So first lets enable all pipes that did not needed a fullmodeset so it don't have any external dependency, this ones can overlap with each other ddb allocations.

Then on the second loop it will enable all the pipes that needs a modeset and don't depends on other pipes like MST master pipe/transcoder.

Then finally all the pipes that needs a modeset and have dependency on other pipes.

Cc Ville Syrjälä <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Matt Roper <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 77 ++++++++++++++------
 1 file changed, 56 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +56 -21
index d059948eec9a..6a815c11c83c 100644
@@ -14566,18 +14566,24 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
 	/*
 	 * Whenever the number of active pipes changes, we need to make sure we
 	 * update the pipes in the right order so that their ddb allocations
-	 * never overlap with eachother inbetween CRTC updates. Otherwise we'll
+	 * never overlap with each other between CRTC updates. Otherwise we'll
 	 * cause pipe underruns and other bad stuff.
+	 *
+	 * So first lets enable all pipes that did not needed a fullmodeset so
+	 * it don't have any external dependency
 	 */
 	do {
 		progress = false;
 
-		for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
-			enum pipe pipe = crtc->pipe;
-			bool vbl_wait = false;
-			bool modeset = needs_modeset(new_crtc_state);
+		for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
+						    new_crtc_state, i) {
+			bool vbl_wait;
+
+			if (updated & BIT(crtc->pipe) ||
+			    !new_crtc_state->hw.active)
+				continue;
 
-			if (updated & BIT(crtc->pipe) || !new_crtc_state->hw.active)
+			if (needs_modeset(new_crtc_state))
 				continue;
 
 			if (skl_ddb_allocation_overlaps(&new_crtc_state->wm.skl.ddb,
@@ -14585,7 +14591,7 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
 							INTEL_NUM_PIPES(dev_priv), i))
 				continue;
 
-			updated |= BIT(pipe);
+			updated |= BIT(crtc->pipe);
 			entries[i] = new_crtc_state->wm.skl.ddb;
 
 			/*
@@ -14596,30 +14602,59 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
 			 */
 			if (!skl_ddb_entry_equal(&new_crtc_state->wm.skl.ddb,
 						 &old_crtc_state->wm.skl.ddb) &&
-			    !modeset &&
 			    state->wm_results.dirty_pipes != updated)
 				vbl_wait = true;
 
-			if (modeset && is_trans_port_sync_mode(new_crtc_state)) {
-				if (is_trans_port_sync_master(new_crtc_state))
-					intel_update_trans_port_sync_crtcs(crtc,
-									   state,
-									   old_crtc_state,
-									   new_crtc_state);
-				else
-					continue;
-			} else {
-				intel_update_crtc(crtc, state, old_crtc_state,
-						  new_crtc_state);
-			}
+			intel_update_crtc(crtc, state, old_crtc_state,
+					  new_crtc_state);
 
 			if (vbl_wait)
-				intel_wait_for_vblank(dev_priv, pipe);
+				intel_wait_for_vblank(dev_priv, crtc->pipe);
 
 			progress = true;
 		}
 	} while (progress);
 
+	/*
+	 * Enabling all pipes that needs a modeset and do not depends on other
+	 * pipes
+	 */
+	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
+					    new_crtc_state, i) {
+		if (updated & BIT(crtc->pipe) || !new_crtc_state->hw.active)
+			continue;
+
+		if (intel_dp_mst_is_slave_trans(new_crtc_state) ||
+		    is_trans_port_sync_slave(new_crtc_state))
+			continue;
+
+		updated |= BIT(crtc->pipe);
+
+		if (is_trans_port_sync_mode(new_crtc_state))
+			intel_update_trans_port_sync_crtcs(crtc, state,
+							   old_crtc_state,
+							   new_crtc_state);
+		else
+			intel_update_crtc(crtc, state, old_crtc_state,
+					  new_crtc_state);
+	}
+
+	/*
+	 * Finally enable all pipes that needs a modeset and depends on
+	 * other pipes, right now it is only MST slaves as both port sync slave
+	 * and master are enabled together
+	 */
+	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
+					    new_crtc_state, i) {
+		if (updated & BIT(crtc->pipe) || !new_crtc_state->hw.active)
+			continue;
+
+		if (is_trans_port_sync_slave(new_crtc_state))
+			continue;
+
+		intel_update_crtc(crtc, state, old_crtc_state, new_crtc_state);
+	}
+
 	/* If 2nd DBuf slice is no more required disable it */
 	if (INTEL_GEN(dev_priv) >= 11 && required_slices < hw_enabled_slices)
 		icl_dbuf_slices_update(dev_priv, required_slices);
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

PATCH v2 9/11 drm/i915/dp: Fix MST disable sequences

In reply to José Roberto de Souza

The disable sequence after wait for transcoder off was not correctly implemented.
The MST disable sequence is basically the same for HSW, SKL, ICL and TGL, with just minor changes for TGL.

So here calling a new MST function to do the MST sequences, most of the steps just moved from the post disable hook.

With this last patch we finally fixed the hotplugs triggered by MST sinks during the disable/enable sequence, those were causing source to try to do a link training while it was not ready causing CPU pipe FIFO underrrus on TGL.

v2: Only unsetting TGL_TRANS_DDI_PORT_MASK for TGL on the post disable sequence

BSpec: 4231
BSpec: 4163
BSpec: 22243
BSpec: 49190

---
 drivers/gpu/drm/i915/display/intel_ddi.c     | 33 ++++++---
 drivers/gpu/drm/i915/display/intel_display.c |  2 +
 drivers/gpu/drm/i915/display/intel_dp_mst.c  | 70 ++++++++++++++++----
 drivers/gpu/drm/i915/display/intel_dp_mst.h  |  1 +
 4 files changed, 84 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/display/intel_ddi.c +24 -9
index e29bde21066e..2fdaae37064b 100644
@@ -34,6 +34,7 @@
 #include "intel_ddi.h"
 #include "intel_display_types.h"
 #include "intel_dp.h"
+#include "intel_dp_mst.h"
 #include "intel_dp_link_training.h"
 #include "intel_dpio_phy.h"
 #include "intel_dsi.h"
@@ -1953,17 +1954,19 @@ void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
-	i915_reg_t reg = TRANS_DDI_FUNC_CTL(cpu_transcoder);
-	u32 val = I915_READ(reg);
+	u32 val;
+
+	val = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder));
+	val &= ~TRANS_DDI_FUNC_ENABLE;
 
 	if (INTEL_GEN(dev_priv) >= 12) {
-		val &= ~(TRANS_DDI_FUNC_ENABLE | TGL_TRANS_DDI_PORT_MASK |
-			 TRANS_DDI_DP_VC_PAYLOAD_ALLOC);
+		if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST) ||
+		    intel_dp_mst_is_slave_trans(crtc_state))
+			val &= ~TGL_TRANS_DDI_PORT_MASK;
 	} else {
-		val &= ~(TRANS_DDI_FUNC_ENABLE | TRANS_DDI_PORT_MASK |
-			 TRANS_DDI_DP_VC_PAYLOAD_ALLOC);
+		val &= ~TRANS_DDI_PORT_MASK;
 	}
-	I915_WRITE(reg, val);
+	I915_WRITE(TRANS_DDI_FUNC_CTL(cpu_transcoder), val);
 
 	if (dev_priv->quirks & QUIRK_INCREASE_DDI_DISABLED_TIME &&
 	    intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
@@ -3812,8 +3815,20 @@ static void intel_ddi_post_disable_dp(struct intel_encoder *encoder,
 	 */
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
 
-	if (INTEL_GEN(dev_priv) < 12 && !is_mst)
-		intel_ddi_disable_pipe_clock(old_crtc_state);
+	if (INTEL_GEN(dev_priv) >= 12) {
+		if (is_mst) {
+			enum transcoder cpu_transcoder;
+			u32 val;
+
+			cpu_transcoder = old_crtc_state->cpu_transcoder;
+			val = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder));
+			val &= ~TGL_TRANS_DDI_PORT_MASK;
+			I915_WRITE(TRANS_DDI_FUNC_CTL(cpu_transcoder), val);
+		}
+	} else {
+		if (!is_mst)
+			intel_ddi_disable_pipe_clock(old_crtc_state);
+	}
 
 	intel_disable_ddi_buf(encoder, old_crtc_state);
 
drivers/gpu/drm/i915/display/intel_display.c +2 -0
index 6a815c11c83c..4dc48e79d14b 100644
@@ -6736,6 +6736,8 @@ static void haswell_crtc_disable(struct intel_atomic_state *state,
 	if (!transcoder_is_dsi(cpu_transcoder))
 		intel_disable_pipe(old_crtc_state);
 
+	intel_dp_mst_post_trans_disabled(old_crtc_state);
+
 	if (INTEL_GEN(dev_priv) >= 11)
 		icl_disable_transcoder_port_sync(old_crtc_state);
 
drivers/gpu/drm/i915/display/intel_dp_mst.c +57 -13

88 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_dp_mst.h +1 -0
index e40767f78343..87f32fab90fc 100644
@@ -16,5 +16,6 @@ void intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port);
 int intel_dp_mst_encoder_active_links(struct intel_digital_port *intel_dig_port);
 bool intel_dp_mst_is_master_trans(const struct intel_crtc_state *crtc_state);
 bool intel_dp_mst_is_slave_trans(const struct intel_crtc_state *crtc_state);
+void intel_dp_mst_post_trans_disabled(const struct intel_crtc_state *old_crtc_state);
 
 #endif /* __INTEL_DP_MST_H__ */
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH v2 10/11 drm/i915/display: Check if pipe fastset is allowed by external dependencies

In reply to José Roberto de Souza

Check if fastset is allowed by external dependencies like other pipes and transcoders.

Right now it only forces a fullmodeset when the MST master transcoder did not changed but the pipe of the master transcoder needs a fullmodeset so all slaves also needs to do a fullmodeset. But it will probably be need for port sync as well.

Cc Ville Syrjälä <[email protected]>
Cc Lucas De Marchi <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 41 ++++++++++++++++++++
 1 file changed, 41 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +41 -0
index 4dc48e79d14b..9729f0b299b3 100644
@@ -13930,11 +13930,52 @@ static int calc_watermark_data(struct intel_atomic_state *state)
 	return 0;
 }
 
+/**
+ * Check if fastset is allowed by external dependencies like other pipes and
+ * transcoders.
+ *
+ * Right now it only forces a fullmodeset when the MST master transcoder did
+ * not changed but the pipe of the master transcoder needs a fullmodeset so
+ * all slaves also needs to do a fullmodeset.
+ */
+static bool
+intel_crtc_check_external_dependencies_fastset(const struct intel_crtc_state *old_crtc_state,
+					       struct intel_crtc_state *new_crtc_state)
+{
+	struct intel_atomic_state *state = to_intel_atomic_state(new_crtc_state->uapi.state);
+	struct drm_i915_private *dev_priv = to_i915(new_crtc_state->uapi.crtc->dev);
+	struct intel_crtc_state *new_crtc_state_iter;
+	struct intel_crtc *crtc_iter;
+	int i;
+
+	if (INTEL_GEN(dev_priv) < 12)
+		return true;
+
+	if (!intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_DP_MST) ||
+	    intel_dp_mst_is_master_trans(new_crtc_state))
+		return true;
+
+	for_each_new_intel_crtc_in_state(state, crtc_iter, new_crtc_state_iter, i) {
+		if (new_crtc_state_iter->cpu_transcoder !=
+		    new_crtc_state->mst_master_transcoder)
+			continue;
+
+		return !needs_modeset(new_crtc_state_iter);
+	}
+
+	DRM_ERROR("Master MST transcoder of pipe not found\n");
+	return false;
+}
+
 static void intel_crtc_check_fastset(const struct intel_crtc_state *old_crtc_state,
 				     struct intel_crtc_state *new_crtc_state)
 {
 	if (!intel_pipe_config_compare(old_crtc_state, new_crtc_state, true))
 		return;
+	if (!intel_crtc_check_external_dependencies_fastset(old_crtc_state,
+							    new_crtc_state))
+		return;
+
 
 	new_crtc_state->uapi.mode_changed = false;
 	new_crtc_state->update_pipe = true;
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH v2 11/11 drm/i915/display: Add comment to a function that probably can be removed

In reply to José Roberto de Souza

This function is only called from port sync and it is identical to what will be executed again in intel_update_crtc() over port sync pipes.
If it is really necessary it at least deserves a better name and a comment, leaving it to people working on port sync.

Cc Ville Syrjälä <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +4 -0
index 9729f0b299b3..8749386da90f 100644
@@ -14505,6 +14505,10 @@ static void intel_set_dp_tp_ctl_normal(struct intel_crtc *crtc,
 	intel_dp_stop_link_train(intel_dp);
 }
 
+/*
+ * TODO: This is only called from port sync and it is identical to what will be
+ * executed again in intel_update_crtc() over port sync pipes
+ */
 static void intel_post_crtc_enable_updates(struct intel_crtc *crtc,
 					   struct intel_atomic_state *state)
 {
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

[Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [v2,01/11] drm: Add __drm_atomic_helper_crtc_state_reset() & co.

In reply to José Roberto de Souza
== Series Details ==

== Series Details ==

Series: series starting with [v2,01/11] drm: Add __drm_atomic_helper_crtc_state_reset() & co.
URL : https://patchwork.freedesktop.org/series/70730/
State : failure

== Summary ==

Applying: drm: Add __drm_atomic_helper_crtc_state_reset() & co.
Applying: drm/i915: s/intel_crtc/crtc/ in intel_crtc_init()
Applying: drm/i915: Introduce intel_crtc_{alloc, free}()
Applying: drm/i915: Introduce intel_crtc_state_reset()
Applying: drm/i915: Introduce intel_plane_state_reset()
Applying: drm/i915/display: Share intel_connector_needs_modeset()
Applying: drm/i915/tgl: Select master transcoder for MST stream
error: sha1 information is lacking or useless (drivers/gpu/drm/i915/display/intel_display.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0007 drm/i915/tgl: Select master transcoder for MST stream When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw
In reply to José Roberto de Souza
Thank you for the patch! Perhaps something to improve:

Hi "José,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[cannot apply to drm-tip/drm-tip linus/master v5.5-rc2 next-20191213] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Jos-Roberto-de-Souza/drm-Add-__drm_atomic_helper_crtc_state_reset-co/20191211-182413
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
reproduce: make htmldocs

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

WARNING: dot(1) not found, for better output quality install graphviz from http://www.graphviz.org
WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org)
include/linux/w1.h:277: warning: Function parameter or member 'of_match_table' not described in 'w1_family' include/linux/spi/spi.h:190: warning: Function parameter or member 'driver_override' not described in 'spi_device' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'quotactl' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'quota_on' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'sb_free_mnt_opts' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'sb_eat_lsm_opts' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'sb_kern_mount' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'sb_show_options' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'sb_add_mnt_opt' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'd_instantiate' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'getprocattr' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'setprocattr' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'locked_down' not described in 'security_list_options' drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c:1: warning: no structured comments found
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1: warning: no structured comments found
drivers/gpio/gpiolib-of.c:92: warning: Excess function parameter 'dev' description in 'of_gpio_need_valid_mask' include/linux/i2c.h:337: warning: Function parameter or member 'init_irq' not described in 'i2c_client' include/linux/regulator/machine.h:196: warning: Function parameter or member 'max_uV_step' not described in 'regulation_constraints' include/linux/regulator/driver.h:223: warning: Function parameter or member 'resume' not described in 'regulator_ops' drivers/usb/typec/bus.c:1: warning: 'typec_altmode_register_driver' not found
drivers/usb/typec/bus.c:1: warning: 'typec_altmode_unregister_driver' not found
drivers/usb/typec/class.c:1: warning: 'typec_altmode_unregister_notifier' not found
drivers/usb/typec/class.c:1: warning: 'typec_altmode_register_notifier' not found
fs/posix_acl.c:647: warning: Function parameter or member 'inode' not described in 'posix_acl_update_mode'
fs/posix_acl.c:647: warning: Function parameter or member 'mode_p' not described in 'posix_acl_update_mode'
fs/posix_acl.c:647: warning: Function parameter or member 'acl' not described in 'posix_acl_update_mode' kernel/dma/coherent.c:1: warning: no structured comments found
include/linux/input/sparse-keymap.h:43: warning: Function parameter or member 'sw' not described in 'key_entry' include/linux/skbuff.h:888: warning: Function parameter or member 'dev_scratch' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'list' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'ip_defrag_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'skb_mstamp_ns' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__cloned_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'head_frag' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__pkt_type_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'encapsulation' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'encap_hdr_csum' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_valid' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__pkt_vlan_present_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'vlan_present' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_complete_sw' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_level' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'inner_protocol_type' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'remcsum_offload' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'sender_cpu' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'reserved_tailroom' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'inner_ipproto' not described in 'sk_buff' include/net/sock.h:233: warning: Function parameter or member 'skc_addrpair' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_portpair' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_ipv6only' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_net_refcnt' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_v6_daddr' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_v6_rcv_saddr' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_cookie' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_listener' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_tw_dr' not described in 'sock_common'
include/net/sock.h:233: warning: Function parameter or member 'skc_rcv_wnd' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_tw_rcv_nxt' not described in 'sock_common' include/net/sock.h:515: warning: Function parameter or member 'sk_rx_skb_cache' not described in 'sock'
include/net/sock.h:515: warning: Function parameter or member 'sk_wq_raw' not described in 'sock'
include/net/sock.h:515: warning: Function parameter or member 'tcp_rtx_queue' not described in 'sock'
include/net/sock.h:515: warning: Function parameter or member 'sk_tx_skb_cache' not described in 'sock'
include/net/sock.h:515: warning: Function parameter or member 'sk_route_forced_caps' not described in 'sock' include/net/sock.h:515: warning: Function parameter or member 'sk_txtime_report_errors' not described in 'sock' include/net/sock.h:515: warning: Function parameter or member 'sk_validate_xmit_skb' not described in 'sock' include/net/sock.h:515: warning: Function parameter or member 'sk_bpf_storage' not described in 'sock'
include/net/sock.h:2455: warning: Function parameter or member 'tcp_rx_skb_cache_key' not described in 'DECLARE_STATIC_KEY_FALSE' include/net/sock.h:2455: warning: Excess function parameter 'sk' description in 'DECLARE_STATIC_KEY_FALSE' include/net/sock.h:2455: warning: Excess function parameter 'skb' description in 'DECLARE_STATIC_KEY_FALSE'
include/linux/netdevice.h:1765: warning: bad line: spinlock
include/linux/netdevice.h:2063: warning: Function parameter or member 'gso_partial_features' not described in 'net_device' include/linux/netdevice.h:2063: warning: Function parameter or member 'l3mdev_ops' not described in 'net_device' include/linux/netdevice.h:2063: warning: Function parameter or member 'xfrmdev_ops' not described in 'net_device' include/linux/netdevice.h:2063: warning: Function parameter or member 'tlsdev_ops' not described in 'net_device' include/linux/netdevice.h:2063: warning: Function parameter or member 'name_assign_type' not described in 'net_device' include/linux/netdevice.h:2063: warning: Function parameter or member 'ieee802154_ptr' not described in 'net_device' include/linux/netdevice.h:2063: warning: Function parameter or member 'mpls_ptr' not described in 'net_device' include/linux/netdevice.h:2063: warning: Function parameter or member 'xdp_prog' not described in 'net_device' include/linux/netdevice.h:2063: warning: Function parameter or member 'gro_flush_timeout' not described in 'net_device' include/linux/netdevice.h:2063: warning: Function parameter or member 'nf_hooks_ingress' not described in 'net_device' include/linux/netdevice.h:2063: warning: Function parameter or member '____cacheline_aligned_in_smp' not described in 'net_device' include/linux/netdevice.h:2063: warning: Function parameter or member 'qdisc_hash' not described in 'net_device' include/linux/netdevice.h:2063: warning: Function parameter or member 'xps_cpus_map' not described in 'net_device' include/linux/netdevice.h:2063: warning: Function parameter or member 'xps_rxqs_map' not described in 'net_device' include/linux/phylink.h:56: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising' not described in 'phylink_link_state' include/linux/phylink.h:56: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising' not described in 'phylink_link_state' lib/genalloc.c:1: warning: 'gen_pool_add_virt' not found
lib/genalloc.c:1: warning: 'gen_pool_alloc' not found
lib/genalloc.c:1: warning: 'gen_pool_free' not found
lib/genalloc.c:1: warning: 'gen_pool_alloc_algo' not found
include/linux/rculist.h:374: warning: Excess function parameter 'cond' description in 'list_for_each_entry_rcu' include/linux/rculist.h:651: warning: Excess function parameter 'cond' description in 'hlist_for_each_entry_rcu'
mm/util.c:1: warning: 'get_user_pages_fast' not found
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:254: warning: Function parameter or member 'hdcp_workqueue' not described in 'amdgpu_display_manager' include/drm/drm_modeset_helper_vtables.h:1052: warning: Function parameter or member 'prepare_writeback_job' not described in 'drm_connector_helper_funcs' include/drm/drm_modeset_helper_vtables.h:1052: warning: Function parameter or member 'cleanup_writeback_job' not described in 'drm_connector_helper_funcs' drivers/gpu/drm/drm_atomic_state_helper.c:240: warning: Excess function parameter 'plane_state' description in '__drm_atomic_helper_plane_state_reset' drivers/gpu/drm/drm_atomic_state_helper.c:385: warning: Excess function parameter 'conn__state' description in '__drm_atomic_helper_connector_state_reset'

>> drivers/gpu/drm/drm_atomic_state_helper.c:241: warning: Function parameter or member 'state' not described in '__drm_atomic_helper_plane_state_reset'
   drivers/gpu/drm/drm_atomic_state_helper.c:241: warning: Excess function parameter 'plane_state' description in '__drm_atomic_helper_plane_state_reset'
>> drivers/gpu/drm/drm_atomic_state_helper.c:386: warning: Function parameter or member 'conn_state' not described in '__drm_atomic_helper_connector_state_reset'

drivers/gpu/drm/drm_atomic_state_helper.c:386: warning: Excess function parameter 'conn__state' description in '__drm_atomic_helper_connector_state_reset' include/net/cfg80211.h:1185: warning: Function parameter or member 'txpwr' not described in 'station_parameters' include/net/mac80211.h:4056: warning: Function parameter or member 'sta_set_txpwr' not described in 'ieee80211_ops' include/net/mac80211.h:2018: warning: Function parameter or member 'txpwr' not described in 'ieee80211_sta' Documentation/admin-guide/perf/imx-ddr.rst:21: WARNING: Unexpected indentation.
Documentation/admin-guide/perf/imx-ddr.rst:34: WARNING: Unexpected indentation.
Documentation/admin-guide/perf/imx-ddr.rst:40: WARNING: Unexpected indentation.
Documentation/admin-guide/perf/imx-ddr.rst:45: WARNING: Unexpected indentation.
Documentation/admin-guide/perf/imx-ddr.rst:52: WARNING: Unexpected indentation.
Documentation/admin-guide/xfs.rst:257: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/trace/kprobetrace.rst:100: WARNING: Explicit markup ends without a blank line; unexpected unindent. drivers/message/fusion/mptbase.c:5057: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/filesystems/ubifs-authentication.rst:94: WARNING: Inline interpreted text or phrase reference start-string without end-string. include/uapi/linux/firewire-cdev.h:312: WARNING: Inline literal start-string without end-string. drivers/firewire/core-transaction.c:606: WARNING: Inline strong start-string without end-string.
Documentation/usb/index.rst:5: WARNING: toctree contains reference to nonexisting document 'usb/rio' Documentation/usb/index.rst:5: WARNING: toctree contains reference to nonexisting document 'usb/wusb-design-overview' Documentation/usb/text_files.rst:22: WARNING: Include file 'Documentation/usb/wusb-cbaf' not found or reading it failed Documentation/translations/it_IT/process/maintainer-pgp-guide.rst:458: WARNING: Unknown target name: "nitrokey pro". include/linux/spi/spi.h:382: WARNING: Unexpected indentation.
Documentation/security/keys/core.rst:1110: WARNING: Inline emphasis start-string without end-string. Documentation/security/keys/core.rst:1110: WARNING: Inline emphasis start-string without end-string. Documentation/security/keys/core.rst:1108: WARNING: Inline emphasis start-string without end-string. Documentation/security/keys/core.rst:1108: WARNING: Inline emphasis start-string without end-string. Documentation/security/keys/core.rst:1108: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:420: WARNING: Unexpected indentation.
Documentation/driver-api/gpio/driver.rst:418: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:422: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/driver-api/gpio/driver.rst:424: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:424: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:424: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:428: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:441: WARNING: Unexpected indentation.
Documentation/driver-api/gpio/driver.rst:435: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:435: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:442: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/driver-api/gpio/driver.rst:444: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/driver-api/gpio/driver.rst:455: WARNING: Unexpected indentation.
Documentation/driver-api/gpio/driver.rst:453: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:455: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:458: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/driver-api/gpio/driver.rst:460: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:460: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:460: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:464: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:471: WARNING: Inline emphasis start-string without end-string.
include/linux/i2c.h:522: WARNING: Inline strong start-string without end-string.
Documentation/misc-devices/index.rst:14: WARNING: toctree contains reference to nonexisting document 'misc-devices/xilinx_sdfec' include/linux/regulator/driver.h:284: WARNING: Unknown target name: "regulator_regmap_x_voltage".
fs/seq_file.c:40: WARNING: Inline strong start-string without end-string.
fs/seq_file.c:40: WARNING: Inline strong start-string without end-string.
fs/seq_file.c:40: WARNING: Inline strong start-string without end-string.
fs/seq_file.c:40: WARNING: Inline strong start-string without end-string.
fs/posix_acl.c:636: WARNING: Inline emphasis start-string without end-string.
fs/debugfs/inode.c:427: WARNING: Inline literal start-string without end-string.
fs/debugfs/inode.c:506: WARNING: Inline literal start-string without end-string.
fs/debugfs/inode.c:538: WARNING: Inline literal start-string without end-string.
fs/debugfs/inode.c:631: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:424: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:430: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:469: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:475: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:514: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:520: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:560: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:566: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:608: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:614: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:875: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:881: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:928: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:934: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:1120: WARNING: Inline literal start-string without end-string.
fs/debugfs/file.c:1126: WARNING: Inline literal start-string without end-string.
Documentation/driver-api/index.rst:14: WARNING: toctree contains reference to nonexisting document 'driver-api/sgi-ioc4' drivers/base/platform.c:160: WARNING: Unexpected indentation.
drivers/base/platform.c:189: WARNING: Unexpected indentation.
drivers/ata/libata-core.c:5945: WARNING: Unknown target name: "hw".
include/linux/netdevice.h:3489: WARNING: Inline emphasis start-string without end-string.
include/linux/netdevice.h:3489: WARNING: Inline emphasis start-string without end-string.
net/core/dev.c:4938: WARNING: Unknown target name: "page_is".
kernel/rcu/update.c:66: WARNING: Inline emphasis start-string without end-string.
kernel/rcu/update.c:66: WARNING: Inline emphasis start-string without end-string.
kernel/rcu/update.c:71: WARNING: Inline emphasis start-string without end-string.
kernel/rcu/update.c:83: WARNING: Inline emphasis start-string without end-string.
drivers/gpu/drm/mcde/mcde_drv.c:47: WARNING: Unexpected indentation.
drivers/gpu/drm/mcde/mcde_drv.c:49: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/admin-guide/device-mapper/dm-clone.rst: WARNING: document isn't included in any toctree Documentation/admin-guide/perf/imx-ddr.rst: WARNING: document isn't included in any toctree
include/linux/slab.h:504: WARNING: undefined label: memory-allocation (if the link has no caption the label must precede a section header)
WARNING: LaTeX command 'latex' cannot be run (needed for math display), check the imgmath_latex setting
WARNING: LaTeX command 'latex' cannot be run (needed for math display), check the imgmath_latex setting Documentation/networking/devlink-trap.rst:175: WARNING: unknown document: /devlink-trap-netdevsim Documentation/trace/kprobetrace.rst:69: WARNING: undefined label: user_mem_access (if the link has no caption the label must precede a section header)
WARNING: LaTeX command 'latex' cannot be run (needed for math display), check the imgmath_latex setting

vim +241 drivers/gpu/drm/drm_atomic_state_helper.c

9ef8a9dc4b2182 Daniel Vetter 2018-10-04 229
9ef8a9dc4b2182 Daniel Vetter 2018-10-04 230 /**

2b3ff8c804f9ee Ville Syrjälä 2019-12-10  231   * __drm_atomic_helper_plane_state_reset - resets plane state to default values
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  232   * @plane_state: atomic plane state, must not be NULL
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  233   * @plane: plane object, must not be NULL
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  234   *
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  235   * Initializes the newly allocated @plane_state with default
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  236   * values. This is useful for drivers that subclass the CRTC state.
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  237   */
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  238  void __drm_atomic_helper_plane_state_reset(struct drm_plane_state *state,
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  239  					   struct drm_plane *plane)
9ef8a9dc4b2182 Daniel Vetter 2018-10-04 @240  {
9ef8a9dc4b2182 Daniel Vetter 2018-10-04 @241  	state->plane = plane;
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  242  	state->rotation = DRM_MODE_ROTATE_0;
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  243  
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  244  	state->alpha = DRM_BLEND_ALPHA_OPAQUE;
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  245  	state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI;
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  246  }
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  247  EXPORT_SYMBOL(__drm_atomic_helper_plane_state_reset);
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  248  
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  249  /**
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  250   * __drm_atomic_helper_plane_reset - reset state on plane
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  251   * @plane: drm plane
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  252   * @plane_state: plane state to assign
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  253   *
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  254   * Initializes the newly allocated @plane_state and assigns it to
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  255   * the &drm_crtc->state pointer of @plane, usually required when
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  256   * initializing the drivers or when called from the &drm_plane_funcs.reset
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  257   * hook.
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  258   *
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  259   * This is useful for drivers that subclass the plane state.
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  260   */
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  261  void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  262  				     struct drm_plane_state *plane_state)
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  263  {
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  264  	if (plane_state)
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  265  		__drm_atomic_helper_plane_state_reset(plane_state, plane);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  266  
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  267  	plane->state = plane_state;
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  268  }
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  269  EXPORT_SYMBOL(__drm_atomic_helper_plane_reset);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  270  
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  271  /**
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  272   * drm_atomic_helper_plane_reset - default &drm_plane_funcs.reset hook for planes
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  273   * @plane: drm plane
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  274   *
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  275   * Resets the atomic state for @plane by freeing the state pointer (which might
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  276   * be NULL, e.g. at driver load time) and allocating a new empty state object.
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  277   */
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  278  void drm_atomic_helper_plane_reset(struct drm_plane *plane)
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  279  {
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  280  	if (plane->state)
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  281  		__drm_atomic_helper_plane_destroy_state(plane->state);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  282  
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  283  	kfree(plane->state);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  284  	plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  285  	if (plane->state)
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  286  		__drm_atomic_helper_plane_reset(plane, plane->state);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  287  }
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  288  EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  289  
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  290  /**
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  291   * __drm_atomic_helper_plane_duplicate_state - copy atomic plane state
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  292   * @plane: plane object
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  293   * @state: atomic plane state
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  294   *
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  295   * Copies atomic state from a plane's current state. This is useful for
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  296   * drivers that subclass the plane state.
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  297   */
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  298  void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane,
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  299  					       struct drm_plane_state *state)
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  300  {
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  301  	memcpy(state, plane->state, sizeof(*state));
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  302  
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  303  	if (state->fb)
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  304  		drm_framebuffer_get(state->fb);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  305  
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  306  	state->fence = NULL;
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  307  	state->commit = NULL;
c75ff001f4fe21 Deepak Rawat  2018-12-21  308  	state->fb_damage_clips = NULL;
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  309  }
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  310  EXPORT_SYMBOL(__drm_atomic_helper_plane_duplicate_state);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  311  
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  312  /**
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  313   * drm_atomic_helper_plane_duplicate_state - default state duplicate hook
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  314   * @plane: drm plane
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  315   *
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  316   * Default plane state duplicate hook for drivers which don't have their own
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  317   * subclassed plane state structure.
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  318   */
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  319  struct drm_plane_state *
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  320  drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane)
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  321  {
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  322  	struct drm_plane_state *state;
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  323  
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  324  	if (WARN_ON(!plane->state))
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  325  		return NULL;
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  326  
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  327  	state = kmalloc(sizeof(*state), GFP_KERNEL);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  328  	if (state)
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  329  		__drm_atomic_helper_plane_duplicate_state(plane, state);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  330  
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  331  	return state;
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  332  }
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  333  EXPORT_SYMBOL(drm_atomic_helper_plane_duplicate_state);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  334  
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  335  /**
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  336   * __drm_atomic_helper_plane_destroy_state - release plane state
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  337   * @state: plane state object to release
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  338   *
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  339   * Releases all resources stored in the plane state without actually freeing
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  340   * the memory of the plane state. This is useful for drivers that subclass the
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  341   * plane state.
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  342   */
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  343  void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state)
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  344  {
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  345  	if (state->fb)
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  346  		drm_framebuffer_put(state->fb);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  347  
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  348  	if (state->fence)
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  349  		dma_fence_put(state->fence);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  350  
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  351  	if (state->commit)
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  352  		drm_crtc_commit_put(state->commit);
c75ff001f4fe21 Deepak Rawat  2018-12-21  353  
c75ff001f4fe21 Deepak Rawat  2018-12-21  354  	drm_property_blob_put(state->fb_damage_clips);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  355  }
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  356  EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  357  
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  358  /**
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  359   * drm_atomic_helper_plane_destroy_state - default state destroy hook
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  360   * @plane: drm plane
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  361   * @state: plane state object to release
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  362   *
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  363   * Default plane state destroy hook for drivers which don't have their own
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  364   * subclassed plane state structure.
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  365   */
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  366  void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  367  					   struct drm_plane_state *state)
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  368  {
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  369  	__drm_atomic_helper_plane_destroy_state(state);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  370  	kfree(state);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  371  }
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  372  EXPORT_SYMBOL(drm_atomic_helper_plane_destroy_state);
9ef8a9dc4b2182 Daniel Vetter 2018-10-04  373  
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  374  /**
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  375   * __drm_atomic_helper_connector_state_reset - reset the connector state
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  376   * @conn__state: atomic connector state, must not be NULL
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  377   * @connector: connectotr object, must not be NULL
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  378   *
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  379   * Initializes the newly allocated @conn_state with default
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  380   * values. This is useful for drivers that subclass the connector state.
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  381   */
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  382  void
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  383  __drm_atomic_helper_connector_state_reset(struct drm_connector_state *conn_state,
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  384  					  struct drm_connector *connector)
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  385  {
2b3ff8c804f9ee Ville Syrjälä 2019-12-10 @386  	conn_state->connector = connector;
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  387  }
2b3ff8c804f9ee Ville Syrjälä 2019-12-10  388  EXPORT_SYMBOL(__drm_atomic_helper_connector_state_reset);

2b3ff8c804f9ee Ville Syrjälä 2019-12-10 389

:::::: The code at line 241 was first introduced by commit
:::::: 9ef8a9dc4b21821d6c397186462fb5e571786b0a drm: Extract drm_atomic_state_helper.[hc]

:::::: TO: Daniel Vetter <[email protected]>
:::::: CC: Daniel Vetter <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation