summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-07-05 23:36:17 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-09-06 08:04:23 +0200
commit87f1faa630b2045ccb6ab29f18c62279ddd7ef17 (patch)
tree1e33115fc84f927bd749435394577ae64b22c2ea
parentdrm/i915: remove crtc disabling special case (diff)
downloadlinux-87f1faa630b2045ccb6ab29f18c62279ddd7ef17.tar.xz
linux-87f1faa630b2045ccb6ab29f18c62279ddd7ef17.zip
drm/i915: move output commit and crtc disabling into set_mode
It's rather pointless to compute crtc->enabled twice right away ;-) The only thing we really have to be careful about is that we frob the dpms state only after a successful modeset and when we've actually haven't just disabled the crtc. Hooray for convoluted interfaces ... Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/intel_display.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0f2c2e1ec6ee..0bfc7993feb5 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6653,9 +6653,13 @@ bool intel_set_mode(struct drm_crtc *crtc,
struct drm_encoder *encoder;
bool ret = true;
+ intel_modeset_commit_output_state(dev);
+
crtc->enabled = drm_helper_crtc_in_use(crtc);
- if (!crtc->enabled)
+ if (!crtc->enabled) {
+ drm_helper_disable_unused_functions(dev);
return true;
+ }
adjusted_mode = drm_mode_duplicate(dev, mode);
if (!adjusted_mode)
@@ -7002,20 +7006,21 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
goto fail;
if (config->mode_changed) {
- intel_modeset_commit_output_state(dev);
-
- set->crtc->enabled = drm_helper_crtc_in_use(set->crtc);
- if (set->crtc->enabled) {
+ if (set->mode) {
DRM_DEBUG_KMS("attempting to set mode from"
" userspace\n");
drm_mode_debug_printmodeline(set->mode);
- if (!intel_set_mode(set->crtc, set->mode,
- set->x, set->y, set->fb)) {
- DRM_ERROR("failed to set mode on [CRTC:%d]\n",
- set->crtc->base.id);
- ret = -EINVAL;
- goto fail;
- }
+ }
+
+ if (!intel_set_mode(set->crtc, set->mode,
+ set->x, set->y, set->fb)) {
+ DRM_ERROR("failed to set mode on [CRTC:%d]\n",
+ set->crtc->base.id);
+ ret = -EINVAL;
+ goto fail;
+ }
+
+ if (set->crtc->enabled) {
DRM_DEBUG_KMS("Setting connector DPMS state to on\n");
for (i = 0; i < set->num_connectors; i++) {
DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set DPMS on\n", set->connectors[i]->base.id,
@@ -7023,7 +7028,6 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
set->connectors[i]->funcs->dpms(set->connectors[i], DRM_MODE_DPMS_ON);
}
}
- drm_helper_disable_unused_functions(dev);
} else if (config->fb_changed) {
ret = intel_pipe_set_base(set->crtc,
set->x, set->y, set->fb);
@@ -7036,8 +7040,6 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
fail:
intel_set_config_restore_state(dev, config);
- intel_modeset_commit_output_state(dev);
-
/* Try to restore the config */
if (config->mode_changed &&
!intel_set_mode(save_set.crtc, save_set.mode,