Mesa (master): freedreno: prep work for timestamp queries

Rob Clark robclark at kemper.freedesktop.org
Sat Jul 23 17:39:48 UTC 2016


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

Author: Rob Clark <robclark at freedesktop.org>
Date:   Tue Mar  1 10:45:32 2016 -0500

freedreno: prep work for timestamp queries

We need "NULL" state to be a valid bit in the bitmask, because timestamp
queries are not restricted to draw/etc stages (ie. the only commands to
submit may just be to read the timestamp).  And just because there are
no draws, isn't a reason to skip the flush and return zero.

Signed-off-by: Rob Clark <robdclark at gmail.com>

---

 src/gallium/drivers/freedreno/freedreno_context.c  |  2 ++
 src/gallium/drivers/freedreno/freedreno_context.h  | 13 +++++++------
 src/gallium/drivers/freedreno/freedreno_query_hw.c |  1 +
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c
index 52557d1..65c3891 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.c
+++ b/src/gallium/drivers/freedreno/freedreno_context.c
@@ -244,6 +244,8 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen,
 	 */
 	ctx->sample_mask = 0xffff;
 
+	ctx->stage = FD_STAGE_NULL;
+
 	pctx = &ctx->base;
 	pctx->screen = pscreen;
 	pctx->priv = priv;
diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h
index 438c2e2..53b4e1d 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.h
+++ b/src/gallium/drivers/freedreno/freedreno_context.h
@@ -116,18 +116,19 @@ struct fd_vertex_state {
  * is active across IB's (or between tile IB and draw IB)
  */
 enum fd_render_stage {
-	FD_STAGE_NULL     = 0x00,
-	FD_STAGE_DRAW     = 0x01,
-	FD_STAGE_CLEAR    = 0x02,
+	FD_STAGE_NULL     = 0x01,
+	FD_STAGE_DRAW     = 0x02,
+	FD_STAGE_CLEAR    = 0x04,
 	/* TODO before queries which include MEM2GMEM or GMEM2MEM will
 	 * work we will need to call fd_hw_query_prepare() from somewhere
 	 * appropriate so that queries in the tiling IB get backed with
 	 * memory to write results to.
 	 */
-	FD_STAGE_MEM2GMEM = 0x04,
-	FD_STAGE_GMEM2MEM = 0x08,
+	FD_STAGE_MEM2GMEM = 0x08,
+	FD_STAGE_GMEM2MEM = 0x10,
 	/* used for driver internal draws (ie. util_blitter_blit()): */
-	FD_STAGE_BLIT     = 0x10,
+	FD_STAGE_BLIT     = 0x20,
+	FD_STAGE_ALL      = 0xff,
 };
 
 #define MAX_HW_SAMPLE_PROVIDERS 4
diff --git a/src/gallium/drivers/freedreno/freedreno_query_hw.c b/src/gallium/drivers/freedreno/freedreno_query_hw.c
index 95fff3f..141dc8a 100644
--- a/src/gallium/drivers/freedreno/freedreno_query_hw.c
+++ b/src/gallium/drivers/freedreno/freedreno_query_hw.c
@@ -66,6 +66,7 @@ get_sample(struct fd_context *ctx, struct fd_ringbuffer *ring,
 	if (!ctx->sample_cache[idx]) {
 		ctx->sample_cache[idx] =
 			ctx->sample_providers[idx]->get_sample(ctx, ring);
+		ctx->needs_flush = true;
 	}
 
 	fd_hw_sample_reference(ctx, &samp, ctx->sample_cache[idx]);




More information about the mesa-commit mailing list