summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/freedreno_context.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2015-08-10 12:11:13 -0400
committerRob Clark <[email protected]>2016-01-21 17:20:11 -0500
commitbc1a37378c194400c502939fc00e2e658f3db3b5 (patch)
tree65b42f5483920fe1fd20ae86c61cb5b15ab5f6d2 /src/gallium/drivers/freedreno/freedreno_context.c
parentd6408372eb359d972614838f838776f1695e3c99 (diff)
freedreno: implement emit_string_marker
Writes string to cmdstream in payload of a no-op packet. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_context.c')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_context.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c
index 0b6b9fbbe7a..c5ea86f9368 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.c
+++ b/src/gallium/drivers/freedreno/freedreno_context.c
@@ -141,6 +141,32 @@ fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
}
}
+/**
+ * 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);
+ struct fd_ringbuffer *ring = ctx->ring;
+ const uint32_t *buf = (const void *)string;
+
+ OUT_PKT3(ring, CP_NOP, align(len, 4) / 4);
+ while (len >= 4) {
+ OUT_RING(ring, *buf);
+ buf++;
+ len -= 4;
+ }
+
+ /* copy remainder bytes without reading past end of input string: */
+ if (len > 0) {
+ uint32_t w = 0;
+ memcpy(&w, buf, len);
+ OUT_RING(ring, w);
+ }
+}
+
void
fd_context_destroy(struct pipe_context *pctx)
{
@@ -207,6 +233,7 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen,
pctx->screen = pscreen;
pctx->priv = priv;
pctx->flush = fd_context_flush;
+ pctx->emit_string_marker = fd_emit_string_marker;
for (i = 0; i < ARRAY_SIZE(ctx->rings); i++) {
ctx->rings[i] = fd_ringbuffer_new(screen->pipe, 0x100000);