All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH 03/36] drm/i915: add pipe_config->timings_set
Date: Thu, 21 Feb 2013 01:49:55 +0100	[thread overview]
Message-ID: <1361407828-2419-4-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1361407828-2419-1-git-send-email-daniel.vetter@ffwll.ch>

Only used by the lvds encoder. Note that we shouldn't do the same
simple conversion with the FORCE_6BPC flag, since that's much better
handling by moving all the pipe_bcp computation around.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_display.c | 12 +++++++++++-
 drivers/gpu/drm/i915/intel_drv.h     | 10 ++++++----
 drivers/gpu/drm/i915/intel_lvds.c    | 19 +++++++++----------
 3 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b348341..d550487 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3896,7 +3896,7 @@ static bool intel_crtc_compute_config(struct drm_crtc *crtc,
 	/* All interlaced capable intel hw wants timings in frames. Note though
 	 * that intel_lvds_mode_fixup does some funny tricks with the crtc
 	 * timings, so we need to be careful not to clobber these.*/
-	if (!(adjusted_mode->private_flags & INTEL_MODE_CRTC_TIMINGS_SET))
+	if (!pipe_config->timings_set)
 		drm_mode_set_crtcinfo(adjusted_mode, 0);
 
 	/* WaPruneModeWithIncorrectHsyncOffset: Cantiga+ cannot handle modes
@@ -7413,6 +7413,16 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
 
 		if (&encoder->new_crtc->base != crtc)
 			continue;
+
+		if (encoder->compute_config) {
+			if (!(encoder->compute_config(encoder, pipe_config))) {
+				DRM_DEBUG_KMS("Encoder config failure\n");
+				goto fail;
+			}
+
+			continue;
+		}
+
 		encoder_funcs = encoder->base.helper_private;
 		if (!(encoder_funcs->mode_fixup(&encoder->base,
 						&pipe_config->requested_mode,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 898fdfe..006d445 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -105,10 +105,6 @@
 #define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0)
 #define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT)
 #define INTEL_MODE_DP_FORCE_6BPC (0x10)
-/* This flag must be set by the encoder's mode_fixup if it changes the crtc
- * timings in the mode to prevent the crtc fixup from overwriting them.
- * Currently only lvds needs that. */
-#define INTEL_MODE_CRTC_TIMINGS_SET (0x20)
 /*
  * Set when limited 16-235 (as opposed to full 0-255) RGB color range is
  * to be used.
@@ -158,6 +154,8 @@ struct intel_encoder {
 	bool cloneable;
 	bool connectors_active;
 	void (*hot_plug)(struct intel_encoder *);
+	bool (*compute_config)(struct intel_encoder *,
+			       struct intel_crtc_config *);
 	void (*pre_pll_enable)(struct intel_encoder *);
 	void (*pre_enable)(struct intel_encoder *);
 	void (*enable)(struct intel_encoder *);
@@ -202,6 +200,10 @@ struct intel_connector {
 struct intel_crtc_config {
 	struct drm_display_mode requested_mode;
 	struct drm_display_mode adjusted_mode;
+	/* This flag must be set by the encoder's compute_config callback if it
+	 * changes the crtc timings in the mode to prevent the crtc fixup from
+	 * overwriting them.  Currently only lvds needs that. */
+	bool timings_set;
 };
 
 struct intel_crtc {
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index c7154bf..565e13e 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -261,8 +261,6 @@ centre_horizontally(struct drm_display_mode *mode,
 
 	mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos;
 	mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width;
-
-	mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET;
 }
 
 static void
@@ -284,8 +282,6 @@ centre_vertically(struct drm_display_mode *mode,
 
 	mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos;
 	mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width;
-
-	mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET;
 }
 
 static inline u32 panel_fitter_scaling(u32 source, u32 target)
@@ -301,15 +297,17 @@ static inline u32 panel_fitter_scaling(u32 source, u32 target)
 	return (FACTOR * ratio + FACTOR/2) / FACTOR;
 }
 
-static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
-				  const struct drm_display_mode *mode,
-				  struct drm_display_mode *adjusted_mode)
+static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
+				      struct intel_crtc_config *pipe_config)
 {
-	struct drm_device *dev = encoder->dev;
+	struct drm_device *dev = intel_encoder->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(encoder);
+	struct intel_lvds_encoder *lvds_encoder =
+		to_lvds_encoder(&intel_encoder->base);
 	struct intel_connector *intel_connector =
 		&lvds_encoder->attached_connector->base;
+	struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode;
+	struct drm_display_mode *mode = &pipe_config->requested_mode;
 	struct intel_crtc *intel_crtc = lvds_encoder->base.new_crtc;
 	u32 pfit_control = 0, pfit_pgm_ratios = 0, border = 0;
 	int pipe;
@@ -359,6 +357,7 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
 		I915_WRITE(BCLRPAT(pipe), 0);
 
 	drm_mode_set_crtcinfo(adjusted_mode, 0);
+	pipe_config->timings_set = true;
 
 	switch (intel_connector->panel.fitting_mode) {
 	case DRM_MODE_SCALE_CENTER:
@@ -661,7 +660,6 @@ static int intel_lvds_set_property(struct drm_connector *connector,
 }
 
 static const struct drm_encoder_helper_funcs intel_lvds_helper_funcs = {
-	.mode_fixup = intel_lvds_mode_fixup,
 	.mode_set = intel_lvds_mode_set,
 	.disable = intel_encoder_noop,
 };
@@ -1103,6 +1101,7 @@ bool intel_lvds_init(struct drm_device *dev)
 	intel_encoder->enable = intel_enable_lvds;
 	intel_encoder->pre_enable = intel_pre_enable_lvds;
 	intel_encoder->pre_pll_enable = intel_pre_pll_enable_lvds;
+	intel_encoder->compute_config = intel_lvds_compute_config;
 	intel_encoder->disable = intel_disable_lvds;
 	intel_encoder->get_hw_state = intel_lvds_get_hw_state;
 	intel_connector->get_hw_state = intel_connector_get_hw_state;
-- 
1.7.11.4

  parent reply	other threads:[~2013-02-21  0:50 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-21  0:49 [PATCH 00/36] introduce pipe_config with fdi auto-dithering Daniel Vetter
2013-02-21  0:49 ` [PATCH 01/36] drm/i915: introduce struct intel_crtc_config Daniel Vetter
2013-02-21 14:38   ` Ville Syrjälä
2013-02-21  0:49 ` [PATCH 02/36] drm/i915: compute pipe_config earlier Daniel Vetter
2013-02-21  0:49 ` Daniel Vetter [this message]
2013-02-21  0:49 ` [PATCH 04/36] drm/i915: add pipe_config->pixel_multiplier Daniel Vetter
2013-02-21  0:49 ` [PATCH 05/36] drm/i915: add pipe_config->has_pch_encoder Daniel Vetter
2013-02-21  0:49 ` [PATCH 06/36] drm/i915: clear up the fdi/dp set_m_n confusion Daniel Vetter
2013-02-21  0:49 ` [PATCH 07/36] drm/i915: move pipe bpp computation to pipe_config Daniel Vetter
2013-02-21 14:49   ` Ville Syrjälä
2013-02-21 14:54     ` Daniel Vetter
2013-02-21  0:50 ` [PATCH 08/36] drm/i915: clean up plane bpp confusion Daniel Vetter
2013-02-21  0:50 ` [PATCH 09/36] drm/i915: clean up pipe " Daniel Vetter
2013-02-21  0:50 ` [PATCH 10/36] drm/i915: move dp_m_n computation to dp_encoder->compute_config Daniel Vetter
2013-02-21  0:50 ` [PATCH 11/36] drm/i915: track dp target_clock in pipe_config Daniel Vetter
2013-02-21  0:50 ` [PATCH 12/36] drm/i915: rip out superflous is_dp&is_cpu_edp tracking Daniel Vetter
2013-02-21  0:50 ` [PATCH 13/36] drm/i915: add hw state readout/checking for pipe_config Daniel Vetter
2013-02-21  0:50 ` [PATCH 14/36] drm/i915: hw readout support for ->has_pch_encoders Daniel Vetter
2013-02-21  0:50 ` [PATCH 15/36] drm/i915: gen2 has no tv out support Daniel Vetter
2013-02-21  0:50 ` [PATCH 16/36] drm/i915: create pipe_config->dpll for clock state Daniel Vetter
2013-02-21  0:50 ` [PATCH 17/36] drm/i915: move dp clock computations to encoder->compute_config Daniel Vetter
2013-02-21  0:50 ` [PATCH 18/36] drm/i915: add pipe_config->limited_color_range Daniel Vetter
2013-02-21  0:50 ` [PATCH 19/36] drm/i915: use pipe_config for lvds dithering Daniel Vetter
2013-02-21  0:50 ` [PATCH 20/36] drm/i915: move intel_crtc->fdi_lanes to pipe_config Daniel Vetter
2013-02-21  0:50 ` [PATCH 21/36] drm/i915: fixup 12bpc hdmi dotclock handling Daniel Vetter
2013-02-21  0:50 ` [PATCH 22/36] drm/i915: hw state readout support for pipe_config->fdi_lanes Daniel Vetter
2013-02-21  0:50 ` [PATCH 23/36] drm/i915: split up fdi_set_m_n into computation and hw setup Daniel Vetter
2013-02-21  0:50 ` [PATCH 24/36] drm/i915: Disable high-bpc on pre-1.4 EDID screens Daniel Vetter
2013-02-21  0:50 ` [PATCH 25/36] drm/i915: force bpp for eDP panels Daniel Vetter
2013-02-21  0:50 ` [PATCH 26/36] drm/i915: allow high-bpc modes on DP Daniel Vetter
2013-02-21  0:50 ` [PATCH 27/36] drm/i915: extract i9xx_set_pipeconf Daniel Vetter
2013-02-21  0:50 ` [PATCH 28/36] drm/i915: drop adjusted_mode from *_set_pipeconf functions Daniel Vetter
2013-02-21  0:50 ` [PATCH 29/36] drm/i915: implement high-bpc + pipeconf-dither support for g4x/vlv Daniel Vetter
2013-02-21  0:50 ` [PATCH 30/36] drm/i915: compute fdi lane config earlier Daniel Vetter
2013-02-21  0:50 ` [PATCH 31/36] drm/i915: Split up ironlake_check_fdi_lanes Daniel Vetter
2013-02-21  0:50 ` [PATCH 32/36] drm/i915: move fdi lane configuration checks ahead Daniel Vetter
2013-02-21  0:50 ` [PATCH 33/36] drm/i915: don't count cpu ports for fdi B/C lane sharing Daniel Vetter
2013-02-21 10:28   ` Chris Wilson
2013-02-21 13:43     ` [PATCH] " Daniel Vetter
2013-02-21  0:50 ` [PATCH 34/36] drm/i915: consolidate pch pll computations a bit Daniel Vetter
2013-02-21  0:50 ` [PATCH 35/36] drm/i915: drop haswell fdi lane check from intel_crt_mode_valid Daniel Vetter
2013-02-21  0:50 ` [PATCH 36/36] drm/i915: implement fdi auto-dithering Daniel Vetter

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=1361407828-2419-4-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.