All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 6/9] drm/i915/dsb: Inline DSB_CTRL writes into intel_dsb_commit()
Date: Wed, 29 Jan 2020 20:20:31 +0200	[thread overview]
Message-ID: <20200129182034.26138-6-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20200129182034.26138-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

No point in having these wrappers for a simple DSB_CTRL write.
Inline them into intel_dsb_commit().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_dsb.c | 64 +++++-------------------
 1 file changed, 13 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c
index a46a8f499e0e..53759bf7a451 100644
--- a/drivers/gpu/drm/i915/display/intel_dsb.c
+++ b/drivers/gpu/drm/i915/display/intel_dsb.c
@@ -43,40 +43,6 @@ static inline bool is_dsb_busy(struct intel_dsb *dsb)
 	return intel_de_read(dev_priv, DSB_CTRL(pipe, dsb->id)) & DSB_STATUS;
 }
 
-static inline bool intel_dsb_enable_engine(struct intel_dsb *dsb)
-{
-	struct intel_crtc *crtc = container_of(dsb, typeof(*crtc), dsb);
-	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
-	enum pipe pipe = crtc->pipe;
-
-	if (is_dsb_busy(dsb)) {
-		DRM_ERROR("DSB engine is busy.\n");
-		return false;
-	}
-
-	intel_de_write(dev_priv, DSB_CTRL(pipe, dsb->id), DSB_ENABLE);
-	intel_de_posting_read(dev_priv, DSB_CTRL(pipe, dsb->id));
-
-	return true;
-}
-
-static inline bool intel_dsb_disable_engine(struct intel_dsb *dsb)
-{
-	struct intel_crtc *crtc = container_of(dsb, typeof(*crtc), dsb);
-	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
-	enum pipe pipe = crtc->pipe;
-
-	if (is_dsb_busy(dsb)) {
-		DRM_DEBUG_KMS("DSB engine is busy.\n");
-		return false;
-	}
-
-	intel_de_write(dev_priv, DSB_CTRL(pipe, dsb->id), 0);
-	intel_de_posting_read(dev_priv, DSB_CTRL(pipe, dsb->id));
-
-	return true;
-}
-
 /**
  * intel_dsb_get() - Allocate DSB context and return a DSB instance.
  * @crtc: intel_crtc structure to get pipe info.
@@ -306,36 +272,32 @@ void intel_dsb_commit(struct intel_dsb *dsb)
 	if (!dsb->free_pos)
 		return;
 
-	if (!intel_dsb_enable_engine(dsb))
-		goto reset;
-
-	if (is_dsb_busy(dsb)) {
-		DRM_ERROR("HEAD_PTR write failed - dsb engine is busy.\n");
-		goto reset;
-	}
-	intel_de_write(dev_priv, DSB_HEAD(pipe, dsb->id),
-		       i915_ggtt_offset(dsb->vma));
-
 	tail = ALIGN(dsb->free_pos * 4, CACHELINE_BYTES);
 	if (tail > dsb->free_pos * 4)
 		memset(&dsb->cmd_buf[dsb->free_pos], 0,
 		       (tail - dsb->free_pos * 4));
 
 	if (is_dsb_busy(dsb)) {
-		DRM_ERROR("TAIL_PTR write failed - dsb engine is busy.\n");
+		DRM_ERROR("DSB engine is busy.\n");
 		goto reset;
 	}
-	DRM_DEBUG_KMS("DSB execution started - head 0x%x, tail 0x%x\n",
-		      i915_ggtt_offset(dsb->vma), tail);
+
+	intel_de_write(dev_priv, DSB_CTRL(pipe, dsb->id),
+		       DSB_ENABLE);
+	intel_de_write(dev_priv, DSB_HEAD(pipe, dsb->id),
+		       i915_ggtt_offset(dsb->vma));
 	intel_de_write(dev_priv, DSB_TAIL(pipe, dsb->id),
 		       i915_ggtt_offset(dsb->vma) + tail);
-	if (wait_for(!is_dsb_busy(dsb), 1)) {
+
+	DRM_DEBUG_KMS("DSB execution started - head 0x%x, tail 0x%x\n",
+		      i915_ggtt_offset(dsb->vma),
+		      i915_ggtt_offset(dsb->vma) + tail);
+
+	if (wait_for(!is_dsb_busy(dsb), 1))
 		DRM_ERROR("Timed out waiting for DSB workload completion.\n");
-		goto reset;
-	}
 
 reset:
 	dsb->free_pos = 0;
 	dsb->ins_start_offset = 0;
-	intel_dsb_disable_engine(dsb);
+	intel_de_write(dev_priv, DSB_CTRL(pipe, dsb->id), 0);
 }
-- 
2.24.1

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

  parent reply	other threads:[~2020-01-29 18:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 18:20 [Intel-gfx] [PATCH 1/9] drm/i915/dsb: Replace HAS_DSB check with dsb->cmd_buf check Ville Syrjala
2020-01-29 18:20 ` [Intel-gfx] [PATCH 2/9] drm/i915/dsb: Disable DSB until fixed Ville Syrjala
2020-01-30 18:13   ` Souza, Jose
2020-01-29 18:20 ` [Intel-gfx] [PATCH 3/9] drm/i915/dsb: Turn the "DSB is busy" into an error Ville Syrjala
2020-02-03 12:36   ` Sharma, Swati2
2020-01-29 18:20 ` [Intel-gfx] [PATCH 4/9] drm/i915/dsb: Stop with the RMW Ville Syrjala
2020-01-29 18:20 ` [Intel-gfx] [PATCH 5/9] drm/i915/dsb: Unwind on map error Ville Syrjala
2020-01-29 18:20 ` Ville Syrjala [this message]
2020-01-29 18:32   ` [Intel-gfx] [PATCH 6/9] drm/i915/dsb: Inline DSB_CTRL writes into intel_dsb_commit() Chris Wilson
2020-01-29 18:44     ` Ville Syrjälä
2020-01-29 18:20 ` [Intel-gfx] [PATCH 7/9] drm/i915/dsb: Wait for DSB to idle after disabling it Ville Syrjala
2020-01-29 18:20 ` [Intel-gfx] [PATCH 8/9] drm/i915/dsb: Introduce intel_dsb_align_tail() Ville Syrjala
2020-01-29 18:20 ` [Intel-gfx] [PATCH 9/9] drm/i915/dsb: Nuke the 'dev' variables Ville Syrjala
2020-02-03 12:32   ` Sharma, Swati2
2020-01-30  0:47 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/9] drm/i915/dsb: Replace HAS_DSB check with dsb->cmd_buf check Patchwork
2020-01-30  1:09 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-01-30 15:11 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/9] drm/i915/dsb: Replace HAS_DSB check with dsb->cmd_buf check (rev2) Patchwork
2020-01-30 15:41 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-01-30 18:13 ` [Intel-gfx] [PATCH 1/9] drm/i915/dsb: Replace HAS_DSB check with dsb->cmd_buf check Souza, Jose
2020-01-31  9:34   ` Manna, Animesh
2020-01-31 11:42     ` Ville Syrjälä
2020-01-31 12:06       ` Manna, Animesh
2020-01-31 12:16         ` Ville Syrjälä
2020-03-03 10:43 ` Sharma, Swati2

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=20200129182034.26138-6-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@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.