[PATCH 10/16] drm/i915: Link planes in a bigjoiner configuration.
Maarten Lankhorst
maarten.lankhorst at linux.intel.com
Tue Aug 6 08:51:53 UTC 2019
Make sure that when a plane is set in a bigjoiner mode, we will add
their counterpart to the atomic state as well. This will allow us to
make sure all state is available when planes are checked.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_display.c | 83 +++++++++++++++++++-
drivers/gpu/drm/i915/intel_drv.h | 7 ++
2 files changed, 86 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 1bd87b4b8640..3e6dfa5b1d9f 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -11714,11 +11714,43 @@ static bool check_single_encoder_cloning(struct drm_atomic_state *state,
static int icl_add_linked_planes(struct intel_atomic_state *state)
{
struct intel_plane *plane, *linked;
- struct intel_plane_state *plane_state, *linked_plane_state;
+ struct intel_plane_state *old_plane_state, *new_plane_state, *linked_plane_state;
+ struct intel_crtc_state *crtc_state;
+ struct intel_crtc *crtc;
int i;
- for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
- linked = plane_state->linked_plane;
+ for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
+ if (old_plane_state->bigjoiner_plane) {
+ linked_plane_state = intel_atomic_get_plane_state(state, old_plane_state->bigjoiner_plane);
+ if (IS_ERR(linked_plane_state))
+ return PTR_ERR(linked_plane_state);
+ }
+
+ if (new_plane_state->bigjoiner_plane &&
+ old_plane_state->bigjoiner_plane != new_plane_state->bigjoiner_plane) {
+ linked_plane_state = intel_atomic_get_plane_state(state, new_plane_state->bigjoiner_plane);
+ if (IS_ERR(linked_plane_state))
+ return PTR_ERR(linked_plane_state);
+ }
+
+ if (!old_plane_state->bigjoiner_plane && !new_plane_state->bigjoiner_plane)
+ continue;
+
+ /* Make sure CRTC is also part of the state */
+ crtc = intel_plane_get_crtc_from_states(state, old_plane_state, new_plane_state);
+ DRM_ERROR("crtc: %p, state: %p\n", crtc, state);
+ if (!crtc)
+ continue;
+
+ crtc_state = intel_atomic_get_crtc_state(&state->base, crtc);
+ if (IS_ERR(crtc_state))
+ return PTR_ERR(crtc_state);
+
+ }
+
+ /* Finally add all linked NV12 planes */
+ for_each_new_intel_plane_in_state(state, plane, new_plane_state, i) {
+ linked = new_plane_state->linked_plane;
if (!linked)
continue;
@@ -11728,7 +11760,7 @@ static int icl_add_linked_planes(struct intel_atomic_state *state)
return PTR_ERR(linked_plane_state);
WARN_ON(linked_plane_state->linked_plane != plane);
- WARN_ON(linked_plane_state->slave == plane_state->slave);
+ WARN_ON(linked_plane_state->slave == new_plane_state->slave);
}
return 0;
@@ -13758,6 +13790,7 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state)
struct drm_i915_private *dev_priv = to_i915(state->base.dev);
struct intel_crtc_state *old_crtc_state, *new_crtc_state, *slave_crtc_state, *master_crtc_state;
struct intel_crtc *crtc, *slave, *master;
+ struct intel_plane *plane;
int i, ret = 0;
if (INTEL_GEN(dev_priv) < 11)
@@ -13852,6 +13885,48 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state)
return ret;
}
+ /*
+ * Setup and teardown the new bigjoiner plane mappings.
+ */
+ for_each_intel_plane(&dev_priv->drm, plane) {
+ struct intel_plane_state *plane_state;
+ struct intel_plane *other_plane = NULL;
+
+ crtc = intel_get_crtc_for_pipe(dev_priv, plane->pipe);
+ old_crtc_state = intel_atomic_get_old_crtc_state(state, crtc);
+ new_crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
+
+ if (!new_crtc_state || !needs_modeset(new_crtc_state))
+ continue;
+
+ if (new_crtc_state->bigjoiner) {
+ struct intel_crtc *other_crtc =
+ new_crtc_state->bigjoiner_master_crtc ?:
+ intel_get_crtc_for_pipe(dev_priv, crtc->pipe + 1);
+ bool found = false;
+
+ for_each_intel_plane_on_crtc(&dev_priv->drm, other_crtc, other_plane) {
+ if (other_plane->id != plane->id)
+ continue;
+
+ found = true;
+ break;
+ }
+
+ /* All pipes should have identical planes. */
+ if (WARN_ON(!found))
+ return -EINVAL;
+ } else if (!old_crtc_state->bigjoiner) {
+ continue;
+ }
+
+ plane_state = intel_atomic_get_plane_state(state, plane);
+ if (IS_ERR(plane_state))
+ return PTR_ERR(plane_state);
+
+ plane_state->bigjoiner_plane = other_plane;
+ }
+
return 0;
}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 196a58322c9f..6d81b4024821 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -548,6 +548,13 @@ struct intel_plane_state {
*/
struct intel_plane *linked_plane;
+ /*
+ * bigjoiner_plane:
+ *
+ * When 2 pipes are joined in a bigjoiner configuration,
+ * points to the same plane on the other pipe.
+ */
+ struct intel_plane *bigjoiner_plane;
/*
* slave:
* If set don't update use the linked plane's state for updating
--
2.20.1
More information about the Intel-gfx-trybot
mailing list