From patchwork Thu Oct 30 18:54:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 5199911 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 3D1929F30B for ; Thu, 30 Oct 2014 18:54:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 52A3B2021B for ; Thu, 30 Oct 2014 18:54:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3AB2A201ED for ; Thu, 30 Oct 2014 18:54:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DB136E0CB; Thu, 30 Oct 2014 11:54:17 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by gabe.freedesktop.org (Postfix) with ESMTP id D66946E0C0 for ; Thu, 30 Oct 2014 11:54:15 -0700 (PDT) Received: by mail-pa0-f43.google.com with SMTP id eu11so6031541pac.16 for ; Thu, 30 Oct 2014 11:54:15 -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=1lr3x+od4Y1wYBoUqSQcVTw9pzyBXl3EAwdLcHfvgjw=; b=NONBw62MHdQQwqP1ENk9IkrImk1Ix49ubR30jV+DFavlTObamTaVIFiyxqJcWCJkWd 1t0PLqfFz8Kfy2HpFUOhNFsd0pqTyz57pfK43EjgHWgo7ln/HEAKN+6WChP2qM9f0FSW Oyah4IJwvNtw6jjt9gLp2ZnvnVsRYjmK2sQpH16dT+Zi30WqcuJq0iUe6asKBpViG2nT MfxQD/nHgxWA5j4VYMRpVw3RPIpeRH4Vgm9VnsISknnvViAAO+vOmA0jIVo1Ronse7Es VBS6rn1MRPPzP7rv4aKxsMzUQ3aPmoiJEdK8+1FzS4o472qIgU/IlrSqWRFMtMfndmzl TGEQ== X-Received: by 10.67.4.167 with SMTP id cf7mr19506110pad.52.1414695255745; Thu, 30 Oct 2014 11:54:15 -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.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Oct 2014 11:54:15 -0700 (PDT) From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Thu, 30 Oct 2014 11:54:00 -0700 Message-Id: <1414695244-14159-2-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 2/6] drm/i915: use compute_config 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 will allow us to consult more info before deciding whether to flip or do a full mode set. v2: - don't use uninitialized or incorrect pipe masks in set_config failure path (Ander) Signed-off-by: Jesse Barnes --- drivers/gpu/drm/i915/intel_display.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index f9a0963..0f1952e 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -11430,6 +11430,7 @@ static int intel_crtc_set_config(struct drm_mode_set *set) struct drm_device *dev; struct drm_mode_set save_set; struct intel_set_config *config; + unsigned modeset_pipes, prepare_pipes, disable_pipes; int ret; BUG_ON(!set); @@ -11475,9 +11476,17 @@ static int intel_crtc_set_config(struct drm_mode_set *set) if (ret) goto fail; + ret = intel_modeset_compute_config(set->crtc, set->mode, set->fb, + &modeset_pipes, &prepare_pipes, + &disable_pipes); + if (ret) + goto fail; + if (config->mode_changed) { - ret = intel_set_mode(set->crtc, set->mode, - set->x, set->y, set->fb); + ret = intel_set_mode_pipes(set->crtc, set->mode, + set->x, set->y, set->fb, + modeset_pipes, prepare_pipes, + disable_pipes); } else if (config->fb_changed) { struct intel_crtc *intel_crtc = to_intel_crtc(set->crtc); @@ -13412,14 +13421,27 @@ void intel_modeset_setup_hw_state(struct drm_device *dev, for_each_pipe(dev_priv, pipe) { struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; + unsigned modeset_pipes, prepare_pipes, disable_pipes; + int ret; + + ret = intel_modeset_compute_config(crtc, &crtc->mode, + crtc->primary->fb, + &modeset_pipes, + &prepare_pipes, + &disable_pipes); + if (ret) { + DRM_DEBUG_KMS("prepare failed\n"); + goto out; + } __intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, - crtc->primary->fb); + crtc->primary->fb, modeset_pipes, + prepare_pipes, disable_pipes); } } else { intel_modeset_update_staged_output_state(dev); } - +out: intel_modeset_check_state(dev); }