From patchwork Wed Nov 5 22:26:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 5238431 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9336AC11AC for ; Wed, 5 Nov 2014 22:33:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8BC612015E for ; Wed, 5 Nov 2014 22:33:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 979C220107 for ; Wed, 5 Nov 2014 22:33:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 147AB6E559; Wed, 5 Nov 2014 14:33:01 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org X-Greylist: delayed 396 seconds by postgrey-1.34 at gabe; Wed, 05 Nov 2014 14:33:00 PST Received: from gproxy8-pub.mail.unifiedlayer.com (gproxy8-pub.mail.unifiedlayer.com [67.222.33.93]) by gabe.freedesktop.org (Postfix) with SMTP id 3D1E06E559 for ; Wed, 5 Nov 2014 14:33:00 -0800 (PST) Received: (qmail 29191 invoked by uid 0); 5 Nov 2014 22:26:20 -0000 Received: from unknown (HELO cmgw2) (10.0.90.83) by gproxy8.mail.unifiedlayer.com with SMTP; 5 Nov 2014 22:26:20 -0000 Received: from box514.bluehost.com ([74.220.219.114]) by cmgw2 with id BySG1p00w2UhLwi01ySKLW; Wed, 05 Nov 2014 15:26:19 -0700 X-Authority-Analysis: v=2.1 cv=W5+rC3mk c=1 sm=1 tr=0 a=9W6Fsu4pMcyimqnCr1W0/w==:117 a=9W6Fsu4pMcyimqnCr1W0/w==:17 a=cNaOj0WVAAAA:8 a=f5113yIGAAAA:8 a=TBVoxVdAAAAA:8 a=GhZ5P8ky69gA:10 a=noBwr2J6l1kA:10 a=iRCIvv_-eFrSe0sd53UA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuousgeek.org; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=i0Abjmlnn0SR7W4WsF6h1E2Cr1PGJTPNRE8m/jYFViI=; b=L75uBXBSy3MEjnItERWCknT9XoPr4fERgKgRHrzuc/dGc72hb6BVMuHzuE7RTlP0ohepmqmpwcjZJK8cH6rhTViXl95D2dLN5/ULmOy6PcfkdkuC/AiUeAdQ1LI6vfjS; Received: from [67.161.37.189] (port=33699 helo=localhost.localdomain) by box514.bluehost.com with esmtpsa (TLSv1.2:AES128-SHA256:128) (Exim 4.82) (envelope-from ) id 1Xm91t-0006zP-M4; Wed, 05 Nov 2014 15:26:17 -0700 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Wed, 5 Nov 2014 14:26:11 -0800 Message-Id: <1415226371-1880-6-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1415226371-1880-1-git-send-email-jbarnes@virtuousgeek.org> References: <1415226371-1880-1-git-send-email-jbarnes@virtuousgeek.org> X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 67.161.37.189 authed with jbarnes@virtuousgeek.org} Cc: shuang.he@linux.intel.com Subject: [Intel-gfx] [PATCH 6/6] drm/i915: calculate pfit changes in set_config v2 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 This should allow us to avoid mode sets for some panel fitter config changes. v2: - fixup pfit comment (Ander) Signed-off-by: Jesse Barnes Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com) --- drivers/gpu/drm/i915/intel_display.c | 61 +++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3f1515d..49281d7 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -2835,17 +2835,8 @@ static void intel_update_pipe_size(struct intel_crtc *crtc) return; /* - * Update pipe size and adjust fitter if needed: the reason for this is - * that in compute_mode_changes we check the native mode (not the pfit - * mode) to see if we can flip rather than do a full mode set. In the - * fastboot case, we'll flip, but if we don't update the pipesrc and - * pfit state, we'll end up with a big fb scanned out into the wrong - * sized surface. - * - * To fix this properly, we need to hoist the checks up into - * compute_mode_changes (or above), check the actual pfit state and - * whether the platform allows pfit disable with pipe active, and only - * then update the pipesrc and pfit state, even on the flip path. + * See intel_pfit_changed for info on when we're allowed to + * do this w/o a pipe shutdown. */ adjusted_mode = &crtc->config.adjusted_mode; @@ -11171,6 +11162,50 @@ static void disable_crtc_nofb(struct intel_crtc *crtc) crtc->new_config = NULL; } +/* Do we need a mode set due to pfit changes? */ +static bool intel_pfit_changed(struct drm_device *dev, + struct intel_crtc_config *new_config, + struct intel_crtc_config *cur_config) +{ + bool ret = false; + + if (HAS_DDI(dev) || HAS_PCH_SPLIT(dev)) { + /* + * On PCH platforms we can disable pfit w/o a pipe shutdown, + * otherwise we'll need a mode set. + */ + if (new_config->pch_pfit.enabled && + cur_config->pch_pfit.enabled) + ret = false; + else if (new_config->pch_pfit.enabled && + !cur_config->pch_pfit.enabled) + ret = true; + else if (!new_config->pch_pfit.enabled && + cur_config->pch_pfit.enabled) + ret = false; + else if (!new_config->pch_pfit.enabled && + !cur_config->pch_pfit.enabled) + ret = false; + } else { + bool new_enabled, old_enabled; + + new_enabled = !!(new_config->gmch_pfit.control & PFIT_ENABLE); + old_enabled = !!(cur_config->gmch_pfit.control & PFIT_ENABLE); + + /* 9xx only needs a shutdown to disable pfit */ + if (new_enabled && old_enabled) + ret = false; + else if (new_enabled && !old_enabled) + ret = false; + else if (!new_enabled && old_enabled) + ret = true; + else if (!new_enabled && !old_enabled) + ret = false; + } + + return ret; +} + static int intel_crtc_set_config(struct drm_mode_set *set) { struct drm_device *dev; @@ -11239,6 +11274,10 @@ static int intel_crtc_set_config(struct drm_mode_set *set) if (to_intel_crtc(set->crtc)->new_config->has_infoframe || to_intel_crtc(set->crtc)->config.has_infoframe) config->mode_changed = true; + + if (intel_pfit_changed(dev, to_intel_crtc(set->crtc)->new_config, + &to_intel_crtc(set->crtc)->config)) + config->mode_changed = true; } /* set_mode will free it in the mode_changed case */