All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2 19/27] drm/i915: atomic plane updates in a nutshell
Date: Thu,  4 Jun 2015 14:47:49 +0200	[thread overview]
Message-ID: <1433422077-14907-20-git-send-email-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <1433422077-14907-1-git-send-email-maarten.lankhorst@linux.intel.com>

Now that all planes are added during a modeset we can use the
calculated changes before disabling a plane, and then either commit
or force disable a plane before disabling the crtc.

The code is shared with atomic_begin/flush, except watermark updating
and vblank evasion are not used.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 128 +++++++----------------------------
 drivers/gpu/drm/i915/intel_sprite.c  |   4 +-
 2 files changed, 27 insertions(+), 105 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3b5d23692935..d4ddcad7eaf1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -109,8 +109,6 @@ static void skl_init_scalers(struct drm_device *dev, struct intel_crtc *intel_cr
 	struct intel_crtc_state *crtc_state);
 static int i9xx_get_refclk(const struct intel_crtc_state *crtc_state,
 			   int num_connectors);
-static void intel_crtc_enable_planes(struct drm_crtc *crtc);
-static void intel_crtc_disable_planes(struct drm_crtc *crtc);
 
 static struct intel_encoder *intel_find_encoder(struct intel_connector *connector, int pipe)
 {
@@ -2215,28 +2213,6 @@ static void intel_disable_pipe(struct intel_crtc *crtc)
 		intel_wait_for_pipe_off(crtc);
 }
 
-/**
- * intel_enable_primary_hw_plane - enable the primary plane on a given pipe
- * @plane:  plane to be enabled
- * @crtc: crtc for the plane
- *
- * Enable @plane on @crtc, making sure that the pipe is running first.
- */
-static void intel_enable_primary_hw_plane(struct drm_plane *plane,
-					  struct drm_crtc *crtc)
-{
-	struct drm_device *dev = plane->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-
-	/* If the pipe isn't enabled, we can't pump pixels and may hang */
-	assert_pipe_enabled(dev_priv, intel_crtc->pipe);
-	to_intel_plane_state(plane->state)->visible = true;
-
-	dev_priv->display.update_primary_plane(crtc, plane->fb,
-					       crtc->x, crtc->y);
-}
-
 static bool need_vtd_wa(struct drm_device *dev)
 {
 #ifdef CONFIG_INTEL_IOMMU
@@ -4501,20 +4477,6 @@ static void ironlake_pfit_enable(struct intel_crtc *crtc)
 	}
 }
 
-static void intel_enable_sprite_planes(struct drm_crtc *crtc)
-{
-	struct drm_device *dev = crtc->dev;
-	enum pipe pipe = to_intel_crtc(crtc)->pipe;
-	struct drm_plane *plane;
-	struct intel_plane *intel_plane;
-
-	drm_for_each_legacy_plane(plane, &dev->mode_config.plane_list) {
-		intel_plane = to_intel_plane(plane);
-		if (intel_plane->pipe == pipe)
-			intel_plane_restore(&intel_plane->base);
-	}
-}
-
 void hsw_enable_ips(struct intel_crtc *crtc)
 {
 	struct drm_device *dev = crtc->base.dev;
@@ -4810,26 +4772,6 @@ static void intel_pre_plane_update(struct intel_crtc *crtc)
 		intel_pre_disable_primary(&crtc->base);
 }
 
-static void intel_crtc_enable_planes(struct drm_crtc *crtc)
-{
-	struct drm_device *dev = crtc->dev;
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-	int pipe = intel_crtc->pipe;
-
-	intel_enable_primary_hw_plane(crtc->primary, crtc);
-	intel_enable_sprite_planes(crtc);
-	intel_crtc_update_cursor(crtc, true);
-
-	intel_post_enable_primary(crtc);
-
-	/*
-	 * FIXME: Once we grow proper nuclear flip support out of this we need
-	 * to compute the mask of flip planes precisely. For the time being
-	 * consider this a flip to a NULL plane.
-	 */
-	intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_ALL_MASK(pipe));
-}
-
 static void intel_disable_planes_on_crtc(struct drm_crtc *c)
 {
 	struct intel_crtc *crtc = to_intel_crtc(c);
@@ -4840,27 +4782,6 @@ static void intel_disable_planes_on_crtc(struct drm_crtc *c)
 		to_intel_plane(plane)->disable_plane(plane, c);
 }
 
-static void intel_crtc_disable_planes(struct drm_crtc *crtc)
-{
-	struct drm_device *dev = crtc->dev;
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-	int pipe = intel_crtc->pipe;
-
-	intel_crtc_wait_for_pending_flips(crtc);
-
-	intel_pre_disable_primary(crtc);
-
-	intel_crtc_dpms_overlay_disable(intel_crtc);
-	intel_disable_planes_on_crtc(crtc);
-
-	/*
-	 * FIXME: Once we grow proper nuclear flip support out of this we need
-	 * to compute the mask of flip planes precisely. For the time being
-	 * consider this a flip to a NULL plane.
-	 */
-	intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_ALL_MASK(pipe));
-}
-
 static void ironlake_crtc_enable(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
@@ -11552,10 +11473,6 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
 	if (old_plane_state->base.fb && !fb)
 		intel_crtc->atomic.disabled_planes |= 1 << i;
 
-	/* don't run rest during modeset yet */
-	if (!intel_crtc->active || mode_changed)
-		return 0;
-
 	if (to_intel_crtc_state(crtc_state)->quirks &
 	    PIPE_CONFIG_QUIRK_INITIAL_PLANES) {
 		if (!plane_state->crtc) {
@@ -12956,15 +12873,23 @@ static int __intel_set_mode(struct drm_atomic_state *state)
 	drm_atomic_helper_swap_state(dev, state);
 
 	for_each_crtc_in_state(state, crtc, crtc_state, i) {
+		struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
 		if (!needs_modeset(crtc->state))
 			continue;
 
 		any_ms = true;
-		if (!crtc_state->active)
-			continue;
+		intel_pre_plane_update(intel_crtc);
+
+		if (crtc_state->active) {
+			intel_crtc_dpms_overlay_disable(intel_crtc);
+			intel_disable_planes_on_crtc(crtc);
+
+			/* XXX: Calculate mask here? */
+			intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_ALL_MASK(intel_crtc->pipe));
 
-		intel_crtc_disable_planes(crtc);
-		dev_priv->display.crtc_disable(crtc);
+			dev_priv->display.crtc_disable(crtc);
+		}
 	}
 
 	/* Only after disabling all output pipelines that will be changed can we
@@ -12978,15 +12903,12 @@ static int __intel_set_mode(struct drm_atomic_state *state)
 
 	/* Now enable the clocks, plane, pipe, and connectors that we set up. */
 	for_each_crtc_in_state(state, crtc, crtc_state, i) {
-		drm_atomic_helper_commit_planes_on_crtc(crtc_state);
-
-		if (!needs_modeset(crtc->state) || !crtc->state->active)
-			continue;
-
-		update_scanline_offset(to_intel_crtc(crtc));
+		if (needs_modeset(crtc->state) && crtc->state->active) {
+			update_scanline_offset(to_intel_crtc(crtc));
+			dev_priv->display.crtc_enable(crtc);
+		}
 
-		dev_priv->display.crtc_enable(crtc);
-		intel_crtc_enable_planes(crtc);
+		drm_atomic_helper_commit_planes_on_crtc(crtc_state);
 	}
 
 	/* FIXME: add subpixel order */
@@ -13524,7 +13446,7 @@ intel_commit_primary_plane(struct drm_plane *plane,
 	crtc->x = src->x1 >> 16;
 	crtc->y = src->y1 >> 16;
 
-	if (!intel_crtc->active)
+	if (!crtc->state->active)
 		return;
 
 	if (state->visible)
@@ -13550,7 +13472,8 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 
-	intel_pre_plane_update(intel_crtc);
+	if (!needs_modeset(crtc->state))
+		intel_pre_plane_update(intel_crtc);
 
 	if (intel_crtc->atomic.update_wm)
 		intel_update_watermarks(crtc);
@@ -13558,17 +13481,18 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc)
 	intel_runtime_pm_get(dev_priv);
 
 	/* Perform vblank evasion around commit operation */
-	if (crtc->state->active && !needs_modeset(crtc->state)) {
+	if (crtc->state->active)
 		intel_crtc->atomic.evade =
 			intel_pipe_update_start(intel_crtc,
 						&intel_crtc->atomic.start_vbl_count);
 
+	if (!needs_modeset(crtc->state)) {
+		if (INTEL_INFO(dev)->gen >= 9)
+			skl_detach_scalers(intel_crtc);
+
 		if (intel_crtc->atomic.force_disabled_planes)
 			intel_disable_planes_on_crtc(crtc);
 	}
-
-	if (!needs_modeset(crtc->state) && INTEL_INFO(dev)->gen >= 9)
-                skl_detach_scalers(intel_crtc);
 }
 
 static void intel_finish_crtc_commit(struct drm_crtc *crtc)
@@ -13770,7 +13694,7 @@ intel_commit_cursor_plane(struct drm_plane *plane,
 	intel_crtc->cursor_bo = obj;
 
 update:
-	if (intel_crtc->active)
+	if (crtc->state->active)
 		intel_crtc_update_cursor(crtc, state->visible);
 }
 
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 2a6cfac210cb..49d867a8b073 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -919,16 +919,14 @@ intel_commit_sprite_plane(struct drm_plane *plane,
 			  struct intel_plane_state *state)
 {
 	struct drm_crtc *crtc = state->base.crtc;
-	struct intel_crtc *intel_crtc;
 	struct intel_plane *intel_plane = to_intel_plane(plane);
 	struct drm_framebuffer *fb = state->base.fb;
 
 	crtc = crtc ? crtc : plane->crtc;
-	intel_crtc = to_intel_crtc(crtc);
 
 	plane->fb = fb;
 
-	if (!intel_crtc->active)
+	if (!crtc->state->active)
 		return;
 
 	if (state->visible) {
-- 
2.1.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-06-04 12:48 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04 12:47 [PATCH v2 00/27] Convert to atomic, part 3 Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 01/27] drm/i915: Always reset in intel_crtc_restore_mode Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 02/27] drm/i915: Use crtc state in intel_modeset_pipe_config Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 03/27] drm/i915: clean up intel_sanitize_crtc, v2 Maarten Lankhorst
2015-06-10  1:58   ` Matt Roper
2015-06-10  7:30     ` Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 04/27] drm/i915: Update power domains only on affected crtc's Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 05/27] drm/i915: add fastboot checks for has_audio and has_infoframe Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 06/27] drm/i915: Clean up intel_atomic_setup_scalers slightly Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 07/27] drm/i915: Add a simple atomic crtc check function, v2 Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 08/27] drm/i915: Move scaler setup to check crtc " Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 09/27] drm/i915: Assign a new pll from the crtc check function Maarten Lankhorst
2015-06-08  8:22   ` Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 10/27] drm/i915: Do not run most checks when there's no modeset Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 11/27] drm/i915: Split skl_update_scaler, v2 Maarten Lankhorst
2015-06-11  1:34   ` Matt Roper
2015-06-04 12:47 ` [PATCH v2 12/27] drm/i915: Split plane updates of crtc->atomic into a helper, v2 Maarten Lankhorst
2015-06-11  1:35   ` Matt Roper
2015-06-11  3:44     ` Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 13/27] drm/i915: clean up plane commit functions Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 14/27] drm/i915: clean up atomic plane check functions Maarten Lankhorst
2015-06-11  1:35   ` Matt Roper
2015-06-11  4:23     ` Maarten Lankhorst
2015-06-15 12:05       ` Daniel Vetter
2015-06-15 12:03         ` Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 15/27] drm/i915: remove force argument from disable_plane Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 16/27] drm/i915: move detaching scalers to begin_crtc_commit, v2 Maarten Lankhorst
2015-06-11  1:36   ` Matt Roper
2015-06-11  3:47     ` Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 17/27] drm/i915: Move crtc commit updates to separate functions Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 18/27] drm/i915: Handle disabling planes better Maarten Lankhorst
2015-06-11  1:37   ` Matt Roper
2015-06-11  3:51     ` Maarten Lankhorst
2015-06-15 12:07       ` Daniel Vetter
2015-06-04 12:47 ` Maarten Lankhorst [this message]
2015-06-04 12:47 ` [PATCH v2 20/27] drm/i915: Update less state during modeset Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 21/27] drm/i915: get rid of intel_plane_restore in intel_crtc_page_flip Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 22/27] drm/i915: Make setting color key atomic Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 23/27] drm/i915: Remove transitional references from intel_plane_atomic_check Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 24/27] drm/i915: Use full atomic modeset Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 25/27] drm/i915: Call plane update functions directly from intel_atomic_commit Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 26/27] drm/i915: always disable irqs in intel_pipe_update_start Maarten Lankhorst
2015-06-04 12:47 ` [PATCH v2 27/27] drm/i915: Only commit planes on crtc's that have changed planes Maarten Lankhorst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433422077-14907-20-git-send-email-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.