From patchwork Fri Nov 16 14:22:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 1755341 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 028174005F for ; Fri, 16 Nov 2012 14:31:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E60B9E5CDB for ; Fri, 16 Nov 2012 06:31:40 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by gabe.freedesktop.org (Postfix) with ESMTP id ED82D436E9; Fri, 16 Nov 2012 06:22:59 -0800 (PST) Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 16 Nov 2012 06:22:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.83,265,1352102400"; d="scan'208";a="169200623" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.168]) by AZSMGA002.ch.intel.com with SMTP; 16 Nov 2012 06:22:38 -0800 Received: by stinkbox (sSMTP sendmail emulation); Fri, 16 Nov 2012 16:22:37 +0200 From: ville.syrjala@linux.intel.com To: dri-devel@lists.freedesktop.org Subject: [PATCH 02/13] drm/i915: Refactor atomic flip code Date: Fri, 16 Nov 2012 16:22:14 +0200 Message-Id: <1353075745-30115-3-git-send-email-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1353075745-30115-1-git-send-email-ville.syrjala@linux.intel.com> References: <1353075745-30115-1-git-send-email-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Cc: intel-gfx@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=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)