From patchwork Wed Jan 13 14:33:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Bainbridge X-Patchwork-Id: 8026681 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8AB2FBEEE5 for ; Wed, 13 Jan 2016 16:04:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0BCD720502 for ; Wed, 13 Jan 2016 16:04:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 10D1A204B5 for ; Wed, 13 Jan 2016 16:04:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D19DF6E94F; Wed, 13 Jan 2016 08:04:14 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4CDF26E7AE for ; Wed, 13 Jan 2016 06:33:52 -0800 (PST) Received: by mail-wm0-f49.google.com with SMTP id f206so298220578wmf.0 for ; Wed, 13 Jan 2016 06:33:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=6BcI3ZISncqF3ltqjcrb2+zn86KFfVGyvmko4vAdzIg=; b=jJRTgvXJJMx1V8DYJ+z7yekRb1TEBl2ikT5VpFM0UbqBYMbvEObrF2vP4MUBPuIon/ JyH3bRLXKQywNMYtyTqMxNVYI2R2R+E0clJJMtlrcmieTUTDZxStXhQUqU40UFx2WG0a gOj6DPAtaVXgq0r/DJItWBXch9wPKZYNo/WV5CtRggYSPgFfeS0ggX1eeMKqyePf2SHF KKeb5Obx7ChvMb2gnqLwctbohy9l9KY2fnOLFmbG9aClSs5ec0kDQcBEQWtwV0UMBoe/ iof0d7eVdehVi1K2MW/8wZZ6tKkRz4ORCEAOdQ0QbK1VUHz42pu9UTeb3rGWi3g7DsFj XQlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=6BcI3ZISncqF3ltqjcrb2+zn86KFfVGyvmko4vAdzIg=; b=M1gRr7KKPE8CYxQngCowH4+DpAFUg4oRDkfhJpktYJPQPSWlrLQuxy0ARmTXsk+U6m j22FWtk9l3SAGZYcSH5wBUreeSsQe+1B5yLTaVLvXv2AJjF1Uh666vxw1yCglwC8S/WE s25g63auaXlUBaZ8aqOP7+EUOwQCdfpzAkhnNiAFh4vEuOau3eeba347r7dLSIr9VCsj szQb7ysCpV14RZxGH/XETRYKYeOV82BF44a6G/nw4zUsmoLTkbOoMmXxqZGdnyKKbzIt JtM48FBxBNRBf7hQHOl0qEUjurwv5PY44GN9y/PZilbFRMJFOJDUV28dq/UzCex6ZGoH VkGg== X-Gm-Message-State: ALoCoQm12McSxondy2lpaywra9e1v//ApGk+VSU+VQo+v5ECQmwYZuxW0YUys8EeYdbxIiUGQWxd5SBApyIuBnSH4sXhQNwzIg== X-Received: by 10.194.250.39 with SMTP id yz7mr163880856wjc.92.1452695631047; Wed, 13 Jan 2016 06:33:51 -0800 (PST) Received: from localhost (cpc5-sgyl32-2-0-cust224.sgyl.cable.virginm.net. [94.174.200.225]) by smtp.gmail.com with ESMTPSA id u12sm22445999wmu.10.2016.01.13.06.33.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jan 2016 06:33:49 -0800 (PST) Date: Wed, 13 Jan 2016 14:33:47 +0000 From: Chris Bainbridge To: daniel.vetter@intel.com Message-ID: <20160113143347.GA4866@localhost> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Mailman-Approved-At: Wed, 13 Jan 2016 08:04:14 -0800 Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [Intel-gfx] [PATCH] drm/i915: disable non-sequential pfits on ivb/hsw X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The existing code assumes a sequential mapping of panel fitters to pipes (pfit0-pipeA, pfit1-pipeB, pfit2-pipeC), but boot firmware can arbitrarily assign any pipe to a pfit on IVB hardware e.g. Macbook UEFI uses pfit 0 and pipe C for eDP1 when the firmware boots in a non-16:10 resolution (the last-used resolution is stored in NVRAM by OS X so the firmware can immediately restore it at boot). When this happens, the display will appear letterboxed due to incorrect aspect ratio and attempting to switch to alternative resolutions will fail. Fix this by disabling any panel fitters which have been non-sequentially assigned at boot time. Link: https://bugs.freedesktop.org/show_bug.cgi?id=93523 Signed-off-by: Chris Bainbridge --- drivers/gpu/drm/i915/intel_display.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 32cf97346978..9e588139a2dd 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -9170,6 +9170,24 @@ static void ironlake_get_pfit_config(struct intel_crtc *crtc, struct drm_device *dev = crtc->base.dev; struct drm_i915_private *dev_priv = dev->dev_private; uint32_t tmp; + int pipe; + + /* + * PF_CTL assumes panel fitter 0 is on pipe A, panel fitter 1 is on + * pipe B, and panel fitter 2 is on pipe C, but firmware can init IVB + * panel fitters to any arbitrary pipe (Macbook UEFI uses pfit 0 for + * pipe C), so find and disable any other mappings. + */ + for (pipe = 0; pipe < INTEL_INFO(dev)->num_pipes; pipe++) { + tmp = I915_READ(PF_CTL(pipe)); + if (IS_GEN7(dev) && (tmp & PF_ENABLE) && + PF_PIPE_SEL_IVB(pipe) != (tmp & PF_PIPE_SEL_MASK_IVB)) { + DRM_DEBUG_KMS("disabling initial panel fitter\n"); + I915_WRITE(PF_CTL(pipe), 0); + I915_WRITE(PF_WIN_POS(pipe), 0); + I915_WRITE(PF_WIN_SZ(pipe), 0); + } + } tmp = I915_READ(PF_CTL(crtc->pipe)); @@ -9177,14 +9195,6 @@ static void ironlake_get_pfit_config(struct intel_crtc *crtc, pipe_config->pch_pfit.enabled = true; pipe_config->pch_pfit.pos = I915_READ(PF_WIN_POS(crtc->pipe)); pipe_config->pch_pfit.size = I915_READ(PF_WIN_SZ(crtc->pipe)); - - /* We currently do not free assignements of panel fitters on - * ivb/hsw (since we don't use the higher upscaling modes which - * differentiates them) so just WARN about this case for now. */ - if (IS_GEN7(dev)) { - WARN_ON((tmp & PF_PIPE_SEL_MASK_IVB) != - PF_PIPE_SEL_IVB(crtc->pipe)); - } } }