From patchwork Wed Dec 12 16:16:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ville Syrjala X-Patchwork-Id: 1869331 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id C54E5DF266 for ; Wed, 12 Dec 2012 17:54:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B8CC9E65E8 for ; Wed, 12 Dec 2012 09:54:59 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 3C570E5DCF; Wed, 12 Dec 2012 08:20:38 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 12 Dec 2012 08:20:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,267,1355126400"; d="scan'208";a="263033372" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.168]) by fmsmga002.fm.intel.com with SMTP; 12 Dec 2012 08:20:35 -0800 Received: by stinkbox (sSMTP sendmail emulation); Wed, 12 Dec 2012 18:20:34 +0200 From: ville.syrjala@linux.intel.com To: dri-devel@lists.freedesktop.org Date: Wed, 12 Dec 2012 18:16:30 +0200 Message-Id: <1355329008-31459-64-git-send-email-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1355329008-31459-1-git-send-email-ville.syrjala@linux.intel.com> References: <1355329008-31459-1-git-send-email-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Cc: intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 63/81] drm/i915: Refactor atomic flip code X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org From: Ville Syrjälä Collect the part which takes care of issuing the flips to a new function. This makes the following patch nicer to look at. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/intel_atomic.c | 37 ++++++++++++++++++++-------------- 1 files changed, 22 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c index 7a7695b..33357ec 100644 --- a/drivers/gpu/drm/i915/intel_atomic.c +++ b/drivers/gpu/drm/i915/intel_atomic.c @@ -2075,15 +2075,35 @@ static void intel_flip_fini(struct drm_device *dev) drm_flip_driver_fini(&dev_priv->flip_driver); } +static void intel_atomic_schedule_flips(struct drm_i915_private *dev_priv, + struct intel_crtc *intel_crtc, + struct list_head *flips) +{ + if (!intel_crtc->active) { + drm_flip_driver_complete_flips(&dev_priv->flip_driver, flips); + return; + } + + drm_flip_driver_prepare_flips(&dev_priv->flip_driver, flips); + + local_irq_disable(); + + intel_pipe_vblank_evade(&intel_crtc->base); + + drm_flip_driver_schedule_flips(&dev_priv->flip_driver, flips); + + local_irq_enable(); +} + static void atomic_pipe_commit(struct drm_device *dev, struct intel_atomic_state *state, int pipe) { struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_file_private *file_priv = state->file->driver_priv; + struct intel_crtc *intel_crtc = to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe)); LIST_HEAD(flips); int i; - bool pipe_enabled = to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe))->active; for (i = 0; i < dev->mode_config.num_crtc; i++) { struct intel_crtc_state *st = &state->crtc[i]; @@ -2189,20 +2209,7 @@ static void atomic_pipe_commit(struct drm_device *dev, if (list_empty(&flips)) return; - if (!pipe_enabled) { - drm_flip_driver_complete_flips(&dev_priv->flip_driver, &flips); - return; - } - - drm_flip_driver_prepare_flips(&dev_priv->flip_driver, &flips); - - local_irq_disable(); - - intel_pipe_vblank_evade(intel_get_crtc_for_pipe(dev, pipe)); - - drm_flip_driver_schedule_flips(&dev_priv->flip_driver, &flips); - - local_irq_enable(); + intel_atomic_schedule_flips(dev_priv, intel_crtc, &flips); } void intel_atomic_handle_vblank(struct drm_device *dev, int pipe)