From patchwork Wed Jul 11 14:28:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1184111 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 560503FC5A for ; Wed, 11 Jul 2012 16:20:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 207B6A0ED5 for ; Wed, 11 Jul 2012 09:20:36 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by gabe.freedesktop.org (Postfix) with ESMTP id A59D19EED2 for ; Wed, 11 Jul 2012 08:36:28 -0700 (PDT) Received: by mail-we0-f177.google.com with SMTP id r3so960506wey.36 for ; Wed, 11 Jul 2012 08:36:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=xrnysel2yyUKMpxxPHn8xOECLzSDGEdSTdPAcMyAZJk=; b=dpHySyZRoCd7BV2RzwkK3QM9kLQaWJCE9luSIhLh0H5eLNO9QOwqZvlzO/ePhBFHuP RFyMpDD9PYR+dcU2OyuRxhAi7faqXwP8vChHl2z+S1W7xxYUGkzz2Hq/l3SRaCSxkSGW PjxROx7q3OxMxC7NP+5UBJ4JYVYX5Y5YmuWVo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=xrnysel2yyUKMpxxPHn8xOECLzSDGEdSTdPAcMyAZJk=; b=XEhOoA3iZGcLwMAU7eXwJvh7ocMGw6JPlaKbcS8LZn/e3IRVbz8Sd0Xdtso6xXm4AK wZFQ/XazLQQL5jwRDXEdebJTeIJWaVKryT+oqsHiIht4ivrGRCpvJZVusjEPoT9+tJor weo504MD2jW57iKQd+E8C+kWESRF7xecb+1FST2K1ZnoKLMHsrua93SRGp7TxKB5Cy8v MMbgo78KVmvRmPCnsBCVqEaAmDOR8cReQdcC3uXPeiiU2JRXL5KjQTzHoil26SEhwDIq fe92D/nUXPrXD9zeBuoQBW4VZYvKl6xETheIXFvTmJPbb1kn0HOOM+GQgsq/WqSE83IP 62sQ== Received: by 10.180.82.39 with SMTP id f7mr15044597wiy.2.1342020988370; Wed, 11 Jul 2012 08:36:28 -0700 (PDT) Received: from wespe.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id bc2sm5777080wib.0.2012.07.11.08.36.26 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 11 Jul 2012 08:36:27 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Wed, 11 Jul 2012 16:28:41 +0200 Message-Id: <1342016944-23395-59-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1342016944-23395-1-git-send-email-daniel.vetter@ffwll.ch> References: <1342016944-23395-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQmaQMAYnHHva40OejV68z7VyQ0/XXsgvVwgRBFZR1d1CN2vfeEci3H783zKnFGcwuLzcejs Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 58/81] drm/i915: move output commit and crtc disabling into set_mode X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org 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 ... Signed-Off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_display.c | 34 ++++++++++++++++++---------------- 1 files changed, 18 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index edd7efc..af8855e 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -6654,9 +6654,13 @@ bool intel_crtc_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) @@ -7018,21 +7022,22 @@ 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_crtc_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_crtc_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, @@ -7040,7 +7045,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); @@ -7053,8 +7057,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_crtc_set_mode(save_set.crtc, save_set.mode, save_set.x,