From patchwork Thu Oct 30 18:54:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 5199941 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AB8DF9F30B for ; Thu, 30 Oct 2014 18:54:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CAC6B201DD for ; Thu, 30 Oct 2014 18:54:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id F003E2015A for ; Thu, 30 Oct 2014 18:54:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6768F6E56A; Thu, 30 Oct 2014 11:54:22 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F50C6E56A for ; Thu, 30 Oct 2014 11:54:19 -0700 (PDT) Received: by mail-pd0-f179.google.com with SMTP id g10so5638788pdj.24 for ; Thu, 30 Oct 2014 11:54:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=piIrjQ3sYoJjTrmwyPSdJp44OtBq4/D+ZX2DJfzENdI=; b=mgK4K57ofQKwDp74NWeYG+i+XzRmNfWOBC//qwFV49KTpH8OpHJNA3aMEYKY9QxpcM baNSApqxw9RwkXs5rMp68PdcLVYl0oDTRNIaAgcHjsCGkwWeTnkrQUZk8aZ4ZPvrcVf3 aj1iidbXPZJ2hIo6W4RAZjJFKrBe3YbADTQHKRuZVV6qdNGfrJmbM8SnSpbRcaiF0aDZ e41jc9SLi06ZRqNYrgfUAPlD+kD0As9tK7DxBOnPyxvblwFEbolqMcfsJ2QuPGYzKTlg uv6Wt8HoJLtm0pEiveZxIPqDxJ8sTGASt7yrNNVuf3YDu72bO7kBO/D1zsbZETr63IDe 3bKw== X-Received: by 10.66.232.67 with SMTP id tm3mr19285760pac.7.1414695259344; Thu, 30 Oct 2014 11:54:19 -0700 (PDT) Received: from jbarnes-t420.intel.com (c-67-161-37-189.hsd1.ca.comcast.net. [67.161.37.189]) by mx.google.com with ESMTPSA id k9sm7828118pdj.41.2014.10.30.11.54.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Oct 2014 11:54:18 -0700 (PDT) From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Thu, 30 Oct 2014 11:54:04 -0700 Message-Id: <1414695244-14159-6-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1414695244-14159-1-git-send-email-jbarnes@virtuousgeek.org> References: <1414695244-14159-1-git-send-email-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.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 This should allow us to avoid mode sets for some panel fitter config changes. v2: - fixup pfit comment (Ander) Signed-off-by: Jesse Barnes Reviewed-by: Ander Conselvan de Oliveira --- 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 470cdac..56154a1 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -2831,17 +2831,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; @@ -11423,6 +11414,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; @@ -11489,6 +11524,10 @@ static int intel_crtc_set_config(struct drm_mode_set *set) 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; + intel_update_pipe_size(to_intel_crtc(set->crtc)); if (config->mode_changed) {