aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-04-24 17:54:42 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-05-05 04:56:58 -0400
commit3fa2dd14cf113c45c51928b502fe77486105e048 (patch)
tree67d3683b40c737dfa150d7976d8d539543660b81 /drivers/gpu/drm/i915
parent5da92eeff85a637db2ee51dca1d870be96cabf15 (diff)
drm/i915/tv: Rip out pipe-disabling nonsense from ->mode_set
The pipe and plane _are_ disabled when we call this. So replace it all with the corresponding assert (as self-documenting code) and rip out all the lore. Checking for a disabled plane would require us to export those macros from intel_display.c, but if the pipe is off the plane isn't working either. So this single check is good enough. Reviewed-by: Imre Deak <imre.deak@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r--drivers/gpu/drm/i915/intel_tv.c62
1 files changed, 21 insertions, 41 deletions
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 3fd1ab376883..722fcb709f4d 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1026,7 +1026,8 @@ static void intel_tv_mode_set(struct intel_encoder *encoder)
1026 const struct video_levels *video_levels; 1026 const struct video_levels *video_levels;
1027 const struct color_conversion *color_conversion; 1027 const struct color_conversion *color_conversion;
1028 bool burst_ena; 1028 bool burst_ena;
1029 int pipe = intel_crtc->pipe; 1029 int xpos = 0x0, ypos = 0x0;
1030 unsigned int xsize, ysize;
1030 1031
1031 if (!tv_mode) 1032 if (!tv_mode)
1032 return; /* can't happen (mode_prepare prevents this) */ 1033 return; /* can't happen (mode_prepare prevents this) */
@@ -1110,46 +1111,25 @@ static void intel_tv_mode_set(struct intel_encoder *encoder)
1110 I915_WRITE(TV_CLR_LEVEL, 1111 I915_WRITE(TV_CLR_LEVEL,
1111 ((video_levels->black << TV_BLACK_LEVEL_SHIFT) | 1112 ((video_levels->black << TV_BLACK_LEVEL_SHIFT) |
1112 (video_levels->blank << TV_BLANK_LEVEL_SHIFT))); 1113 (video_levels->blank << TV_BLANK_LEVEL_SHIFT)));
1113 { 1114
1114 int pipeconf_reg = PIPECONF(pipe); 1115 assert_pipe_disabled(dev_priv, intel_crtc->pipe);
1115 int dspcntr_reg = DSPCNTR(intel_crtc->plane); 1116
1116 int pipeconf = I915_READ(pipeconf_reg); 1117 /* Filter ctl must be set before TV_WIN_SIZE */
1117 int dspcntr = I915_READ(dspcntr_reg); 1118 I915_WRITE(TV_FILTER_CTL_1, TV_AUTO_SCALE);
1118 int xpos = 0x0, ypos = 0x0; 1119 xsize = tv_mode->hblank_start - tv_mode->hblank_end;
1119 unsigned int xsize, ysize; 1120 if (tv_mode->progressive)
1120 /* Pipe must be off here */ 1121 ysize = tv_mode->nbr_end + 1;
1121 I915_WRITE(dspcntr_reg, dspcntr & ~DISPLAY_PLANE_ENABLE); 1122 else
1122 intel_flush_primary_plane(dev_priv, intel_crtc->plane); 1123 ysize = 2*tv_mode->nbr_end + 1;
1123 1124
1124 /* Wait for vblank for the disable to take effect */ 1125 xpos += intel_tv->margin[TV_MARGIN_LEFT];
1125 if (IS_GEN2(dev)) 1126 ypos += intel_tv->margin[TV_MARGIN_TOP];
1126 intel_wait_for_vblank(dev, intel_crtc->pipe); 1127 xsize -= (intel_tv->margin[TV_MARGIN_LEFT] +
1127 1128 intel_tv->margin[TV_MARGIN_RIGHT]);
1128 I915_WRITE(pipeconf_reg, pipeconf & ~PIPECONF_ENABLE); 1129 ysize -= (intel_tv->margin[TV_MARGIN_TOP] +
1129 /* Wait for vblank for the disable to take effect. */ 1130 intel_tv->margin[TV_MARGIN_BOTTOM]);
1130 intel_wait_for_pipe_off(dev, intel_crtc->pipe); 1131 I915_WRITE(TV_WIN_POS, (xpos<<16)|ypos);
1131 1132 I915_WRITE(TV_WIN_SIZE, (xsize<<16)|ysize);
1132 /* Filter ctl must be set before TV_WIN_SIZE */
1133 I915_WRITE(TV_FILTER_CTL_1, TV_AUTO_SCALE);
1134 xsize = tv_mode->hblank_start - tv_mode->hblank_end;
1135 if (tv_mode->progressive)
1136 ysize = tv_mode->nbr_end + 1;
1137 else
1138 ysize = 2*tv_mode->nbr_end + 1;
1139
1140 xpos += intel_tv->margin[TV_MARGIN_LEFT];
1141 ypos += intel_tv->margin[TV_MARGIN_TOP];
1142 xsize -= (intel_tv->margin[TV_MARGIN_LEFT] +
1143 intel_tv->margin[TV_MARGIN_RIGHT]);
1144 ysize -= (intel_tv->margin[TV_MARGIN_TOP] +
1145 intel_tv->margin[TV_MARGIN_BOTTOM]);
1146 I915_WRITE(TV_WIN_POS, (xpos<<16)|ypos);
1147 I915_WRITE(TV_WIN_SIZE, (xsize<<16)|ysize);
1148
1149 I915_WRITE(pipeconf_reg, pipeconf);
1150 I915_WRITE(dspcntr_reg, dspcntr);
1151 intel_flush_primary_plane(dev_priv, intel_crtc->plane);
1152 }
1153 1133
1154 j = 0; 1134 j = 0;
1155 for (i = 0; i < 60; i++) 1135 for (i = 0; i < 60; i++)