fdi/dp m_n reorg and a few other clock changes
Subsystems (2)
cover fdi/dp m_n reorg and a few other clock changes
Hi all,
This here is a bit a grab-bag of changes, all around the clock handling in our code. Originally I've wanted to push this further so that we can compute the desired dpll settings in the pipe_config computation stage. We need that to properly figure out pll sharing for atomic modeset. But it's messy, so this only moves us a bit further.
Also contained in here is the hw state readout support infrastructure for pipe configurations. It helps in simplifying things a bit, but otherwise not used for a lot of things yet.
Cheers, Daniel
Daniel Vetter (8):
drm/i915: clear up the fdi/dp set_m_n confusion drm/i915: move dp_m_n computation to dp_encoder->compute_config drm/i915: track dp target_clock in pipe_config drm/i915: rip out superflous is_dp&is_cpu_edp tracking drm/i915: add hw state readout/checking for pipe_config drm/i915: hw readout support for ->has_pch_encoders drm/i915: create pipe_config->dpll for clock state drm/i915: move dp clock computations to encoder->compute_config
drivers/gpu/drm/i915/i915_drv.h | 5 + drivers/gpu/drm/i915/intel_display.c | 527 +++++++++++++++++------------------ drivers/gpu/drm/i915/intel_dp.c | 115 ++++---- drivers/gpu/drm/i915/intel_drv.h | 30 +- 4 files changed, 335 insertions(+), 342 deletions(-)
Signature · 1 line
1.7.11.4
PATCH 1/8 drm/i915: clear up the fdi/dp set_m_n confusion
There's a rather decent confusion going on around transcoder m_n values. So let's clarify:
- All dp encoders need this, either on the pch transcoder if it's a pch port, or on the cpu transcoder/pipe if it's a cpu port.
- fdi links need to have the right m_n values for the fdi link set in the cpu transcoder.
To handle the pch vs transcoder stuff a bit better, extract transcoder set_m_n helpers. To make them simpler, set intel_crtc->cpu_transcoder als in ironlake_crtc_mode_set, so that gen5+ (where the cpu m_n registers are all at the same offset) can use it.
Haswell modeset is decently confused about dp vs. edp vs. fdi. dp vs. edp works exactly the same as dp (since there's no pch dp any more), so use that as a check. And only set up the fdi m_n values if we really have a pch encoder present (which means we have a VGA encoder).
On ilk+ we've called ironlake_set_m_n both for cpu_edp and for pch encoders. Now that dp_set_m_n handles all dp links (thanks to the pch encoder check), we can ditch the cpu_edp stuff from the fdi_set_m_n function.
Since the dp_m_n values are not readily available, we need to carefully coax the edp values out of the encoder. Hence we can't (yet) kill this superflous complexity.
v2: Rebase on top of the ivb fdi B/C check patch - we need to properly clear intel_crtc->fdi_lane, otherwise those checks will misfire.
v3: Rebased on top of a s/IS_HASWELL/HAS_DDI/ patch from Paulo Zanoni.
--- drivers/gpu/drm/i915/intel_display.c | 86 +++++++++++++++++++++++------------- drivers/gpu/drm/i915/intel_dp.c | 30 ++----------- drivers/gpu/drm/i915/intel_drv.h | 8 ++++ 3 files changed, 67 insertions(+), 57 deletions(-)
drivers/gpu/drm/i915/intel_display.c +55 -31
@@ -5255,15 +5255,47 @@ int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp)return bps / (link_bw *8 ) +1 ; } -static void ironlake_set_m_n (struct drm_crtc *crtc) +void intel_pch_transcoder_set_m_n (struct intel_crtc *crtc, +struct intel_link_m_n *m_n) { -struct drm_device *dev = crtc->dev; +struct drm_device *dev = crtc->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; +int pipe = crtc->pipe; + +I915_WRITE (TRANSDATA_M1 (pipe),TU_SIZE (m_n->tu) | m_n->gmch_m); +I915_WRITE (TRANSDATA_N1 (pipe), m_n->gmch_n); +I915_WRITE (TRANSDPLINK_M1 (pipe), m_n->link_m); +I915_WRITE (TRANSDPLINK_N1 (pipe), m_n->link_n); +} + +void intel_cpu_transcoder_set_m_n (struct intel_crtc *crtc, +struct intel_link_m_n *m_n) +{ +struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; +int pipe = crtc->pipe; +enum transcoder transcoder = crtc->cpu_transcoder; + +if (INTEL_INFO (dev)->gen >=5 ) { +I915_WRITE (PIPE_DATA_M1 (transcoder),TU_SIZE (m_n->tu) | m_n->gmch_m); +I915_WRITE (PIPE_DATA_N1 (transcoder), m_n->gmch_n); +I915_WRITE (PIPE_LINK_M1 (transcoder), m_n->link_m); +I915_WRITE (PIPE_LINK_N1 (transcoder), m_n->link_n); + }else { +I915_WRITE (PIPE_GMCH_DATA_M (pipe),TU_SIZE (m_n->tu) | m_n->gmch_m); +I915_WRITE (PIPE_GMCH_DATA_N (pipe), m_n->gmch_n); +I915_WRITE (PIPE_DP_LINK_M (pipe), m_n->link_m); +I915_WRITE (PIPE_DP_LINK_N (pipe), m_n->link_n); + } +} + +static void ironlake_fdi_set_m_n (struct drm_crtc *crtc) +{ +struct drm_device *dev = crtc->dev;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct drm_display_mode *adjusted_mode = &intel_crtc->config.adjusted_mode;struct drm_display_mode *mode = &intel_crtc->config.requested_mode; -enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;struct intel_encoder *intel_encoder, *edp_encoder =NULL ;struct intel_link_m_n m_n = {0 };int target_clock, lane, link_bw;
@@ -5283,22 +5315,14 @@ static void ironlake_set_m_n(struct drm_crtc *crtc) } } -/* FDI link */ - lane =0 ; -/* CPU eDP doesn't require FDI link, so just set DP M/N -according to current link config */ -if (is_cpu_edp) { -intel_edp_link_config (edp_encoder, &lane, &link_bw); - }else { -/* FDI is a binary signal running at ~2.7GHz, encoding -* each output octet as 10 bits. The actual frequency -* is stored as a divider into a 100MHz clock, and the -* mode pixel clock is stored in units of 1KHz. -* Hence the bw of each lane in terms of the mode signal -* is: -*/ - link_bw =intel_fdi_link_freq (dev) *MHz (100 )/KHz (1 )/10 ; - } +/* FDI is a binary signal running at ~2.7GHz, encoding +* each output octet as 10 bits. The actual frequency +* is stored as a divider into a 100MHz clock, and the +* mode pixel clock is stored in units of 1KHz. +* Hence the bw of each lane in terms of the mode signal +* is: +*/ + link_bw =intel_fdi_link_freq (dev) *MHz (100 )/KHz (1 )/10 ;/* [e]DP over FDI requires target mode clock instead of link clock. */ if (edp_encoder)
@@ -5308,9 +5332,8 @@ static void ironlake_set_m_n(struct drm_crtc *crtc)else target_clock = adjusted_mode->clock; -if (!lane) - lane =ironlake_get_lanes_required (target_clock, link_bw, - intel_crtc->config.pipe_bpp); + lane =ironlake_get_lanes_required (target_clock, link_bw, + intel_crtc->config.pipe_bpp); intel_crtc->fdi_lanes = lane;
@@ -5319,10 +5342,7 @@ static void ironlake_set_m_n(struct drm_crtc *crtc)intel_link_compute_m_n (intel_crtc->config.pipe_bpp, lane, target_clock, link_bw, &m_n); -I915_WRITE (PIPE_DATA_M1 (cpu_transcoder),TU_SIZE (m_n.tu) | m_n.gmch_m); -I915_WRITE (PIPE_DATA_N1 (cpu_transcoder), m_n.gmch_n); -I915_WRITE (PIPE_LINK_M1 (cpu_transcoder), m_n.link_m); -I915_WRITE (PIPE_LINK_N1 (cpu_transcoder), m_n.link_n); +intel_cpu_transcoder_set_m_n (intel_crtc, &m_n); } static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc,
@@ -5469,6 +5489,8 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,WARN (!(HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)),"Unexpected PCH type %d\n" ,INTEL_PCH_TYPE (dev)); + intel_crtc->cpu_transcoder = pipe; + ok =ironlake_compute_clocks (crtc, adjusted_mode, &clock, &has_reduced_clock, &reduced_clock);if (!ok) {
@@ -5507,7 +5529,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, }else intel_put_pch_pll (intel_crtc); -if (is_dp && !is_cpu_edp) +if (is_dp)intel_dp_set_m_n (crtc, mode, adjusted_mode);for_each_encoder_on_crtc (dev, crtc, encoder)
@@ -5543,7 +5565,9 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,/* Note, this also computes intel_crtc->fdi_lanes which is used below in * ironlake_check_fdi_lanes. */ -ironlake_set_m_n (crtc); + intel_crtc->fdi_lanes =0 ; +if (intel_crtc->config.has_pch_encoder) +ironlake_fdi_set_m_n (crtc); fdi_config_ok =ironlake_check_fdi_lanes (intel_crtc);
@@ -5650,15 +5674,15 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc,DRM_DEBUG_KMS ("Mode for pipe %d:\n" , pipe);drm_mode_debug_printmodeline (mode); -if (is_dp && !is_cpu_edp) +if (is_dp)intel_dp_set_m_n (crtc, mode, adjusted_mode); intel_crtc->lowfreq_avail = false;intel_set_pipe_timings (intel_crtc, mode, adjusted_mode); -if (!is_dp || is_cpu_edp) -ironlake_set_m_n (crtc); +if (intel_crtc->config.has_pch_encoder) +ironlake_fdi_set_m_n (crtc);haswell_set_pipeconf (crtc, adjusted_mode, dither);
drivers/gpu/drm/i915/intel_dp.c +4 -26
@@ -766,12 +766,9 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,struct drm_device *dev = crtc->dev;struct intel_encoder *intel_encoder;struct intel_dp *intel_dp; -struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int lane_count =4 ;struct intel_link_m_n m_n; -int pipe = intel_crtc->pipe; -enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;/* * Find the lane count in the intel_encoder private
@@ -795,29 +792,10 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,intel_link_compute_m_n (intel_crtc->config.pipe_bpp, lane_count, mode->clock, adjusted_mode->clock, &m_n); -if (HAS_DDI (dev)) { -I915_WRITE (PIPE_DATA_M1 (cpu_transcoder), -TU_SIZE (m_n.tu) | m_n.gmch_m); -I915_WRITE (PIPE_DATA_N1 (cpu_transcoder), m_n.gmch_n); -I915_WRITE (PIPE_LINK_M1 (cpu_transcoder), m_n.link_m); -I915_WRITE (PIPE_LINK_N1 (cpu_transcoder), m_n.link_n); - }else if (HAS_PCH_SPLIT (dev)) { -I915_WRITE (TRANSDATA_M1 (pipe),TU_SIZE (m_n.tu) | m_n.gmch_m); -I915_WRITE (TRANSDATA_N1 (pipe), m_n.gmch_n); -I915_WRITE (TRANSDPLINK_M1 (pipe), m_n.link_m); -I915_WRITE (TRANSDPLINK_N1 (pipe), m_n.link_n); - }else if (IS_VALLEYVIEW (dev)) { -I915_WRITE (PIPE_DATA_M1 (pipe),TU_SIZE (m_n.tu) | m_n.gmch_m); -I915_WRITE (PIPE_DATA_N1 (pipe), m_n.gmch_n); -I915_WRITE (PIPE_LINK_M1 (pipe), m_n.link_m); -I915_WRITE (PIPE_LINK_N1 (pipe), m_n.link_n); - }else { -I915_WRITE (PIPE_GMCH_DATA_M (pipe), -TU_SIZE (m_n.tu) | m_n.gmch_m); -I915_WRITE (PIPE_GMCH_DATA_N (pipe), m_n.gmch_n); -I915_WRITE (PIPE_DP_LINK_M (pipe), m_n.link_m); -I915_WRITE (PIPE_DP_LINK_N (pipe), m_n.link_n); - } +if (intel_crtc->config.has_pch_encoder) +intel_pch_transcoder_set_m_n (intel_crtc, &m_n); +else +intel_cpu_transcoder_set_m_n (intel_crtc, &m_n); }void intel_dp_init_link_config (struct intel_dp *intel_dp)
drivers/gpu/drm/i915/intel_drv.h +8 -0
@@ -191,8 +191,12 @@ struct intel_crtc_config {*/ bool limited_color_range; +/* DP has a bunch of special case unfortunately, so mark the pipe +* accordingly. */ +bool has_dp_encoder;bool dither;int pipe_bpp; +struct intel_link_m_n dp_m_n;/* Used by SDVO (and if we ever fix it, HDMI). */ unsigned pixel_multiplier;
@@ -635,6 +639,10 @@ extern void intel_init_clock_gating(struct drm_device *dev);extern void intel_write_eld (struct drm_encoder *encoder,struct drm_display_mode *mode);extern void intel_cpt_verify_modeset (struct drm_device *dev,int pipe); +extern void intel_cpu_transcoder_set_m_n (struct intel_crtc *crtc, +struct intel_link_m_n *m_n); +extern void intel_pch_transcoder_set_m_n (struct intel_crtc *crtc, +struct intel_link_m_n *m_n);extern void intel_prepare_ddi (struct drm_device *dev);extern void hsw_fdi_link_train (struct drm_crtc *crtc);extern void intel_ddi_init (struct drm_device *dev,enum port port);
Signature · 1 line
1.7.11.4
PATCH 2/8 drm/i915: move dp_m_n computation to dp_encoder->compute_config
In reply to Daniel VetterWe need a flag to designate dp encoders and the dp link m_n parameters in the pipe config for that. And now that the pipe bpp computations have been moved up and stored in the pipe config, too, we can do this without losing our sanity.
--- drivers/gpu/drm/i915/intel_display.c | 30 +++++++++++----------- drivers/gpu/drm/i915/intel_dp.c | 49 +++++++----------------------------- drivers/gpu/drm/i915/intel_drv.h | 3 --- 3 files changed, 25 insertions(+), 57 deletions(-)
drivers/gpu/drm/i915/intel_display.c +16 -14
@@ -4125,6 +4125,14 @@ static void i9xx_update_pll_dividers(struct drm_crtc *crtc, } } +static void intel_dp_set_m_n (struct intel_crtc *crtc) +{ +if (crtc->config.has_pch_encoder) +intel_pch_transcoder_set_m_n (crtc, &crtc->config.dp_m_n); +else +intel_cpu_transcoder_set_m_n (crtc, &crtc->config.dp_m_n); +} +static void vlv_update_pll (struct drm_crtc *crtc,intel_clock_t *clock,intel_clock_t *reduced_clock,int num_connectors)
@@ -4132,9 +4140,6 @@ static void vlv_update_pll(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct drm_display_mode *adjusted_mode = - &intel_crtc->config.adjusted_mode; -struct drm_display_mode *mode = &intel_crtc->config.requested_mode;int pipe = intel_crtc->pipe;u32 dpll, mdiv, pdiv;u32 bestn, bestm1, bestm2, bestp1, bestp2;
@@ -4190,8 +4195,8 @@ static void vlv_update_pll(struct drm_crtc *crtc,intel_dpio_write (dev_priv,DPIO_FASTCLK_DISABLE ,0x620 ); -if (intel_pipe_has_type (crtc,INTEL_OUTPUT_DISPLAYPORT )) -intel_dp_set_m_n (crtc, mode, adjusted_mode); +if (intel_crtc->config.has_dp_encoder) +intel_dp_set_m_n (intel_crtc);I915_WRITE (DPLL (pipe), dpll);
@@ -4237,9 +4242,6 @@ static void i9xx_update_pll(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct drm_display_mode *adjusted_mode = - &intel_crtc->config.adjusted_mode; -struct drm_display_mode *mode = &intel_crtc->config.requested_mode;struct intel_encoder *encoder;int pipe = intel_crtc->pipe;u32 dpll;
@@ -4314,8 +4316,8 @@ static void i9xx_update_pll(struct drm_crtc *crtc,if (encoder->pre_pll_enable) encoder->pre_pll_enable (encoder); -if (intel_pipe_has_type (crtc,INTEL_OUTPUT_DISPLAYPORT )) -intel_dp_set_m_n (crtc, mode, adjusted_mode); +if (intel_crtc->config.has_dp_encoder) +intel_dp_set_m_n (intel_crtc);I915_WRITE (DPLL (pipe), dpll);
@@ -5529,8 +5531,8 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, }else intel_put_pch_pll (intel_crtc); -if (is_dp) -intel_dp_set_m_n (crtc, mode, adjusted_mode); +if (intel_crtc->config.has_dp_encoder) +intel_dp_set_m_n (intel_crtc);for_each_encoder_on_crtc (dev, crtc, encoder)if (encoder->pre_pll_enable)
@@ -5674,8 +5676,8 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc,DRM_DEBUG_KMS ("Mode for pipe %d:\n" , pipe);drm_mode_debug_printmodeline (mode); -if (is_dp) -intel_dp_set_m_n (crtc, mode, adjusted_mode); +if (intel_crtc->config.has_dp_encoder) +intel_dp_set_m_n (intel_crtc); intel_crtc->lowfreq_avail = false;
drivers/gpu/drm/i915/intel_dp.c +9 -40
74 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +0 -3
@@ -468,9 +468,6 @@ extern void intel_dp_init(struct drm_device *dev, int output_reg, enum port port);extern void intel_dp_init_connector (struct intel_digital_port *intel_dig_port,struct intel_connector *intel_connector); -void -intel_dp_set_m_n (struct drm_crtc *crtc,struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode);extern void intel_dp_init_link_config (struct intel_dp *intel_dp);extern void intel_dp_start_link_train (struct intel_dp *intel_dp);extern void intel_dp_complete_link_train (struct intel_dp *intel_dp);
Signature · 1 line
1.7.11.4
PATCH 3/8 drm/i915: track dp target_clock in pipe_config
In reply to Daniel VetterWe need it in the fdi m_n computation, which nicely kills almost all ugly special cases in there.
It looks like we also need this to handle 12bpc hdmi correctly.
Eventually it might be better to switch things around and put the target clock into adjusted_mode->clock and create a new pipe_config parameter for the port link clock.
v2: Add a massive comment in the code to explain this mess.
v3: s/dp_target_clock/pixel_target_clock in anticipation of the hdmi use-case.
--- drivers/gpu/drm/i915/intel_display.c | 25 +++---------------------- drivers/gpu/drm/i915/intel_dp.c | 1 + drivers/gpu/drm/i915/intel_drv.h | 7 ++++++- 3 files changed, 10 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -22
@@ -5297,25 +5297,9 @@ static void ironlake_fdi_set_m_n(struct drm_crtc *crtc)struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct drm_display_mode *adjusted_mode = &intel_crtc->config.adjusted_mode; -struct drm_display_mode *mode = &intel_crtc->config.requested_mode; -struct intel_encoder *intel_encoder, *edp_encoder =NULL ;struct intel_link_m_n m_n = {0 };int target_clock, lane, link_bw; -bool is_dp = false, is_cpu_edp = false; - -for_each_encoder_on_crtc (dev, crtc, intel_encoder) { -switch (intel_encoder->type) { -case INTEL_OUTPUT_DISPLAYPORT : - is_dp = true; -break ; -case INTEL_OUTPUT_EDP : - is_dp = true; -if (!intel_encoder_is_pch_edp (&intel_encoder->base)) - is_cpu_edp = true; - edp_encoder = intel_encoder; -break ; - } - } +uint32_t bps;/* FDI is a binary signal running at ~2.7GHz, encoding * each output octet as 10 bits. The actual frequency
@@ -5326,11 +5310,8 @@ static void ironlake_fdi_set_m_n(struct drm_crtc *crtc)*/ link_bw =intel_fdi_link_freq (dev) *MHz (100 )/KHz (1 )/10 ; -/* [e]DP over FDI requires target mode clock instead of link clock. */ -if (edp_encoder) - target_clock =intel_edp_target_clock (edp_encoder, mode); -else if (is_dp) - target_clock = mode->clock; +if (intel_crtc->config.pixel_target_clock) + target_clock = intel_crtc->config.pixel_target_clock;else target_clock = adjusted_mode->clock;
drivers/gpu/drm/i915/intel_dp.c +1 -0
@@ -753,6 +753,7 @@ found: intel_dp->lane_count = lane_count; adjusted_mode->clock =drm_dp_bw_code_to_link_rate (intel_dp->link_bw); pipe_config->pipe_bpp = bpp; + pipe_config->pixel_target_clock = target_clock; DRM_DEBUG_KMS("DP link bw %02x lane count %d clock %d bpp %d\n", intel_dp->link_bw, intel_dp->lane_count,
drivers/gpu/drm/i915/intel_drv.h +6 -1
@@ -197,7 +197,12 @@ struct intel_crtc_config {bool dither;int pipe_bpp;struct intel_link_m_n dp_m_n; - +/** +* This is currently used by DP and HDMI encoders since those can have a +* target pixel clock != the port link clock (which is currently stored +* in adjusted_mode->clock). +*/ +int pixel_target_clock;/* Used by SDVO (and if we ever fix it, HDMI). */ unsigned pixel_multiplier; };
Signature · 1 line
1.7.11.4
PATCH 4/8 drm/i915: rip out superflous is_dp&is_cpu_edp tracking
In reply to Daniel VetterThe only exception left is is_cpu_edp in the haswell modeset code. We need that to assign the cpu transcoder, but we might want to move that eventually into the encoder, too.
--- drivers/gpu/drm/i915/intel_display.c | 37 +++++++----------------------------- 1 file changed, 7 insertions(+), 30 deletions(-)
drivers/gpu/drm/i915/intel_display.c +7 -30
@@ -4475,7 +4475,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,intel_clock_t clock, reduced_clock;u32 dspcntr, pipeconf;bool ok, has_reduced_clock = false, is_sdvo = false; -bool is_lvds = false, is_tv = false, is_dp = false; +bool is_lvds = false, is_tv = false;struct intel_encoder *encoder;const intel_limit_t *limit;int ret;
@@ -4494,9 +4494,6 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,case INTEL_OUTPUT_TVOUT : is_tv = true;break ; -case INTEL_OUTPUT_DISPLAYPORT : - is_dp = true; -break ; } num_connectors++;
@@ -4577,7 +4574,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,/* default to 8bpc */ pipeconf &= ~(PIPECONF_BPC_MASK |PIPECONF_DITHER_EN ); -if (is_dp) { +if (intel_crtc->config.has_dp_encoder) {if (intel_crtc->config.dither) { pipeconf |=PIPECONF_6BPC | PIPECONF_DITHER_EN |
@@ -5338,7 +5335,6 @@ static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc,uint32_t dpll;int factor, num_connectors =0 ;bool is_lvds = false, is_sdvo = false, is_tv = false; -bool is_dp = false, is_cpu_edp = false;for_each_encoder_on_crtc (dev, crtc, intel_encoder) {switch (intel_encoder->type) {
@@ -5354,14 +5350,6 @@ static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc,case INTEL_OUTPUT_TVOUT : is_tv = true;break ; -case INTEL_OUTPUT_DISPLAYPORT : - is_dp = true; -break ; -case INTEL_OUTPUT_EDP : - is_dp = true; -if (!intel_encoder_is_pch_edp (&intel_encoder->base)) - is_cpu_edp = true; -break ; } num_connectors++;
@@ -5393,7 +5381,8 @@ static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc, } dpll |=DPLL_DVO_HIGH_SPEED ; } -if (is_dp && !is_cpu_edp) +if (intel_crtc->config.has_dp_encoder && + intel_crtc->config.has_pch_encoder) dpll |=DPLL_DVO_HIGH_SPEED ;/* compute bitmask from p1 value */
@@ -5446,7 +5435,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,intel_clock_t clock, reduced_clock;u32 dpll, fp =0 , fp2 =0 ;bool ok, has_reduced_clock = false; -bool is_lvds = false, is_dp = false, is_cpu_edp = false; +bool is_lvds = false;struct intel_encoder *encoder;int ret;bool dither, fdi_config_ok;
@@ -5456,14 +5445,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,case INTEL_OUTPUT_LVDS : is_lvds = true;break ; -case INTEL_OUTPUT_DISPLAYPORT : - is_dp = true; -break ; -case INTEL_OUTPUT_EDP : - is_dp = true; -if (!intel_encoder_is_pch_edp (&encoder->base)) - is_cpu_edp = true; -break ; } num_connectors++;
@@ -5500,7 +5481,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,drm_mode_debug_printmodeline (mode);/* CPU eDP is the only output that doesn't need a PCH PLL of its own. */ -if (!is_cpu_edp) { +if (intel_crtc->config.has_pch_encoder) {struct intel_pch_pll *pll; pll =intel_get_pch_pll (intel_crtc, dpll, fp);
@@ -5613,18 +5594,14 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc,int pipe = intel_crtc->pipe;int plane = intel_crtc->plane;int num_connectors =0 ; -bool is_dp = false, is_cpu_edp = false; +bool is_cpu_edp = false;struct intel_encoder *encoder;int ret;bool dither;for_each_encoder_on_crtc (dev, crtc, encoder) {switch (encoder->type) { -case INTEL_OUTPUT_DISPLAYPORT : - is_dp = true; -break ;case INTEL_OUTPUT_EDP : - is_dp = true;if (!intel_encoder_is_pch_edp (&encoder->base)) is_cpu_edp = true;break ;
Signature · 1 line
1.7.11.4
PATCH 5/8 drm/i915: add hw state readout/checking for pipe_config
In reply to Daniel VetterWe need to be able to read out the hw state code for a bunch of reasons:
- Correctly disabling boot-up/resume state.
- Pure paranoia.
Since not all of the pipe configuration is e.g. relevant for fastboot (or at least we can allow some wiggle room in some parameters, like the clocks), we need to add a strict_checking parameter to intel_pipe_config_compare for fastboot.
For now intel_pipe_config_compare should be fully paranoid and check everything that the hw state readout code supports. Which for this infrastructure code is nothing.
I've gone a bit overboard with adding 3 get_pipe_config functions:
The ilk version will differ with the next patch, so it's not too onerous.
v2: Don't check the hw config if the pipe is off, since an enabled, but dpms off crtc will obviously have tons of difference with the hw state.
--- drivers/gpu/drm/i915/i915_drv.h | 5 +++ drivers/gpu/drm/i915/intel_display.c | 77 +++++++++++++++++++++++++++++++----- 2 files changed, 72 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +5 -0
@@ -272,6 +272,7 @@ struct drm_i915_error_state { };struct intel_crtc_config ; +struct intel_crtc ;struct drm_i915_display_funcs {bool (*fbc_enabled)(struct drm_device *dev);
@@ -285,6 +286,10 @@ struct drm_i915_display_funcs {void (*update_linetime_wm)(struct drm_device *dev,int pipe,struct drm_display_mode *mode);void (*modeset_global_resources)(struct drm_device *dev); +/* Returns the active state of the crtc, and if the crtc is active, +* fills out the pipe-config with the hw state. */ +bool (*get_pipe_config)(struct intel_crtc *, +struct intel_crtc_config *);int (*crtc_mode_set)(struct drm_crtc *crtc,int x,int y,struct drm_framebuffer *old_fb);
drivers/gpu/drm/i915/intel_display.c +67 -10
143 lines not on this page · raw message
Signature · 1 line
1.7.11.4
PATCH 6/8 drm/i915: hw readout support for ->has_pch_encoders
In reply to Daniel VetterNow we can ditch the checks in the Haswell disable code.
v2: add support for Haswell
--- drivers/gpu/drm/i915/intel_display.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_display.c +25 -9
@@ -2945,11 +2945,6 @@ static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)mutex_unlock (&dev->struct_mutex); } -static bool haswell_crtc_driving_pch (struct drm_crtc *crtc) -{ -return intel_pipe_has_type (crtc,INTEL_OUTPUT_ANALOG ); -} -/* Program iCLKIP clock to the desired frequency */ static void lpt_program_iclkip (struct drm_crtc *crtc) {
@@ -3532,13 +3527,10 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)int pipe = intel_crtc->pipe;int plane = intel_crtc->plane;enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder; -bool is_pch_port;if (!intel_crtc->active)return ; - is_pch_port =haswell_crtc_driving_pch (crtc); -for_each_encoder_on_crtc (dev, crtc, encoder) encoder->disable (encoder);
@@ -3565,7 +3557,7 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)if (encoder->post_disable) encoder->post_disable (encoder); -if (is_pch_port) { +if (intel_crtc->config.has_pch_encoder) {lpt_disable_pch_transcoder (dev_priv);intel_ddi_fdi_disable (crtc); }
@@ -5576,6 +5568,9 @@ static bool ironlake_get_pipe_config(struct intel_crtc *crtc,if (!(tmp &PIPECONF_ENABLE ))return false; +if (I915_READ (TRANSCONF (crtc->pipe)) &TRANS_ENABLE ) + pipe_config->has_pch_encoder = true; +return true; }
@@ -5699,6 +5694,17 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,if (!(tmp &PIPECONF_ENABLE ))return false; +/* +* aswell has only FDI/PCH transcoder A. It is which is connected to +* DDI E. So just check whether this pipe is wired to DDI E and whether +* the PCH transcoder is on. +*/ + tmp =I915_READ (TRANS_DDI_FUNC_CTL (crtc->pipe)); +if ((tmp &TRANS_DDI_PORT_MASK ) ==TRANS_DDI_SELECT_PORT (PORT_E ) && +I915_READ (TRANSCONF (PIPE_A )) &TRANS_ENABLE ) + pipe_config->has_pch_encoder = true; + +return true; }
@@ -7641,6 +7647,14 @@ static bool intel_pipe_config_compare(struct intel_crtc_config *current_config, struct intel_crtc_config *pipe_config) { + if (current_config->has_pch_encoder != pipe_config->has_pch_encoder) { + DRM_ERROR("mismatch in has_pch_encoder " +"(expected %i, found %i)\n" , + current_config->has_pch_encoder, + pipe_config->has_pch_encoder); +return false; + } +return true; }
@@ -7740,6 +7754,7 @@ intel_modeset_check_state(struct drm_device *dev)"crtc's computed enabled state doesn't match tracked enabled state " "(expected %i, found %i)\n", enabled, crtc->base.enabled); +memset (&pipe_config,0 ,sizeof (pipe_config)); active = dev_priv->display.get_pipe_config (crtc, &pipe_config); WARN(crtc->active != active,
@@ -9097,6 +9112,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,list_for_each_entry (crtc, &dev->mode_config.crtc_list, base.head) { +memset (&crtc->config,0 ,sizeof (crtc->config)); crtc->active = dev_priv->display.get_pipe_config (crtc, &crtc->config);
Signature · 1 line
1.7.11.4
PATCH 7/8 drm/i915: create pipe_config->dpll for clock state
In reply to Daniel VetterClock computations and handling are highly encoder specific, both in the optimal clock selection and also in which clocks to use and when sharing of clocks is possible.
So the best place to do this is somewhere in the encoders, with a generic fallback for those encoders without special needs. To facility this, add a pipe_config->clocks_set boolean.
This patch here is only prep work, it simply sets the computed clock values in pipe_config->dpll, and uses that data in the hw clock setting functions.
Haswell code isn't touched, simply because Haswell clocks work much different and need their own infrastructure (with probably a Haswell-specific config->ddi_clock substruct).
--- drivers/gpu/drm/i915/intel_display.c | 155 +++++++++++++++++++---------------- drivers/gpu/drm/i915/intel_drv.h | 12 +++ 2 files changed, 95 insertions(+), 72 deletions(-)
drivers/gpu/drm/i915/intel_display.c +83 -72
@@ -4061,37 +4061,38 @@ static int i9xx_get_refclk(struct drm_crtc *crtc, int num_connectors)return refclk; } -static void i9xx_adjust_sdvo_tv_clock (struct drm_display_mode *adjusted_mode, -intel_clock_t *clock) +static void i9xx_adjust_sdvo_tv_clock (struct intel_crtc *crtc) { +unsigned dotclock = crtc->config.adjusted_mode.clock; +struct dpll *clock = &crtc->config.dpll; +/* SDVO TV has fixed PLL values depend on its clock range, this mirrors vbios setting. */ -if (adjusted_mode->clock >=100000 - && adjusted_mode->clock <140500 ) { +if (dotclock >=100000 && dotclock <140500 ) { clock->p1 =2 ; clock->p2 =10 ; clock->n =3 ; clock->m1 =16 ; clock->m2 =8 ; - }else if (adjusted_mode->clock >=140500 - && adjusted_mode->clock <=200000 ) { + }else if (dotclock >=140500 && dotclock <=200000 ) { clock->p1 =1 ; clock->p2 =10 ; clock->n =6 ; clock->m1 =12 ; clock->m2 =8 ; } + + crtc->config.clock_set = true; } -static void i9xx_update_pll_dividers (struct drm_crtc *crtc, -intel_clock_t *clock, +static void i9xx_update_pll_dividers (struct intel_crtc *crtc,intel_clock_t *reduced_clock) { -struct drm_device *dev = crtc->dev; +struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -int pipe = intel_crtc->pipe; +int pipe = crtc->pipe;u32 fp, fp2 =0 ; +struct dpll *clock = &crtc->config.dpll;if (IS_PINEVIEW (dev)) { fp = (1 << clock->n) <<16 | clock->m1 <<8 | clock->m2;
@@ -4107,11 +4108,11 @@ static void i9xx_update_pll_dividers(struct drm_crtc *crtc,I915_WRITE (FP0 (pipe), fp); - intel_crtc->lowfreq_avail = false; -if (intel_pipe_has_type (crtc,INTEL_OUTPUT_LVDS ) && + crtc->lowfreq_avail = false; +if (intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_LVDS ) && reduced_clock && i915_powersave) {I915_WRITE (FP1 (pipe), fp2); - intel_crtc->lowfreq_avail = true; + crtc->lowfreq_avail = true; }else {I915_WRITE (FP1 (pipe), fp); }
@@ -4125,14 +4126,11 @@ static void intel_dp_set_m_n(struct intel_crtc *crtc)intel_cpu_transcoder_set_m_n (crtc, &crtc->config.dp_m_n); } -static void vlv_update_pll (struct drm_crtc *crtc, -intel_clock_t *clock,intel_clock_t *reduced_clock, -int num_connectors) +static void vlv_update_pll (struct intel_crtc *crtc) { -struct drm_device *dev = crtc->dev; +struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -int pipe = intel_crtc->pipe; +int pipe = crtc->pipe;u32 dpll, mdiv, pdiv;u32 bestn, bestm1, bestm2, bestp1, bestp2;bool is_sdvo;
@@ -4140,8 +4138,8 @@ static void vlv_update_pll(struct drm_crtc *crtc,mutex_lock (&dev_priv->dpio_lock); - is_sdvo =intel_pipe_has_type (crtc,INTEL_OUTPUT_SDVO ) || -intel_pipe_has_type (crtc,INTEL_OUTPUT_HDMI ); + is_sdvo =intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_SDVO ) || +intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_HDMI ); dpll =DPLL_VGA_MODE_DIS ; dpll |=DPLL_EXT_BUFFER_ENABLE_VLV ;
@@ -4151,11 +4149,11 @@ static void vlv_update_pll(struct drm_crtc *crtc,I915_WRITE (DPLL (pipe), dpll);POSTING_READ (DPLL (pipe)); - bestn = clock->n; - bestm1 = clock->m1; - bestm2 = clock->m2; - bestp1 = clock->p1; - bestp2 = clock->p2; + bestn = crtc->config.dpll.n; + bestm1 = crtc->config.dpll.m1; + bestm2 = crtc->config.dpll.m2; + bestp1 = crtc->config.dpll.p1; + bestp2 = crtc->config.dpll.p2;/* * In Valleyview PLL and program lane counter registers are exposed
@@ -4187,8 +4185,8 @@ static void vlv_update_pll(struct drm_crtc *crtc,intel_dpio_write (dev_priv,DPIO_FASTCLK_DISABLE ,0x620 ); -if (intel_crtc->config.has_dp_encoder) -intel_dp_set_m_n (intel_crtc); +if (crtc->config.has_dp_encoder) +intel_dp_set_m_n (crtc);I915_WRITE (DPLL (pipe), dpll);
@@ -4199,8 +4197,8 @@ static void vlv_update_pll(struct drm_crtc *crtc, temp =0 ;if (is_sdvo) { temp =0 ; -if (intel_crtc->config.pixel_multiplier >1 ) { - temp = (intel_crtc->config.pixel_multiplier -1 ) +if (crtc->config.pixel_multiplier >1 ) { + temp = (crtc->config.pixel_multiplier -1 ) <<DPLL_MD_UDI_MULTIPLIER_SHIFT ; } }
@@ -4208,16 +4206,15 @@ static void vlv_update_pll(struct drm_crtc *crtc,POSTING_READ (DPLL_MD (pipe));/* Now program lane control registers */ -if (intel_pipe_has_type (crtc,INTEL_OUTPUT_DISPLAYPORT ) - ||intel_pipe_has_type (crtc,INTEL_OUTPUT_HDMI )) - { +if (intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_DISPLAYPORT ) + ||intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_HDMI )) { temp =0x1000C4 ;if (pipe ==1 ) temp |= (1 <<21 );intel_dpio_write (dev_priv,DPIO_DATA_CHANNEL1 , temp); } -if (intel_pipe_has_type (crtc,INTEL_OUTPUT_EDP )) - { + +if (intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_EDP )) { temp =0x1000C4 ;if (pipe ==1 ) temp |= (1 <<21 );
@@ -4227,39 +4224,39 @@ static void vlv_update_pll(struct drm_crtc *crtc,mutex_unlock (&dev_priv->dpio_lock); } -static void i9xx_update_pll (struct drm_crtc *crtc, -intel_clock_t *clock,intel_clock_t *reduced_clock, +static void i9xx_update_pll (struct intel_crtc *crtc, +intel_clock_t *reduced_clock,int num_connectors) { -struct drm_device *dev = crtc->dev; +struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct intel_encoder *encoder; -int pipe = intel_crtc->pipe; +int pipe = crtc->pipe;u32 dpll;bool is_sdvo; +struct dpll *clock = &crtc->config.dpll; -i9xx_update_pll_dividers (crtc, clock, reduced_clock); +i9xx_update_pll_dividers (crtc, reduced_clock); - is_sdvo =intel_pipe_has_type (crtc,INTEL_OUTPUT_SDVO ) || -intel_pipe_has_type (crtc,INTEL_OUTPUT_HDMI ); + is_sdvo =intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_SDVO ) || +intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_HDMI ); dpll =DPLL_VGA_MODE_DIS ; -if (intel_pipe_has_type (crtc,INTEL_OUTPUT_LVDS )) +if (intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_LVDS )) dpll |=DPLLB_MODE_LVDS ;else dpll |=DPLLB_MODE_DAC_SERIAL ;if (is_sdvo) { -if ((intel_crtc->config.pixel_multiplier >1 ) && +if ((crtc->config.pixel_multiplier >1 ) && (IS_I945G (dev) ||IS_I945GM (dev) ||IS_G33 (dev))) { - dpll |= (intel_crtc->config.pixel_multiplier -1 ) + dpll |= (crtc->config.pixel_multiplier -1 ) <<SDVO_MULTIPLIER_SHIFT_HIRES ; } dpll |=DPLL_DVO_HIGH_SPEED ; } -if (intel_pipe_has_type (crtc,INTEL_OUTPUT_DISPLAYPORT )) +if (intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_DISPLAYPORT )) dpll |=DPLL_DVO_HIGH_SPEED ;/* compute bitmask from p1 value */
@@ -4287,13 +4284,13 @@ static void i9xx_update_pll(struct drm_crtc *crtc,if (INTEL_INFO (dev)->gen >=4 ) dpll |= (6 <<PLL_LOAD_PULSE_PHASE_SHIFT ); -if (is_sdvo &&intel_pipe_has_type (crtc,INTEL_OUTPUT_TVOUT )) +if (is_sdvo &&intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_TVOUT )) dpll |=PLL_REF_INPUT_TVCLKINBC ; -else if (intel_pipe_has_type (crtc,INTEL_OUTPUT_TVOUT )) +else if (intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_TVOUT ))/* XXX: just matching BIOS for now */ /* dpll |= PLL_REF_INPUT_TVCLKINBC; */ dpll |=3 ; -else if (intel_pipe_has_type (crtc,INTEL_OUTPUT_LVDS ) && +else if (intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_LVDS ) &&intel_panel_use_ssc (dev_priv) && num_connectors <2 ) dpll |=PLLB_REF_INPUT_SPREADSPECTRUMIN ;else
@@ -4304,12 +4301,12 @@ static void i9xx_update_pll(struct drm_crtc *crtc,POSTING_READ (DPLL (pipe));udelay (150 ); -for_each_encoder_on_crtc (dev, crtc, encoder) +for_each_encoder_on_crtc (dev, &crtc->base, encoder)if (encoder->pre_pll_enable) encoder->pre_pll_enable (encoder); -if (intel_crtc->config.has_dp_encoder) -intel_dp_set_m_n (intel_crtc); +if (crtc->config.has_dp_encoder) +intel_dp_set_m_n (crtc);I915_WRITE (DPLL (pipe), dpll);
@@ -4321,8 +4318,8 @@ static void i9xx_update_pll(struct drm_crtc *crtc,u32 temp =0 ;if (is_sdvo) { temp =0 ; -if (intel_crtc->config.pixel_multiplier >1 ) { - temp = (intel_crtc->config.pixel_multiplier -1 ) +if (crtc->config.pixel_multiplier >1 ) { + temp = (crtc->config.pixel_multiplier -1 ) <<DPLL_MD_UDI_MULTIPLIER_SHIFT ; } }
@@ -4337,23 +4334,23 @@ static void i9xx_update_pll(struct drm_crtc *crtc, } } -static void i8xx_update_pll (struct drm_crtc *crtc, +static void i8xx_update_pll (struct intel_crtc *crtc,struct drm_display_mode *adjusted_mode, -intel_clock_t *clock,intel_clock_t *reduced_clock, +intel_clock_t *reduced_clock,int num_connectors) { -struct drm_device *dev = crtc->dev; +struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct intel_encoder *encoder; -int pipe = intel_crtc->pipe; +int pipe = crtc->pipe;u32 dpll; +struct dpll *clock = &crtc->config.dpll; -i9xx_update_pll_dividers (crtc, clock, reduced_clock); +i9xx_update_pll_dividers (crtc, reduced_clock); dpll =DPLL_VGA_MODE_DIS ; -if (intel_pipe_has_type (crtc,INTEL_OUTPUT_LVDS )) { +if (intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_LVDS )) { dpll |= (1 << (clock->p1 -1 )) <<DPLL_FPA01_P1_POST_DIV_SHIFT ; }else {if (clock->p1 ==2 )
@@ -4364,7 +4361,7 @@ static void i8xx_update_pll(struct drm_crtc *crtc, dpll |=PLL_P2_DIVIDE_BY_4 ; } -if (intel_pipe_has_type (crtc,INTEL_OUTPUT_LVDS ) && +if (intel_pipe_has_type (&crtc->base,INTEL_OUTPUT_LVDS ) &&intel_panel_use_ssc (dev_priv) && num_connectors <2 ) dpll |=PLLB_REF_INPUT_SPREADSPECTRUMIN ;else
@@ -4375,7 +4372,7 @@ static void i8xx_update_pll(struct drm_crtc *crtc,POSTING_READ (DPLL (pipe));udelay (150 ); -for_each_encoder_on_crtc (dev, crtc, encoder) +for_each_encoder_on_crtc (dev, &crtc->base, encoder)if (encoder->pre_pll_enable) encoder->pre_pll_enable (encoder);
@@ -4522,20 +4519,26 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, &clock, &reduced_clock); } +/* Compat-code for transition, will disappear. */ +if (!intel_crtc->config.clock_set) { + intel_crtc->config.dpll.n = clock.n; + intel_crtc->config.dpll.m1 = clock.m1; + intel_crtc->config.dpll.m2 = clock.m2; + intel_crtc->config.dpll.p1 = clock.p1; + intel_crtc->config.dpll.p2 = clock.p2; + }if (is_sdvo && is_tv) -i9xx_adjust_sdvo_tv_clock (adjusted_mode, &clock); +i9xx_adjust_sdvo_tv_clock (intel_crtc);if (IS_GEN2 (dev)) -i8xx_update_pll (crtc, adjusted_mode, &clock, +i8xx_update_pll (intel_crtc, adjusted_mode, has_reduced_clock ? &reduced_clock :NULL , num_connectors);else if (IS_VALLEYVIEW (dev)) -vlv_update_pll (crtc, &clock, - has_reduced_clock ? &reduced_clock :NULL , - num_connectors); +vlv_update_pll (intel_crtc);else -i9xx_update_pll (crtc, &clock, +i9xx_update_pll (intel_crtc, has_reduced_clock ? &reduced_clock :NULL , num_connectors);
@@ -5162,7 +5165,7 @@ static bool ironlake_compute_clocks(struct drm_crtc *crtc, }if (is_sdvo && is_tv) -i9xx_adjust_sdvo_tv_clock (adjusted_mode, clock); +i9xx_adjust_sdvo_tv_clock (to_intel_crtc (crtc));return true; }
@@ -5466,6 +5469,14 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,DRM_ERROR ("Couldn't find PLL settings for mode!\n" );return -EINVAL ; } +/* Compat-code for transition, will disappear. */ +if (!intel_crtc->config.clock_set) { + intel_crtc->config.dpll.n = clock.n; + intel_crtc->config.dpll.m1 = clock.m1; + intel_crtc->config.dpll.m2 = clock.m2; + intel_crtc->config.dpll.p1 = clock.p1; + intel_crtc->config.dpll.p2 = clock.p2; + }/* Ensure that the cursor is valid for the new mode before changing... */ intel_crtc_update_cursor (crtc, true);
drivers/gpu/drm/i915/intel_drv.h +12 -0
@@ -195,6 +195,18 @@ struct intel_crtc_config {* accordingly. */ bool has_dp_encoder;bool dither; + +/* Controls for the clock computation, to override various stages. */ +bool clock_set; + +/* Settings for the intel dpll used on pretty much everything but +* haswell. */ +struct dpll { +unsigned n; +unsigned m1, m2; +unsigned p1, p2; + } dpll; +int pipe_bpp;struct intel_link_m_n dp_m_n;/**
Signature · 1 line
1.7.11.4
PATCH 8/8 drm/i915: move dp clock computations to encoder->compute_config
In reply to Daniel VetterWith the exception of hsw, which has dedicated DP clocks which run at the fixed frequency already, and vlv, which doesn't have optmized pre-defined dp clock parameters (yet).
--- drivers/gpu/drm/i915/intel_display.c | 97 +----------------------------------- drivers/gpu/drm/i915/intel_dp.c | 45 +++++++++++++++++ 2 files changed, 46 insertions(+), 96 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -96
@@ -98,15 +98,6 @@ intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, intel_clock_t *best_clock);static bool -intel_find_pll_g4x_dp (const intel_limit_t *,struct drm_crtc *crtc, -int target,int refclk,intel_clock_t *match_clock, -intel_clock_t *best_clock); -static bool -intel_find_pll_ironlake_dp (const intel_limit_t *,struct drm_crtc *crtc, -int target,int refclk,intel_clock_t *match_clock, -intel_clock_t *best_clock); - -static bool intel_vlv_find_best_pll (const intel_limit_t *limit,struct drm_crtc *crtc,int target,int refclk,intel_clock_t *match_clock,intel_clock_t *best_clock);
@@ -238,20 +229,6 @@ static const intel_limit_t intel_limits_g4x_dual_channel_lvds = { .find_pll = intel_g4x_find_best_PLL, }; -static const intel_limit_t intel_limits_g4x_display_port = { - .dot = { .min =161670 , .max =227000 }, - .vco = { .min =1750000 , .max =3500000 }, - .n = { .min =1 , .max =2 }, - .m = { .min =97 , .max =108 }, - .m1 = { .min =0x10 , .max =0x12 }, - .m2 = { .min =0x05 , .max =0x06 }, - .p = { .min =10 , .max =20 }, - .p1 = { .min =1 , .max =2 }, - .p2 = { .dot_limit =0 , - .p2_slow =10 , .p2_fast =10 }, - .find_pll = intel_find_pll_g4x_dp, -}; -static const intel_limit_t intel_limits_pineview_sdvo = { .dot = { .min =20000 , .max =400000 }, .vco = { .min =1700000 , .max =3500000 },
@@ -358,20 +335,6 @@ static const intel_limit_t intel_limits_ironlake_dual_lvds_100m = { .find_pll = intel_g4x_find_best_PLL, }; -static const intel_limit_t intel_limits_ironlake_display_port = { - .dot = { .min =25000 , .max =350000 }, - .vco = { .min =1760000 , .max =3510000 }, - .n = { .min =1 , .max =2 }, - .m = { .min =81 , .max =90 }, - .m1 = { .min =12 , .max =22 }, - .m2 = { .min =5 , .max =9 }, - .p = { .min =10 , .max =20 }, - .p1 = { .min =1 , .max =2 }, - .p2 = { .dot_limit =0 , - .p2_slow =10 , .p2_fast =10 }, - .find_pll = intel_find_pll_ironlake_dp, -}; -static const intel_limit_t intel_limits_vlv_dac = { .dot = { .min =25000 , .max =270000 }, .vco = { .min =4000000 , .max =6000000 },
@@ -482,10 +445,7 @@ static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc,else limit = &intel_limits_ironlake_single_lvds; } - }else if (intel_pipe_has_type (crtc,INTEL_OUTPUT_DISPLAYPORT ) || -intel_pipe_has_type (crtc,INTEL_OUTPUT_EDP )) - limit = &intel_limits_ironlake_display_port; -else + }else limit = &intel_limits_ironlake_dac;return limit;
@@ -508,8 +468,6 @@ static const intel_limit_t *intel_g4x_limit(struct drm_crtc *crtc) limit = &intel_limits_g4x_hdmi; }else if (intel_pipe_has_type (crtc,INTEL_OUTPUT_SDVO )) { limit = &intel_limits_g4x_sdvo; - }else if (intel_pipe_has_type (crtc,INTEL_OUTPUT_DISPLAYPORT )) { - limit = &intel_limits_g4x_display_port; }else /* The option is for other outputs */ limit = &intel_limits_i9xx_sdvo;
@@ -752,59 +710,6 @@ intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, }static bool -intel_find_pll_ironlake_dp (const intel_limit_t *limit,struct drm_crtc *crtc, -int target,int refclk,intel_clock_t *match_clock, -intel_clock_t *best_clock) -{ -struct drm_device *dev = crtc->dev; -intel_clock_t clock; - -if (target <200000 ) { - clock.n =1 ; - clock.p1 =2 ; - clock.p2 =10 ; - clock.m1 =12 ; - clock.m2 =9 ; - }else { - clock.n =2 ; - clock.p1 =1 ; - clock.p2 =10 ; - clock.m1 =14 ; - clock.m2 =8 ; - } -intel_clock (dev, refclk, &clock); -memcpy (best_clock, &clock,sizeof (intel_clock_t)); -return true; -} - -/* DisplayPort has only two frequencies, 162MHz and 270MHz */ -static bool -intel_find_pll_g4x_dp (const intel_limit_t *limit,struct drm_crtc *crtc, -int target,int refclk,intel_clock_t *match_clock, -intel_clock_t *best_clock) -{ -intel_clock_t clock; -if (target <200000 ) { - clock.p1 =2 ; - clock.p2 =10 ; - clock.n =2 ; - clock.m1 =23 ; - clock.m2 =8 ; - }else { - clock.p1 =1 ; - clock.p2 =10 ; - clock.n =1 ; - clock.m1 =14 ; - clock.m2 =2 ; - } - clock.m =5 * (clock.m1 +2 ) + (clock.m2 +2 ); - clock.p = (clock.p1 * clock.p2); - clock.dot =96000 * clock.m / (clock.n +2 ) / clock.p; - clock.vco =0 ; -memcpy (best_clock, &clock,sizeof (intel_clock_t)); -return true; -} -static bool intel_vlv_find_best_pll (const intel_limit_t *limit,struct drm_crtc *crtc,int target,int refclk,intel_clock_t *match_clock,intel_clock_t *best_clock)
drivers/gpu/drm/i915/intel_dp.c +45 -0
57 lines not on this page · raw message
Signature · 1 line
1.7.11.4