aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-04-12 13:06:51 -0400
committerKeith Packard <keithp@keithp.com>2011-04-12 16:08:33 -0400
commitf6e5b1603b8bb7131b6778d0d4e2e5dda120a379 (patch)
tree1c795016a3ac7f76242766227374005ad24088a2 /drivers/gpu/drm/i915/intel_display.c
parentccacfec6cc22157971bd970486fd3fd4972b8e2e (diff)
drm/i915: Sanitize the output registers after resume
Similar to booting, we need to inspect the state left by the BIOS and remove any conflicting bits before we take over. The example reported by Seth Forshee is very similar to the bug we encountered with the state left by grub2, that the crtc pipe<->planning mapping was reversed from our expectations and so we failed to turn off the outputs when booting or, in this case, resuming. This may be in fact the same bug, but triggered at resume time. This patch rearranges the code we already have to clear up the conflicting state upon init and calls it from reset (which is called after we have lost control of the hardware, i.e. along both the boot and resume paths) instead. Reported-and-tested-by: Seth Forshee <seth.forshee@canonical.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=35796 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: stable@kernel.org Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c68
1 files changed, 36 insertions, 32 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 432fc04c6bff..4fc21e047a2d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6215,36 +6215,6 @@ cleanup_work:
6215 return ret; 6215 return ret;
6216} 6216}
6217 6217
6218static void intel_crtc_reset(struct drm_crtc *crtc)
6219{
6220 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6221
6222 /* Reset flags back to the 'unknown' status so that they
6223 * will be correctly set on the initial modeset.
6224 */
6225 intel_crtc->dpms_mode = -1;
6226}
6227
6228static struct drm_crtc_helper_funcs intel_helper_funcs = {
6229 .dpms = intel_crtc_dpms,
6230 .mode_fixup = intel_crtc_mode_fixup,
6231 .mode_set = intel_crtc_mode_set,
6232 .mode_set_base = intel_pipe_set_base,
6233 .mode_set_base_atomic = intel_pipe_set_base_atomic,
6234 .load_lut = intel_crtc_load_lut,
6235 .disable = intel_crtc_disable,
6236};
6237
6238static const struct drm_crtc_funcs intel_crtc_funcs = {
6239 .reset = intel_crtc_reset,
6240 .cursor_set = intel_crtc_cursor_set,
6241 .cursor_move = intel_crtc_cursor_move,
6242 .gamma_set = intel_crtc_gamma_set,
6243 .set_config = drm_crtc_helper_set_config,
6244 .destroy = intel_crtc_destroy,
6245 .page_flip = intel_crtc_page_flip,
6246};
6247
6248static void intel_sanitize_modesetting(struct drm_device *dev, 6218static void intel_sanitize_modesetting(struct drm_device *dev,
6249 int pipe, int plane) 6219 int pipe, int plane)
6250{ 6220{
@@ -6281,6 +6251,42 @@ static void intel_sanitize_modesetting(struct drm_device *dev,
6281 intel_disable_pipe(dev_priv, pipe); 6251 intel_disable_pipe(dev_priv, pipe);
6282} 6252}
6283 6253
6254static void intel_crtc_reset(struct drm_crtc *crtc)
6255{
6256 struct drm_device *dev = crtc->dev;
6257 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6258
6259 /* Reset flags back to the 'unknown' status so that they
6260 * will be correctly set on the initial modeset.
6261 */
6262 intel_crtc->dpms_mode = -1;
6263
6264 /* We need to fix up any BIOS configuration that conflicts with
6265 * our expectations.
6266 */
6267 intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane);
6268}
6269
6270static struct drm_crtc_helper_funcs intel_helper_funcs = {
6271 .dpms = intel_crtc_dpms,
6272 .mode_fixup = intel_crtc_mode_fixup,
6273 .mode_set = intel_crtc_mode_set,
6274 .mode_set_base = intel_pipe_set_base,
6275 .mode_set_base_atomic = intel_pipe_set_base_atomic,
6276 .load_lut = intel_crtc_load_lut,
6277 .disable = intel_crtc_disable,
6278};
6279
6280static const struct drm_crtc_funcs intel_crtc_funcs = {
6281 .reset = intel_crtc_reset,
6282 .cursor_set = intel_crtc_cursor_set,
6283 .cursor_move = intel_crtc_cursor_move,
6284 .gamma_set = intel_crtc_gamma_set,
6285 .set_config = drm_crtc_helper_set_config,
6286 .destroy = intel_crtc_destroy,
6287 .page_flip = intel_crtc_page_flip,
6288};
6289
6284static void intel_crtc_init(struct drm_device *dev, int pipe) 6290static void intel_crtc_init(struct drm_device *dev, int pipe)
6285{ 6291{
6286 drm_i915_private_t *dev_priv = dev->dev_private; 6292 drm_i915_private_t *dev_priv = dev->dev_private;
@@ -6330,8 +6336,6 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
6330 6336
6331 setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer, 6337 setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer,
6332 (unsigned long)intel_crtc); 6338 (unsigned long)intel_crtc);
6333
6334 intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane);
6335} 6339}
6336 6340
6337int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, 6341int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,