Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 5/6] drm/i915: Introduce intel_crtc_readout_derived_state()
Date: Thu, 12 Nov 2020 21:17:17 +0200	[thread overview]
Message-ID: <20201112191718.16683-6-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20201112191718.16683-1-ville.syrjala@linux.intel.com>

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

Collect up a bunch of derived state "readout" into
a common helper, which we can call from both
intel_encoder_get_config() and intel_crtc_get_pipe_config().

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

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index ebf621ff7ef6..07b8d945c41f 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -8162,10 +8162,26 @@ static void intel_crtc_compute_pixel_rate(struct intel_crtc_state *crtc_state)
 			ilk_pipe_pixel_rate(crtc_state);
 }
 
+static void intel_crtc_readout_derived_state(struct intel_crtc_state *crtc_state)
+{
+	struct drm_display_mode *mode = &crtc_state->hw.mode;
+	struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
+
+	intel_mode_from_crtc_timings(adjusted_mode, adjusted_mode);
+
+	intel_crtc_compute_pixel_rate(crtc_state);
+
+	drm_mode_copy(mode, adjusted_mode);
+	mode->hdisplay = crtc_state->pipe_src_w;
+	mode->vdisplay = crtc_state->pipe_src_h;
+}
+
 static void intel_encoder_get_config(struct intel_encoder *encoder,
 				     struct intel_crtc_state *crtc_state)
 {
 	encoder->get_config(encoder, crtc_state);
+
+	intel_crtc_readout_derived_state(crtc_state);
 }
 
 static int intel_crtc_compute_config(struct intel_crtc *crtc,
@@ -9046,9 +9062,6 @@ static void intel_get_pipe_src_size(struct intel_crtc *crtc,
 	tmp = intel_de_read(dev_priv, PIPESRC(crtc->pipe));
 	pipe_config->pipe_src_h = (tmp & 0xffff) + 1;
 	pipe_config->pipe_src_w = ((tmp >> 16) & 0xffff) + 1;
-
-	pipe_config->hw.mode.vdisplay = pipe_config->pipe_src_h;
-	pipe_config->hw.mode.hdisplay = pipe_config->pipe_src_w;
 }
 
 static void i9xx_set_pipeconf(const struct intel_crtc_state *crtc_state)
@@ -11417,6 +11430,8 @@ static bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state)
 
 	crtc_state->hw.active = true;
 
+	intel_crtc_readout_derived_state(crtc_state);
+
 	return true;
 }
 
@@ -14469,8 +14484,6 @@ verify_crtc_state(struct intel_crtc *crtc,
 			intel_encoder_get_config(encoder, pipe_config);
 	}
 
-	intel_crtc_compute_pixel_rate(pipe_config);
-
 	if (!new_crtc_state->hw.active)
 		return;
 
@@ -18839,15 +18852,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 		int min_cdclk = 0;
 
 		if (crtc_state->hw.active) {
-			struct drm_display_mode *mode = &crtc_state->hw.mode;
-
-			intel_mode_from_crtc_timings(&crtc_state->hw.adjusted_mode,
-						     &crtc_state->hw.adjusted_mode);
-
-			*mode = crtc_state->hw.adjusted_mode;
-			mode->hdisplay = crtc_state->pipe_src_w;
-			mode->vdisplay = crtc_state->pipe_src_h;
-
 			/*
 			 * The initial mode needs to be set in order to keep
 			 * the atomic core happy. It wants a valid mode if the
@@ -18859,8 +18863,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 			 */
 			crtc_state->inherited = true;
 
-			intel_crtc_compute_pixel_rate(crtc_state);
-
 			intel_crtc_update_active_timings(crtc_state);
 
 			intel_crtc_copy_hw_to_uapi_state(crtc_state);
-- 
2.26.2

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

  parent reply	other threads:[~2020-11-12 19:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 19:17 [Intel-gfx] [PATCH 0/6] drm/i915: Introduce crtc_state.hw.pipe_mode Ville Syrjala
2020-11-12 19:17 ` [Intel-gfx] [PATCH 1/6] drm/i915: Move encoder->get_config to a new function Ville Syrjala
2020-11-12 19:45   ` Navare, Manasi
2020-11-13  8:56     ` Manna, Animesh
2020-11-12 19:17 ` [Intel-gfx] [PATCH 2/6] drm/i915: Add a wrapper function around get_pipe_config Ville Syrjala
2020-11-12 19:46   ` Navare, Manasi
2020-11-13  8:58     ` Manna, Animesh
2020-11-12 19:17 ` [Intel-gfx] [PATCH 3/6] drm/i915: Move hw.active assignment into intel_crtc_get_pipe_config() Ville Syrjala
2020-11-12 19:48   ` Navare, Manasi
2020-11-13 14:27     ` Ville Syrjälä
2020-11-12 19:17 ` [Intel-gfx] [PATCH 4/6] drm/i915: s/intel_mode_from_pipe_config/intel_mode_from_crtc_timings/ Ville Syrjala
2020-11-12 19:49   ` Navare, Manasi
2020-11-12 19:17 ` Ville Syrjala [this message]
2020-11-12 19:49   ` [Intel-gfx] [PATCH 5/6] drm/i915: Introduce intel_crtc_readout_derived_state() Navare, Manasi
2020-11-12 19:17 ` [Intel-gfx] [PATCH 6/6] drm/i915: Add hw.pipe_mode to allow bigjoiner pipe/transcoder split Ville Syrjala
2020-11-12 23:45 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915: Introduce crtc_state.hw.pipe_mode Patchwork
2020-11-13  0:15 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-11-13  2:46 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201112191718.16683-6-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox