Haswell eDP enablement
Subsystems (2)
cover Haswell eDP enablement
From: Paulo Zanoni <[email protected]>
Hi
Now that DP is merged, time for eDP :)
Most of the patches here exist because on Haswell what we used to call "CPU pipe" was split into "CPU pipe" and "CPU transcoder" (and we still have the "PCH transcoder") and now we have 3 CPU pipes (A, B and C) and 4 CPU transcoders (A, B, C and EDP). Read the description of patch 01 to understand the changes.
In addition to the CPU transcoder changes we just have a few patches to add the eDP-specific bits to the Haswell mode set sequence. I'm not reusing some code from intel_dp.c because I really want our mode set sequence to follow the spec.
After this series eDP should light up and work.
Paulo Zanoni (14):
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 drm/i915: implement workaround for VTOTAL when using TRANSCODER_EDP drm/i915: select the correct pipe when using TRANSCODER_EDP drm/i915: set the correct eDP aux channel clock divider on DDI drm/i915: set/unset the DDI eDP backlight
drm/i915: turn the eDP DDI panel on/off
drm/i915: enable DDI eDP
drivers/gpu/drm/i915/i915_drv.h | 8 ++ drivers/gpu/drm/i915/i915_irq.c | 11 ++- drivers/gpu/drm/i915/i915_reg.h | 127 +++++++++++++----------- drivers/gpu/drm/i915/intel_crt.c | 12 ++- drivers/gpu/drm/i915/intel_ddi.c | 182 ++++++++++++++++++++++++---------- drivers/gpu/drm/i915/intel_display.c | 187 ++++++++++++++++++++++++----------- drivers/gpu/drm/i915/intel_dp.c | 29 +++--- drivers/gpu/drm/i915/intel_drv.h | 18 +++- drivers/gpu/drm/i915/intel_sprite.c | 3 +- drivers/gpu/drm/i915/intel_tv.c | 4 +- 10 files changed, 379 insertions(+), 202 deletions(-)
Signature · 1 line
1.7.11.4
PATCH 1/14 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 output 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 | 3 +++ 4 files changed, 30 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 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 +3 -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,8 @@ 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 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
Re: [PATCH 01/14] drm/i915: add TRANSCODER_EDP
Quoted 68 lines · Paulo Zanoni
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 output 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_transcoderdefinitions and settingcpu_transcodertoTRANSCODER_EDPon 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.Signed-off-by Paulo Zanoni <[email protected]>--- 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 | 3 +++ 4 files changed, 30 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 +0
-0@@ -927,6 +927,15 @@ intel_vlv_find_best_pll(const intel_limit_t *limit, struct drm_crtc *crtc,return true;
drivers/gpu/drm/i915/intel_display.c intel_vlv_find_best_pll(const intel_limit_t *limit, struct drm_crtc *crtc, · line 937
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +8
-0} +enum transcoder 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; +}
We need int intel_ prefix on this to avoid polluting the global namespace. -Daniel
Quoted 62 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+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 +3
-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,8 @@ 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 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 · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 2/14 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
@@ -4539,13 +4539,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/14 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 | 100 ++++++++++++++++++++++------------- drivers/gpu/drm/i915/intel_display.c | 8 +-- drivers/gpu/drm/i915/intel_drv.h | 4 +- 4 files changed, 102 insertions(+), 69 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +32 -27
@@ -4395,34 +4395,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 +63 -37
174 lines not on this page · raw message
drivers/gpu/drm/i915/intel_display.c +5 -3
@@ -1112,12 +1112,13 @@ static void assert_fdi_tx(struct drm_i915_private *dev_priv,int reg;u32 val;bool cur_state; +enum transcoder cpu_transcoder =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 +3260,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 +3282,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
@@ -595,8 +595,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/14 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
@@ -8551,6 +8551,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
Re: [PATCH 04/14] drm/i915: check TRANSCODER_EDP on intel_modeset_setup_hw_state
Quoted 5 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
We need to check if any of the pipes is using
TRANSCODER_EDP.Signed-off-by Paulo Zanoni <[email protected]>
I wonder whether it doesn't make more sense for haswell to return the transcoder in the encoder->get_hw_state function, and then map that to the crtc with the intel_pipe_to_cpu_transcoder. That way we don't need to add a special-case for eDP.
-Daniel
Quoted 47 lines
--- drivers/gpu/drm/i915/intel_display.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)drivers/gpu/drm/i915/intel_display.c +25
-0@@ -8551,6 +8551,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 · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 04/14] drm/i915: check TRANSCODER_EDP on intel_modeset_setup_hw_state
Hi
2012/10/18 Daniel Vetter <[email protected]>:
Quoted 11 lines · Paulo Zanoni
Quoted 5 lines
From: Paulo Zanoni <[email protected]>
We need to check if any of the pipes is using
TRANSCODER_EDP.Signed-off-by Paulo Zanoni <[email protected]>I wonder whether it doesn't make more sense for haswell to return the transcoder in the
encoder->get_hw_statefunction, and then map that to the crtc with theintel_pipe_to_cpu_transcoder. That way we don't need to add a special-case for eDP.
I know we had some IRC discussions about this comment, but after this I tried to implement your suggestion. It won't work unless we completely rewrite a lot of code. For example, on intel_modeset_setup_hw_state (the function this patch changes) we need to know which transcoder is associated to the pipe before doing I915_READ(PIPECONF(pipe)) (because PIPECONF(pipe) is wrong, we need PIPECONF(cpu_transcoder), which comes later in the patch series), so we will need to discover the encoder state before discovering the pipe state, which is not what we do now. Also, having dev_priv->transcoder_to_pipe_mapping is not as clean as having pipe_to_transcoder_mapping because every pipe is always associated with a transcoder, but not every transcoder is associated to a pipe, so we'd need to keep checking for NULL on unused transcoders.
My first strategy to implement this code also tried to use "for_each_transcoder" instead of "for_each_pipe" when checking the pipe state, but it added even more complexity to the function.
I really believe my approach here is as KISS as we can get. A single special haswell case here prevents a lot of "is this cpu transcoder being used by some pipe?" checks in a lot of places.
Quoted 54 lines
-Daniel
Quoted 43 lines
--- drivers/gpu/drm/i915/intel_display.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)drivers/gpu/drm/i915/intel_display.c +25
-1@@ -8551,6 +8551,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]); --1.7.11.4
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 1 line
Paulo Zanoni
PATCH 5/14 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 | 4 ++- drivers/gpu/drm/i915/i915_reg.h | 2 +- drivers/gpu/drm/i915/intel_crt.c | 6 ++-- drivers/gpu/drm/i915/intel_display.c | 61 ++++++++++++++++++++++-------------- drivers/gpu/drm/i915/intel_sprite.c | 3 +- drivers/gpu/drm/i915/intel_tv.c | 4 +-- 6 files changed, 49 insertions(+), 31 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +3 -1
@@ -123,7 +123,9 @@ 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 =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_crt.c +4 -2
@@ -467,7 +467,9 @@ intel_crt_load_detect(struct intel_crt *crt) {struct drm_device *dev = crt->base.base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -uint32_t pipe =to_intel_crtc (crt->base.base.crtc)->pipe; +struct intel_crtc *intel_crtc =to_intel_crtc (crt->base.base.crtc); +enum pipe pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;uint32_t save_bclrpat;uint32_t save_vtotal;uint32_t vtotal, vactive;
@@ -489,7 +491,7 @@ intel_crt_load_detect(struct intel_crt *crt) vtotal_reg =VTOTAL (pipe); vblank_reg =VBLANK (pipe); vsync_reg =VSYNC (pipe); - pipeconf_reg =PIPECONF (pipe); + pipeconf_reg =PIPECONF (cpu_transcoder); pipe_dsl_reg =PIPEDSL (pipe); save_bclrpat =I915_READ (bclrpat_reg);
drivers/gpu/drm/i915/intel_display.c +37 -24
240 lines not on this page · raw message
drivers/gpu/drm/i915/intel_sprite.c +2 -1
@@ -422,6 +422,7 @@ 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 =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 +437,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)
drivers/gpu/drm/i915/intel_tv.c +2 -2
@@ -941,7 +941,7 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,const struct video_levels *video_levels;const struct color_conversion *color_conversion;bool burst_ena; -int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;if (!tv_mode)return ;/* can't happen (mode_prepare prevents this) */
@@ -1085,7 +1085,7 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, ((video_levels->black <<TV_BLACK_LEVEL_SHIFT ) | (video_levels->blank << TV_BLANK_LEVEL_SHIFT))); { -int pipeconf_reg =PIPECONF (pipe); +int pipeconf_reg =PIPECONF (cpu_transcoder);int dspcntr_reg =DSPCNTR (intel_crtc->plane);int pipeconf =I915_READ (pipeconf_reg);int dspcntr =I915_READ (dspcntr_reg);
Signature · 1 line
1.7.11.4
Re: [PATCH 05/14] drm/i915: convert PIPECONF to use transcoder instead of pipe
Quoted 10 lines · Paulo Zanoni
From: 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.
Signed-off-by Paulo Zanoni <[email protected]>
I think as a general rule it makes sense to not convert codepaths that are never run on haswell to cpu_transcoder, since that thing really doesn't exist that much on earlier platforms. Also, it makes the patch smaller ;-)
Below some comments about which hunks I think we can drop. -Daniel
Quoted 14 lines
--- drivers/gpu/drm/i915/i915_irq.c | 4 ++- drivers/gpu/drm/i915/i915_reg.h | 2 +- drivers/gpu/drm/i915/intel_crt.c | 6 ++-- drivers/gpu/drm/i915/intel_display.c | 61 ++++++++++++++++++++++-------------- drivers/gpu/drm/i915/intel_sprite.c | 3 +- drivers/gpu/drm/i915/intel_tv.c | 4 +-- 6 files changed, 49 insertions(+), 31 deletions(-)drivers/gpu/drm/i915/i915_irq.c +0
-0
drivers/gpu/drm/i915/i915_irq.c static int · line 129
Quoted 8 lines
drivers/gpu/drm/i915/i915_irq.c +3
-1@@ -123,7 +123,9 @@ 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 =pipe_to_cpu_transcoder (dev_priv, pipe); + +return I915_READ (PIPECONF (cpu_transcoder)) &PIPECONF_ENABLE ; }
Oh, how I hate our vblank code and it's insistency to deal with pipes instead of crtc numbers.
Quoted 31 lines
drivers/gpu/drm/i915/i915_irq.c +0
-0/* 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_crt.c +3
-1@@ -467,7 +467,9 @@ intel_crt_load_detect(struct intel_crt *crt) {struct drm_device *dev = crt->base.base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -uint32_t pipe =to_intel_crtc (crt->base.base.crtc)->pipe; +struct intel_crtc *intel_crtc =to_intel_crtc (crt->base.base.crtc); +enum pipe pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;uint32_t save_bclrpat;uint32_t save_vtotal;uint32_t vtotal, vactive;
drivers/gpu/drm/i915/intel_crt.c intel_crt_load_detect(struct intel_crt *crt) · line 497
Quoted 8 lines
drivers/gpu/drm/i915/intel_crt.c +1
-1@@ -489,7 +491,7 @@ intel_crt_load_detect(struct intel_crt *crt) vtotal_reg =VTOTAL (pipe); vblank_reg =VBLANK (pipe); vsync_reg =VSYNC (pipe); - pipeconf_reg =PIPECONF (pipe); + pipeconf_reg =PIPECONF (cpu_transcoder); pipe_dsl_reg =PIPEDSL (pipe); save_bclrpat =I915_READ (bclrpat_reg);
Load detect is only used by gen2/3 vga connectors and by the tv out connector, nothing else. So I think we can just leave this as-is.
Quoted 32 lines
drivers/gpu/drm/i915/intel_display.c +4
-2@@ -1008,9 +1008,10 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe)void intel_wait_for_pipe_off (struct drm_device *dev,int pipe) {struct drm_i915_private *dev_priv = dev->dev_private; +enum transcoder cpu_transcoder =pipe_to_cpu_transcoder (dev_priv, pipe);if (INTEL_INFO (dev)->gen >=4 ) { -int reg =PIPECONF (pipe); +int reg =PIPECONF (cpu_transcoder);/* Wait for the Pipe State to go off */ if (wait_for((I915_READ(reg) & I965_PIPECONF_ACTIVE) == 0,@@ -1222,12 +1223,13 @@ void assert_pipe(struct drm_i915_private *dev_priv,int reg;u32 val;bool cur_state; +enum transcoder cpu_transcoder =pipe_to_cpu_transcoder (dev_priv, pipe);/* if we need the pipe A quirk it must be always on */ if (pipe ==PIPE_A && dev_priv->quirks &QUIRK_PIPEA_FORCE ) state = true; - reg =PIPECONF (pipe); + reg =PIPECONF (cpu_transcoder); val =I915_READ (reg); cur_state = !!(val &PIPECONF_ENABLE ); WARN(cur_state != state,
drivers/gpu/drm/i915/intel_display.c static void intel_enable_transcoder(struct drm_i915_private *dev_priv, · line 1669
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +1
-0@@ -1661,6 +1663,7 @@ static void intel_enable_transcoder(struct drm_i915_private *dev_priv,int reg;u32 val, pipeconf_val;struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; +enum transcoder cpu_transcoder =pipe_to_cpu_transcoder (dev_priv, pipe);/* PCH only available on ILK+ */ BUG_ON (dev_priv->info->gen <5 );
Do we really need this on hsw for the pch vga port? Since the only pch port we have is vga, and that is currently restricted to pipe 0 I'd prefer if we fix this up once we really put the code to some use (i.e. lift the pipe == 0 restriction).
Quoted 44 lines
drivers/gpu/drm/i915/intel_display.c +5
-3@@ -1680,7 +1683,7 @@ static void intel_enable_transcoder(struct drm_i915_private *dev_priv, } reg =TRANSCONF (pipe); val =I915_READ (reg); - pipeconf_val =I915_READ (PIPECONF (pipe)); + pipeconf_val =I915_READ (PIPECONF (cpu_transcoder));if (HAS_PCH_IBX (dev_priv->dev)) {/* @@ -1745,6 +1748,7 @@ static void intel_disable_transcoder(struct drm_i915_private *dev_priv,static void intel_enable_pipe (struct drm_i915_private *dev_priv,enum pipe pipe,bool pch_port) { +enum transcoder cpu_transcoder =pipe_to_cpu_transcoder (dev_priv, pipe);int reg;u32 val;@@ -1764,7 +1768,7 @@ static void intel_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe,/* FIXME: assert CPU port conditions for SNB+ */ } - reg =PIPECONF (pipe); + reg =PIPECONF (cpu_transcoder); val =I915_READ (reg);if (val &PIPECONF_ENABLE )return ;@@ -1788,6 +1792,7 @@ static void intel_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe,static void intel_disable_pipe (struct drm_i915_private *dev_priv,enum pipe pipe) { +enum transcoder cpu_transcoder =pipe_to_cpu_transcoder (dev_priv, pipe);int reg;u32 val;@@ -1801,7 +1806,7 @@ static void intel_disable_pipe(struct drm_i915_private *dev_priv,if (pipe ==PIPE_A && (dev_priv->quirks &QUIRK_PIPEA_FORCE ))return ; - reg =PIPECONF (pipe); + reg =PIPECONF (cpu_transcoder); val =I915_READ (reg);if ((val &PIPECONF_ENABLE ) ==0 )return ;
drivers/gpu/drm/i915/intel_display.c static void ironlake_fdi_pll_enable(struct intel_crtc *intel_crtc) · line 2688
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0@@ -2679,6 +2684,7 @@ static void ironlake_fdi_pll_enable(struct intel_crtc *intel_crtc)struct drm_device *dev = intel_crtc->base.dev;struct drm_i915_private *dev_priv = dev->dev_private;int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;u32 reg, temp;
Dito for all the fdi stuff here, I think that's better done when we enable/fix-up VGA.
Quoted 64 lines
drivers/gpu/drm/i915/intel_display.c +8
-4/* Write the TU size bits so error detection works */ @@ -2690,7 +2696,7 @@ static void ironlake_fdi_pll_enable(struct intel_crtc *intel_crtc) temp =I915_READ (reg); temp &= ~((0x7 <<19 ) | (0x7 <<16 )); temp |= (intel_crtc->fdi_lanes -1 ) <<19 ; - temp |= (I915_READ (PIPECONF (pipe)) &PIPE_BPC_MASK ) <<11 ; + temp |= (I915_READ (PIPECONF (cpu_transcoder)) &PIPE_BPC_MASK ) <<11 ;I915_WRITE (reg, temp |FDI_RX_PLL_ENABLE );POSTING_READ (reg);@@ -2764,6 +2770,7 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc)struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;u32 reg, temp;/* disable CPU FDI tx and PCH FDI rx */ @@ -2775,7 +2782,7 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc) reg =FDI_RX_CTL (pipe); temp =I915_READ (reg); temp &= ~(0x7 <<16 ); - temp |= (I915_READ (PIPECONF (pipe)) &PIPE_BPC_MASK ) <<11 ; + temp |= (I915_READ (PIPECONF (cpu_transcoder)) &PIPE_BPC_MASK ) <<11 ;I915_WRITE (reg, temp & ~FDI_RX_ENABLE );POSTING_READ (reg);@@ -2809,7 +2816,7 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc) }/* BPC in FDI rx is consistent with that in PIPECONF */ temp &= ~(0x07 <<16 ); - temp |= (I915_READ (PIPECONF (pipe)) &PIPE_BPC_MASK ) <<11 ; + temp |= (I915_READ (PIPECONF (cpu_transcoder)) &PIPE_BPC_MASK ) <<11 ;I915_WRITE (reg, temp);POSTING_READ (reg);@@ -2971,6 +2978,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;u32 reg, temp;assert_transcoder_disabled (dev_priv, pipe);@@ -3027,7 +3035,8 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)if (HAS_PCH_CPT (dev) && (intel_pipe_has_type (crtc,INTEL_OUTPUT_DISPLAYPORT ) ||intel_pipe_has_type (crtc,INTEL_OUTPUT_EDP ))) { -u32 bpc = (I915_READ (PIPECONF (pipe)) &PIPE_BPC_MASK ) >>5 ; +u32 bpc = (I915_READ (PIPECONF (cpu_transcoder)) & +PIPE_BPC_MASK ) >>5 ; reg =TRANS_DP_CTL (pipe); temp =I915_READ (reg); temp &= ~(TRANS_DP_PORT_SEL_MASK |@@ -4383,6 +4392,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_crtc->pipe;int plane = intel_crtc->plane; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;int refclk, num_connectors =0 ;intel_clock_t clock, reduced_clock;u32 dspcntr, pipeconf;
drivers/gpu/drm/i915/intel_display.c static int i9xx_crtc_mode_set(struct drm_crtc *crtc, · line 4473
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -4463,7 +4473,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, num_connectors);
i9xx stuff, I think pipeconf is totally ok for these ;-)
Quoted 19 lines
drivers/gpu/drm/i915/intel_display.c +3
-3/* setup pipeconf */ - pipeconf =I915_READ (PIPECONF (pipe)); + pipeconf =I915_READ (PIPECONF (cpu_transcoder));/* Set up the display plane register */ dspcntr =DISPPLANE_GAMMA_ENABLE ;@@ -4535,8 +4545,8 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, (mode->hdisplay - 1));I915_WRITE (DSPPOS (plane),0 ); -I915_WRITE (PIPECONF (pipe), pipeconf); -POSTING_READ (PIPECONF (pipe)); +I915_WRITE (PIPECONF (cpu_transcoder), pipeconf); +POSTING_READ (PIPECONF (cpu_transcoder));intel_enable_pipe (dev_priv, pipe, false);intel_wait_for_vblank (dev, pipe);
drivers/gpu/drm/i915/intel_display.c static void ironlake_set_pipeconf(struct drm_crtc *crtc, · line 4718
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +1
-1@@ -4704,10 +4714,10 @@ static void ironlake_set_pipeconf(struct drm_crtc *crtc, {struct drm_i915_private *dev_priv = crtc->dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;uint32_t val;
ilk_set_pipeconf is not called on hsw, we have the special version now.
Quoted 99 lines
drivers/gpu/drm/i915/intel_display.c +14
-11- val =I915_READ (PIPECONF (pipe)); + val =I915_READ (PIPECONF (cpu_transcoder)); val &= ~PIPE_BPC_MASK ;switch (intel_crtc->bpp) {@@ -4738,8 +4748,8 @@ static void ironlake_set_pipeconf(struct drm_crtc *crtc,else val |=PIPECONF_PROGRESSIVE ; -I915_WRITE (PIPECONF (pipe), val); -POSTING_READ (PIPECONF (pipe)); +I915_WRITE (PIPECONF (cpu_transcoder), val); +POSTING_READ (PIPECONF (cpu_transcoder)); } static void haswell_set_pipeconf(struct drm_crtc *crtc,@@ -4748,10 +4758,10 @@ static void haswell_set_pipeconf(struct drm_crtc *crtc, {struct drm_i915_private *dev_priv = crtc->dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;uint32_t val; - val =I915_READ (PIPECONF (pipe)); + val =I915_READ (PIPECONF (cpu_transcoder)); val &= ~(PIPECONF_DITHER_EN |PIPECONF_DITHER_TYPE_MASK );if (dither)@@ -4763,8 +4773,8 @@ static void haswell_set_pipeconf(struct drm_crtc *crtc,else val |=PIPECONF_PROGRESSIVE ; -I915_WRITE (PIPECONF (pipe), val); -POSTING_READ (PIPECONF (pipe)); +I915_WRITE (PIPECONF (cpu_transcoder), val); +POSTING_READ (PIPECONF (cpu_transcoder)); } static bool ironlake_compute_clocks(struct drm_crtc *crtc,@@ -5238,7 +5248,7 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc,WARN (num_connectors !=1 ,"%d connectors attached to pipe %c\n" , num_connectors,pipe_name (pipe)); -WARN_ON (I915_READ (PIPECONF (pipe)) & +WARN_ON (I915_READ (PIPECONF (intel_crtc->cpu_transcoder)) & (PIPECONF_ENABLE |I965_PIPECONF_ACTIVE ));WARN_ON (I915_READ (DSPCNTR (plane)) &DISPLAY_PLANE_ENABLE );@@ -8416,7 +8426,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)u32 reg, val;/* Clear any frame start delays used for debugging left by the BIOS */ - reg =PIPECONF (crtc->pipe); + reg =PIPECONF (crtc->cpu_transcoder);I915_WRITE (reg,I915_READ (reg) & ~PIPECONF_FRAME_START_DELAY_MASK );/* We need to sanitize the plane -> pipe mapping first because this will @@ -8579,7 +8589,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev)for_each_pipe (pipe) { crtc =to_intel_crtc (dev_priv->pipe_to_crtc_mapping[pipe]); - tmp =I915_READ (PIPECONF (pipe)); + tmp =I915_READ (PIPECONF (crtc->cpu_transcoder));if (tmp &PIPECONF_ENABLE ) crtc->active = true;else @@ -8773,6 +8783,7 @@ intel_display_capture_error_state(struct drm_device *dev) {drm_i915_private_t *dev_priv = dev->dev_private;struct intel_display_error_state *error; +enum transcoder cpu_transcoder;int i; error =kmalloc (sizeof (*error),GFP_ATOMIC );@@ -8780,6 +8791,8 @@ intel_display_capture_error_state(struct drm_device *dev)return NULL ;for_each_pipe (i) { + cpu_transcoder =pipe_to_cpu_transcoder (dev_priv, i); + error->cursor[i].control =I915_READ (CURCNTR (i)); error->cursor[i].position =I915_READ (CURPOS (i)); error->cursor[i].base =I915_READ (CURBASE (i));@@ -8794,7 +8807,7 @@ intel_display_capture_error_state(struct drm_device *dev) error->plane[i].tile_offset =I915_READ (DSPTILEOFF (i)); } - error->pipe[i].conf =I915_READ (PIPECONF (i)); + error->pipe[i].conf =I915_READ (PIPECONF (cpu_transcoder)); error->pipe[i].source =I915_READ (PIPESRC (i)); error->pipe[i].htotal =I915_READ (HTOTAL (i)); error->pipe[i].hblank =I915_READ (HBLANK (i));drivers/gpu/drm/i915/intel_sprite.c +0
-0
drivers/gpu/drm/i915/intel_sprite.c intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, · line 425
Quoted 4 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-0@@ -422,6 +422,7 @@ 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 =pipe_to_cpu_transcoder (dev_priv, pipe);
I think we can leave that until we enable sprite support on hsw, too.
Quoted 17 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-1int ret =0 ;int x = src_x >>16 , y = src_y >>16 ;int primary_w = crtc->mode.hdisplay, primary_h = crtc->mode.vdisplay;@@ -436,7 +437,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)drivers/gpu/drm/i915/intel_tv.c +0
-0
drivers/gpu/drm/i915/intel_tv.c intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, · line 944
Quoted 5 lines
drivers/gpu/drm/i915/intel_tv.c +1
-1@@ -941,7 +941,7 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,const struct video_levels *video_levels;const struct color_conversion *color_conversion;bool burst_ena; -int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;
TV-out is non-existing on hsw ...
Quoted 19 lines
drivers/gpu/drm/i915/intel_tv.c +1
-1if (!tv_mode)return ;/* can't happen (mode_prepare prevents this) */ @@ -1085,7 +1085,7 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, ((video_levels->black <<TV_BLACK_LEVEL_SHIFT ) | (video_levels->blank << TV_BLANK_LEVEL_SHIFT))); { -int pipeconf_reg =PIPECONF (pipe); +int pipeconf_reg =PIPECONF (cpu_transcoder);int dspcntr_reg =DSPCNTR (intel_crtc->plane);int pipeconf =I915_READ (pipeconf_reg);int dspcntr =I915_READ (dspcntr_reg);Signature · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 05/14] drm/i915: convert PIPECONF to use transcoder instead of pipe
Hi
2012/10/18 Daniel Vetter <[email protected]>:
Quoted 10 lines · Paulo Zanoni
Quoted 9 lines
From: 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.
Quoted 5 lines
Quoted 1 line
Signed-off-by Paulo Zanoni <[email protected]>I think as a general rule it makes sense to not convert codepaths that are never run on haswell to
cpu_transcoder, since that thing really doesn't exist that much on earlier platforms. Also, it makes the patch smaller ;-)
Just making the discussion public...
I also thought about that, but my fear is that as we move code from one place to another, in the future we might end moving/copying some code and making Haswell use pipe instead of transcoder.
I will write the smaller version with only haswell-specific bits and send V2.
Quoted 421 lines
Below some comments about which hunks I think we can drop. -Daniel
Quoted 14 lines
--- drivers/gpu/drm/i915/i915_irq.c | 4 ++- drivers/gpu/drm/i915/i915_reg.h | 2 +- drivers/gpu/drm/i915/intel_crt.c | 6 ++-- drivers/gpu/drm/i915/intel_display.c | 61 ++++++++++++++++++++++-------------- drivers/gpu/drm/i915/intel_sprite.c | 3 +- drivers/gpu/drm/i915/intel_tv.c | 4 +-- 6 files changed, 49 insertions(+), 31 deletions(-)drivers/gpu/drm/i915/i915_irq.c +0
-0drivers/gpu/drm/i915/i915_irq.c static int · line 129
Quoted 8 lines
drivers/gpu/drm/i915/i915_irq.c +3
-1@@ -123,7 +123,9 @@ 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 =pipe_to_cpu_transcoder (dev_priv, pipe); + +return I915_READ (PIPECONF (cpu_transcoder)) &PIPECONF_ENABLE ; }Oh, how I hate our vblank code and it's insistency to deal with pipes instead of crtc numbers.
Quoted 31 lines
drivers/gpu/drm/i915/i915_irq.c +0
-0/* 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_crt.c +3
-1@@ -467,7 +467,9 @@ intel_crt_load_detect(struct intel_crt *crt) {struct drm_device *dev = crt->base.base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -uint32_t pipe =to_intel_crtc (crt->base.base.crtc)->pipe; +struct intel_crtc *intel_crtc =to_intel_crtc (crt->base.base.crtc); +enum pipe pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;uint32_t save_bclrpat;uint32_t save_vtotal;uint32_t vtotal, vactive;drivers/gpu/drm/i915/intel_crt.c intel_crt_load_detect(struct intel_crt *crt) · line 497
Quoted 8 lines
drivers/gpu/drm/i915/intel_crt.c +1
-1@@ -489,7 +491,7 @@ intel_crt_load_detect(struct intel_crt *crt) vtotal_reg =VTOTAL (pipe); vblank_reg =VBLANK (pipe); vsync_reg =VSYNC (pipe); - pipeconf_reg =PIPECONF (pipe); + pipeconf_reg =PIPECONF (cpu_transcoder); pipe_dsl_reg =PIPEDSL (pipe); save_bclrpat =I915_READ (bclrpat_reg);Load detect is only used by gen2/3 vga connectors and by the tv out connector, nothing else. So I think we can just leave this as-is.
Quoted 32 lines
drivers/gpu/drm/i915/intel_display.c +4
-2@@ -1008,9 +1008,10 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe)void intel_wait_for_pipe_off (struct drm_device *dev,int pipe) {struct drm_i915_private *dev_priv = dev->dev_private; +enum transcoder cpu_transcoder =pipe_to_cpu_transcoder (dev_priv, pipe);if (INTEL_INFO (dev)->gen >=4 ) { -int reg =PIPECONF (pipe); +int reg =PIPECONF (cpu_transcoder);/* Wait for the Pipe State to go off */ if (wait_for((I915_READ(reg) & I965_PIPECONF_ACTIVE) == 0,@@ -1222,12 +1223,13 @@ void assert_pipe(struct drm_i915_private *dev_priv,int reg;u32 val;bool cur_state; +enum transcoder cpu_transcoder =pipe_to_cpu_transcoder (dev_priv, pipe);/* if we need the pipe A quirk it must be always on */ if (pipe ==PIPE_A && dev_priv->quirks &QUIRK_PIPEA_FORCE ) state = true; - reg =PIPECONF (pipe); + reg =PIPECONF (cpu_transcoder); val =I915_READ (reg); cur_state = !!(val &PIPECONF_ENABLE ); WARN(cur_state != state,drivers/gpu/drm/i915/intel_display.c static void intel_enable_transcoder(struct drm_i915_private *dev_priv, · line 1669
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +1
-0@@ -1661,6 +1663,7 @@ static void intel_enable_transcoder(struct drm_i915_private *dev_priv,int reg;u32 val, pipeconf_val;struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; +enum transcoder cpu_transcoder =pipe_to_cpu_transcoder (dev_priv, pipe);/* PCH only available on ILK+ */ BUG_ON (dev_priv->info->gen <5 );Do we really need this on hsw for the pch vga port? Since the only pch port we have is vga, and that is currently restricted to pipe 0 I'd prefer if we fix this up once we really put the code to some use (i.e. lift the pipe == 0 restriction).
Quoted 44 lines
drivers/gpu/drm/i915/intel_display.c +5
-3@@ -1680,7 +1683,7 @@ static void intel_enable_transcoder(struct drm_i915_private *dev_priv, } reg =TRANSCONF (pipe); val =I915_READ (reg); - pipeconf_val =I915_READ (PIPECONF (pipe)); + pipeconf_val =I915_READ (PIPECONF (cpu_transcoder));if (HAS_PCH_IBX (dev_priv->dev)) {/* @@ -1745,6 +1748,7 @@ static void intel_disable_transcoder(struct drm_i915_private *dev_priv,static void intel_enable_pipe (struct drm_i915_private *dev_priv,enum pipe pipe,bool pch_port) { +enum transcoder cpu_transcoder =pipe_to_cpu_transcoder (dev_priv, pipe);int reg;u32 val;@@ -1764,7 +1768,7 @@ static void intel_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe,/* FIXME: assert CPU port conditions for SNB+ */ } - reg =PIPECONF (pipe); + reg =PIPECONF (cpu_transcoder); val =I915_READ (reg);if (val &PIPECONF_ENABLE )return ;@@ -1788,6 +1792,7 @@ static void intel_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe,static void intel_disable_pipe (struct drm_i915_private *dev_priv,enum pipe pipe) { +enum transcoder cpu_transcoder =pipe_to_cpu_transcoder (dev_priv, pipe);int reg;u32 val;@@ -1801,7 +1806,7 @@ static void intel_disable_pipe(struct drm_i915_private *dev_priv,if (pipe ==PIPE_A && (dev_priv->quirks &QUIRK_PIPEA_FORCE ))return ; - reg =PIPECONF (pipe); + reg =PIPECONF (cpu_transcoder); val =I915_READ (reg);if ((val &PIPECONF_ENABLE ) ==0 )return ;drivers/gpu/drm/i915/intel_display.c static void ironlake_fdi_pll_enable(struct intel_crtc *intel_crtc) · line 2688
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0@@ -2679,6 +2684,7 @@ static void ironlake_fdi_pll_enable(struct intel_crtc *intel_crtc)struct drm_device *dev = intel_crtc->base.dev;struct drm_i915_private *dev_priv = dev->dev_private;int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;u32 reg, temp;Dito for all the fdi stuff here, I think that's better done when we enable/fix-up VGA.
Quoted 64 lines
drivers/gpu/drm/i915/intel_display.c +8
-4/* Write the TU size bits so error detection works */ @@ -2690,7 +2696,7 @@ static void ironlake_fdi_pll_enable(struct intel_crtc *intel_crtc) temp =I915_READ (reg); temp &= ~((0x7 <<19 ) | (0x7 <<16 )); temp |= (intel_crtc->fdi_lanes -1 ) <<19 ; - temp |= (I915_READ (PIPECONF (pipe)) &PIPE_BPC_MASK ) <<11 ; + temp |= (I915_READ (PIPECONF (cpu_transcoder)) &PIPE_BPC_MASK ) <<11 ;I915_WRITE (reg, temp |FDI_RX_PLL_ENABLE );POSTING_READ (reg);@@ -2764,6 +2770,7 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc)struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;u32 reg, temp;/* disable CPU FDI tx and PCH FDI rx */ @@ -2775,7 +2782,7 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc) reg =FDI_RX_CTL (pipe); temp =I915_READ (reg); temp &= ~(0x7 <<16 ); - temp |= (I915_READ (PIPECONF (pipe)) &PIPE_BPC_MASK ) <<11 ; + temp |= (I915_READ (PIPECONF (cpu_transcoder)) &PIPE_BPC_MASK ) <<11 ;I915_WRITE (reg, temp & ~FDI_RX_ENABLE );POSTING_READ (reg);@@ -2809,7 +2816,7 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc) }/* BPC in FDI rx is consistent with that in PIPECONF */ temp &= ~(0x07 <<16 ); - temp |= (I915_READ (PIPECONF (pipe)) &PIPE_BPC_MASK ) <<11 ; + temp |= (I915_READ (PIPECONF (cpu_transcoder)) &PIPE_BPC_MASK ) <<11 ;I915_WRITE (reg, temp);POSTING_READ (reg);@@ -2971,6 +2978,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;u32 reg, temp;assert_transcoder_disabled (dev_priv, pipe);@@ -3027,7 +3035,8 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)if (HAS_PCH_CPT (dev) && (intel_pipe_has_type (crtc,INTEL_OUTPUT_DISPLAYPORT ) ||intel_pipe_has_type (crtc,INTEL_OUTPUT_EDP ))) { -u32 bpc = (I915_READ (PIPECONF (pipe)) &PIPE_BPC_MASK ) >>5 ; +u32 bpc = (I915_READ (PIPECONF (cpu_transcoder)) & +PIPE_BPC_MASK ) >>5 ; reg =TRANS_DP_CTL (pipe); temp =I915_READ (reg); temp &= ~(TRANS_DP_PORT_SEL_MASK |@@ -4383,6 +4392,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_crtc->pipe;int plane = intel_crtc->plane; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;int refclk, num_connectors =0 ;intel_clock_t clock, reduced_clock;u32 dspcntr, pipeconf;drivers/gpu/drm/i915/intel_display.c static int i9xx_crtc_mode_set(struct drm_crtc *crtc, · line 4473
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -4463,7 +4473,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, num_connectors);i9xx stuff, I think pipeconf is totally ok for these ;-)
Quoted 19 lines
drivers/gpu/drm/i915/intel_display.c +3
-3/* setup pipeconf */ - pipeconf =I915_READ (PIPECONF (pipe)); + pipeconf =I915_READ (PIPECONF (cpu_transcoder));/* Set up the display plane register */ dspcntr =DISPPLANE_GAMMA_ENABLE ;@@ -4535,8 +4545,8 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, (mode->hdisplay - 1));I915_WRITE (DSPPOS (plane),0 ); -I915_WRITE (PIPECONF (pipe), pipeconf); -POSTING_READ (PIPECONF (pipe)); +I915_WRITE (PIPECONF (cpu_transcoder), pipeconf); +POSTING_READ (PIPECONF (cpu_transcoder));intel_enable_pipe (dev_priv, pipe, false);intel_wait_for_vblank (dev, pipe);drivers/gpu/drm/i915/intel_display.c static void ironlake_set_pipeconf(struct drm_crtc *crtc, · line 4718
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +1
-1@@ -4704,10 +4714,10 @@ static void ironlake_set_pipeconf(struct drm_crtc *crtc, {struct drm_i915_private *dev_priv = crtc->dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;uint32_t val;
ilk_set_pipeconfis not called on hsw, we have the special version now.Quoted 99 lines
drivers/gpu/drm/i915/intel_display.c +14
-11- val =I915_READ (PIPECONF (pipe)); + val =I915_READ (PIPECONF (cpu_transcoder)); val &= ~PIPE_BPC_MASK ;switch (intel_crtc->bpp) {@@ -4738,8 +4748,8 @@ static void ironlake_set_pipeconf(struct drm_crtc *crtc,else val |=PIPECONF_PROGRESSIVE ; -I915_WRITE (PIPECONF (pipe), val); -POSTING_READ (PIPECONF (pipe)); +I915_WRITE (PIPECONF (cpu_transcoder), val); +POSTING_READ (PIPECONF (cpu_transcoder)); } static void haswell_set_pipeconf(struct drm_crtc *crtc,@@ -4748,10 +4758,10 @@ static void haswell_set_pipeconf(struct drm_crtc *crtc, {struct drm_i915_private *dev_priv = crtc->dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;uint32_t val; - val =I915_READ (PIPECONF (pipe)); + val =I915_READ (PIPECONF (cpu_transcoder)); val &= ~(PIPECONF_DITHER_EN |PIPECONF_DITHER_TYPE_MASK );if (dither)@@ -4763,8 +4773,8 @@ static void haswell_set_pipeconf(struct drm_crtc *crtc,else val |=PIPECONF_PROGRESSIVE ; -I915_WRITE (PIPECONF (pipe), val); -POSTING_READ (PIPECONF (pipe)); +I915_WRITE (PIPECONF (cpu_transcoder), val); +POSTING_READ (PIPECONF (cpu_transcoder)); } static bool ironlake_compute_clocks(struct drm_crtc *crtc,@@ -5238,7 +5248,7 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc,WARN (num_connectors !=1 ,"%d connectors attached to pipe %c\n" , num_connectors,pipe_name (pipe)); -WARN_ON (I915_READ (PIPECONF (pipe)) & +WARN_ON (I915_READ (PIPECONF (intel_crtc->cpu_transcoder)) & (PIPECONF_ENABLE |I965_PIPECONF_ACTIVE ));WARN_ON (I915_READ (DSPCNTR (plane)) &DISPLAY_PLANE_ENABLE );@@ -8416,7 +8426,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)u32 reg, val;/* Clear any frame start delays used for debugging left by the BIOS */ - reg =PIPECONF (crtc->pipe); + reg =PIPECONF (crtc->cpu_transcoder);I915_WRITE (reg,I915_READ (reg) & ~PIPECONF_FRAME_START_DELAY_MASK );/* We need to sanitize the plane -> pipe mapping first because this will @@ -8579,7 +8589,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev)for_each_pipe (pipe) { crtc =to_intel_crtc (dev_priv->pipe_to_crtc_mapping[pipe]); - tmp =I915_READ (PIPECONF (pipe)); + tmp =I915_READ (PIPECONF (crtc->cpu_transcoder));if (tmp &PIPECONF_ENABLE ) crtc->active = true;else @@ -8773,6 +8783,7 @@ intel_display_capture_error_state(struct drm_device *dev) {drm_i915_private_t *dev_priv = dev->dev_private;struct intel_display_error_state *error; +enum transcoder cpu_transcoder;int i; error =kmalloc (sizeof (*error),GFP_ATOMIC );@@ -8780,6 +8791,8 @@ intel_display_capture_error_state(struct drm_device *dev)return NULL ;for_each_pipe (i) { + cpu_transcoder =pipe_to_cpu_transcoder (dev_priv, i); + error->cursor[i].control =I915_READ (CURCNTR (i)); error->cursor[i].position =I915_READ (CURPOS (i)); error->cursor[i].base =I915_READ (CURBASE (i));@@ -8794,7 +8807,7 @@ intel_display_capture_error_state(struct drm_device *dev) error->plane[i].tile_offset =I915_READ (DSPTILEOFF (i)); } - error->pipe[i].conf =I915_READ (PIPECONF (i)); + error->pipe[i].conf =I915_READ (PIPECONF (cpu_transcoder)); error->pipe[i].source =I915_READ (PIPESRC (i)); error->pipe[i].htotal =I915_READ (HTOTAL (i)); error->pipe[i].hblank =I915_READ (HBLANK (i));drivers/gpu/drm/i915/intel_sprite.c +0
-0drivers/gpu/drm/i915/intel_sprite.c intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, · line 425
Quoted 4 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-0@@ -422,6 +422,7 @@ 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 =pipe_to_cpu_transcoder (dev_priv, pipe);I think we can leave that until we enable sprite support on hsw, too.
Quoted 17 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-1int ret =0 ;int x = src_x >>16 , y = src_y >>16 ;int primary_w = crtc->mode.hdisplay, primary_h = crtc->mode.vdisplay;@@ -436,7 +437,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)drivers/gpu/drm/i915/intel_tv.c +0
-0drivers/gpu/drm/i915/intel_tv.c intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, · line 944
Quoted 5 lines
drivers/gpu/drm/i915/intel_tv.c +1
-1@@ -941,7 +941,7 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,const struct video_levels *video_levels;const struct color_conversion *color_conversion;bool burst_ena; -int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;TV-out is non-existing on hsw ...
Quoted 15 lines
drivers/gpu/drm/i915/intel_tv.c +1
-2if (!tv_mode)return ;/* can't happen (mode_prepare prevents this) */ @@ -1085,7 +1085,7 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, ((video_levels->black <<TV_BLACK_LEVEL_SHIFT ) | (video_levels->blank << TV_BLANK_LEVEL_SHIFT))); { -int pipeconf_reg =PIPECONF (pipe); +int pipeconf_reg =PIPECONF (cpu_transcoder);int dspcntr_reg =DSPCNTR (intel_crtc->plane);int pipeconf =I915_READ (pipeconf_reg);int dspcntr =I915_READ (dspcntr_reg); --1.7.11.4
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 1 line
Paulo Zanoni
PATCH 6/14 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
@@ -4552,15 +4552,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/14 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
@@ -3304,14 +3304,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
@@ -2689,7 +2689,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);
@@ -4847,7 +4847,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;
@@ -4910,10 +4910,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
Re: [PATCH 07/14] drm/i915: convert CPU M/N timings to transcoder
Quoted 6 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
Same thing as the previous commits. Not renaming this one since it exists since way before Haswell.
Signed-off-by Paulo Zanoni <[email protected]>
Again I think we can drop the fdi hunks here. We better keep the set_m_n hunks (I think we only need the dp one though), since that part of the code is a convoluted mess and needs a cleanup. I have plans for pre-hsw pch platforms ;-)
-Daniel
Quoted 105 lines
--- 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@@ -3304,14 +3304,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@@ -2689,7 +2689,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);@@ -4847,7 +4847,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;@@ -4910,10 +4910,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 · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 8/14 drm/i915: convert pipe timing definitions to transcoder
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
--- drivers/gpu/drm/i915/i915_irq.c | 7 ++--- drivers/gpu/drm/i915/i915_reg.h | 14 +++++----- drivers/gpu/drm/i915/intel_crt.c | 6 ++--- drivers/gpu/drm/i915/intel_display.c | 52 +++++++++++++++++++----------------- 4 files changed, 41 insertions(+), 38 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +4 -3
@@ -185,6 +185,7 @@ 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 =pipe_to_cpu_transcoder (dev_priv, pipe);if (!i915_pipe_enabled (dev, pipe)) { DRM_DEBUG_DRIVER("trying to get scanoutpos for disabled "
@@ -193,7 +194,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
@@ -213,13 +214,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_crt.c +3 -3
@@ -488,9 +488,9 @@ intel_crt_load_detect(struct intel_crt *crt)DRM_DEBUG_KMS ("starting load-detect on CRT\n" ); bclrpat_reg =BCLRPAT (pipe); - vtotal_reg =VTOTAL (pipe); - vblank_reg =VBLANK (pipe); - vsync_reg =VSYNC (pipe); + vtotal_reg =VTOTAL (cpu_transcoder); + vblank_reg =VBLANK (cpu_transcoder); + vsync_reg =VSYNC (cpu_transcoder); pipeconf_reg =PIPECONF (cpu_transcoder); pipe_dsl_reg =PIPEDSL (pipe);
drivers/gpu/drm/i915/intel_display.c +27 -25
96 lines not on this page · raw message
Signature · 1 line
1.7.11.4
Re: [PATCH 08/14] drm/i915: convert pipe timing definitions to transcoder
Quoted 3 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
Signed-off-by Paulo Zanoni <[email protected]>
Again, I think we can drop the hunks for the load detect code and the pch stuff for now. For the pch stuff I think we'll better do that once we give vga a good look.
-Daniel
Quoted 199 lines
--- drivers/gpu/drm/i915/i915_irq.c | 7 ++--- drivers/gpu/drm/i915/i915_reg.h | 14 +++++----- drivers/gpu/drm/i915/intel_crt.c | 6 ++--- drivers/gpu/drm/i915/intel_display.c | 52 +++++++++++++++++++----------------- 4 files changed, 41 insertions(+), 38 deletions(-)drivers/gpu/drm/i915/i915_irq.c +4
-3@@ -185,6 +185,7 @@ 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 =pipe_to_cpu_transcoder (dev_priv, pipe);if (!i915_pipe_enabled (dev, pipe)) { DRM_DEBUG_DRIVER("trying to get scanoutpos for disabled "@@ -193,7 +194,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 @@ -213,13 +214,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 0x61100drivers/gpu/drm/i915/intel_crt.c +3
-3@@ -488,9 +488,9 @@ intel_crt_load_detect(struct intel_crt *crt)DRM_DEBUG_KMS ("starting load-detect on CRT\n" ); bclrpat_reg =BCLRPAT (pipe); - vtotal_reg =VTOTAL (pipe); - vblank_reg =VBLANK (pipe); - vsync_reg =VSYNC (pipe); + vtotal_reg =VTOTAL (cpu_transcoder); + vblank_reg =VBLANK (cpu_transcoder); + vsync_reg =VSYNC (cpu_transcoder); pipeconf_reg =PIPECONF (cpu_transcoder); pipe_dsl_reg =PIPEDSL (pipe);drivers/gpu/drm/i915/intel_display.c +27
-25@@ -3019,14 +3019,15 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)/* set transcoder timing, panel must allow it */ assert_panel_unlocked (dev_priv, pipe); -I915_WRITE (TRANS_HTOTAL (pipe),I915_READ (HTOTAL (pipe))); -I915_WRITE (TRANS_HBLANK (pipe),I915_READ (HBLANK (pipe))); -I915_WRITE (TRANS_HSYNC (pipe),I915_READ (HSYNC (pipe))); +I915_WRITE (TRANS_HTOTAL (pipe),I915_READ (HTOTAL (cpu_transcoder))); +I915_WRITE (TRANS_HBLANK (pipe),I915_READ (HBLANK (cpu_transcoder))); +I915_WRITE (TRANS_HSYNC (pipe),I915_READ (HSYNC (cpu_transcoder))); -I915_WRITE (TRANS_VTOTAL (pipe),I915_READ (VTOTAL (pipe))); -I915_WRITE (TRANS_VBLANK (pipe),I915_READ (VBLANK (pipe))); -I915_WRITE (TRANS_VSYNC (pipe),I915_READ (VSYNC (pipe))); -I915_WRITE (TRANS_VSYNCSHIFT (pipe),I915_READ (VSYNCSHIFT (pipe))); +I915_WRITE (TRANS_VTOTAL (pipe),I915_READ (VTOTAL (cpu_transcoder))); +I915_WRITE (TRANS_VBLANK (pipe),I915_READ (VBLANK (cpu_transcoder))); +I915_WRITE (TRANS_VSYNC (pipe),I915_READ (VSYNC (cpu_transcoder))); +I915_WRITE (TRANS_VSYNCSHIFT (pipe), +I915_READ (VSYNCSHIFT (cpu_transcoder)));if (!IS_HASWELL (dev))intel_fdi_normal_train (crtc);@@ -4339,6 +4340,7 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc,struct drm_device *dev = intel_crtc->base.dev;struct drm_i915_private *dev_priv = dev->dev_private;enum pipe pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;uint32_t vsyncshift;if (!IS_GEN2 (dev) && adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE ) {@@ -4352,25 +4354,25 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc, }if (INTEL_INFO (dev)->gen >3 ) -I915_WRITE (VSYNCSHIFT (pipe), vsyncshift); +I915_WRITE (VSYNCSHIFT (cpu_transcoder), vsyncshift); -I915_WRITE (HTOTAL (pipe), +I915_WRITE (HTOTAL (cpu_transcoder), (adjusted_mode->crtc_hdisplay -1 ) | ((adjusted_mode->crtc_htotal -1 ) <<16 )); -I915_WRITE (HBLANK (pipe), +I915_WRITE (HBLANK (cpu_transcoder), (adjusted_mode->crtc_hblank_start -1 ) | ((adjusted_mode->crtc_hblank_end -1 ) <<16 )); -I915_WRITE (HSYNC (pipe), +I915_WRITE (HSYNC (cpu_transcoder), (adjusted_mode->crtc_hsync_start -1 ) | ((adjusted_mode->crtc_hsync_end -1 ) <<16 )); -I915_WRITE (VTOTAL (pipe), +I915_WRITE (VTOTAL (cpu_transcoder), (adjusted_mode->crtc_vdisplay -1 ) | ((adjusted_mode->crtc_vtotal -1 ) <<16 )); -I915_WRITE (VBLANK (pipe), +I915_WRITE (VBLANK (cpu_transcoder), (adjusted_mode->crtc_vblank_start -1 ) | ((adjusted_mode->crtc_vblank_end -1 ) <<16 )); -I915_WRITE (VSYNC (pipe), +I915_WRITE (VSYNC (cpu_transcoder), (adjusted_mode->crtc_vsync_start -1 ) | ((adjusted_mode->crtc_vsync_end -1 ) <<16 ));@@ -6333,12 +6335,12 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev, {struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -int pipe = intel_crtc->pipe; +enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;struct drm_display_mode *mode; -int htot =I915_READ (HTOTAL (pipe)); -int hsync =I915_READ (HSYNC (pipe)); -int vtot =I915_READ (VTOTAL (pipe)); -int vsync =I915_READ (VSYNC (pipe)); +int htot =I915_READ (HTOTAL (cpu_transcoder)); +int hsync =I915_READ (HSYNC (cpu_transcoder)); +int vtot =I915_READ (VTOTAL (cpu_transcoder)); +int vsync =I915_READ (VSYNC (cpu_transcoder)); mode =kzalloc (sizeof (*mode),GFP_KERNEL );if (!mode)@@ -8809,12 +8811,12 @@ intel_display_capture_error_state(struct drm_device *dev) error->pipe[i].conf =I915_READ (PIPECONF (cpu_transcoder)); error->pipe[i].source =I915_READ (PIPESRC (i)); - error->pipe[i].htotal =I915_READ (HTOTAL (i)); - error->pipe[i].hblank =I915_READ (HBLANK (i)); - error->pipe[i].hsync =I915_READ (HSYNC (i)); - error->pipe[i].vtotal =I915_READ (VTOTAL (i)); - error->pipe[i].vblank =I915_READ (VBLANK (i)); - error->pipe[i].vsync =I915_READ (VSYNC (i)); + error->pipe[i].htotal =I915_READ (HTOTAL (cpu_transcoder)); + error->pipe[i].hblank =I915_READ (HBLANK (cpu_transcoder)); + error->pipe[i].hsync =I915_READ (HSYNC (cpu_transcoder)); + error->pipe[i].vtotal =I915_READ (VTOTAL (cpu_transcoder)); + error->pipe[i].vblank =I915_READ (VBLANK (cpu_transcoder)); + error->pipe[i].vsync =I915_READ (VSYNC (cpu_transcoder)); }return error;Signature · 6 lines
1.7.11.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 9/14 drm/i915: implement workaround for VTOTAL when using TRANSCODER_EDP
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
See the documentation for the DDI_FUNC_CTL register, EDP Input Select
bits: when the EDP input selection is B, the VTOTAL_B must be programmed with the VTOTAL_EDP value, same thing for selection C.
--- drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/intel_display.c +11 -0
@@ -4376,6 +4376,17 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc, (adjusted_mode->crtc_vsync_start -1 ) | ((adjusted_mode->crtc_vsync_end - 1) << 16)); +/* Workaround: when the EDP input selection is B, the VTOTAL_B must be +* programmed with the VTOTAL_EDP value. Same for VTOTAL_C. This is +* documented on the DDI_FUNC_CTL register description, EDP Input Select +* bits. */ +if (IS_HASWELL (dev) && cpu_transcoder ==TRANSCODER_EDP && + (pipe ==PIPE_B || pipe ==PIPE_C )) { +I915_WRITE (VTOTAL (pipe), + (adjusted_mode->crtc_vdisplay -1 ) | + ((adjusted_mode->crtc_vtotal -1 ) <<16 )); + } +/* pipesrc controls the size that is scaled from, which should * always be the user's requested size. */
Signature · 1 line
1.7.11.4
PATCH 10/14 drm/i915: select the correct pipe when using TRANSCODER_EDP
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
--- drivers/gpu/drm/i915/intel_ddi.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +17 -0
@@ -954,6 +954,23 @@ void intel_ddi_enable_pipe_func(struct drm_crtc *crtc)if (crtc->mode.flags &DRM_MODE_FLAG_PHSYNC ) temp |=TRANS_DDI_PHSYNC ; +if (cpu_transcoder ==TRANSCODER_EDP ) { +switch (pipe) { +case PIPE_A : + temp |=TRANS_DDI_EDP_INPUT_A_ONOFF ; +break ; +case PIPE_B : + temp |=TRANS_DDI_EDP_INPUT_B_ONOFF ; +break ; +case PIPE_C : + temp |=TRANS_DDI_EDP_INPUT_C_ONOFF ; +break ; +default : +BUG (); +break ; + } + } +if (type ==INTEL_OUTPUT_HDMI ) {struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (encoder);
Signature · 1 line
1.7.11.4
PATCH 11/14 drm/i915: set the correct eDP aux channel clock divider on DDI
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
The cdclk frequency is not always the same, so the value here should be adjusted to match it.
Version 2: call intel_ddi_get_cdclk_freq instead of reading CDCLK_FREQ, because the register is just for earlier HW steppings.
--- drivers/gpu/drm/i915/intel_ddi.c | 2 +- drivers/gpu/drm/i915/intel_dp.c | 4 +++- drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +1 -1
@@ -1238,7 +1238,7 @@ void intel_disable_ddi(struct intel_encoder *encoder)/* This will be needed in the future, so leave it here for now */ } -static int intel_ddi_get_cdclk_freq (struct drm_i915_private *dev_priv) +int intel_ddi_get_cdclk_freq (struct drm_i915_private *dev_priv) {if (I915_READ (HSW_FUSE_STRAP ) &HSW_CDCLK_LIMIT )return 450 ;
drivers/gpu/drm/i915/intel_dp.c +3 -1
@@ -386,7 +386,9 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,* clock divider. */ if (is_cpu_edp (intel_dp)) { -if (IS_VALLEYVIEW (dev)) +if (IS_HASWELL (dev)) + aux_clock_divider =intel_ddi_get_cdclk_freq (dev_priv) >>1 ; +else if (IS_VALLEYVIEW (dev)) aux_clock_divider =100 ;else if (IS_GEN6 (dev) ||IS_GEN7 (dev)) aux_clock_divider =200 ;/* SNB & IVB eDP input clock at 400Mhz */
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -593,6 +593,7 @@ extern bool intel_ddi_get_hw_state(struct intel_encoder *encoder,extern void intel_ddi_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode); +extern int intel_ddi_get_cdclk_freq (struct drm_i915_private *dev_priv);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_transcoder_func(struct drm_i915_private *dev_priv,
Signature · 1 line
1.7.11.4
PATCH 12/14 drm/i915: set/unset the DDI eDP backlight
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
--- drivers/gpu/drm/i915/intel_ddi.c | 15 +++++++++++++-- drivers/gpu/drm/i915/intel_dp.c | 4 ++-- drivers/gpu/drm/i915/intel_drv.h | 6 ++++-- 3 files changed, 19 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +13 -2
@@ -1230,12 +1230,23 @@ void intel_enable_ddi(struct intel_encoder *intel_encoder)* enabling the port. */ I915_WRITE (DDI_BUF_CTL (port),DDI_BUF_CTL_ENABLE ); + }else if (type ==INTEL_OUTPUT_EDP ) { +struct intel_dp *intel_dp =enc_to_intel_dp (encoder); + +ironlake_edp_backlight_on (intel_dp); } } -void intel_disable_ddi (struct intel_encoder *encoder) +void intel_disable_ddi (struct intel_encoder *intel_encoder) { -/* This will be needed in the future, so leave it here for now */ +struct drm_encoder *encoder = &intel_encoder->base; +int type = intel_encoder->type; + +if (type ==INTEL_OUTPUT_EDP ) { +struct intel_dp *intel_dp =enc_to_intel_dp (encoder); + +ironlake_edp_backlight_off (intel_dp); + } }int intel_ddi_get_cdclk_freq (struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/intel_dp.c +2 -2
@@ -1178,7 +1178,7 @@ static void ironlake_edp_panel_off(struct intel_dp *intel_dp)ironlake_wait_panel_off (intel_dp); } -static void ironlake_edp_backlight_on (struct intel_dp *intel_dp) +void ironlake_edp_backlight_on (struct intel_dp *intel_dp) {struct drm_device *dev = intel_dp->base.base.dev;struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1201,7 +1201,7 @@ static void ironlake_edp_backlight_on(struct intel_dp *intel_dp)POSTING_READ (PCH_PP_CONTROL ); } -static void ironlake_edp_backlight_off (struct intel_dp *intel_dp) +void ironlake_edp_backlight_off (struct intel_dp *intel_dp) {struct drm_device *dev = intel_dp->base.base.dev;struct drm_i915_private *dev_priv = dev->dev_private;
drivers/gpu/drm/i915/intel_drv.h +4 -2
@@ -428,6 +428,8 @@ extern void intel_dp_start_link_train(struct intel_dp *intel_dp);extern void intel_dp_complete_link_train (struct intel_dp *intel_dp);extern void intel_dp_sink_dpms (struct intel_dp *intel_dp,int mode);extern bool intel_dpd_is_edp (struct drm_device *dev); +extern void ironlake_edp_backlight_on (struct intel_dp *intel_dp); +extern void ironlake_edp_backlight_off (struct intel_dp *intel_dp);extern void intel_edp_link_config (struct intel_encoder *,int *,int *);extern int intel_edp_target_clock (struct intel_encoder *,struct drm_display_mode *mode);
@@ -586,8 +588,8 @@ extern void intel_disable_gt_powersave(struct drm_device *dev);extern void gen6_gt_check_fifodbg (struct drm_i915_private *dev_priv);extern void ironlake_teardown_rc6 (struct drm_device *dev); -extern void intel_enable_ddi (struct intel_encoder *encoder); -extern void intel_disable_ddi (struct intel_encoder *encoder); +extern void intel_enable_ddi (struct intel_encoder *intel_encoder); +extern void intel_disable_ddi (struct intel_encoder *intel_encoder);extern bool intel_ddi_get_hw_state (struct intel_encoder *encoder,enum pipe *pipe); extern void intel_ddi_mode_set(struct drm_encoder *encoder,
Signature · 1 line
1.7.11.4
PATCH 13/14 drm/i915: turn the eDP DDI panel on/off
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
It's an important step :)
--- drivers/gpu/drm/i915/intel_ddi.c | 18 ++++++++++++++++-- drivers/gpu/drm/i915/intel_dp.c | 11 ++++------- drivers/gpu/drm/i915/intel_drv.h | 4 ++++ 3 files changed, 24 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +16 -2
@@ -1162,12 +1162,19 @@ void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)struct drm_i915_private *dev_priv = encoder->dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);enum port port =intel_ddi_get_encoder_port (intel_encoder); +int type = intel_encoder->type; -WARN_ON (intel_crtc->ddi_pll_sel ==PORT_CLK_SEL_NONE ); +if (type ==INTEL_OUTPUT_EDP ) { +struct intel_dp *intel_dp =enc_to_intel_dp (encoder); +ironlake_edp_panel_vdd_on (intel_dp); +ironlake_edp_panel_on (intel_dp); +ironlake_edp_panel_vdd_off (intel_dp, true); + } +WARN_ON (intel_crtc->ddi_pll_sel ==PORT_CLK_SEL_NONE );I915_WRITE (PORT_CLK_SEL (port), intel_crtc->ddi_pll_sel); -if (intel_encoder->type ==INTEL_OUTPUT_DISPLAYPORT ) { +if (type ==INTEL_OUTPUT_DISPLAYPORT || type ==INTEL_OUTPUT_EDP ) {struct intel_dp *intel_dp =enc_to_intel_dp (encoder);intel_dp_sink_dpms (intel_dp,DRM_MODE_DPMS_ON );
@@ -1195,6 +1202,7 @@ void intel_ddi_post_disable(struct intel_encoder *intel_encoder)struct drm_encoder *encoder = &intel_encoder->base;struct drm_i915_private *dev_priv = encoder->dev->dev_private;enum port port =intel_ddi_get_encoder_port (intel_encoder); +int type = intel_encoder->type;uint32_t val;bool wait = false;
@@ -1213,6 +1221,12 @@ void intel_ddi_post_disable(struct intel_encoder *intel_encoder)if (wait)intel_wait_ddi_buf_idle (dev_priv, port); +if (type ==INTEL_OUTPUT_EDP ) { +struct intel_dp *intel_dp =enc_to_intel_dp (encoder); +ironlake_edp_panel_vdd_on (intel_dp); +ironlake_edp_panel_off (intel_dp); + } +I915_WRITE (PORT_CLK_SEL (port),PORT_CLK_SEL_NONE ); }
drivers/gpu/drm/i915/intel_dp.c +4 -7
@@ -667,9 +667,6 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,return -EREMOTEIO ; } -static void ironlake_edp_panel_vdd_on (struct intel_dp *intel_dp); -static void ironlake_edp_panel_vdd_off (struct intel_dp *intel_dp,bool sync); -static int intel_dp_i2c_init (struct intel_dp *intel_dp,struct intel_connector *intel_connector,const char *name)
@@ -1018,7 +1015,7 @@ static u32 ironlake_get_pp_control(struct drm_i915_private *dev_priv)return control; } -static void ironlake_edp_panel_vdd_on (struct intel_dp *intel_dp) +void ironlake_edp_panel_vdd_on (struct intel_dp *intel_dp) {struct drm_device *dev = intel_dp->base.base.dev;struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1088,7 +1085,7 @@ static void ironlake_panel_vdd_work(struct work_struct *__work)mutex_unlock (&dev->mode_config.mutex); } -static void ironlake_edp_panel_vdd_off (struct intel_dp *intel_dp,bool sync) +void ironlake_edp_panel_vdd_off (struct intel_dp *intel_dp,bool sync) {if (!is_edp (intel_dp))return ;
@@ -1111,7 +1108,7 @@ static void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) } } -static void ironlake_edp_panel_on (struct intel_dp *intel_dp) +void ironlake_edp_panel_on (struct intel_dp *intel_dp) {struct drm_device *dev = intel_dp->base.base.dev;struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1153,7 +1150,7 @@ static void ironlake_edp_panel_on(struct intel_dp *intel_dp) } } -static void ironlake_edp_panel_off (struct intel_dp *intel_dp) +void ironlake_edp_panel_off (struct intel_dp *intel_dp) {struct drm_device *dev = intel_dp->base.base.dev;struct drm_i915_private *dev_priv = dev->dev_private;
drivers/gpu/drm/i915/intel_drv.h +4 -0
@@ -430,6 +430,10 @@ extern void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);extern bool intel_dpd_is_edp (struct drm_device *dev);extern void ironlake_edp_backlight_on (struct intel_dp *intel_dp);extern void ironlake_edp_backlight_off (struct intel_dp *intel_dp); +extern void ironlake_edp_panel_on (struct intel_dp *intel_dp); +extern void ironlake_edp_panel_off (struct intel_dp *intel_dp); +extern void ironlake_edp_panel_vdd_on (struct intel_dp *intel_dp); +extern void ironlake_edp_panel_vdd_off (struct intel_dp *intel_dp,bool sync);extern void intel_edp_link_config (struct intel_encoder *,int *,int *);extern int intel_edp_target_clock (struct intel_encoder *,struct drm_display_mode *mode);
Signature · 1 line
1.7.11.4
PATCH 14/14 drm/i915: enable DDI eDP
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Now that all the eDP enablement bits are there, we can actually try to use the eDP.
--- drivers/gpu/drm/i915/intel_ddi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +1 -1
@@ -242,8 +242,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port)switch (port){case PORT_A : -/* We don't handle eDP and DP yet */ DRM_DEBUG_DRIVER ("Found digital output on DDI port A\n" ); +intel_dp_init (dev,DDI_BUF_CTL_A ,PORT_A );break ;/* Assume that the ports B, C and D are working in HDMI mode for now */ case PORT_B :
Signature · 1 line
1.7.11.4