@@ -7916,9 +7916,9 @@ intel_modeset_check_state(struct drm_device *dev)
}
}
-int intel_set_mode(struct drm_crtc *crtc,
- struct drm_display_mode *mode,
- int x, int y, struct drm_framebuffer *fb)
+static int __intel_set_mode(struct drm_crtc *crtc,
+ struct drm_display_mode *mode,
+ int x, int y, struct drm_framebuffer *fb)
{
struct drm_device *dev = crtc->dev;
drm_i915_private_t *dev_priv = dev->dev_private;
@@ -8012,8 +8012,6 @@ done:
if (ret && crtc->enabled) {
crtc->hwmode = *saved_hwmode;
crtc->mode = *saved_mode;
- } else {
- intel_modeset_check_state(dev);
}
out:
@@ -8022,9 +8020,27 @@ out:
return ret;
}
-void intel_crtc_restore_mode(struct drm_crtc *crtc)
+int intel_set_mode(struct drm_crtc *crtc,
+ struct drm_display_mode *mode,
+ int x, int y, struct drm_framebuffer *fb)
+{
+ int ret;
+
+ ret = __intel_set_mode(crtc, mode, x, y, fb);
+
+ if (ret == 0)
+ intel_modeset_check_state(crtc->dev);
+
+ return ret;
+}
+
+void intel_crtc_restore_mode(struct drm_crtc *crtc,
+ bool check)
{
- intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->fb);
+ __intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->fb);
+
+ if (check)
+ intel_modeset_check_state(crtc->dev);
}
#undef for_each_intel_crtc_masked
@@ -9336,7 +9352,7 @@ setup_pipes:
for_each_pipe(pipe) {
struct drm_crtc *crtc =
dev_priv->pipe_to_crtc_mapping[pipe];
- intel_crtc_restore_mode(crtc);
+ intel_crtc_restore_mode(crtc, false);
}
list_for_each_entry(plane, &dev->mode_config.plane_list, head)
intel_plane_restore(plane);
@@ -2466,7 +2466,7 @@ intel_dp_set_property(struct drm_connector *connector,
done:
if (intel_encoder->base.crtc)
- intel_crtc_restore_mode(intel_encoder->base.crtc);
+ intel_crtc_restore_mode(intel_encoder->base.crtc, true);
return 0;
}
@@ -540,7 +540,7 @@ struct intel_set_config {
extern int intel_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode,
int x, int y, struct drm_framebuffer *old_fb);
extern void intel_modeset_disable(struct drm_device *dev);
-extern void intel_crtc_restore_mode(struct drm_crtc *crtc);
+extern void intel_crtc_restore_mode(struct drm_crtc *crtc, bool check);
extern void intel_crtc_load_lut(struct drm_crtc *crtc);
extern void intel_crtc_update_dpms(struct drm_crtc *crtc);
extern void intel_encoder_destroy(struct drm_encoder *encoder);
@@ -942,7 +942,7 @@ intel_hdmi_set_property(struct drm_connector *connector,
done:
if (intel_dig_port->base.base.crtc)
- intel_crtc_restore_mode(intel_dig_port->base.base.crtc);
+ intel_crtc_restore_mode(intel_dig_port->base.base.crtc, true);
return 0;
}
@@ -666,7 +666,7 @@ static int intel_lvds_set_property(struct drm_connector *connector,
* If the CRTC is enabled, the display will be changed
* according to the new panel fitting mode.
*/
- intel_crtc_restore_mode(crtc);
+ intel_crtc_restore_mode(crtc, true);
}
}
@@ -2044,7 +2044,7 @@ set_value:
done:
if (intel_sdvo->base.base.crtc)
- intel_crtc_restore_mode(intel_sdvo->base.base.crtc);
+ intel_crtc_restore_mode(intel_sdvo->base.base.crtc, true);
return 0;
#undef CHECK_PROPERTY
@@ -1481,7 +1481,7 @@ intel_tv_set_property(struct drm_connector *connector, struct drm_property *prop
}
if (changed && crtc)
- intel_crtc_restore_mode(crtc);
+ intel_crtc_restore_mode(crtc, true);
out:
return ret;
}