From patchwork Thu Jan 29 14:55:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ander Conselvan de Oliveira X-Patchwork-Id: 5742961 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 66563BF440 for ; Thu, 29 Jan 2015 14:56:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 87CC82021F for ; Thu, 29 Jan 2015 14:56:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9EAC82018E for ; Thu, 29 Jan 2015 14:56:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 29E476E797; Thu, 29 Jan 2015 06:56:12 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 3DDFF6E797 for ; Thu, 29 Jan 2015 06:56:10 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 29 Jan 2015 06:55:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,486,1418112000"; d="scan'208";a="669730917" Received: from linux.jf.intel.com (HELO linux.intel.com) ([10.23.219.25]) by fmsmga002.fm.intel.com with ESMTP; 29 Jan 2015 06:55:26 -0800 Received: from localhost (unknown [10.252.24.22]) by linux.intel.com (Postfix) with ESMTP id D937B2C8002; Thu, 29 Jan 2015 06:55:18 -0800 (PST) From: Ander Conselvan de Oliveira To: intel-gfx@lists.freedesktop.org Date: Thu, 29 Jan 2015 16:55:11 +0200 Message-Id: <1422543311-5107-4-git-send-email-ander.conselvan.de.oliveira@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422543311-5107-1-git-send-email-ander.conselvan.de.oliveira@intel.com> References: <1422543311-5107-1-git-send-email-ander.conselvan.de.oliveira@intel.com> Cc: Ander Conselvan de Oliveira Subject: [Intel-gfx] [PATCH 4/4] drm/i915: Simplify pll state commit by swapping new and old state 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 deletes some code and is closer to what the logic will look like with atomic mode setting. Signed-off-by: Ander Conselvan de Oliveira Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com) --- drivers/gpu/drm/i915/intel_display.c | 58 ++++++++---------------------------- 1 file changed, 12 insertions(+), 46 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index fecffbb..96176c1 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -3963,46 +3963,11 @@ found: return pll; } -/** - * intel_shared_dpll_start_config - start a new PLL staged config - * @dev_priv: DRM device - * @clear_pipes: mask of pipes that will have their PLLs freed - * - * Starts a new PLL staged config, copying the current config but - * releasing the references of pipes specified in clear_pipes. - */ -static int intel_shared_dpll_start_config(struct drm_i915_private *dev_priv, - struct intel_atomic_state *state, - unsigned clear_pipes) -{ - struct intel_shared_dpll_config *pll_config; - enum intel_dpll_id i; - - /* FIXME: convert this to a simple memdup */ - - for (i = 0; i < dev_priv->num_shared_dpll; i++) { - pll_config = &dev_priv->display_state->shared_dpll[i]; - - memcpy(&state->shared_dpll[i], pll_config, - sizeof *pll_config); - state->shared_dpll[i].crtc_mask &= ~clear_pipes; - } - - return 0; -} - -static void intel_shared_dpll_commit(struct drm_i915_private *dev_priv, - struct intel_atomic_state *state) +static struct intel_atomic_state * +intel_atomic_state_duplicate(struct drm_i915_private *dev_priv) { - struct intel_shared_dpll_config *pll_config; - enum intel_dpll_id i; - - /* FIXME: convert this to a poiner swap */ - - for (i = 0; i < dev_priv->num_shared_dpll; i++) { - pll_config = &dev_priv->display_state->shared_dpll[i]; - *pll_config = state->shared_dpll[i]; - } + return kmemdup(dev_priv->display_state, + sizeof *dev_priv->display_state, GFP_KERNEL); } static void cpt_verify_modeset(struct drm_device *dev, int pipe) @@ -10405,14 +10370,15 @@ static bool intel_crtc_in_use(struct drm_crtc *crtc) static void intel_modeset_update_state(struct drm_device *dev, unsigned prepare_pipes, - struct intel_atomic_state *state) + struct intel_atomic_state **state) { struct drm_i915_private *dev_priv = dev->dev_private; struct intel_encoder *intel_encoder; struct intel_crtc *intel_crtc; struct drm_connector *connector; - intel_shared_dpll_commit(dev_priv, state); + /* Commit PLL and other global state */ + swap(dev_priv->display_state, *state); for_each_intel_encoder(dev, intel_encoder) { if (!intel_encoder->base.crtc) @@ -11020,13 +10986,13 @@ static int __intel_set_mode_setup_plls(struct drm_device *dev, unsigned clear_pipes = modeset_pipes | disable_pipes; struct intel_crtc *intel_crtc; int ret = 0; + int i; if (!dev_priv->display.crtc_compute_clock) return 0; - ret = intel_shared_dpll_start_config(dev_priv, state, clear_pipes); - if (ret) - return ret; + for (i = 0; i < dev_priv->num_shared_dpll; i++) + state->shared_dpll[i].crtc_mask &= ~clear_pipes; for_each_intel_crtc_masked(dev, modeset_pipes, intel_crtc) { struct intel_crtc_state *crtc_state = intel_crtc->new_config; @@ -11077,7 +11043,7 @@ static int __intel_set_mode(struct drm_crtc *crtc, prepare_pipes &= ~disable_pipes; } - state = kzalloc(sizeof *state, GFP_KERNEL); + state = intel_atomic_state_duplicate(dev_priv); if (!state) { ret = -ENOMEM; goto done; @@ -11120,7 +11086,7 @@ static int __intel_set_mode(struct drm_crtc *crtc, /* Only after disabling all output pipelines that will be changed can we * update the the output configuration. */ - intel_modeset_update_state(dev, prepare_pipes, state); + intel_modeset_update_state(dev, prepare_pipes, &state); modeset_update_crtc_power_domains(dev);