From patchwork Thu Oct 23 18:50:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 5142671 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 34007C11AC for ; Thu, 23 Oct 2014 18:51:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 584BA20220 for ; Thu, 23 Oct 2014 18:51:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 66108201FB for ; Thu, 23 Oct 2014 18:51:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 462EC6E4FD; Thu, 23 Oct 2014 11:51:15 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by gabe.freedesktop.org (Postfix) with ESMTP id E6CDA6E409 for ; Thu, 23 Oct 2014 11:51:13 -0700 (PDT) Received: by mail-pa0-f51.google.com with SMTP id lj1so1603141pab.10 for ; Thu, 23 Oct 2014 11:51:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:subject:date:message-id:in-reply-to:references; bh=kbQBUDf/Yk7P9vCOb3YZuEcaxhGEGNL4Gt3uluyTfUQ=; b=TtV/GAgkOtcxizgikKUPnOb8nQmR/H5wV7Y2v8q0A8giQoqzgX0XDfVLMWaPHo6ri4 x3kMOVM28HxUAtBfTCS2U/C/Qy8FV6msx58vTAr4yQ9cEDXFtmCIT6beYKrBM0DoSsKR QpV3x9FIiMICJh8cK7vt0FLTE9gZPZoo9Dgtp7wpQp0eWtn1mAdvVS31lEEJJ50ITgWm ZTYCxGpr/VpK86FYoAXYuggtsjjiw+wL3OQwn2WynWGr6g/F1/W6LQXTHgtDYAydyjgc mPmvQnYMzFHGxuVpLUreFILntOT8XUAeReHp9vhER54GDWIMU6YSgUGbuQuuyuNNsJg2 p6CA== X-Received: by 10.68.100.69 with SMTP id ew5mr6989136pbb.84.1414090273755; Thu, 23 Oct 2014 11:51:13 -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 yk3sm2096713pbb.60.2014.10.23.11.51.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Oct 2014 11:51:13 -0700 (PDT) From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Thu, 23 Oct 2014 11:50:43 -0700 Message-Id: <1414090247-28930-2-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1414090247-28930-1-git-send-email-jbarnes@virtuousgeek.org> References: <1414090247-28930-1-git-send-email-jbarnes@virtuousgeek.org> Subject: [Intel-gfx] [PATCH 2/6] drm/i915: use compute_config in set_config 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 will allow us to consult more info before deciding whether to flip or do a full mode set. Signed-off-by: Jesse Barnes --- drivers/gpu/drm/i915/intel_display.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index d5f95e4..e031ee8 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -11427,6 +11427,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); @@ -11472,9 +11473,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); @@ -11521,8 +11530,10 @@ fail: /* Try to restore the config */ if (config->mode_changed && - intel_set_mode(save_set.crtc, save_set.mode, - save_set.x, save_set.y, save_set.fb)) + intel_set_mode_pipes(save_set.crtc, save_set.mode, + save_set.x, save_set.y, save_set.fb, + modeset_pipes, prepare_pipes, + disable_pipes)) DRM_ERROR("failed to restore config after modeset failure\n"); } @@ -13409,14 +13420,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); }