From patchwork Thu Apr 11 14:29:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 2428981 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 1DD393FD8C for ; Thu, 11 Apr 2013 14:32:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1490CE663B for ; Thu, 11 Apr 2013 07:32:08 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com [74.125.83.53]) by gabe.freedesktop.org (Postfix) with ESMTP id CCDAAE61CF for ; Thu, 11 Apr 2013 07:30:49 -0700 (PDT) Received: by mail-ee0-f53.google.com with SMTP id c13so773184eek.26 for ; Thu, 11 Apr 2013 07:30:48 -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=cJkMnHWMG86V5mdRpu3a/y9Ya2dtZho/SuYys8Z9EdA=; b=BdXO7M85T2Ht203R2s65ftBPE2uFSloGLwIHs7f+YN1Qog2KcXDeSqDIkaUDNt2dIS +LIqztV7eRIN6g+7JAbMKXqvmAitVPA81D9KyLUPJcwdNt+EKFlwXgs2ysReUq0mz6Bp 7zMeiWW3HytbqWYdAcqH+Q1qVbF68CxoPsePE= 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=cJkMnHWMG86V5mdRpu3a/y9Ya2dtZho/SuYys8Z9EdA=; b=EySsnXlgsfX16j/t9nfoTBNc/NJyVs/VFl/5J56ck1JeLUKts6akfNpIKitv6tCYKs +kELwRv63U7nV67J8HHfDYkIk35joyOy7g5oHfpsETrgSELTv/IVeiEXxNaAKzYr0mg7 BmIi3lRd5hVmKtcF3NMdd5ZdDyFys1YkYT3lwuIaLPXEtaXgsUfcSCNRihXvpNOlKc7t 6d5c3NSjK3qGiUgi4jOYz0Rt1ToxrcPSYxm8jtUVen+v99liOPgfkMrTTmXthN4DyP+8 akr9g6RCG0jkhzgfd14ob1fl5j4VCMuoQ2J4EkVU9wlXr5VHUlbbATWYHhxk515aXsTc I8CA== X-Received: by 10.15.21.1 with SMTP id c1mr17450401eeu.36.1365690648817; Thu, 11 Apr 2013 07:30:48 -0700 (PDT) Received: from gina.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id a41sm5965845eei.4.2013.04.11.07.30.46 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Apr 2013 07:30:46 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Thu, 11 Apr 2013 16:29:06 +0200 Message-Id: <1365690550-5716-3-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1365690550-5716-1-git-send-email-daniel.vetter@ffwll.ch> References: <1365690550-5716-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQnNf6ZwXA5nVeuFa5QKYfqrCoBLR584hYQL9T0e6TqSulavRIK2swDtsiAV2hvgEP+dijbq Cc: Daniel Vetter , Mika Kuoppala , Hans de Bruin Subject: [Intel-gfx] [PATCH 3/7] drm/i915: Fixup pfit disabling for gen2/3 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 The recent rework of the pfit handling didn't take into account that the panel fitter is fixed to pipe B: commit 24a1f16de97c4cf0029d9acd04be06db32208726 Author: Mika Kuoppala Date: Fri Feb 8 16:35:37 2013 +0200 drm/i915: disable shared panel fitter for pipe Fix this up by properly computing the pipe the pfit is on. Also extract the logic into its own function, add a debug assert to check that the pipe is off (mostly just documentation) and add some debug output. If pipe A was disabled after pipe B was set up, the panel fitter will be disabled. Now most userspace doesn't do modesets in this order, which is why I couldn't ever reproduce this and why it took me so long to figure out. We really need hw state readout and check support for the pannel fitter ... Reported-by: Hans de Bruin Cc: Mika Kuoppala Cc: Hans de Bruin References: http://permalink.gmane.org/gmane.comp.freedesktop.xorg.drivers.intel/19049 Signed-off-by: Daniel Vetter Reviewed-by: Chris Wilson --- drivers/gpu/drm/i915/intel_display.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 58c6bb6..38b8a77 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -3623,6 +3623,26 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc) encoder->enable(encoder); } +static void i9xx_pfit_disable(struct intel_crtc *crtc) +{ + struct drm_device *dev = crtc->base.dev; + struct drm_i915_private *dev_priv = dev->dev_private; + enum pipe pipe; + uint32_t pctl = I915_READ(PFIT_CONTROL); + + assert_pipe_disabled(dev_priv, crtc->pipe); + + if (INTEL_INFO(dev)->gen >= 4) + pipe = (pctl & PFIT_PIPE_MASK) >> PFIT_PIPE_SHIFT; + else + pipe = PIPE_B; + + if (pipe == crtc->pipe) { + DRM_DEBUG_DRIVER("disabling pfit, current: 0x%08x\n", pctl); + I915_WRITE(PFIT_CONTROL, 0); + } +} + static void i9xx_crtc_disable(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; @@ -3631,8 +3651,6 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc) struct intel_encoder *encoder; int pipe = intel_crtc->pipe; int plane = intel_crtc->plane; - u32 pctl; - if (!intel_crtc->active) return; @@ -3652,11 +3670,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc) intel_disable_plane(dev_priv, plane, pipe); intel_disable_pipe(dev_priv, pipe); - /* Disable pannel fitter if it is on this pipe. */ - pctl = I915_READ(PFIT_CONTROL); - if ((pctl & PFIT_ENABLE) && - ((pctl & PFIT_PIPE_MASK) >> PFIT_PIPE_SHIFT) == pipe) - I915_WRITE(PFIT_CONTROL, 0); + i9xx_pfit_disable(intel_crtc); intel_disable_pll(dev_priv, pipe);