Commit 4d1b53df authored by Ville Syrjälä's avatar Ville Syrjälä
Browse files

drm/i915: Eliminate bigjoiner boolean



Since we now have the bigjoiner_pipes bitmask the boolean
is redundant. Get rid of it.

Also, populating bigjoiner_pipes already during
encoder->compute_config() allows us to use it much earlier
during the state calculation as well. The initial aim is
to use it in intel_crtc_compute_config().

v2: Move the hweight(bigjoiner_pipes) stuff to a later patch

Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com> #v1
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com> #v1
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220223131315.18016-12-ville.syrjala@linux.intel.com
parent 26111a16
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -630,7 +630,7 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
	 * FIXME bigjoiner fastpath would be good
	 */
	if (!crtc_state->hw.active || intel_crtc_needs_modeset(crtc_state) ||
	    crtc_state->update_pipe || crtc_state->bigjoiner)
	    crtc_state->update_pipe || crtc_state->bigjoiner_pipes)
		goto slow;

	/*
+23 −29
Original line number Diff line number Diff line
@@ -1918,7 +1918,7 @@ static void hsw_crtc_enable(struct intel_atomic_state *state,
	if (drm_WARN_ON(&dev_priv->drm, crtc->active))
		return;

	if (!new_crtc_state->bigjoiner) {
	if (!new_crtc_state->bigjoiner_pipes) {
		intel_encoders_pre_pll_enable(state, crtc);

		if (new_crtc_state->shared_dpll)
@@ -2719,7 +2719,7 @@ static void intel_crtc_compute_pixel_rate(struct intel_crtc_state *crtc_state)
static void intel_bigjoiner_adjust_timings(const struct intel_crtc_state *crtc_state,
					   struct drm_display_mode *mode)
{
	if (!crtc_state->bigjoiner)
	if (!crtc_state->bigjoiner_pipes)
		return;

	mode->crtc_clock /= 2;
@@ -2780,7 +2780,7 @@ static void intel_crtc_readout_derived_state(struct intel_crtc_state *crtc_state
	/* Populate the "user" mode with full numbers */
	drm_mode_copy(mode, pipe_mode);
	intel_mode_from_crtc_timings(mode, mode);
	mode->hdisplay = drm_rect_width(&crtc_state->pipe_src) << crtc_state->bigjoiner;
	mode->hdisplay = drm_rect_width(&crtc_state->pipe_src) << !!crtc_state->bigjoiner_pipes;
	mode->vdisplay = drm_rect_height(&crtc_state->pipe_src);

	/* Derive per-pipe timings in case bigjoiner is used */
@@ -2802,7 +2802,7 @@ static void intel_bigjoiner_compute_pipe_src(struct intel_crtc_state *crtc_state
{
	int width, height;

	if (!crtc_state->bigjoiner)
	if (!crtc_state->bigjoiner_pipes)
		return;

	width = drm_rect_width(&crtc_state->pipe_src);
@@ -4190,7 +4190,6 @@ static void intel_bigjoiner_get_config(struct intel_crtc_state *crtc_state)
	if (((master_pipes | slave_pipes) & BIT(pipe)) == 0)
		return;

	crtc_state->bigjoiner = true;
	crtc_state->bigjoiner_pipes =
		BIT(get_bigjoiner_master_pipe(pipe, master_pipes, slave_pipes)) |
		get_bigjoiner_slave_pipes(pipe, master_pipes, slave_pipes);
@@ -5600,6 +5599,9 @@ copy_bigjoiner_crtc_state_modeset(struct intel_atomic_state *state,
		intel_atomic_get_new_crtc_state(state, master_crtc);
	struct intel_crtc_state *saved_state;

	WARN_ON(master_crtc_state->bigjoiner_pipes !=
		slave_crtc_state->bigjoiner_pipes);

	saved_state = kmemdup(master_crtc_state, sizeof(*saved_state), GFP_KERNEL);
	if (!saved_state)
		return -ENOMEM;
@@ -5630,6 +5632,9 @@ copy_bigjoiner_crtc_state_modeset(struct intel_atomic_state *state,
	slave_crtc_state->uapi.connectors_changed = master_crtc_state->uapi.connectors_changed;
	slave_crtc_state->uapi.active_changed = master_crtc_state->uapi.active_changed;

	WARN_ON(master_crtc_state->bigjoiner_pipes !=
		slave_crtc_state->bigjoiner_pipes);

	return 0;
}

@@ -6405,7 +6410,6 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,

	PIPE_CONF_CHECK_X(sync_mode_slaves_mask);
	PIPE_CONF_CHECK_I(master_transcoder);
	PIPE_CONF_CHECK_BOOL(bigjoiner);
	PIPE_CONF_CHECK_X(bigjoiner_pipes);

	PIPE_CONF_CHECK_I(dsc.compression_enable);
@@ -7336,32 +7340,26 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state,
	struct intel_crtc_state *master_crtc_state =
		intel_atomic_get_new_crtc_state(state, master_crtc);
	struct intel_crtc *slave_crtc;
	u8 slave_pipes;

	/*
	 * TODO: encoder.compute_config() may be the best
	 * place to populate the bitmask for the master crtc.
	 * For now encoder.compute_config() just flags things
	 * as needing bigjoiner and we populate the bitmask
	 * here.
	 */
	WARN_ON(master_crtc_state->bigjoiner_pipes);

	if (!master_crtc_state->bigjoiner)
	if (!master_crtc_state->bigjoiner_pipes)
		return 0;

	slave_pipes = BIT(master_crtc->pipe + 1);
	/* sanity check */
	if (drm_WARN_ON(&i915->drm,
			master_crtc->pipe != bigjoiner_master_pipe(master_crtc_state)))
		return -EINVAL;

	if (slave_pipes & ~bigjoiner_pipes(i915)) {
	if (master_crtc_state->bigjoiner_pipes & ~bigjoiner_pipes(i915)) {
		drm_dbg_kms(&i915->drm,
			    "[CRTC:%d:%s] Cannot act as big joiner master "
			    "(need 0x%x as slave pipes, only 0x%x possible)\n",
			    "(need 0x%x as pipes, only 0x%x possible)\n",
			    master_crtc->base.base.id, master_crtc->base.name,
			    slave_pipes, bigjoiner_pipes(i915));
			    master_crtc_state->bigjoiner_pipes, bigjoiner_pipes(i915));
		return -EINVAL;
	}

	for_each_intel_crtc_in_pipe_mask(&i915->drm, slave_crtc, slave_pipes) {
	for_each_intel_crtc_in_pipe_mask(&i915->drm, slave_crtc,
					 intel_crtc_bigjoiner_slave_pipes(master_crtc_state)) {
		struct intel_crtc_state *slave_crtc_state;
		int ret;

@@ -7395,10 +7393,8 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state,
			    slave_crtc->base.base.id, slave_crtc->base.name,
			    master_crtc->base.base.id, master_crtc->base.name);

		master_crtc_state->bigjoiner_pipes =
			BIT(master_crtc->pipe) | BIT(slave_crtc->pipe);
		slave_crtc_state->bigjoiner_pipes =
			BIT(master_crtc->pipe) | BIT(slave_crtc->pipe);
			master_crtc_state->bigjoiner_pipes;

		ret = copy_bigjoiner_crtc_state_modeset(state, slave_crtc);
		if (ret)
@@ -7421,13 +7417,11 @@ static void kill_bigjoiner_slave(struct intel_atomic_state *state,
		struct intel_crtc_state *slave_crtc_state =
			intel_atomic_get_new_crtc_state(state, slave_crtc);

		slave_crtc_state->bigjoiner = false;
		slave_crtc_state->bigjoiner_pipes = 0;

		intel_crtc_copy_uapi_to_hw_state_modeset(state, slave_crtc);
	}

	master_crtc_state->bigjoiner = false;
	master_crtc_state->bigjoiner_pipes = 0;
}

@@ -7840,7 +7834,7 @@ static int intel_atomic_check(struct drm_device *dev,
			}
		}

		if (new_crtc_state->bigjoiner) {
		if (new_crtc_state->bigjoiner_pipes) {
			if (intel_pipes_need_modeset(state, new_crtc_state->bigjoiner_pipes)) {
				new_crtc_state->uapi.mode_changed = true;
				new_crtc_state->update_pipe = false;
@@ -10176,7 +10170,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
			intel_encoder_get_config(encoder, crtc_state);

			/* read out to slave crtc as well for bigjoiner */
			if (crtc_state->bigjoiner) {
			if (crtc_state->bigjoiner_pipes) {
				struct intel_crtc *slave_crtc;

				/* encoder should read be linked to bigjoiner master */
+1 −1
Original line number Diff line number Diff line
@@ -945,7 +945,7 @@ static void intel_crtc_info(struct seq_file *m, struct intel_crtc *crtc)

	intel_scaler_info(m, crtc);

	if (crtc_state->bigjoiner)
	if (crtc_state->bigjoiner_pipes)
		seq_printf(m, "\tLinked to 0x%x pipes as a %s\n",
			   crtc_state->bigjoiner_pipes,
			   intel_crtc_is_bigjoiner_slave(crtc_state) ? "slave" : "master");
+0 −3
Original line number Diff line number Diff line
@@ -1181,9 +1181,6 @@ struct intel_crtc_state {
	/* enable pipe csc? */
	bool csc_enable;

	/* enable pipe big joiner? */
	bool bigjoiner;

	/* big joiner pipe bitmask */
	u8 bigjoiner_pipes;

+7 −6
Original line number Diff line number Diff line
@@ -1426,13 +1426,13 @@ static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
						    pipe_config->lane_count,
						    adjusted_mode->crtc_clock,
						    adjusted_mode->crtc_hdisplay,
						    pipe_config->bigjoiner,
						    pipe_config->bigjoiner_pipes,
						    pipe_bpp);
		dsc_dp_slice_count =
			intel_dp_dsc_get_slice_count(intel_dp,
						     adjusted_mode->crtc_clock,
						     adjusted_mode->crtc_hdisplay,
						     pipe_config->bigjoiner);
						     pipe_config->bigjoiner_pipes);
		if (!dsc_max_output_bpp || !dsc_dp_slice_count) {
			drm_dbg_kms(&dev_priv->drm,
				    "Compressed BPP/Slice Count not supported\n");
@@ -1466,7 +1466,7 @@ static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
	 * then we need to use 2 VDSC instances.
	 */
	if (adjusted_mode->crtc_clock > dev_priv->max_cdclk_freq ||
	    pipe_config->bigjoiner) {
	    pipe_config->bigjoiner_pipes) {
		if (pipe_config->dsc.slice_count < 2) {
			drm_dbg_kms(&dev_priv->drm,
				    "Cannot split stream to use 2 VDSC instances\n");
@@ -1502,6 +1502,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
			     struct drm_connector_state *conn_state)
{
	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
	struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc);
	const struct drm_display_mode *adjusted_mode =
		&pipe_config->hw.adjusted_mode;
	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
@@ -1539,7 +1540,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,

	if (intel_dp_need_bigjoiner(intel_dp, adjusted_mode->crtc_hdisplay,
				    adjusted_mode->crtc_clock))
		pipe_config->bigjoiner = true;
		pipe_config->bigjoiner_pipes = GENMASK(crtc->pipe + 1, crtc->pipe);

	/*
	 * Optimize for slow and wide for everything, because there are some
@@ -1552,8 +1553,8 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
	 * onwards pipe joiner can be enabled without compression.
	 */
	drm_dbg_kms(&i915->drm, "Force DSC en = %d\n", intel_dp->force_dsc_en);
	if (ret || intel_dp->force_dsc_en || (DISPLAY_VER(i915) < 13 &&
					      pipe_config->bigjoiner)) {
	if (ret || intel_dp->force_dsc_en ||
	    (DISPLAY_VER(i915) < 13 && pipe_config->bigjoiner_pipes)) {
		ret = intel_dp_dsc_compute_config(intel_dp, pipe_config,
						  conn_state, &limits);
		if (ret < 0)
Loading