From patchwork Tue Apr 9 19:51:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 2416701 Return-Path: X-Original-To: patchwork-dri-devel@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 8ADD53FC71 for ; Tue, 9 Apr 2013 19:48:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3FF1DE62CF for ; Tue, 9 Apr 2013 12:48:51 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by gabe.freedesktop.org (Postfix) with ESMTP id A726BE5F08 for ; Tue, 9 Apr 2013 12:48:37 -0700 (PDT) Received: by mail-ee0-f54.google.com with SMTP id e51so3156230eek.41 for ; Tue, 09 Apr 2013 12:48:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=lnX0Vsc7+vKqe+hUWGembs28LsB7fXnlk9/OCzjKkys=; b=Had58n0u1/0fYc+Cf/dRM9/SV2lO6vRzTKjzUIN34HBvmal/9cKXhM0CRTz0gkuYAI xjWOrfgMIU+12P4B3MQGAHIgp74SurDcw2puwugyMVGXZrzzM4w1G7r4p+Lnf2ZTItlD y0Ua7gZraJL4FrfDIScBJUaMWuiYZ1oBfxEQs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=lnX0Vsc7+vKqe+hUWGembs28LsB7fXnlk9/OCzjKkys=; b=OmQyyPA24Cj+cMT/6r1Lw54CODnrkq6SKretjnfcAiE2gAJDWr7X7LuhfuX6WYp0C3 zYZstSJHf7HlzE/Dab2yobsYUh/toJzqdr3VR2XWYzoqZ4yCRvpz1tYq6wtTFJM3KN9z Pfj33ptaul3LVvicvBbcENWa52zd9EKbsfzvM+U/7AReJ3JBW8dPZ+8CQCThCQ1PBfDN iEfhvb/so0xDIowAJzpns9dfGfqRzNWUSprrLIjpZ7T6wzXAiOtnNGYGTApW2JFZ7IjU mbQ17iNGr7cexgIS6QomAWEfbgLYvZtiDSO3V78YSL1IUz5SZr73ziGHJHqMPh8AFTab hZ8w== X-Received: by 10.14.179.5 with SMTP id g5mr63299974eem.41.1365536915570; Tue, 09 Apr 2013 12:48:35 -0700 (PDT) Received: from phenom.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id ca4sm39825694eeb.15.2013.04.09.12.48.32 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Apr 2013 12:48:33 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Subject: [PATCH] drm/i915: don't check inconsistent modeset state when force-restoring Date: Tue, 9 Apr 2013 21:51:30 +0200 Message-Id: <1365537090-11518-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <20130409172820.GC27612@phenom.ffwll.local> References: <20130409172820.GC27612@phenom.ffwll.local> X-Gm-Message-State: ALoCoQkbpOKvXy2YVuB8rduLctMlcxjwKUagAN/xwtlHc85GCa0JcJpG8aIMPzAMCJfIsHVRin0d Cc: Daniel Vetter , Richard Cochran , LKML , DRI Development , Tomas Melin , stable@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org It will be only consistent once we've restored all the crtcs. Since a bunch of other callers also want to just restore a single crtc, add a boolean to disable checking only where it doesn't make sense. Note that intel_modeset_setup_hw_state already has a call to intel_modeset_check_state at the end, so we don't reduce the amount of checking. v2: Try harder not to create a big patch (Chris). References: https://lkml.org/lkml/2013/3/16/60 Cc: Tomas Melin Cc: Richard Cochran Cc: Chris Wilson Cc: stable@vger.kernel.org Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_display.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 8809813..2959fb8 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -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,25 @@ out: return ret; } +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) { - intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->fb); + __intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->fb); + + intel_modeset_check_state(crtc->dev); } #undef for_each_intel_crtc_masked @@ -9333,10 +9347,16 @@ setup_pipes: } if (force_restore) { + /* + * We need to use raw interfaces for restoring state to avoid + * checking (bogus) intermediate states. + */ for_each_pipe(pipe) { struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; - intel_crtc_restore_mode(crtc); + + __intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, + crtc->fb); } list_for_each_entry(plane, &dev->mode_config.plane_list, head) intel_plane_restore(plane);