drm/i915: rip out pre-DDI stuff from haswell_crtc_mode_set
Subsystems (2)
PATCH 1/10 drm/i915: rip out pre-DDI stuff from haswell_crtc_mode_set
Especially getting rid of all things lvds is ... great!
v2: Drop the two additional pre-hsw hunks noticed by Paulo Zanoni.
v3:
- handle DP ports correctly (spoted by Paulo)
- don't leave {} behind for a single-line block (again spotted by Paulo)
- kill another if (IBX || CPT) block
--- drivers/gpu/drm/i915/intel_display.c | 131 +---------------------------------- 1 file changed, 2 insertions(+), 129 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -129
@@ -5343,9 +5343,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, num_connectors++; } -WARN (!(HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)), -"Unexpected PCH type %d\n" ,INTEL_PCH_TYPE (dev)); - ok =ironlake_compute_clocks (crtc, adjusted_mode, &clock, &has_reduced_clock, &reduced_clock);if (!ok) {
@@ -5464,20 +5461,13 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc,int pipe = intel_crtc->pipe;int plane = intel_crtc->plane;int num_connectors =0 ; -intel_clock_t clock, reduced_clock; -u32 dpll =0 , fp =0 , fp2 =0 ; -bool ok, has_reduced_clock = false; -bool is_lvds = false, is_dp = false, is_cpu_edp = false; +bool is_dp = false, is_cpu_edp = false;struct intel_encoder *encoder; -u32 temp;int ret;bool dither;for_each_encoder_on_crtc (dev, crtc, encoder) {switch (encoder->type) { -case INTEL_OUTPUT_LVDS : - is_lvds = true; -break ;case INTEL_OUTPUT_DISPLAYPORT : is_dp = true;break ;
@@ -5511,143 +5501,26 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc,if (!intel_ddi_pll_mode_set (crtc, adjusted_mode->clock))return -EINVAL ; -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) { - ok =ironlake_compute_clocks (crtc, adjusted_mode, &clock, - &has_reduced_clock, - &reduced_clock); -if (!ok) { -DRM_ERROR ("Couldn't find PLL settings for mode!\n" ); -return -EINVAL ; - } - } -/* Ensure that the cursor is valid for the new mode before changing... */ intel_crtc_update_cursor (crtc, true);/* determine panel color depth */ dither =intel_choose_pipe_bpp_dither (crtc, fb, &intel_crtc->bpp, adjusted_mode); -if (is_lvds && dev_priv->lvds_dither) - dither = true;DRM_DEBUG_KMS ("Mode for pipe %d:\n" , pipe);drm_mode_debug_printmodeline (mode); -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) { - fp = clock.n <<16 | clock.m1 <<8 | clock.m2; -if (has_reduced_clock) - fp2 = reduced_clock.n <<16 | reduced_clock.m1 <<8 | - reduced_clock.m2; - - dpll =ironlake_compute_dpll (intel_crtc, adjusted_mode, &clock, - fp); - -/* CPU eDP is the only output that doesn't need a PCH PLL of its -* own on pre-Haswell/LPT generation */ -if (!is_cpu_edp) { -struct intel_pch_pll *pll; - - pll =intel_get_pch_pll (intel_crtc, dpll, fp); -if (pll ==NULL ) { -DRM_DEBUG_DRIVER ("failed to find PLL for pipe %d\n" , - pipe); -return -EINVAL ; - } - }else -intel_put_pch_pll (intel_crtc); - -/* The LVDS pin pair needs to be on before the DPLLs are -* enabled. This is an exception to the general rule that -* mode_set doesn't turn things on. -*/ -if (is_lvds) { - temp =I915_READ (PCH_LVDS ); - temp |=LVDS_PORT_EN |LVDS_A0A2_CLKA_POWER_UP ; -if (HAS_PCH_CPT (dev)) { - temp &= ~PORT_TRANS_SEL_MASK ; - temp |=PORT_TRANS_SEL_CPT (pipe); - }else { -if (pipe ==1 ) - temp |=LVDS_PIPEB_SELECT ; -else - temp &= ~LVDS_PIPEB_SELECT ; - } - -/* set the corresponsding LVDS_BORDER bit */ - temp |= dev_priv->lvds_border_bits; -/* Set the B0-B3 data pairs corresponding to whether -* we're going to set the DPLLs for dual-channel mode or -* not. -*/ -if (clock.p2 ==7 ) - temp |=LVDS_B0B3_POWER_UP |LVDS_CLKB_POWER_UP ; -else - temp &= ~(LVDS_B0B3_POWER_UP | -LVDS_CLKB_POWER_UP ); - -/* It would be nice to set 24 vs 18-bit mode -* (LVDS_A3_POWER_UP) appropriately here, but we need to -* look more thoroughly into how panels behave in the -* two modes. -*/ - temp &= ~(LVDS_HSYNC_POLARITY |LVDS_VSYNC_POLARITY ); -if (adjusted_mode->flags &DRM_MODE_FLAG_NHSYNC ) - temp |=LVDS_HSYNC_POLARITY ; -if (adjusted_mode->flags &DRM_MODE_FLAG_NVSYNC ) - temp |=LVDS_VSYNC_POLARITY ; -I915_WRITE (PCH_LVDS , temp); - } - } - -if (is_dp && !is_cpu_edp) { +if (is_dp && !is_cpu_edp)intel_dp_set_m_n (crtc, mode, adjusted_mode); - }else { -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) { -/* For non-DP output, clear any trans DP clock recovery -* setting.*/ -I915_WRITE (TRANSDATA_M1 (pipe),0 ); -I915_WRITE (TRANSDATA_N1 (pipe),0 ); -I915_WRITE (TRANSDPLINK_M1 (pipe),0 ); -I915_WRITE (TRANSDPLINK_N1 (pipe),0 ); - } - } intel_crtc->lowfreq_avail = false; -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) { -if (intel_crtc->pch_pll) { -I915_WRITE (intel_crtc->pch_pll->pll_reg, dpll); - -/* Wait for the clocks to stabilize. */ -POSTING_READ (intel_crtc->pch_pll->pll_reg); -udelay (150 ); - -/* The pixel multiplier can only be updated once the -* DPLL is enabled and the clocks are stable. -* -* So write it again. -*/ -I915_WRITE (intel_crtc->pch_pll->pll_reg, dpll); - } - -if (intel_crtc->pch_pll) { -if (is_lvds && has_reduced_clock && i915_powersave) { -I915_WRITE (intel_crtc->pch_pll->fp1_reg, fp2); - intel_crtc->lowfreq_avail = true; - }else { -I915_WRITE (intel_crtc->pch_pll->fp1_reg, fp); - } - } - }intel_set_pipe_timings (intel_crtc, mode, adjusted_mode);if (!is_dp || is_cpu_edp)ironlake_set_m_n (crtc, mode, adjusted_mode); -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) -if (is_cpu_edp) -ironlake_set_pll_edp (crtc, adjusted_mode->clock); -haswell_set_pipeconf (crtc, adjusted_mode, dither);/* Set up the display plane register */
Signature · 1 line
1.7.11.7
PATCH 2/10 drm/i915: move set_pll_edp to intel_dp.c
Now that we enable the cpu edp pll in intel_dp->pre_enable and no longer in crtc_mode_set, we can also move the modeset part to the intel_dp->mode_set callback. Previously this was not possible because the encoder ->mode_set callbacks are called after the crtc mode set callback.
v2: Rebase on top of copy&pasted hsw crtc_mode_set.
--- drivers/gpu/drm/i915/intel_display.c | 40 ------------------------------------ drivers/gpu/drm/i915/intel_dp.c | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 40 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -40
@@ -2293,43 +2293,6 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,return 0 ; } -static void ironlake_set_pll_edp (struct drm_crtc *crtc,int clock) -{ -struct drm_device *dev = crtc->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -u32 dpa_ctl; - -DRM_DEBUG_KMS ("eDP PLL enable for clock %d\n" , clock); - dpa_ctl =I915_READ (DP_A ); - dpa_ctl &= ~DP_PLL_FREQ_MASK ; - -if (clock <200000 ) { -u32 temp; - dpa_ctl |=DP_PLL_FREQ_160MHZ ; -/* workaround for 160Mhz: -1) program 0x4600c bits 15:0 = 0x8124 -2) program 0x46010 bit 0 = 1 -3) program 0x46034 bit 24 = 1 -4) program 0x64000 bit 14 = 1 -*/ - temp =I915_READ (0x4600c ); - temp &=0xffff0000 ; -I915_WRITE (0x4600c , temp |0x8124 ); - - temp =I915_READ (0x46010 ); -I915_WRITE (0x46010 , temp |1 ); - - temp =I915_READ (0x46034 ); -I915_WRITE (0x46034 , temp | (1 <<24 )); - }else { - dpa_ctl |=DP_PLL_FREQ_270MHZ ; - } -I915_WRITE (DP_A , dpa_ctl); - -POSTING_READ (DP_A ); -udelay (500 ); -} -static void intel_fdi_normal_train (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;
@@ -5429,9 +5392,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, fdi_config_ok =ironlake_check_fdi_lanes (intel_crtc); -if (is_cpu_edp) -ironlake_set_pll_edp (crtc, adjusted_mode->clock); -ironlake_set_pipeconf (crtc, adjusted_mode, dither);intel_wait_for_vblank (dev, pipe);
drivers/gpu/drm/i915/intel_dp.c +40 -0
@@ -851,6 +851,43 @@ void intel_dp_init_link_config(struct intel_dp *intel_dp) } } +static void ironlake_set_pll_edp (struct drm_crtc *crtc,int clock) +{ +struct drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +u32 dpa_ctl; + +DRM_DEBUG_KMS ("eDP PLL enable for clock %d\n" , clock); + dpa_ctl =I915_READ (DP_A ); + dpa_ctl &= ~DP_PLL_FREQ_MASK ; + +if (clock <200000 ) { +u32 temp; + dpa_ctl |=DP_PLL_FREQ_160MHZ ; +/* workaround for 160Mhz: +1) program 0x4600c bits 15:0 = 0x8124 +2) program 0x46010 bit 0 = 1 +3) program 0x46034 bit 24 = 1 +4) program 0x64000 bit 14 = 1 +*/ + temp =I915_READ (0x4600c ); + temp &=0xffff0000 ; +I915_WRITE (0x4600c , temp |0x8124 ); + + temp =I915_READ (0x46010 ); +I915_WRITE (0x46010 , temp |1 ); + + temp =I915_READ (0x46034 ); +I915_WRITE (0x46034 , temp | (1 <<24 )); + }else { + dpa_ctl |=DP_PLL_FREQ_270MHZ ; + } +I915_WRITE (DP_A , dpa_ctl); + +POSTING_READ (DP_A ); +udelay (500 ); +} +static void intel_dp_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode)
@@ -950,6 +987,9 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, }else { intel_dp->DP |=DP_LINK_TRAIN_OFF_CPT ; } + +if (is_cpu_edp (intel_dp)) +ironlake_set_pll_edp (crtc, adjusted_mode->clock); }#define IDLE_ON_MASK (PP_ON | 0 | PP_SEQUENCE_MASK | 0 | PP_SEQUENCE_STATE_MASK)
Signature · 1 line
1.7.11.7
PATCH 3/10 drm/i915: rip out pre-production ilk cpu edp w/a
In reply to Daniel VetterWhile reading docs I've noticed that this special workaround to select the 1.6 GHz DP clock only applies to pre-production ilk machines. Since the registers we're touching here are rather undocumented and might be harmful on later chips, rip it out.
For the Bspec reference of this w/a look in "vol4g CPU Display Registers [DevILK]", Section 4.1.7.1 "DP_A—DisplayPort A Control Register", "DP_PLL_Frequency_Select".
v2: Keep a debug message as a hint in case something regresses. Requested by Chris Wilson.
--- drivers/gpu/drm/i915/intel_dp.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +5 -16
@@ -862,26 +862,15 @@ static void ironlake_set_pll_edp(struct drm_crtc *crtc, int clock) dpa_ctl &= ~DP_PLL_FREQ_MASK ;if (clock <200000 ) { -u32 temp; +/* For a long time we've carried around a ILK-DevA w/a for the +* 160MHz clock. If we're really unlucky, it's still required. +*/ +DRM_DEBUG_KMS ("160MHz cpu eDP clock, might need ilk devA w/a\n" ); dpa_ctl |=DP_PLL_FREQ_160MHZ ; -/* workaround for 160Mhz: -1) program 0x4600c bits 15:0 = 0x8124 -2) program 0x46010 bit 0 = 1 -3) program 0x46034 bit 24 = 1 -4) program 0x64000 bit 14 = 1 -*/ - temp =I915_READ (0x4600c ); - temp &=0xffff0000 ; -I915_WRITE (0x4600c , temp |0x8124 ); - - temp =I915_READ (0x46010 ); -I915_WRITE (0x46010 , temp |1 ); - - temp =I915_READ (0x46034 ); -I915_WRITE (0x46034 , temp | (1 <<24 )); }else { dpa_ctl |=DP_PLL_FREQ_270MHZ ; } +I915_WRITE (DP_A , dpa_ctl);POSTING_READ (DP_A );
Signature · 6 lines
1.7.11.7 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/10 drm/i915: use wait_for_vblank instead of msleep(17)
In reply to Daniel Vetter17 ms is eerily close to 60 Hz ^-1
Unfortunately this goes back to the original DP enabling for ilk, and unfortunately does not come with a reason for it's existance attached.
Some closer inspection of the code and DP specs shows that we set the idle link pattern before we disable the port. And it seems like that the DP spec (or at least our hw) only switch to the idle pattern on the next vblank. Hence a vblank wait at this spot makes _much_ more sense than a really long wait.
v2: Rebase fixup.
--- drivers/gpu/drm/i915/intel_dp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +4 -2
@@ -1993,6 +1993,8 @@ intel_dp_link_down(struct intel_dp *intel_dp)struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp);struct drm_device *dev = intel_dig_port->base.base.dev;struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc = +to_intel_crtc (intel_dig_port->base.base.crtc);uint32_t DP = intel_dp->DP;/*
@@ -2027,7 +2029,7 @@ intel_dp_link_down(struct intel_dp *intel_dp) }POSTING_READ (intel_dp->output_reg); -msleep (17 ); +intel_wait_for_vblank (dev, intel_crtc->pipe);if (HAS_PCH_IBX (dev) &&I915_READ (intel_dp->output_reg) &DP_PIPEB_SELECT ) {
@@ -2059,7 +2061,7 @@ intel_dp_link_down(struct intel_dp *intel_dp)POSTING_READ (intel_dp->output_reg);msleep (50 ); }else -intel_wait_for_vblank (dev,to_intel_crtc (crtc)->pipe); +intel_wait_for_vblank (dev, intel_crtc->pipe); }DP &= ~DP_AUDIO_OUTPUT_ENABLE ;
Signature · 1 line
1.7.11.7
PATCH 5/10 drm/i915: WARN on !crtc in intel_dp_link_down
In reply to Daniel VetterThis could have happened with the old crtc helper based modeset code, but can't happen any longer with the new code.
Hence put in a WARN and adjust the comment. If no one hits this, we can eventually remove it (like a few other such cases across our code).
--- drivers/gpu/drm/i915/intel_dp.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +4 -9
@@ -2049,15 +2049,10 @@ intel_dp_link_down(struct intel_dp *intel_dp)/* Changes to enable or select take place the vblank * after being written. */ -if (crtc ==NULL ) { -/* We can arrive here never having been attached -* to a CRTC, for instance, due to inheriting -* random state from the BIOS. -* -* If the pipe is not running, play safe and -* wait for the clocks to stabilise before -* continuing. -*/ +if (WARN_ON (crtc ==NULL )) { +/* We should never try to disable a port without a crtc +* attached. For paranoia keep the code around for a +* bit. */ POSTING_READ (intel_dp->output_reg);msleep (50 ); }else
Signature · 1 line
1.7.11.7
PATCH 6/10 drm/i915: drop unnecessary clearing of pch dp transcoder timings
In reply to Daniel VetterThis has originally been added in
commit 8db9d77b1b14fd730561f64beea8c00e4478d7c5
Author: Zhenyu Wang <[email protected]> Date: Wed Apr 7 16:15:54 2010 +0800
drm/i915: Support for Cougarpoint PCH display pipeline
probably to combat issues with hw state left behind by the BIOS. And indeed, I've checked out that specific revision, and there is no DP support yet. So the pch dp transcoder won't be correctly disabled, and that's important since it requires a rether special disable dance:
Just writing 0 to TRANS_DP_CTL won't cut it, since we need to select the NONE port when disabling, too.
And indeed, things seem to still work, so let's just remove this.
--- drivers/gpu/drm/i915/intel_display.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -8
@@ -5345,15 +5345,8 @@ 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 && !is_cpu_edp)intel_dp_set_m_n (crtc, mode, adjusted_mode); - }else { -/* For non-DP output, clear any trans DP clock recovery setting.*/ -I915_WRITE (TRANSDATA_M1 (pipe),0 ); -I915_WRITE (TRANSDATA_N1 (pipe),0 ); -I915_WRITE (TRANSDPLINK_M1 (pipe),0 ); -I915_WRITE (TRANSDPLINK_N1 (pipe),0 ); - }for_each_encoder_on_crtc (dev, crtc, encoder)if (encoder->pre_pll_enable)
Signature · 1 line
1.7.11.7
Re: [PATCH 06/10] drm/i915: drop unnecessary clearing of pch dp transcoder timings
Hi
2012/11/29 Daniel Vetter <[email protected]>:
Quoted 15 lines
This has originally been added in
commit
8db9d77b1b14fd730561f64beea8c00e4478d7c5Author: Zhenyu Wang <[email protected]> Date: Wed Apr 7 16:15:54 2010 +0800drm/i915: Support for Cougarpoint PCH display pipeline
probably to combat issues with hw state left behind by the BIOS. And indeed, I've checked out that specific revision, and there is no DP support yet. So the pch dp transcoder won't be correctly disabled, and that's important since it requires a rether special disable dance:
Just writing 0 toTRANS_DP_CTLwon't cut it, since we need to select the NONE port when disabling, too.
Quoted 3 lines
And indeed, things seem to still work, so let's just remove this.
Signed-off-by Daniel Vetter <[email protected]>
Briefly tested on SNB:
- Connected DP, disconnected
- Connected HDMI, disconnected
- Connected VGA, disconnected
They all worked.
Quoted 32 lines
--- drivers/gpu/drm/i915/intel_display.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)drivers/gpu/drm/i915/intel_display.c +1
-9@@ -5345,15 +5345,8 @@ 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 && !is_cpu_edp)intel_dp_set_m_n (crtc, mode, adjusted_mode); - }else { -/* For non-DP output, clear any trans DP clock recovery setting.*/ -I915_WRITE (TRANSDATA_M1 (pipe),0 ); -I915_WRITE (TRANSDATA_N1 (pipe),0 ); -I915_WRITE (TRANSDPLINK_M1 (pipe),0 ); -I915_WRITE (TRANSDPLINK_N1 (pipe),0 ); - }for_each_encoder_on_crtc (dev, crtc, encoder)if (encoder->pre_pll_enable) --1.7.11.7
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Paulo Zanoni
PATCH 7/10 drm/i915: extract common link_m_n helpers
In reply to Daniel VetterBoth the dp and fdi code use the exact same computations (ignore minor differences in conversion between bits and bytes).
This makes it even more apparent that we have a _massive_ mess between cpu transcoder/fdi link/pch transcoder and pch link settings. And also that we have hilarious amounts of confusion between edp and dp (despite that they're identical at a link level).
--- drivers/gpu/drm/i915/i915_drv.h | 13 ++++++++++++ drivers/gpu/drm/i915/intel_display.c | 31 +++++++++------------------- drivers/gpu/drm/i915/intel_dp.c | 39 +++--------------------------------- 3 files changed, 26 insertions(+), 57 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +13 -0
@@ -101,6 +101,19 @@ struct intel_pch_pll { };#define I915_NUM_PLLS 2 +/* Used by dp and fdi links */ +struct intel_link_m_n { +uint32_t tu; +uint32_t gmch_m; +uint32_t gmch_n; +uint32_t link_m; +uint32_t link_n; +}; + +void intel_link_compute_m_n (int bpp,int nlanes, +int pixel_clock,int link_clock, +struct intel_link_m_n *m_n); +struct intel_ddi_plls {int spll_refcount;int wrpll1_refcount;
drivers/gpu/drm/i915/intel_display.c +10 -21
@@ -3954,16 +3954,8 @@ static int i830_get_display_clock_speed(struct drm_device *dev)return 133000 ; } -struct fdi_m_n { -u32 tu; -u32 gmch_m; -u32 gmch_n; -u32 link_m; -u32 link_n; -}; -static void -fdi_reduce_ratio (u32 *num,u32 *den) +intel_reduce_ratio (uint32_t *num,uint32_t *den) {while (*num >0xffffff || *den >0xffffff ) { *num >>=1 ;
@@ -3971,20 +3963,18 @@ fdi_reduce_ratio(u32 *num, u32 *den) } } -static void -ironlake_compute_m_n (int bits_per_pixel,int nlanes,int pixel_clock, -int link_clock,struct fdi_m_n *m_n) +void +intel_link_compute_m_n (int bits_per_pixel,int nlanes, +int pixel_clock,int link_clock, +struct intel_link_m_n *m_n) { - m_n->tu =64 ;/* default size */ - -/* BUG_ON(pixel_clock > INT_MAX / 36); */ + m_n->tu =64 ; m_n->gmch_m = bits_per_pixel * pixel_clock; m_n->gmch_n = link_clock * nlanes *8 ; -fdi_reduce_ratio (&m_n->gmch_m, &m_n->gmch_n); - +intel_reduce_ratio (&m_n->gmch_m, &m_n->gmch_n); m_n->link_m = pixel_clock; m_n->link_n = link_clock; -fdi_reduce_ratio (&m_n->link_m, &m_n->link_n); +intel_reduce_ratio (&m_n->link_m, &m_n->link_n); }static inline bool intel_panel_use_ssc (struct drm_i915_private *dev_priv)
@@ -5098,7 +5088,7 @@ static void ironlake_set_m_n(struct drm_crtc *crtc,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;struct intel_encoder *intel_encoder, *edp_encoder =NULL ; -struct fdi_m_n m_n = {0 }; +struct intel_link_m_n m_n = {0 };int target_clock, pixel_multiplier, lane, link_bw;bool is_dp = false, is_cpu_edp = false;
@@ -5156,8 +5146,7 @@ static void ironlake_set_m_n(struct drm_crtc *crtc,if (pixel_multiplier >1 ) link_bw *= pixel_multiplier; -ironlake_compute_m_n (intel_crtc->bpp, lane, target_clock, link_bw, - &m_n); +intel_link_compute_m_n (intel_crtc->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);
drivers/gpu/drm/i915/intel_dp.c +3 -36
@@ -742,39 +742,6 @@ intel_dp_mode_fixup(struct drm_encoder *encoder,return false; } -struct intel_dp_m_n { -uint32_t tu; -uint32_t gmch_m; -uint32_t gmch_n; -uint32_t link_m; -uint32_t link_n; -}; - -static void -intel_reduce_ratio (uint32_t *num,uint32_t *den) -{ -while (*num >0xffffff || *den >0xffffff ) { - *num >>=1 ; - *den >>=1 ; - } -} - -static void -intel_dp_compute_m_n (int bpp, -int nlanes, -int pixel_clock, -int link_clock, -struct intel_dp_m_n *m_n) -{ - m_n->tu =64 ; - m_n->gmch_m = (pixel_clock * bpp) >>3 ; - m_n->gmch_n = link_clock * nlanes; -intel_reduce_ratio (&m_n->gmch_m, &m_n->gmch_n); - m_n->link_m = pixel_clock; - m_n->link_n = link_clock; -intel_reduce_ratio (&m_n->link_m, &m_n->link_n); -} -void intel_dp_set_m_n (struct drm_crtc *crtc,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode)
@@ -785,7 +752,7 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int lane_count =4 ; -struct intel_dp_m_n m_n; +struct intel_link_m_n m_n;int pipe = intel_crtc->pipe;enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;
@@ -808,8 +775,8 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,* the number of bytes_per_pixel post-LUT, which we always * set up for 8-bits of R/G/B, or 3 bytes total. */ -intel_dp_compute_m_n (intel_crtc->bpp, lane_count, - mode->clock, adjusted_mode->clock, &m_n); +intel_link_compute_m_n (intel_crtc->bpp, lane_count, + mode->clock, adjusted_mode->clock, &m_n);if (IS_HASWELL (dev)) { I915_WRITE(PIPE_DATA_M1(cpu_transcoder),
Signature · 1 line
1.7.11.7
Re: [PATCH 07/10] drm/i915: extract common link_m_n helpers
2012/11/29 Daniel Vetter <[email protected]>:
Quoted 9 lines
Both the dp and fdi code use the exact same computations (ignore minor differences in conversion between bits and bytes).
This makes it even more apparent that we have a _massive_ mess between cpu transcoder/fdi link/pch transcoder and pch link settings. And also that we have hilarious amounts of confusion between edp and dp (despite that they're identical at a link level).
Signed-off-by Daniel Vetter <[email protected]>
Quoted 170 lines
--- drivers/gpu/drm/i915/i915_drv.h | 13 ++++++++++++ drivers/gpu/drm/i915/intel_display.c | 31 +++++++++------------------- drivers/gpu/drm/i915/intel_dp.c | 39 +++--------------------------------- 3 files changed, 26 insertions(+), 57 deletions(-)drivers/gpu/drm/i915/i915_drv.h +13
-0@@ -101,6 +101,19 @@ struct intel_pch_pll { };#define I915_NUM_PLLS 2 +/* Used by dp and fdi links */ +struct intel_link_m_n { +uint32_t tu; +uint32_t gmch_m; +uint32_t gmch_n; +uint32_t link_m; +uint32_t link_n; +}; + +void intel_link_compute_m_n (int bpp,int nlanes, +int pixel_clock,int link_clock, +struct intel_link_m_n *m_n); +struct intel_ddi_plls {int spll_refcount;int wrpll1_refcount;drivers/gpu/drm/i915/intel_display.c +10
-21@@ -3954,16 +3954,8 @@ static int i830_get_display_clock_speed(struct drm_device *dev)return 133000 ; } -struct fdi_m_n { -u32 tu; -u32 gmch_m; -u32 gmch_n; -u32 link_m; -u32 link_n; -}; -static void -fdi_reduce_ratio (u32 *num,u32 *den) +intel_reduce_ratio (uint32_t *num,uint32_t *den) {while (*num >0xffffff || *den >0xffffff ) { *num >>=1 ;@@ -3971,20 +3963,18 @@ fdi_reduce_ratio(u32 *num, u32 *den) } } -static void -ironlake_compute_m_n (int bits_per_pixel,int nlanes,int pixel_clock, -int link_clock,struct fdi_m_n *m_n) +void +intel_link_compute_m_n (int bits_per_pixel,int nlanes, +int pixel_clock,int link_clock, +struct intel_link_m_n *m_n) { - m_n->tu =64 ;/* default size */ - -/* BUG_ON(pixel_clock > INT_MAX / 36); */ + m_n->tu =64 ; m_n->gmch_m = bits_per_pixel * pixel_clock; m_n->gmch_n = link_clock * nlanes *8 ; -fdi_reduce_ratio (&m_n->gmch_m, &m_n->gmch_n); - +intel_reduce_ratio (&m_n->gmch_m, &m_n->gmch_n); m_n->link_m = pixel_clock; m_n->link_n = link_clock; -fdi_reduce_ratio (&m_n->link_m, &m_n->link_n); +intel_reduce_ratio (&m_n->link_m, &m_n->link_n); }static inline bool intel_panel_use_ssc (struct drm_i915_private *dev_priv)@@ -5098,7 +5088,7 @@ static void ironlake_set_m_n(struct drm_crtc *crtc,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;struct intel_encoder *intel_encoder, *edp_encoder =NULL ; -struct fdi_m_n m_n = {0 }; +struct intel_link_m_n m_n = {0 };int target_clock, pixel_multiplier, lane, link_bw;bool is_dp = false, is_cpu_edp = false;@@ -5156,8 +5146,7 @@ static void ironlake_set_m_n(struct drm_crtc *crtc,if (pixel_multiplier >1 ) link_bw *= pixel_multiplier; -ironlake_compute_m_n (intel_crtc->bpp, lane, target_clock, link_bw, - &m_n); +intel_link_compute_m_n (intel_crtc->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);drivers/gpu/drm/i915/intel_dp.c +3
-37@@ -742,39 +742,6 @@ intel_dp_mode_fixup(struct drm_encoder *encoder,return false; } -struct intel_dp_m_n { -uint32_t tu; -uint32_t gmch_m; -uint32_t gmch_n; -uint32_t link_m; -uint32_t link_n; -}; - -static void -intel_reduce_ratio (uint32_t *num,uint32_t *den) -{ -while (*num >0xffffff || *den >0xffffff ) { - *num >>=1 ; - *den >>=1 ; - } -} - -static void -intel_dp_compute_m_n (int bpp, -int nlanes, -int pixel_clock, -int link_clock, -struct intel_dp_m_n *m_n) -{ - m_n->tu =64 ; - m_n->gmch_m = (pixel_clock * bpp) >>3 ; - m_n->gmch_n = link_clock * nlanes; -intel_reduce_ratio (&m_n->gmch_m, &m_n->gmch_n); - m_n->link_m = pixel_clock; - m_n->link_n = link_clock; -intel_reduce_ratio (&m_n->link_m, &m_n->link_n); -} -void intel_dp_set_m_n (struct drm_crtc *crtc,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode)@@ -785,7 +752,7 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int lane_count =4 ; -struct intel_dp_m_n m_n; +struct intel_link_m_n m_n;int pipe = intel_crtc->pipe;enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;@@ -808,8 +775,8 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,* the number of bytes_per_pixel post-LUT, which we always * set up for 8-bits of R/G/B, or 3 bytes total. */ -intel_dp_compute_m_n (intel_crtc->bpp, lane_count, - mode->clock, adjusted_mode->clock, &m_n); +intel_link_compute_m_n (intel_crtc->bpp, lane_count, + mode->clock, adjusted_mode->clock, &m_n);if (IS_HASWELL (dev)) { I915_WRITE(PIPE_DATA_M1(cpu_transcoder), --1.7.11.7
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Paulo Zanoni
Re: [PATCH 07/10] drm/i915: extract common link_m_n helpers
Quoted 4 lines · Paulo Zanoni
2012/11/29 Daniel Vetter <[email protected]>:
Quoted 3 lines
Both the dp and fdi code use the exact same computations (ignore minor differences in conversion between bits and bytes).
Quoted 8 lines
Quoted 6 lines
This makes it even more apparent that we have a _massive_ mess between cpu transcoder/fdi link/pch transcoder and pch link settings. And also that we have hilarious amounts of confusion between edp and dp (despite that they're identical at a link level).
Signed-off-by Daniel Vetter <[email protected]>Reviewed-by Paulo Zanoni <[email protected]>
Slurped in the DP part of this patch-bomb, the watermark stuff isn't really thought through. Thanks for the review.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 8/10 drm/i915: don't call update_watermark in crtc_mode_set
In reply to Daniel VetterWe already update watermarks at all the right places in the crtc_enable/disable callbacks. And since ->mode_set doesn't change the active state, nothing will have changed ...
v2: Rebase on top of latest haswell copy&pasta.
--- drivers/gpu/drm/i915/intel_display.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -6
@@ -4713,8 +4713,6 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, ret =intel_pipe_set_base (crtc, x, y, fb); -intel_update_watermarks (dev); -return ret; }
@@ -5384,8 +5382,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, ret =intel_pipe_set_base (crtc, x, y, fb); -intel_update_watermarks (dev); -intel_update_linetime_watermarks (dev, pipe, adjusted_mode);return fdi_config_ok ? ret : -EINVAL ;
@@ -5471,8 +5467,6 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc, ret =intel_pipe_set_base (crtc, x, y, fb); -intel_update_watermarks (dev); -intel_update_linetime_watermarks (dev, pipe, adjusted_mode);return ret;
Signature · 1 line
1.7.11.7
PATCH 9/10 drm/i915: don't call update_watermarks from haswell enable/disable code
In reply to Daniel VetterWe don't use these on haswell, since haswell as per-pipe watermarks and nothing global any more.
--- drivers/gpu/drm/i915/intel_display.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -2
@@ -3357,7 +3357,6 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)return ; intel_crtc->active = true; -intel_update_watermarks (dev); is_pch_port =haswell_crtc_driving_pch (crtc);
@@ -3546,7 +3545,6 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) } intel_crtc->active = false; -intel_update_watermarks (dev);mutex_lock (&dev->struct_mutex);intel_update_fbc (dev);
Signature · 1 line
1.7.11.7
PATCH 10/10 drm/i915: rip out update_linetime_wm abstraction
In reply to Daniel VetterI like abstraction and vfuncs, but only if they actually abstract anything. In this case here they just obfuscate, so let's rip this stuff out.
Aside: We really should move all the haswell stuff into it's own file ...
--- drivers/gpu/drm/i915/i915_drv.h | 2 -- drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++++++++--- drivers/gpu/drm/i915/intel_drv.h | 2 -- drivers/gpu/drm/i915/intel_pm.c | 37 ------------------------------------ 4 files changed, 28 insertions(+), 44 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -2
@@ -269,8 +269,6 @@ struct drm_i915_display_funcs {void (*update_wm)(struct drm_device *dev);void (*update_sprite_wm)(struct drm_device *dev,int pipe,uint32_t sprite_width,int pixel_size); -void (*update_linetime_wm)(struct drm_device *dev,int pipe, -struct drm_display_mode *mode);void (*modeset_global_resources)(struct drm_device *dev); int (*crtc_mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode,
drivers/gpu/drm/i915/intel_display.c +28 -3
@@ -5380,11 +5380,36 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, ret =intel_pipe_set_base (crtc, x, y, fb); -intel_update_linetime_watermarks (dev, pipe, adjusted_mode); -return fdi_config_ok ? ret : -EINVAL ; } +static void +haswell_update_linetime_wm (struct drm_device *dev,int pipe, +struct drm_display_mode *mode) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +u32 temp; + + temp =I915_READ (PIPE_WM_LINETIME (pipe)); + temp &= ~PIPE_WM_LINETIME_MASK ; + +/* The WM are computed with base on how long it takes to fill a single +* row at the given clock rate, multiplied by 8. +* */ + temp |=PIPE_WM_LINETIME_TIME ( + ((mode->crtc_hdisplay *1000 ) / mode->clock) *8 ); + +/* IPS watermarks are only used by pipe A, and are ignored by +* pipes B and C. They are calculated similarly to the common +* linetime values, except that we are using CD clock frequency +* in MHz instead of pixel rate for the division. +* +* This is a placeholder for the IPS watermark calculation code. +*/ + +I915_WRITE (PIPE_WM_LINETIME (pipe), temp); +} + static int haswell_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode,
@@ -5465,7 +5490,7 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc, ret =intel_pipe_set_base (crtc, x, y, fb); -intel_update_linetime_watermarks (dev, pipe, adjusted_mode); +haswell_update_linetime_wm (dev, pipe, adjusted_mode);return ret; }
drivers/gpu/drm/i915/intel_drv.h +0 -2
@@ -622,8 +622,6 @@ extern void intel_update_watermarks(struct drm_device *dev);extern void intel_update_sprite_watermarks (struct drm_device *dev,int pipe,uint32_t sprite_width,int pixel_size); -extern void intel_update_linetime_watermarks (struct drm_device *dev,int pipe, -struct drm_display_mode *mode); extern unsigned long intel_gen4_compute_offset_xtiled(int *x, int *y, unsigned int bpp,
drivers/gpu/drm/i915/intel_pm.c +0 -37
@@ -1890,33 +1890,6 @@ static void sandybridge_update_wm(struct drm_device *dev) cursor_wm); } -static void -haswell_update_linetime_wm (struct drm_device *dev,int pipe, -struct drm_display_mode *mode) -{ -struct drm_i915_private *dev_priv = dev->dev_private; -u32 temp; - - temp =I915_READ (PIPE_WM_LINETIME (pipe)); - temp &= ~PIPE_WM_LINETIME_MASK ; - -/* The WM are computed with base on how long it takes to fill a single -* row at the given clock rate, multiplied by 8. -* */ - temp |=PIPE_WM_LINETIME_TIME ( - ((mode->crtc_hdisplay *1000 ) / mode->clock) *8 ); - -/* IPS watermarks are only used by pipe A, and are ignored by -* pipes B and C. They are calculated similarly to the common -* linetime values, except that we are using CD clock frequency -* in MHz instead of pixel rate for the division. -* -* This is a placeholder for the IPS watermark calculation code. -*/ - -I915_WRITE (PIPE_WM_LINETIME (pipe), temp); -} - static bool sandybridge_compute_sprite_wm(struct drm_device *dev, int plane, uint32_t sprite_width, int pixel_size,
@@ -2112,15 +2085,6 @@ void intel_update_watermarks(struct drm_device *dev) dev_priv->display.update_wm (dev); } -void intel_update_linetime_watermarks (struct drm_device *dev, -int pipe,struct drm_display_mode *mode) -{ -struct drm_i915_private *dev_priv = dev->dev_private; - -if (dev_priv->display.update_linetime_wm) - dev_priv->display.update_linetime_wm (dev, pipe, mode); -} -void intel_update_sprite_watermarks (struct drm_device *dev,int pipe,uint32_t sprite_width,int pixel_size) {
@@ -4011,7 +3975,6 @@ void intel_init_pm(struct drm_device *dev)if (SNB_READ_WM0_LATENCY ()) { dev_priv->display.update_wm = sandybridge_update_wm; dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm; - dev_priv->display.update_linetime_wm = haswell_update_linetime_wm; }else {DRM_DEBUG_KMS ("Failed to read display plane latency. " "Disable CxSR\n" );
Signature · 1 line
1.7.11.7
Re: [PATCH 10/10] drm/i915: rip out update_linetime_wm abstraction
Hi
2012/11/29 Daniel Vetter <[email protected]>:
Quoted 4 lines
I like abstraction and vfuncs, but only if they actually abstract anything. In this case here they just obfuscate, so let's rip this stuff out.
Aside: We really should move all the haswell stuff into it's own file ...
Well, a few Kernels ago we did a nice effort to move a lot of code from intel_display.c to intel_pm.c. Now we're bringing it back... I'd like to understand what are the current plans regarding this.
Quoted 156 lines
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 -- drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++++++++++++++++++--- drivers/gpu/drm/i915/intel_drv.h | 2 -- drivers/gpu/drm/i915/intel_pm.c | 37 ------------------------------------ 4 files changed, 28 insertions(+), 44 deletions(-)drivers/gpu/drm/i915/i915_drv.h +0
-2@@ -269,8 +269,6 @@ struct drm_i915_display_funcs {void (*update_wm)(struct drm_device *dev);void (*update_sprite_wm)(struct drm_device *dev,int pipe,uint32_t sprite_width,int pixel_size); -void (*update_linetime_wm)(struct drm_device *dev,int pipe, -struct drm_display_mode *mode);void (*modeset_global_resources)(struct drm_device *dev); int (*crtc_mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode,drivers/gpu/drm/i915/intel_display.c +28
-3@@ -5380,11 +5380,36 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, ret =intel_pipe_set_base (crtc, x, y, fb); -intel_update_linetime_watermarks (dev, pipe, adjusted_mode); -return fdi_config_ok ? ret : -EINVAL ; } +static void +haswell_update_linetime_wm (struct drm_device *dev,int pipe, +struct drm_display_mode *mode) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +u32 temp; + + temp =I915_READ (PIPE_WM_LINETIME (pipe)); + temp &= ~PIPE_WM_LINETIME_MASK ; + +/* The WM are computed with base on how long it takes to fill a single +* row at the given clock rate, multiplied by 8. +* */ + temp |=PIPE_WM_LINETIME_TIME ( + ((mode->crtc_hdisplay *1000 ) / mode->clock) *8 ); + +/* IPS watermarks are only used by pipe A, and are ignored by +* pipes B and C. They are calculated similarly to the common +* linetime values, except that we are using CD clock frequency +* in MHz instead of pixel rate for the division. +* +* This is a placeholder for the IPS watermark calculation code. +*/ + +I915_WRITE (PIPE_WM_LINETIME (pipe), temp); +} + static int haswell_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode,@@ -5465,7 +5490,7 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc, ret =intel_pipe_set_base (crtc, x, y, fb); -intel_update_linetime_watermarks (dev, pipe, adjusted_mode); +haswell_update_linetime_wm (dev, pipe, adjusted_mode);return ret; }drivers/gpu/drm/i915/intel_drv.h +0
-2@@ -622,8 +622,6 @@ extern void intel_update_watermarks(struct drm_device *dev);extern void intel_update_sprite_watermarks (struct drm_device *dev,int pipe,uint32_t sprite_width,int pixel_size); -extern void intel_update_linetime_watermarks (struct drm_device *dev,int pipe, -struct drm_display_mode *mode); extern unsigned long intel_gen4_compute_offset_xtiled(int *x, int *y, unsigned int bpp,drivers/gpu/drm/i915/intel_pm.c +0
-38@@ -1890,33 +1890,6 @@ static void sandybridge_update_wm(struct drm_device *dev) cursor_wm); } -static void -haswell_update_linetime_wm (struct drm_device *dev,int pipe, -struct drm_display_mode *mode) -{ -struct drm_i915_private *dev_priv = dev->dev_private; -u32 temp; - - temp =I915_READ (PIPE_WM_LINETIME (pipe)); - temp &= ~PIPE_WM_LINETIME_MASK ; - -/* The WM are computed with base on how long it takes to fill a single -* row at the given clock rate, multiplied by 8. -* */ - temp |=PIPE_WM_LINETIME_TIME ( - ((mode->crtc_hdisplay *1000 ) / mode->clock) *8 ); - -/* IPS watermarks are only used by pipe A, and are ignored by -* pipes B and C. They are calculated similarly to the common -* linetime values, except that we are using CD clock frequency -* in MHz instead of pixel rate for the division. -* -* This is a placeholder for the IPS watermark calculation code. -*/ - -I915_WRITE (PIPE_WM_LINETIME (pipe), temp); -} - static bool sandybridge_compute_sprite_wm(struct drm_device *dev, int plane, uint32_t sprite_width, int pixel_size,@@ -2112,15 +2085,6 @@ void intel_update_watermarks(struct drm_device *dev) dev_priv->display.update_wm (dev); } -void intel_update_linetime_watermarks (struct drm_device *dev, -int pipe,struct drm_display_mode *mode) -{ -struct drm_i915_private *dev_priv = dev->dev_private; - -if (dev_priv->display.update_linetime_wm) - dev_priv->display.update_linetime_wm (dev, pipe, mode); -} -void intel_update_sprite_watermarks (struct drm_device *dev,int pipe,uint32_t sprite_width,int pixel_size) {@@ -4011,7 +3975,6 @@ void intel_init_pm(struct drm_device *dev)if (SNB_READ_WM0_LATENCY ()) { dev_priv->display.update_wm = sandybridge_update_wm; dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm; - dev_priv->display.update_linetime_wm = haswell_update_linetime_wm; }else {DRM_DEBUG_KMS ("Failed to read display plane latency. " "Disable CxSR\n" ); --1.7.11.7
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Paulo Zanoni
Re: [PATCH 10/10] drm/i915: rip out update_linetime_wm abstraction
Quoted 11 lines · Paulo Zanoni
Hi
2012/11/29 Daniel Vetter <[email protected]>:
Quoted 4 lines
I like abstraction and vfuncs, but only if they actually abstract anything. In this case here they just obfuscate, so let's rip this stuff out.
Aside: We really should move all the haswell stuff into it's own file ...
Well, a few Kernels ago we did a nice effort to move a lot of code from
intel_display.ctointel_pm.c. Now we're bringing it back... I'd like to understand what are the current plans regarding this.
I guess we should move all the haswell stuff into intel_ddi.c, once it settles. But I'll drop the watermark patches here anyway, not thought through these here ...
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Hi
2012/11/29 Daniel Vetter <[email protected]>:
Quoted 20 lines
Especially getting rid of all things lvds is ... great!
v2: Drop the two additional pre-hsw hunks noticed by Paulo Zanoni.
v3:
- handle DP ports correctly (spoted by Paulo)
- don't leave {} behind for a single-line block (again spotted by Paulo)
- kill another if (IBX || CPT) blockSigned-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 131 +---------------------------------- 1 file changed, 2 insertions(+), 129 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-0
drivers/gpu/drm/i915/intel_display.c static int ironlake_crtc_mode_set(struct drm_crtc *crtc, · line 5348
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +0
-3@@ -5343,9 +5343,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, num_connectors++; } -WARN (!(HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)), -"Unexpected PCH type %d\n" ,INTEL_PCH_TYPE (dev)); -
This is patching ironlake_crtc_mode_set, instead of haswell_crtc_mode_set, which still includes the following lines:
/* We are not sure yet this won't happen. */
WARN(!HAS_PCH_LPT(dev), "Unexpected PCH type %d\n",
INTEL_PCH_TYPE(dev));Patch still looks correct, so with or without that fixed:
Quoted 177 lines
drivers/gpu/drm/i915/intel_display.c +2
-127ok =ironlake_compute_clocks (crtc, adjusted_mode, &clock, &has_reduced_clock, &reduced_clock);if (!ok) {@@ -5464,20 +5461,13 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc,int pipe = intel_crtc->pipe;int plane = intel_crtc->plane;int num_connectors =0 ; -intel_clock_t clock, reduced_clock; -u32 dpll =0 , fp =0 , fp2 =0 ; -bool ok, has_reduced_clock = false; -bool is_lvds = false, is_dp = false, is_cpu_edp = false; +bool is_dp = false, is_cpu_edp = false;struct intel_encoder *encoder; -u32 temp;int ret;bool dither;for_each_encoder_on_crtc (dev, crtc, encoder) {switch (encoder->type) { -case INTEL_OUTPUT_LVDS : - is_lvds = true; -break ;case INTEL_OUTPUT_DISPLAYPORT : is_dp = true;break ;@@ -5511,143 +5501,26 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc,if (!intel_ddi_pll_mode_set (crtc, adjusted_mode->clock))return -EINVAL ; -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) { - ok =ironlake_compute_clocks (crtc, adjusted_mode, &clock, - &has_reduced_clock, - &reduced_clock); -if (!ok) { -DRM_ERROR ("Couldn't find PLL settings for mode!\n" ); -return -EINVAL ; - } - } -/* Ensure that the cursor is valid for the new mode before changing... */ intel_crtc_update_cursor (crtc, true);/* determine panel color depth */ dither =intel_choose_pipe_bpp_dither (crtc, fb, &intel_crtc->bpp, adjusted_mode); -if (is_lvds && dev_priv->lvds_dither) - dither = true;DRM_DEBUG_KMS ("Mode for pipe %d:\n" , pipe);drm_mode_debug_printmodeline (mode); -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) { - fp = clock.n <<16 | clock.m1 <<8 | clock.m2; -if (has_reduced_clock) - fp2 = reduced_clock.n <<16 | reduced_clock.m1 <<8 | - reduced_clock.m2; - - dpll =ironlake_compute_dpll (intel_crtc, adjusted_mode, &clock, - fp); - -/* CPU eDP is the only output that doesn't need a PCH PLL of its -* own on pre-Haswell/LPT generation */ -if (!is_cpu_edp) { -struct intel_pch_pll *pll; - - pll =intel_get_pch_pll (intel_crtc, dpll, fp); -if (pll ==NULL ) { -DRM_DEBUG_DRIVER ("failed to find PLL for pipe %d\n" , - pipe); -return -EINVAL ; - } - }else -intel_put_pch_pll (intel_crtc); - -/* The LVDS pin pair needs to be on before the DPLLs are -* enabled. This is an exception to the general rule that -* mode_set doesn't turn things on. -*/ -if (is_lvds) { - temp =I915_READ (PCH_LVDS ); - temp |=LVDS_PORT_EN |LVDS_A0A2_CLKA_POWER_UP ; -if (HAS_PCH_CPT (dev)) { - temp &= ~PORT_TRANS_SEL_MASK ; - temp |=PORT_TRANS_SEL_CPT (pipe); - }else { -if (pipe ==1 ) - temp |=LVDS_PIPEB_SELECT ; -else - temp &= ~LVDS_PIPEB_SELECT ; - } - -/* set the corresponsding LVDS_BORDER bit */ - temp |= dev_priv->lvds_border_bits; -/* Set the B0-B3 data pairs corresponding to whether -* we're going to set the DPLLs for dual-channel mode or -* not. -*/ -if (clock.p2 ==7 ) - temp |=LVDS_B0B3_POWER_UP |LVDS_CLKB_POWER_UP ; -else - temp &= ~(LVDS_B0B3_POWER_UP | -LVDS_CLKB_POWER_UP ); - -/* It would be nice to set 24 vs 18-bit mode -* (LVDS_A3_POWER_UP) appropriately here, but we need to -* look more thoroughly into how panels behave in the -* two modes. -*/ - temp &= ~(LVDS_HSYNC_POLARITY |LVDS_VSYNC_POLARITY ); -if (adjusted_mode->flags &DRM_MODE_FLAG_NHSYNC ) - temp |=LVDS_HSYNC_POLARITY ; -if (adjusted_mode->flags &DRM_MODE_FLAG_NVSYNC ) - temp |=LVDS_VSYNC_POLARITY ; -I915_WRITE (PCH_LVDS , temp); - } - } - -if (is_dp && !is_cpu_edp) { +if (is_dp && !is_cpu_edp)intel_dp_set_m_n (crtc, mode, adjusted_mode); - }else { -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) { -/* For non-DP output, clear any trans DP clock recovery -* setting.*/ -I915_WRITE (TRANSDATA_M1 (pipe),0 ); -I915_WRITE (TRANSDATA_N1 (pipe),0 ); -I915_WRITE (TRANSDPLINK_M1 (pipe),0 ); -I915_WRITE (TRANSDPLINK_N1 (pipe),0 ); - } - } intel_crtc->lowfreq_avail = false; -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) { -if (intel_crtc->pch_pll) { -I915_WRITE (intel_crtc->pch_pll->pll_reg, dpll); - -/* Wait for the clocks to stabilize. */ -POSTING_READ (intel_crtc->pch_pll->pll_reg); -udelay (150 ); - -/* The pixel multiplier can only be updated once the -* DPLL is enabled and the clocks are stable. -* -* So write it again. -*/ -I915_WRITE (intel_crtc->pch_pll->pll_reg, dpll); - } - -if (intel_crtc->pch_pll) { -if (is_lvds && has_reduced_clock && i915_powersave) { -I915_WRITE (intel_crtc->pch_pll->fp1_reg, fp2); - intel_crtc->lowfreq_avail = true; - }else { -I915_WRITE (intel_crtc->pch_pll->fp1_reg, fp); - } - } - }intel_set_pipe_timings (intel_crtc, mode, adjusted_mode);if (!is_dp || is_cpu_edp)ironlake_set_m_n (crtc, mode, adjusted_mode); -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) -if (is_cpu_edp) -ironlake_set_pll_edp (crtc, adjusted_mode->clock); -haswell_set_pipeconf (crtc, adjusted_mode, dither);/* Set up the display plane register */ --1.7.11.7
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Paulo Zanoni
Quoted 33 lines · Paulo Zanoni
Hi
2012/11/29 Daniel Vetter <[email protected]>:
Quoted 20 lines
Especially getting rid of all things lvds is ... great!
v2: Drop the two additional pre-hsw hunks noticed by Paulo Zanoni.
v3:
- handle DP ports correctly (spoted by Paulo)
- don't leave {} behind for a single-line block (again spotted by Paulo)
- kill another if (IBX || CPT) blockSigned-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 131 +---------------------------------- 1 file changed, 2 insertions(+), 129 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-0drivers/gpu/drm/i915/intel_display.c static int ironlake_crtc_mode_set(struct drm_crtc *crtc, · line 5348
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +0
-3@@ -5343,9 +5343,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, num_connectors++; } -WARN (!(HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)), -"Unexpected PCH type %d\n" ,INTEL_PCH_TYPE (dev)); -This is patching
ironlake_crtc_mode_set, instead ofhaswell_crtc_mode_set, which still includes the following lines:
Quoted 3 lines
/* We are not sure yet this won't happen. */
WARN(!HAS_PCH_LPT(dev), "Unexpected PCH type %d\n",
INTEL_PCH_TYPE(dev));Hm, can I blame git rebase on this one? Probably not ;-) I'll fix this when applying, and we really need to split this stuff up a bit - the current code is way too confuse, with too many lookalikes all around.
Thanks for catching this.
-Daniel
Quoted 187 lines
Patch still looks correct, so with or without that fixed:
Reviewed-by Paulo Zanoni <[email protected]>Quoted 177 lines
drivers/gpu/drm/i915/intel_display.c +2
-127ok =ironlake_compute_clocks (crtc, adjusted_mode, &clock, &has_reduced_clock, &reduced_clock);if (!ok) {@@ -5464,20 +5461,13 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc,int pipe = intel_crtc->pipe;int plane = intel_crtc->plane;int num_connectors =0 ; -intel_clock_t clock, reduced_clock; -u32 dpll =0 , fp =0 , fp2 =0 ; -bool ok, has_reduced_clock = false; -bool is_lvds = false, is_dp = false, is_cpu_edp = false; +bool is_dp = false, is_cpu_edp = false;struct intel_encoder *encoder; -u32 temp;int ret;bool dither;for_each_encoder_on_crtc (dev, crtc, encoder) {switch (encoder->type) { -case INTEL_OUTPUT_LVDS : - is_lvds = true; -break ;case INTEL_OUTPUT_DISPLAYPORT : is_dp = true;break ;@@ -5511,143 +5501,26 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc,if (!intel_ddi_pll_mode_set (crtc, adjusted_mode->clock))return -EINVAL ; -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) { - ok =ironlake_compute_clocks (crtc, adjusted_mode, &clock, - &has_reduced_clock, - &reduced_clock); -if (!ok) { -DRM_ERROR ("Couldn't find PLL settings for mode!\n" ); -return -EINVAL ; - } - } -/* Ensure that the cursor is valid for the new mode before changing... */ intel_crtc_update_cursor (crtc, true);/* determine panel color depth */ dither =intel_choose_pipe_bpp_dither (crtc, fb, &intel_crtc->bpp, adjusted_mode); -if (is_lvds && dev_priv->lvds_dither) - dither = true;DRM_DEBUG_KMS ("Mode for pipe %d:\n" , pipe);drm_mode_debug_printmodeline (mode); -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) { - fp = clock.n <<16 | clock.m1 <<8 | clock.m2; -if (has_reduced_clock) - fp2 = reduced_clock.n <<16 | reduced_clock.m1 <<8 | - reduced_clock.m2; - - dpll =ironlake_compute_dpll (intel_crtc, adjusted_mode, &clock, - fp); - -/* CPU eDP is the only output that doesn't need a PCH PLL of its -* own on pre-Haswell/LPT generation */ -if (!is_cpu_edp) { -struct intel_pch_pll *pll; - - pll =intel_get_pch_pll (intel_crtc, dpll, fp); -if (pll ==NULL ) { -DRM_DEBUG_DRIVER ("failed to find PLL for pipe %d\n" , - pipe); -return -EINVAL ; - } - }else -intel_put_pch_pll (intel_crtc); - -/* The LVDS pin pair needs to be on before the DPLLs are -* enabled. This is an exception to the general rule that -* mode_set doesn't turn things on. -*/ -if (is_lvds) { - temp =I915_READ (PCH_LVDS ); - temp |=LVDS_PORT_EN |LVDS_A0A2_CLKA_POWER_UP ; -if (HAS_PCH_CPT (dev)) { - temp &= ~PORT_TRANS_SEL_MASK ; - temp |=PORT_TRANS_SEL_CPT (pipe); - }else { -if (pipe ==1 ) - temp |=LVDS_PIPEB_SELECT ; -else - temp &= ~LVDS_PIPEB_SELECT ; - } - -/* set the corresponsding LVDS_BORDER bit */ - temp |= dev_priv->lvds_border_bits; -/* Set the B0-B3 data pairs corresponding to whether -* we're going to set the DPLLs for dual-channel mode or -* not. -*/ -if (clock.p2 ==7 ) - temp |=LVDS_B0B3_POWER_UP |LVDS_CLKB_POWER_UP ; -else - temp &= ~(LVDS_B0B3_POWER_UP | -LVDS_CLKB_POWER_UP ); - -/* It would be nice to set 24 vs 18-bit mode -* (LVDS_A3_POWER_UP) appropriately here, but we need to -* look more thoroughly into how panels behave in the -* two modes. -*/ - temp &= ~(LVDS_HSYNC_POLARITY |LVDS_VSYNC_POLARITY ); -if (adjusted_mode->flags &DRM_MODE_FLAG_NHSYNC ) - temp |=LVDS_HSYNC_POLARITY ; -if (adjusted_mode->flags &DRM_MODE_FLAG_NVSYNC ) - temp |=LVDS_VSYNC_POLARITY ; -I915_WRITE (PCH_LVDS , temp); - } - } - -if (is_dp && !is_cpu_edp) { +if (is_dp && !is_cpu_edp)intel_dp_set_m_n (crtc, mode, adjusted_mode); - }else { -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) { -/* For non-DP output, clear any trans DP clock recovery -* setting.*/ -I915_WRITE (TRANSDATA_M1 (pipe),0 ); -I915_WRITE (TRANSDATA_N1 (pipe),0 ); -I915_WRITE (TRANSDPLINK_M1 (pipe),0 ); -I915_WRITE (TRANSDPLINK_N1 (pipe),0 ); - } - } intel_crtc->lowfreq_avail = false; -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) { -if (intel_crtc->pch_pll) { -I915_WRITE (intel_crtc->pch_pll->pll_reg, dpll); - -/* Wait for the clocks to stabilize. */ -POSTING_READ (intel_crtc->pch_pll->pll_reg); -udelay (150 ); - -/* The pixel multiplier can only be updated once the -* DPLL is enabled and the clocks are stable. -* -* So write it again. -*/ -I915_WRITE (intel_crtc->pch_pll->pll_reg, dpll); - } - -if (intel_crtc->pch_pll) { -if (is_lvds && has_reduced_clock && i915_powersave) { -I915_WRITE (intel_crtc->pch_pll->fp1_reg, fp2); - intel_crtc->lowfreq_avail = true; - }else { -I915_WRITE (intel_crtc->pch_pll->fp1_reg, fp); - } - } - }intel_set_pipe_timings (intel_crtc, mode, adjusted_mode);if (!is_dp || is_cpu_edp)ironlake_set_m_n (crtc, mode, adjusted_mode); -if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)) -if (is_cpu_edp) -ironlake_set_pll_edp (crtc, adjusted_mode->clock); -haswell_set_pipeconf (crtc, adjusted_mode, dither);/* Set up the display plane register */ --1.7.11.7
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 1 line
Paulo Zanoni
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 38 lines · Daniel Vetter
Quoted 33 lines · Paulo Zanoni
Hi
2012/11/29 Daniel Vetter <[email protected]>:
Quoted 20 lines
Especially getting rid of all things lvds is ... great!
v2: Drop the two additional pre-hsw hunks noticed by Paulo Zanoni.
v3:
- handle DP ports correctly (spoted by Paulo)
- don't leave {} behind for a single-line block (again spotted by Paulo)
- kill another if (IBX || CPT) blockSigned-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 131 +---------------------------------- 1 file changed, 2 insertions(+), 129 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-0drivers/gpu/drm/i915/intel_display.c static int ironlake_crtc_mode_set(struct drm_crtc *crtc, · line 5348
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +0
-3@@ -5343,9 +5343,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, num_connectors++; } -WARN (!(HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev)), -"Unexpected PCH type %d\n" ,INTEL_PCH_TYPE (dev)); -This is patching
ironlake_crtc_mode_set, instead ofhaswell_crtc_mode_set, which still includes the following lines:Quoted 3 lines
/* We are not sure yet this won't happen. */ WARN(!HAS_PCH_LPT(dev), "Unexpected PCH type %d\n", INTEL_PCH_TYPE(dev));
Quoted 5 lines
Hm, can I blame git rebase on this one? Probably not ;-) I'll fix this when applying, and we really need to split this stuff up a bit - the current code is way too confuse, with too many lookalikes all around.
Thanks for catching this.
Actually I've just left this bit of code in there and deleted this hunk from the patch - a bit of paranoid WARN to check that the respective mode_set functions are only called on the right cpu/pch combinations can't hurt.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch