From patchwork Thu Oct 23 16:59:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 5149961 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 23D8AC11AC for ; Fri, 24 Oct 2014 21:30:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C69D52026C for ; Fri, 24 Oct 2014 21:30:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4CEE5201C7 for ; Fri, 24 Oct 2014 21:30:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B9E5C6EB59; Fri, 24 Oct 2014 14:25:16 -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 070C16E04E for ; Thu, 23 Oct 2014 10:00:12 -0700 (PDT) Received: by mail-pa0-f43.google.com with SMTP id eu11so1419174pac.2 for ; Thu, 23 Oct 2014 10:00:11 -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=xY66X/TzxnmG18SDzNZ5Sj3z9AGbTs9bGqZu8Q58HSw=; b=TB/eJtWG2sYV8Trg4bgQtULnn28GBO93V+P9Lzy0hPttd52eOMUSzYS7h+IvEu4XNs tMN94BdLe+nH5/TEssag8UEC0TLdrKMGdB1+i0ApyLtERDuLn1Ewg3+7T17r6YeRKw05 NC7TDQzTb2E7Lw/55ohnOBWydi/KbINOJAOORGk985CUT80vaHuBpHAtAPMiwgyW9Jln 3tQiNNX3Lf+leT7MpE/inuwBBy/54LH5QhVbuhbP4DD8ktnHs+naUSrBO1T4GSWOVABl DmZcSSf1x3z0Qf/F0O7y7GDIeS/XmPbPVsRs/aNRJspr4bWwC+pTzB5SJbSR/qx/x4Xr gXDQ== X-Received: by 10.70.91.204 with SMTP id cg12mr6185446pdb.33.1414083611831; Thu, 23 Oct 2014 10:00:11 -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 ke5sm1967412pad.34.2014.10.23.10.00.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Oct 2014 10:00:11 -0700 (PDT) From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Thu, 23 Oct 2014 18:59:13 +0200 Message-Id: <1414083556-26054-2-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1414083556-26054-1-git-send-email-jbarnes@virtuousgeek.org> References: <1414083556-26054-1-git-send-email-jbarnes@virtuousgeek.org> Cc: shuang.he@linux.intel.com Subject: [Intel-gfx] [PATCH 2/5] drm/i915: factor compute_config out of __intel_mode_set X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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=-5.6 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 allows us to calculate the full pipe config before we do any mode setting work. Signed-off-by: Jesse Barnes --- drivers/gpu/drm/i915/intel_display.c | 40 ++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index a9c1c32..6aec3ae 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -10976,21 +10976,18 @@ out: static int __intel_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode, - int x, int y, struct drm_framebuffer *fb) + int x, int y, struct drm_framebuffer *fb, + unsigned disable_pipes, + unsigned prepare_pipes, + unsigned modeset_pipes) { struct drm_device *dev = crtc->dev; struct drm_i915_private *dev_priv = dev->dev_private; struct drm_display_mode *saved_mode; struct intel_crtc_config *pipe_config = NULL; struct intel_crtc *intel_crtc; - unsigned disable_pipes, prepare_pipes, modeset_pipes; int ret = 0; - ret = intel_modeset_compute_config(crtc, mode, fb, &modeset_pipes, - &prepare_pipes, &disable_pipes); - if (ret) - return ret; - saved_mode = kmalloc(sizeof(*saved_mode), GFP_KERNEL); if (!saved_mode) return -ENOMEM; @@ -11095,13 +11092,17 @@ done: return ret; } -static int intel_set_mode(struct drm_crtc *crtc, - struct drm_display_mode *mode, - int x, int y, struct drm_framebuffer *fb) +static int intel_set_mode_pipes(struct drm_crtc *crtc, + struct drm_display_mode *mode, + int x, int y, struct drm_framebuffer *fb, + unsigned modeset_pipes, + unsigned prepare_pipes, + unsigned disable_pipes) { int ret; - ret = __intel_set_mode(crtc, mode, x, y, fb); + ret = __intel_set_mode(crtc, mode, x, y, fb, modeset_pipes, + prepare_pipes, disable_pipes); if (ret == 0) intel_modeset_check_state(crtc->dev); @@ -11109,6 +11110,23 @@ static int intel_set_mode(struct drm_crtc *crtc, return ret; } +static int intel_set_mode(struct drm_crtc *crtc, + struct drm_display_mode *mode, + int x, int y, struct drm_framebuffer *fb) +{ + unsigned modeset_pipes, prepare_pipes, disable_pipes; + int ret; + + ret = intel_modeset_compute_config(crtc, mode, fb, + &modeset_pipes, &prepare_pipes, + &disable_pipes); + if (ret) + return ret; + + return intel_set_mode_pipes(crtc, mode, x, y, fb, modeset_pipes, + prepare_pipes, disable_pipes); +} + void intel_crtc_restore_mode(struct drm_crtc *crtc) { intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->primary->fb);