From patchwork Wed Apr 10 20:10:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 2423191 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 840023FD8C for ; Wed, 10 Apr 2013 20:07:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E059E64E9 for ; Wed, 10 Apr 2013 13:07:39 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f43.google.com (mail-ee0-f43.google.com [74.125.83.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 6CC30E5CE2 for ; Wed, 10 Apr 2013 13:07:25 -0700 (PDT) Received: by mail-ee0-f43.google.com with SMTP id e50so432484eek.16 for ; Wed, 10 Apr 2013 13:07:24 -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=inQAgdV5/ZZFYztRi0z2GhewUl2xdp2O2D4h1hobxy4=; b=XOYRaJAfihOB4ueDKMaXIk1d2OhUYAHSecB25hzI99jSfGitKXp+ApWrC8LiMSSo5g ITTnq0JZy7U1uUnmGwWNz4p91FbMfEV39YcbkGhBtCuBW5JicD22UB0b85d1U32BhBpq M2fmrfe8a7RKB4Zbr1SlUIAfwUZMLUvik7Jcg= 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=inQAgdV5/ZZFYztRi0z2GhewUl2xdp2O2D4h1hobxy4=; b=e1LNmxWRMRWzc3IAQf37WYfLkWMyljk7Ts3gQx3AmegopLJhjK+XHu1qdhtuYrfiv3 IhMtVDFZyvafLxhyJBiBjyDNIrRtOQeO3UIKkWQpShP9l6xm/sa07N3S+wdIvQNqy68L f6VDckjfkfRJNT9zhXTGTI18Y983JZgy7VwW1IloeLshbKgdeihp22wTNrG9ykYnkoA1 rvSZls+FQEhO9gIHgBswv36WAgGjoBlf3kT8n2FdHAK083vjFpOWXu02UmztlraFIkiF b6XY04J6L1atkgRdSdf8Vgzv59Cxto5jDLpIH3cK4evquyt/5kpUn/njg884Yze/rzs5 C41g== X-Received: by 10.15.111.202 with SMTP id cj50mr8965684eeb.6.1365624444589; Wed, 10 Apr 2013 13:07:24 -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 bk42sm1808414eeb.3.2013.04.10.13.07.22 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Apr 2013 13:07:23 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Subject: [PATCH] drm/i915: don't check inconsistent modeset state when force-restoring Date: Wed, 10 Apr 2013 22:10:21 +0200 Message-Id: <1365624621-5683-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-Gm-Message-State: ALoCoQljHDXPAk4f3ECsiqgwb7Et4etWaDIOm5frqOzMggxfKWEpsfPSETJz+AvGpvVIA5YVN0jS 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). v3: Even smaller (still Chris). Also fix a trailing space. v4: Rebased on top of 3.9-rc6. 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 | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index b20d501..5f1eb50 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -7771,9 +7771,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; @@ -7863,8 +7863,6 @@ done: if (ret && crtc->enabled) { crtc->hwmode = *saved_hwmode; crtc->mode = *saved_mode; - } else { - intel_modeset_check_state(dev); } out: @@ -7872,6 +7870,20 @@ 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); @@ -9172,8 +9184,16 @@ void intel_modeset_setup_hw_state(struct drm_device *dev, } if (force_restore) { + /* + * We need to use raw interfaces for restoring state to avoid + * checking (bogus) intermediate states. + */ for_each_pipe(pipe) { - intel_crtc_restore_mode(dev_priv->pipe_to_crtc_mapping[pipe]); + struct drm_crtc *crtc = + dev_priv->pipe_to_crtc_mapping[pipe]; + + __intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, + crtc->fb); } i915_redisable_vga(dev);