Haswell eDP enablement patches 1-8 v2
Subsystems (2)
cover Haswell eDP enablement patches 1-8 v2
From: Paulo Zanoni <[email protected]>
Hi
So here is a new version of the first 8 patches with changes based on the comments.
Biggest diff is:
- Renamed pipe_to_cpu_transcoder to intel_pipe_to_cpu_transcoder (this triggered the rewrite of most subsequent patches)
- Followed Daniel's suggestion to convert from pipe to cpu_transcoder only the code that we actually run on Haswell.
- Daniel suggested to not convert some of the code that touches FDI and the PCH transcoder but I did not remove these chunks since we're currently running this code on Haswell even when not using VGA, so if we don't convert the code to cpu_transcoder we might start poking the wrong pipes and messing a lot of things. I really don't think we should delay Haswell enablement even more based on cleanups we did not even write yet. I've been maintaining these Haswell patches for a long time, I'd love to get rid of them. When we do the VGA cleanups we will be able to fix what we need to fix.
Patches 9-14 should still apply cleanly.
Please help reviewing. We'll still have more patches after the eDP series...
Thanks,
Paulo
Paulo Zanoni (8):
drm/i915: add TRANSCODER_EDP
drm/i915: convert PIPE_CLK_SEL to transcoder drm/i915: convert DDI_FUNC_CTL to transcoder drm/i915: check TRANSCODER_EDP on intel_modeset_setup_hw_state drm/i915: convert PIPECONF to use transcoder instead of pipe drm/i915: convert PIPE_MSA_MISC to transcoder drm/i915: convert CPU M/N timings to transcoder drm/i915: convert pipe timing definitions to transcoder
drivers/gpu/drm/i915/i915_drv.h | 8 ++ drivers/gpu/drm/i915/i915_irq.c | 13 ++- drivers/gpu/drm/i915/i915_reg.h | 127 +++++++++++++------------- drivers/gpu/drm/i915/intel_ddi.c | 129 +++++++++++++++++---------- drivers/gpu/drm/i915/intel_display.c | 167 ++++++++++++++++++++++++----------- drivers/gpu/drm/i915/intel_dp.c | 10 ++- drivers/gpu/drm/i915/intel_drv.h | 8 +- drivers/gpu/drm/i915/intel_sprite.c | 4 +- 8 files changed, 296 insertions(+), 170 deletions(-)
Signature · 1 line
1.7.11.4
PATCH 1/8 drm/i915: add TRANSCODER_EDP
From: Paulo Zanoni <[email protected]>
Before Haswell we used to have the CPU pipes and the PCH transcoders. We had the same amount of pipes and transcoders, and there was a 1:1 mapping between them. After Haswell what we used to call CPU pipe was split into CPU pipe and CPU transcoder. So now we have 3 CPU pipes (A, B and C), 4 CPU transcoders (A, B, C and EDP) and 1 PCH transcoder (only used for VGA).
For all the outputs except for EDP we have an 1:1 mapping on the CPU pipes and CPU transcoders, so if you're using CPU pipe A you have to use CPU transcoder A. When have an eDP ouput you have to use transcoder EDP and you can attach this CPU transcoder to any of the 3 CPU pipes. When using VGA you need to select a pair of matching CPU pipes/transcoders (A/A, B/B, C/C) and you also need to enable/use the PCH transcoder.
For now we're just creating the cpu_transcoder definitions and setting cpu_transcoder to TRANSCODER_EDP on DDI eDP code, but none of the registers was ported to use transcoder instead of pipe. The goal is to keep the code backwards-compatible since on all cases except when using eDP we must have pipe == cpu_transcoder.
--- drivers/gpu/drm/i915/i915_drv.h | 8 ++++++++ drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 4 ++++ 4 files changed, 31 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +8 -0
@@ -58,6 +58,14 @@ enum pipe { };#define pipe_name (p) ((p) + 'A') +enum transcoder { +TRANSCODER_A =0 , +TRANSCODER_B , +TRANSCODER_C , +TRANSCODER_EDP =0xF , +}; +#define transcoder_name (t) ((t) + 'A') +enum plane {PLANE_A =0 ,PLANE_B ,
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -26,6 +26,7 @@#define _I915_REG_H_#define _PIPE (pipe, a, b) ((a) + (pipe)*((b)-(a))) +#define _TRANSCODER (tran, a, b) ((a) + (tran)*((b)-(a)))#define _PORT (port, a, b) ((a) + (port)*((b)-(a)))
drivers/gpu/drm/i915/intel_display.c +18 -0
@@ -927,6 +927,15 @@ intel_vlv_find_best_pll(const intel_limit_t *limit, struct drm_crtc *crtc,return true; } +enum transcoder intel_pipe_to_cpu_transcoder (struct drm_i915_private *dev_priv, +enum pipe pipe) +{ +struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +return intel_crtc->cpu_transcoder; +} +static void ironlake_wait_for_vblank (struct drm_device *dev,int pipe) {struct drm_i915_private *dev_priv = dev->dev_private;
@@ -3336,6 +3345,9 @@ static void ironlake_crtc_off(struct drm_crtc *crtc)static void haswell_crtc_off (struct drm_crtc *crtc) { +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + + intel_crtc->cpu_transcoder = intel_crtc->pipe;intel_ddi_put_crtc_pll (crtc); }
@@ -5212,6 +5224,11 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc, num_connectors++; } +if (is_cpu_edp) + intel_crtc->cpu_transcoder =TRANSCODER_EDP ; +else + intel_crtc->cpu_transcoder = pipe; +/* We are not sure yet this won't happen. */ WARN (!HAS_PCH_LPT (dev),"Unexpected PCH type %d\n" ,INTEL_PCH_TYPE (dev));
@@ -7770,6 +7787,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)/* Swap pipes & planes for FBC on pre-965 */ intel_crtc->pipe = pipe; intel_crtc->plane = pipe; + intel_crtc->cpu_transcoder = pipe;if (IS_MOBILE (dev) &&IS_GEN3 (dev)) {DRM_DEBUG_KMS ("swapping pipes & planes for FBC\n" ); intel_crtc->plane = !pipe;
drivers/gpu/drm/i915/intel_drv.h +4 -0
@@ -185,6 +185,7 @@ struct intel_crtc {struct drm_crtc base;enum pipe pipe;enum plane plane; +enum transcoder cpu_transcoder;u8 lut_r[256 ], lut_g[256 ], lut_b[256 ];/* * Whether the crtc and the connected output pipeline is active. Implies
@@ -491,6 +492,9 @@ extern struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev, struct drm_crtc *crtc);int intel_get_pipe_from_crtc_id (struct drm_device *dev,void *data,struct drm_file *file_priv); +extern enum transcoder +intel_pipe_to_cpu_transcoder (struct drm_i915_private *dev_priv, +enum pipe pipe);extern void intel_wait_for_vblank (struct drm_device *dev,int pipe);extern void intel_wait_for_pipe_off (struct drm_device *dev,int pipe);
Signature · 1 line
1.7.11.4
PATCH 2/8 drm/i915: convert PIPE_CLK_SEL to transcoder
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
This register appeared in Haswell. It does not have an EDP version because the EDP transcoder is always tied to the DDIA clock. Notice that if we call PIPE_CLK_SEL(pipe) when pipe is PIPE_A and transcoder is TRANSCODER_EDP we might introduce a bug, that's why this is a transcoder register even though it does not have an EDP version.
Even though Haswell names this register PIPE_CLK_SEL, it will be renamed to TRANS_CLK_SEL in the future, so let's just start using the real name that makes more sense and avoids misusage.
--- drivers/gpu/drm/i915/i915_reg.h | 14 +++++++------- drivers/gpu/drm/i915/intel_ddi.c | 10 ++++++++-- 2 files changed, 15 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +7 -7
@@ -4531,13 +4531,13 @@#define PORT_CLK_SEL_WRPLL2 (5<<29)#define PORT_CLK_SEL_NONE (7<<29) -/* Pipe clock selection */ -#define PIPE_CLK_SEL_A 0x46140 -#define PIPE_CLK_SEL_B 0x46144 -#define PIPE_CLK_SEL (pipe) _PIPE(pipe, PIPE_CLK_SEL_A, PIPE_CLK_SEL_B) -/* For each pipe, we need to select the corresponding port clock */ -#define PIPE_CLK_SEL_DISABLED (0x0<<29) -#define PIPE_CLK_SEL_PORT (x) ((x+1)<<29) +/* Transcoder clock selection */ +#define TRANS_CLK_SEL_A 0x46140 +#define TRANS_CLK_SEL_B 0x46144 +#define TRANS_CLK_SEL (tran) _TRANSCODER(tran, TRANS_CLK_SEL_A, TRANS_CLK_SEL_B) +/* For each transcoder, we need to select the corresponding port clock */ +#define TRANS_CLK_SEL_DISABLED (0x0<<29) +#define TRANS_CLK_SEL_PORT (x) ((x+1)<<29)#define _PIPEA_MSA_MISC 0x60410#define _PIPEB_MSA_MISC 0x61410
drivers/gpu/drm/i915/intel_ddi.c +8 -2
@@ -1095,15 +1095,21 @@ void intel_ddi_enable_pipe_clock(struct intel_crtc *intel_crtc)struct drm_i915_private *dev_priv = crtc->dev->dev_private;struct intel_encoder *intel_encoder =intel_ddi_get_crtc_encoder (crtc);enum port port =intel_ddi_get_encoder_port (intel_encoder); +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder; -I915_WRITE (PIPE_CLK_SEL (intel_crtc->pipe),PIPE_CLK_SEL_PORT (port)); +if (cpu_transcoder !=TRANSCODER_EDP ) +I915_WRITE (TRANS_CLK_SEL (cpu_transcoder), +TRANS_CLK_SEL_PORT (port)); }void intel_ddi_disable_pipe_clock (struct intel_crtc *intel_crtc) {struct drm_i915_private *dev_priv = intel_crtc->base.dev->dev_private; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder; -I915_WRITE (PIPE_CLK_SEL (intel_crtc->pipe),PIPE_CLK_SEL_DISABLED ); +if (cpu_transcoder !=TRANSCODER_EDP ) +I915_WRITE (TRANS_CLK_SEL (cpu_transcoder), +TRANS_CLK_SEL_DISABLED ); }void intel_ddi_pre_enable (struct intel_encoder *intel_encoder)
Signature · 1 line
1.7.11.4
PATCH 3/8 drm/i915: convert DDI_FUNC_CTL to transcoder
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Because there's one instance of the register per CPU transcoder and not per CPU pipe. This is another register that appeared for the first time on Haswell, and even though its Haswell name is PIPE_DDI_FUNC_CTL, it will be renamed to TRANS_DDI_FUNC_CTL, so let's just use the new naming scheme before it confuses more people.
Notice that there's a big improvement on intel_ddi_get_hw_state due to the new TRANSCODER_EDP.
--- drivers/gpu/drm/i915/i915_reg.h | 59 ++++++++++---------- drivers/gpu/drm/i915/intel_ddi.c | 101 ++++++++++++++++++++++------------- drivers/gpu/drm/i915/intel_display.c | 9 ++-- drivers/gpu/drm/i915/intel_drv.h | 4 +- 4 files changed, 104 insertions(+), 69 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +32 -27
@@ -4387,34 +4387,39 @@#define HSW_PWR_WELL_CTL6 0x45414/* Per-pipe DDI Function Control */ -#define PIPE_DDI_FUNC_CTL_A 0x60400 -#define PIPE_DDI_FUNC_CTL_B 0x61400 -#define PIPE_DDI_FUNC_CTL_C 0x62400 -#define PIPE_DDI_FUNC_CTL_EDP 0x6F400 -#define DDI_FUNC_CTL (pipe) _PIPE(pipe, PIPE_DDI_FUNC_CTL_A, \ - PIPE_DDI_FUNC_CTL_B) -#define PIPE_DDI_FUNC_ENABLE (1<<31) +#define TRANS_DDI_FUNC_CTL_A 0x60400 +#define TRANS_DDI_FUNC_CTL_B 0x61400 +#define TRANS_DDI_FUNC_CTL_C 0x62400 +#define TRANS_DDI_FUNC_CTL_EDP 0x6F400 +#define DDI_FUNC_CTL (tran) _TRANSCODER(tran, TRANS_DDI_FUNC_CTL_A, \ + TRANS_DDI_FUNC_CTL_B) +#define TRANS_DDI_FUNC_ENABLE (1<<31)/* Those bits are ignored by pipe EDP since it can only connect to DDI A */ -#define PIPE_DDI_PORT_MASK (7<<28) -#define PIPE_DDI_SELECT_PORT (x) ((x)<<28) -#define PIPE_DDI_PORT_NONE (0<<28) -#define PIPE_DDI_MODE_SELECT_MASK (7<<24) -#define PIPE_DDI_MODE_SELECT_HDMI (0<<24) -#define PIPE_DDI_MODE_SELECT_DVI (1<<24) -#define PIPE_DDI_MODE_SELECT_DP_SST (2<<24) -#define PIPE_DDI_MODE_SELECT_DP_MST (3<<24) -#define PIPE_DDI_MODE_SELECT_FDI (4<<24) -#define PIPE_DDI_BPC_MASK (7<<20) -#define PIPE_DDI_BPC_8 (0<<20) -#define PIPE_DDI_BPC_10 (1<<20) -#define PIPE_DDI_BPC_6 (2<<20) -#define PIPE_DDI_BPC_12 (3<<20) -#define PIPE_DDI_PVSYNC (1<<17) -#define PIPE_DDI_PHSYNC (1<<16) -#define PIPE_DDI_BFI_ENABLE (1<<4) -#define PIPE_DDI_PORT_WIDTH_X1 (0<<1) -#define PIPE_DDI_PORT_WIDTH_X2 (1<<1) -#define PIPE_DDI_PORT_WIDTH_X4 (3<<1) +#define TRANS_DDI_PORT_MASK (7<<28) +#define TRANS_DDI_SELECT_PORT (x) ((x)<<28) +#define TRANS_DDI_PORT_NONE (0<<28) +#define TRANS_DDI_MODE_SELECT_MASK (7<<24) +#define TRANS_DDI_MODE_SELECT_HDMI (0<<24) +#define TRANS_DDI_MODE_SELECT_DVI (1<<24) +#define TRANS_DDI_MODE_SELECT_DP_SST (2<<24) +#define TRANS_DDI_MODE_SELECT_DP_MST (3<<24) +#define TRANS_DDI_MODE_SELECT_FDI (4<<24) +#define TRANS_DDI_BPC_MASK (7<<20) +#define TRANS_DDI_BPC_8 (0<<20) +#define TRANS_DDI_BPC_10 (1<<20) +#define TRANS_DDI_BPC_6 (2<<20) +#define TRANS_DDI_BPC_12 (3<<20) +#define TRANS_DDI_PVSYNC (1<<17) +#define TRANS_DDI_PHSYNC (1<<16) +#define TRANS_DDI_EDP_INPUT_MASK (7<<12) +#define TRANS_DDI_EDP_INPUT_A_ON (0<<12) +#define TRANS_DDI_EDP_INPUT_A_ONOFF (4<<12) +#define TRANS_DDI_EDP_INPUT_B_ONOFF (5<<12) +#define TRANS_DDI_EDP_INPUT_C_ONOFF (6<<12) +#define TRANS_DDI_BFI_ENABLE (1<<4) +#define TRANS_DDI_PORT_WIDTH_X1 (0<<1) +#define TRANS_DDI_PORT_WIDTH_X2 (1<<1) +#define TRANS_DDI_PORT_WIDTH_X4 (3<<1)/* DisplayPort Transport Control */ #define DP_TP_CTL_A 0x64040
drivers/gpu/drm/i915/intel_ddi.c +64 -37
175 lines not on this page · raw message
drivers/gpu/drm/i915/intel_display.c +6 -3
@@ -1112,12 +1112,14 @@ static void assert_fdi_tx(struct drm_i915_private *dev_priv,int reg;u32 val;bool cur_state; +enum transcoder cpu_transcoder =intel_pipe_to_cpu_transcoder (dev_priv, + pipe);if (IS_HASWELL (dev_priv->dev)) {/* On Haswell, DDI is used instead of FDI_TX_CTL */ - reg =DDI_FUNC_CTL (pipe); + reg =DDI_FUNC_CTL (cpu_transcoder); val =I915_READ (reg); - cur_state = !!(val &PIPE_DDI_FUNC_ENABLE ); + cur_state = !!(val &TRANS_DDI_FUNC_ENABLE ); }else { reg =FDI_TX_CTL (pipe); val =I915_READ (reg);
@@ -3259,6 +3261,7 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)struct intel_encoder *encoder;int pipe = intel_crtc->pipe;int plane = intel_crtc->plane; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;u32 reg, temp;
@@ -3280,7 +3283,7 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)intel_disable_pipe (dev_priv, pipe);if (IS_HASWELL (dev)) -intel_ddi_disable_pipe_func (dev_priv, pipe); +intel_ddi_disable_transcoder_func (dev_priv, cpu_transcoder);/* Disable PF */ I915_WRITE (PF_CTL (pipe),0 );
drivers/gpu/drm/i915/intel_drv.h +2 -2
@@ -596,8 +596,8 @@ extern void intel_ddi_mode_set(struct drm_encoder *encoder, struct drm_display_mode *adjusted_mode);extern void intel_ddi_pll_init (struct drm_device *dev);extern void intel_ddi_enable_pipe_func (struct drm_crtc *crtc); -extern void intel_ddi_disable_pipe_func (struct drm_i915_private *dev_priv, -enum pipe pipe); +extern void intel_ddi_disable_transcoder_func (struct drm_i915_private *dev_priv, +enum transcoder cpu_transcoder);extern void intel_ddi_enable_pipe_clock (struct intel_crtc *intel_crtc);extern void intel_ddi_disable_pipe_clock (struct intel_crtc *intel_crtc);extern void intel_ddi_setup_hw_pll_state (struct drm_device *dev);
Signature · 1 line
1.7.11.4
PATCH 4/8 drm/i915: check TRANSCODER_EDP on intel_modeset_setup_hw_state
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
We need to check if any of the pipes is using TRANSCODER_EDP.
--- drivers/gpu/drm/i915/intel_display.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/gpu/drm/i915/intel_display.c +25 -0
@@ -8552,6 +8552,31 @@ void intel_modeset_setup_hw_state(struct drm_device *dev)struct intel_encoder *encoder;struct intel_connector *connector; +if (IS_HASWELL (dev)) { + tmp =I915_READ (DDI_FUNC_CTL (TRANSCODER_EDP )); + +if (tmp &TRANS_DDI_FUNC_ENABLE ) { +switch (tmp &TRANS_DDI_EDP_INPUT_MASK ) { +case TRANS_DDI_EDP_INPUT_A_ON : +case TRANS_DDI_EDP_INPUT_A_ONOFF : + pipe =PIPE_A ; +break ; +case TRANS_DDI_EDP_INPUT_B_ONOFF : + pipe =PIPE_B ; +break ; +case TRANS_DDI_EDP_INPUT_C_ONOFF : + pipe =PIPE_C ; +break ; + } + + crtc =to_intel_crtc (dev_priv->pipe_to_crtc_mapping[pipe]); + crtc->cpu_transcoder =TRANSCODER_EDP ; + +DRM_DEBUG_KMS ("Pipe %c using transcoder EDP\n" , +pipe_name (pipe)); + } + } +for_each_pipe (pipe) { crtc =to_intel_crtc (dev_priv->pipe_to_crtc_mapping[pipe]);
Signature · 1 line
1.7.11.4
PATCH 5/8 drm/i915: convert PIPECONF to use transcoder instead of pipe
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Because the PIPECONF register is actually part of the CPU transcoder, not the CPU pipe.
Ideally we would also rename PIPECONF to TRANSCONF to remind people that they should use the transcoder instead of the pipe, but let's keep it like this for now since most Gens still name it PIPECONF.
--- drivers/gpu/drm/i915/i915_irq.c | 5 +++- drivers/gpu/drm/i915/i915_reg.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 51 ++++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_sprite.c | 4 ++- 4 files changed, 42 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +4 -1
@@ -123,7 +123,10 @@ static int i915_pipe_enabled(struct drm_device *dev, int pipe) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; -return I915_READ (PIPECONF (pipe)) &PIPECONF_ENABLE ; +enum transcoder cpu_transcoder =intel_pipe_to_cpu_transcoder (dev_priv, + pipe); + +return I915_READ (PIPECONF (cpu_transcoder)) &PIPECONF_ENABLE ; }/* Called from drm generic code, passed a 'crtc', which
drivers/gpu/drm/i915/i915_reg.h +1 -1
@@ -2714,7 +2714,7 @@#define PIPE_12BPC (3 << 5)#define PIPESRC (pipe) _PIPE(pipe, _PIPEASRC, _PIPEBSRC) -#define PIPECONF (pipe) _PIPE(pipe, _PIPEACONF, _PIPEBCONF) +#define PIPECONF (tran) _TRANSCODER(tran, _PIPEACONF, _PIPEBCONF)#define PIPEDSL (pipe) _PIPE(pipe, _PIPEADSL, _PIPEBDSL)#define PIPEFRAME (pipe) _PIPE(pipe, _PIPEAFRAMEHIGH, _PIPEBFRAMEHIGH)#define PIPEFRAMEPIXEL (pipe) _PIPE(pipe, _PIPEAFRAMEPIXEL, _PIPEBFRAMEPIXEL)
drivers/gpu/drm/i915/intel_display.c +34 -17
198 lines not on this page · raw message
drivers/gpu/drm/i915/intel_sprite.c +3 -1
@@ -422,6 +422,8 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,struct intel_framebuffer *intel_fb;struct drm_i915_gem_object *obj, *old_obj;int pipe = intel_plane->pipe; +enum transcoder cpu_transcoder =intel_pipe_to_cpu_transcoder (dev_priv, + pipe);int ret =0 ;int x = src_x >>16 , y = src_y >>16 ;int primary_w = crtc->mode.hdisplay, primary_h = crtc->mode.vdisplay;
@@ -436,7 +438,7 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, src_h = src_h >>16 ;/* Pipe must be running... */ -if (!(I915_READ (PIPECONF (pipe)) &PIPECONF_ENABLE )) +if (!(I915_READ (PIPECONF (cpu_transcoder)) &PIPECONF_ENABLE ))return -EINVAL ;if (crtc_x >= primary_w || crtc_y >= primary_h)
Signature · 1 line
1.7.11.4
PATCH 6/8 drm/i915: convert PIPE_MSA_MISC to transcoder
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Same as the other registers. This one also appeared on Haswell for the first time, so that's why we are renaming it.
--- drivers/gpu/drm/i915/i915_reg.h | 19 ++++++++++--------- drivers/gpu/drm/i915/intel_ddi.c | 18 +++++++++--------- 2 files changed, 19 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +10 -9
@@ -4544,15 +4544,16 @@#define TRANS_CLK_SEL_DISABLED (0x0<<29)#define TRANS_CLK_SEL_PORT (x) ((x+1)<<29) -#define _PIPEA_MSA_MISC 0x60410 -#define _PIPEB_MSA_MISC 0x61410 -#define PIPE_MSA_MISC (pipe) _PIPE(pipe, _PIPEA_MSA_MISC, _PIPEB_MSA_MISC) -#define PIPE_MSA_SYNC_CLK (1<<0) -#define PIPE_MSA_6_BPC (0<<5) -#define PIPE_MSA_8_BPC (1<<5) -#define PIPE_MSA_10_BPC (2<<5) -#define PIPE_MSA_12_BPC (3<<5) -#define PIPE_MSA_16_BPC (4<<5) +#define _TRANSA_MSA_MISC 0x60410 +#define _TRANSB_MSA_MISC 0x61410 +#define TRANS_MSA_MISC (tran) _TRANSCODER(tran, _TRANSA_MSA_MISC, \ + _TRANSB_MSA_MISC) +#define TRANS_MSA_SYNC_CLK (1<<0) +#define TRANS_MSA_6_BPC (0<<5) +#define TRANS_MSA_8_BPC (1<<5) +#define TRANS_MSA_10_BPC (2<<5) +#define TRANS_MSA_12_BPC (3<<5) +#define TRANS_MSA_16_BPC (4<<5)/* LCPLL Control */ #define LCPLL_CTL 0x130040
drivers/gpu/drm/i915/intel_ddi.c +9 -9
@@ -888,32 +888,32 @@ void intel_ddi_set_pipe_settings(struct drm_crtc *crtc)struct drm_i915_private *dev_priv = crtc->dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct intel_encoder *intel_encoder =intel_ddi_get_crtc_encoder (crtc); -enum pipe pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;int type = intel_encoder->type;uint32_t temp;if (type ==INTEL_OUTPUT_DISPLAYPORT || type ==INTEL_OUTPUT_EDP ) { - temp =PIPE_MSA_SYNC_CLK ; + temp =TRANS_MSA_SYNC_CLK ;switch (intel_crtc->bpp) {case 18 : - temp |=PIPE_MSA_6_BPC ; + temp |=TRANS_MSA_6_BPC ;break ;case 24 : - temp |=PIPE_MSA_8_BPC ; + temp |=TRANS_MSA_8_BPC ;break ;case 30 : - temp |=PIPE_MSA_10_BPC ; + temp |=TRANS_MSA_10_BPC ;break ;case 36 : - temp |=PIPE_MSA_12_BPC ; + temp |=TRANS_MSA_12_BPC ;break ;default : - temp |=PIPE_MSA_8_BPC ; -WARN (1 ,"%d bpp unsupported by pipe DDI function\n" , + temp |=TRANS_MSA_8_BPC ; +WARN (1 ,"%d bpp unsupported by DDI function\n" , intel_crtc->bpp); } -I915_WRITE (PIPE_MSA_MISC (pipe), temp); +I915_WRITE (TRANS_MSA_MISC (cpu_transcoder), temp); } }
Signature · 1 line
1.7.11.4
PATCH 7/8 drm/i915: convert CPU M/N timings to transcoder
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Same thing as the previous commits. Not renaming this one since it exists since way before Haswell.
--- drivers/gpu/drm/i915/i915_reg.h | 16 ++++++++-------- drivers/gpu/drm/i915/intel_display.c | 12 ++++++------ drivers/gpu/drm/i915/intel_dp.c | 10 ++++++---- 3 files changed, 20 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +8 -8
@@ -3298,14 +3298,14 @@#define _PIPEB_LINK_M2 0x61048#define _PIPEB_LINK_N2 0x6104c -#define PIPE_DATA_M1 (pipe) _PIPE(pipe, _PIPEA_DATA_M1, _PIPEB_DATA_M1) -#define PIPE_DATA_N1 (pipe) _PIPE(pipe, _PIPEA_DATA_N1, _PIPEB_DATA_N1) -#define PIPE_DATA_M2 (pipe) _PIPE(pipe, _PIPEA_DATA_M2, _PIPEB_DATA_M2) -#define PIPE_DATA_N2 (pipe) _PIPE(pipe, _PIPEA_DATA_N2, _PIPEB_DATA_N2) -#define PIPE_LINK_M1 (pipe) _PIPE(pipe, _PIPEA_LINK_M1, _PIPEB_LINK_M1) -#define PIPE_LINK_N1 (pipe) _PIPE(pipe, _PIPEA_LINK_N1, _PIPEB_LINK_N1) -#define PIPE_LINK_M2 (pipe) _PIPE(pipe, _PIPEA_LINK_M2, _PIPEB_LINK_M2) -#define PIPE_LINK_N2 (pipe) _PIPE(pipe, _PIPEA_LINK_N2, _PIPEB_LINK_N2) +#define PIPE_DATA_M1 (tran) _TRANSCODER(tran, _PIPEA_DATA_M1, _PIPEB_DATA_M1) +#define PIPE_DATA_N1 (tran) _TRANSCODER(tran, _PIPEA_DATA_N1, _PIPEB_DATA_N1) +#define PIPE_DATA_M2 (tran) _TRANSCODER(tran, _PIPEA_DATA_M2, _PIPEB_DATA_M2) +#define PIPE_DATA_N2 (tran) _TRANSCODER(tran, _PIPEA_DATA_N2, _PIPEB_DATA_N2) +#define PIPE_LINK_M1 (tran) _TRANSCODER(tran, _PIPEA_LINK_M1, _PIPEB_LINK_M1) +#define PIPE_LINK_N1 (tran) _TRANSCODER(tran, _PIPEA_LINK_N1, _PIPEB_LINK_N1) +#define PIPE_LINK_M2 (tran) _TRANSCODER(tran, _PIPEA_LINK_M2, _PIPEB_LINK_M2) +#define PIPE_LINK_N2 (tran) _TRANSCODER(tran, _PIPEA_LINK_N2, _PIPEB_LINK_N2)/* CPU panel fitter */ /* IVB+ has 3 fitters, 0 is 7x5 capable, the other two only 3x3 */
drivers/gpu/drm/i915/intel_display.c +6 -6
@@ -2695,7 +2695,7 @@ static void ironlake_fdi_pll_enable(struct intel_crtc *intel_crtc)/* Write the TU size bits so error detection works */ I915_WRITE (FDI_RX_TUSIZE1 (pipe), -I915_READ (PIPE_DATA_M1 (pipe)) &TU_SIZE_MASK ); +I915_READ (PIPE_DATA_M1 (cpu_transcoder)) &TU_SIZE_MASK );/* enable PCH FDI RX PLL, wait warmup plus DMI latency */ reg =FDI_RX_CTL (pipe);
@@ -4852,7 +4852,7 @@ static void ironlake_set_m_n(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); -enum pipe pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;struct intel_encoder *intel_encoder, *edp_encoder =NULL ;struct fdi_m_n m_n = {0 };int target_clock, pixel_multiplier, lane, link_bw;
@@ -4915,10 +4915,10 @@ static void ironlake_set_m_n(struct drm_crtc *crtc,ironlake_compute_m_n (intel_crtc->bpp, lane, target_clock, link_bw, &m_n); -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); +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); } static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc,
drivers/gpu/drm/i915/intel_dp.c +6 -4
@@ -791,6 +791,7 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,int lane_count =4 ;struct intel_dp_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
@@ -815,10 +816,11 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, mode->clock, adjusted_mode->clock, &m_n);if (IS_HASWELL (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); +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);
Signature · 1 line
1.7.11.4
PATCH 8/8 drm/i915: convert pipe timing definitions to transcoder
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
--- drivers/gpu/drm/i915/i915_irq.c | 8 +++--- drivers/gpu/drm/i915/i915_reg.h | 14 +++++----- drivers/gpu/drm/i915/intel_display.c | 52 +++++++++++++++++++----------------- 3 files changed, 39 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +5 -3
@@ -186,6 +186,8 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe,int vbl_start, vbl_end, htotal, vtotal;bool in_vbl = true;int ret =0 ; +enum transcoder cpu_transcoder =intel_pipe_to_cpu_transcoder (dev_priv, + pipe);if (!i915_pipe_enabled (dev, pipe)) { DRM_DEBUG_DRIVER("trying to get scanoutpos for disabled "
@@ -194,7 +196,7 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe, }/* Get vtotal. */ - vtotal =1 + ((I915_READ (VTOTAL (pipe)) >>16 ) &0x1fff ); + vtotal =1 + ((I915_READ (VTOTAL (cpu_transcoder)) >>16 ) &0x1fff );if (INTEL_INFO (dev)->gen >=4 ) {/* No obvious pixelcount register. Only query vertical
@@ -214,13 +216,13 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe,*/ position = (I915_READ (PIPEFRAMEPIXEL (pipe)) &PIPE_PIXEL_MASK ) >>PIPE_PIXEL_SHIFT ; - htotal =1 + ((I915_READ (HTOTAL (pipe)) >>16 ) &0x1fff ); + htotal =1 + ((I915_READ (HTOTAL (cpu_transcoder)) >>16 ) &0x1fff ); *vpos = position / htotal; *hpos = position - (*vpos * htotal); }/* Query vblank area. */ - vbl =I915_READ (VBLANK (pipe)); + vbl =I915_READ (VBLANK (cpu_transcoder));/* Test position against vblank region. */ vbl_start = vbl &0x1fff ;
drivers/gpu/drm/i915/i915_reg.h +7 -7
@@ -1565,14 +1565,14 @@#define _VSYNCSHIFT_B 0x61028 -#define HTOTAL (pipe) _PIPE(pipe, _HTOTAL_A, _HTOTAL_B) -#define HBLANK (pipe) _PIPE(pipe, _HBLANK_A, _HBLANK_B) -#define HSYNC (pipe) _PIPE(pipe, _HSYNC_A, _HSYNC_B) -#define VTOTAL (pipe) _PIPE(pipe, _VTOTAL_A, _VTOTAL_B) -#define VBLANK (pipe) _PIPE(pipe, _VBLANK_A, _VBLANK_B) -#define VSYNC (pipe) _PIPE(pipe, _VSYNC_A, _VSYNC_B) +#define HTOTAL (trans) _TRANSCODER(trans, _HTOTAL_A, _HTOTAL_B) +#define HBLANK (trans) _TRANSCODER(trans, _HBLANK_A, _HBLANK_B) +#define HSYNC (trans) _TRANSCODER(trans, _HSYNC_A, _HSYNC_B) +#define VTOTAL (trans) _TRANSCODER(trans, _VTOTAL_A, _VTOTAL_B) +#define VBLANK (trans) _TRANSCODER(trans, _VBLANK_A, _VBLANK_B) +#define VSYNC (trans) _TRANSCODER(trans, _VSYNC_A, _VSYNC_B)#define BCLRPAT (pipe) _PIPE(pipe, _BCLRPAT_A, _BCLRPAT_B) -#define VSYNCSHIFT (pipe) _PIPE(pipe, _VSYNCSHIFT_A, _VSYNCSHIFT_B) +#define VSYNCSHIFT (trans) _TRANSCODER(trans, _VSYNCSHIFT_A, _VSYNCSHIFT_B)/* VGA port control */ #define ADPA 0x61100
drivers/gpu/drm/i915/intel_display.c +27 -25
96 lines not on this page · raw message
Signature · 1 line
1.7.11.4
Quoted 9 lines · Paulo Zanoni
- Daniel suggested to not convert some of the code that touches FDI and the PCH transcoder but I did not remove these chunks since we're currently running this code on Haswell even when not using VGA, so if we don't convert the code to
cpu_transcoderwe might start poking the wrong pipes and messing a lot of things. I really don't think we should delay Haswell enablement even more based on cleanups we did not even write yet. I've been maintaining these Haswell patches for a long time, I'd love to get rid of them. When we do the VGA cleanups we will be able to fix what we need to fix.
Hm, where are we calling into fdi/pch code if the connector is not VGA? I've thought we've taken care of all these things by now ... -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 11 lines · Daniel Vetter
Quoted 9 lines · Paulo Zanoni
- Daniel suggested to not convert some of the code that touches FDI and the PCH transcoder but I did not remove these chunks since we're currently running this code on Haswell even when not using VGA, so if we don't convert the code to
cpu_transcoderwe might start poking the wrong pipes and messing a lot of things. I really don't think we should delay Haswell enablement even more based on cleanups we did not even write yet. I've been maintaining these Haswell patches for a long time, I'd love to get rid of them. When we do the VGA cleanups we will be able to fix what we need to fix.
Quoted 2 lines
Hm, where are we calling into fdi/pch code if the connector is not VGA? I've thought we've taken care of all these things by now ...
Ok, on irc Paulo clarified that in ironlake_crtc_disable we still call some of the fdi and (pch) transcoder functions. Now for most cases I'd simply call this a bug - we need to teach the code some smarts to check whether any of the encoders are on the pch and only disable things if that's the case.
But even without that consideration I don't think it makes sense to to the s/pipe/cpu_transcoder transformation on these functions:
- At most we should talk about a separate pch transcoder (to make the vga encoder work on cpu_pipe != PIPE_A). The current code works somewhat since there's only one pch transcoder on LPT, and by fixing VGA to pipe A we make sure we don't try to use a non-existing pch transcoder.
- We don't have an eDP transcoder on any pch device. So mapping to the transcoder enum makes even less sense.
My proposal:
- ditch the s/pipe/cpu_transcoder/ that touch the fdi/pch transcoder stuff from this patch series.
- when fixing up hsw vga support, first rename the current transcoder functions to pch_transcoder, to make clear what they're dealing with
- add a intel_crtc->pch_transcoder, which for all platforms but hsw would be the same as intel_crtc->pipe, switch all pch code over to use that
- add an encoder->is_pch_encoder field, and wrap up all the fdi/pch stuff with checks for this to avoid calling code that we should call. We probably should keep around all the asserts that check whether things are properly disabled.
- fix the pch_transcoder field on hsw to PIPE_A, since that's what we'll ever use.
Depending upon what the code looks like, we could also create haswell specific crtc_enable/disable functions and maybe even move all the fdi/pch_transcoder stuff into the a hsw specific crt encoder (since it's the only odd thing out).
Comments?
Cheers, Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch