Commit 2b1466ea authored by Ville Syrjälä's avatar Ville Syrjälä
Browse files

drm/i915: Remove weird code from intel_atomic_check_bigjoiner()



There's some weird junk in intel_atomic_check_bigjoiner()
that's trying to look at the old crtc state's bigjoiner
usage for some reason. That code is totally unnecessary,
and maybe even actively harmful. Not entirely sure which
since it's such a mess that I can't actually wrap my brain
around what it ends up doing.

Either way, thanks to intel_bigjoiner_add_affected_crtcs()
all of the old bigjoiner crtcs are guaranteed to be in the
state already if any one of them is in the state. Also if
any one of those crtcs got flagged for a modeset, then all
of them will have been flagged, and the bigjoiner links
will have been detached via kill_bigjoiner_slave().

So there is no need to look examing any old bigjoiner
usage in intel_atomic_check_bigjoiner(). All we have to care
about is whether bigjoiner is needed for the new state,
and whether we can get the slave crtc we need.

Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220203183823.22890-4-ville.syrjala@linux.intel.com


Reviewed-by: default avatarManasi Navare <manasi.d.navare@intel.com>
parent 6148f365
Loading
Loading
Loading
Loading
+11 −22
Original line number Original line Diff line number Diff line
@@ -7370,38 +7370,28 @@ static bool intel_cpu_transcoders_need_modeset(struct intel_atomic_state *state,
}
}


static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state,
static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state,
					struct intel_crtc *crtc,
					struct intel_crtc *master_crtc)
					struct intel_crtc_state *old_crtc_state,
					struct intel_crtc_state *new_crtc_state)
{
{
	struct drm_i915_private *i915 = to_i915(state->base.dev);
	struct drm_i915_private *i915 = to_i915(state->base.dev);
	struct intel_crtc_state *slave_crtc_state, *master_crtc_state;
	struct intel_crtc_state *master_crtc_state =
	struct intel_crtc *slave_crtc, *master_crtc;
		intel_atomic_get_new_crtc_state(state, master_crtc);
	struct intel_crtc_state *slave_crtc_state;
	struct intel_crtc *slave_crtc;


	/* slave being enabled, is master is still claiming this crtc? */
	if (!master_crtc_state->bigjoiner)
	if (old_crtc_state->bigjoiner_slave) {
		slave_crtc = crtc;
		master_crtc = old_crtc_state->bigjoiner_linked_crtc;
		master_crtc_state = intel_atomic_get_new_crtc_state(state, master_crtc);
		if (!master_crtc_state || !intel_crtc_needs_modeset(master_crtc_state))
			goto claimed;
	}

	if (!new_crtc_state->bigjoiner)
		return 0;
		return 0;


	slave_crtc = intel_dsc_get_bigjoiner_secondary(crtc);
	slave_crtc = intel_dsc_get_bigjoiner_secondary(master_crtc);
	if (!slave_crtc) {
	if (!slave_crtc) {
		drm_dbg_kms(&i915->drm,
		drm_dbg_kms(&i915->drm,
			    "[CRTC:%d:%s] Big joiner configuration requires "
			    "[CRTC:%d:%s] Big joiner configuration requires "
			    "CRTC + 1 to be used, doesn't exist\n",
			    "CRTC + 1 to be used, doesn't exist\n",
			    crtc->base.base.id, crtc->base.name);
			    master_crtc->base.base.id, master_crtc->base.name);
		return -EINVAL;
		return -EINVAL;
	}
	}


	new_crtc_state->bigjoiner_linked_crtc = slave_crtc;
	master_crtc_state->bigjoiner_linked_crtc = slave_crtc;
	slave_crtc_state = intel_atomic_get_crtc_state(&state->base, slave_crtc);
	slave_crtc_state = intel_atomic_get_crtc_state(&state->base, slave_crtc);
	master_crtc = crtc;
	if (IS_ERR(slave_crtc_state))
	if (IS_ERR(slave_crtc_state))
		return PTR_ERR(slave_crtc_state);
		return PTR_ERR(slave_crtc_state);


@@ -7413,7 +7403,7 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state,
		    "[CRTC:%d:%s] Used as slave for big joiner\n",
		    "[CRTC:%d:%s] Used as slave for big joiner\n",
		    slave_crtc->base.base.id, slave_crtc->base.name);
		    slave_crtc->base.base.id, slave_crtc->base.name);


	return copy_bigjoiner_crtc_state(slave_crtc_state, new_crtc_state);
	return copy_bigjoiner_crtc_state(slave_crtc_state, master_crtc_state);


claimed:
claimed:
	drm_dbg_kms(&i915->drm,
	drm_dbg_kms(&i915->drm,
@@ -7685,8 +7675,7 @@ static int intel_atomic_check(struct drm_device *dev,
		if (ret)
		if (ret)
			goto fail;
			goto fail;


		ret = intel_atomic_check_bigjoiner(state, crtc, old_crtc_state,
		ret = intel_atomic_check_bigjoiner(state, crtc);
						   new_crtc_state);
		if (ret)
		if (ret)
			goto fail;
			goto fail;
	}
	}