Mesa (master): freedreno: splitup emit_string_marker

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 16 21:14:02 UTC 2020


Module: Mesa
Branch: master
Commit: 541c288b5f8b8b579a00460b7343784ae9cdbde9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=541c288b5f8b8b579a00460b7343784ae9cdbde9

Author: Rob Clark <robdclark at chromium.org>
Date:   Wed May 13 09:53:43 2020 -0700

freedreno: splitup emit_string_marker

So that we can use it internally to emit string markers into a specified
rb.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5280>

---

 src/gallium/drivers/freedreno/freedreno_context.c | 67 ++++++++++++++++-------
 src/gallium/drivers/freedreno/freedreno_context.h |  2 +
 2 files changed, 48 insertions(+), 21 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c
index 4572147c4e7..a69a194379b 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.c
+++ b/src/gallium/drivers/freedreno/freedreno_context.c
@@ -138,31 +138,11 @@ fd_memory_barrier(struct pipe_context *pctx, unsigned flags)
 	/* TODO do we need to check for persistently mapped buffers and fd_bo_cpu_prep()?? */
 }
 
-/**
- * emit marker string as payload of a no-op packet, which can be
- * decoded by cffdump.
- */
 static void
-fd_emit_string_marker(struct pipe_context *pctx, const char *string, int len)
+emit_string_tail(struct fd_ringbuffer *ring, const char *string, int len)
 {
-	struct fd_context *ctx = fd_context(pctx);
-	struct fd_ringbuffer *ring;
 	const uint32_t *buf = (const void *)string;
 
-	if (!ctx->batch)
-		return;
-
-	ctx->batch->needs_flush = true;
-
-	ring = ctx->batch->draw;
-
-	/* max packet size is 0x3fff dwords: */
-	len = MIN2(len, 0x3fff * 4);
-
-	if (ctx->screen->gpu_id >= 500)
-		OUT_PKT7(ring, CP_NOP, align(len, 4) / 4);
-	else
-		OUT_PKT3(ring, CP_NOP, align(len, 4) / 4);
 	while (len >= 4) {
 		OUT_RING(ring, *buf);
 		buf++;
@@ -177,6 +157,51 @@ fd_emit_string_marker(struct pipe_context *pctx, const char *string, int len)
 	}
 }
 
+/* for prior to a5xx: */
+void
+fd_emit_string(struct fd_ringbuffer *ring,
+		const char *string, int len)
+{
+	/* max packet size is 0x3fff+1 dwords: */
+	len = MIN2(len, 0x4000 * 4);
+
+	OUT_PKT3(ring, CP_NOP, align(len, 4) / 4);
+	emit_string_tail(ring, string, len);
+}
+
+/* for a5xx+ */
+void
+fd_emit_string5(struct fd_ringbuffer *ring,
+		const char *string, int len)
+{
+	/* max packet size is 0x3fff dwords: */
+	len = MIN2(len, 0x3fff * 4);
+
+	OUT_PKT7(ring, CP_NOP, align(len, 4) / 4);
+	emit_string_tail(ring, string, len);
+}
+
+/**
+ * emit marker string as payload of a no-op packet, which can be
+ * decoded by cffdump.
+ */
+static void
+fd_emit_string_marker(struct pipe_context *pctx, const char *string, int len)
+{
+	struct fd_context *ctx = fd_context(pctx);
+
+	if (!ctx->batch)
+		return;
+
+	ctx->batch->needs_flush = true;
+
+	if (ctx->screen->gpu_id >= 500) {
+		fd_emit_string5(ctx->batch->draw, string, len);
+	} else {
+		fd_emit_string(ctx->batch->draw, string, len);
+	}
+}
+
 void
 fd_context_destroy(struct pipe_context *pctx)
 {
diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h
index faafad5c672..620768306ab 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.h
+++ b/src/gallium/drivers/freedreno/freedreno_context.h
@@ -503,6 +503,8 @@ fd_batch_set_stage(struct fd_batch *batch, enum fd_render_stage stage)
 
 void fd_context_setup_common_vbos(struct fd_context *ctx);
 void fd_context_cleanup_common_vbos(struct fd_context *ctx);
+void fd_emit_string(struct fd_ringbuffer *ring, const char *string, int len);
+void fd_emit_string5(struct fd_ringbuffer *ring, const char *string, int len);
 
 struct pipe_context * fd_context_init(struct fd_context *ctx,
 		struct pipe_screen *pscreen, const uint8_t *primtypes,



More information about the mesa-commit mailing list