From db1dc21a75d110344c0a7eccbddcce9c3a1b99d9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 11 Dec 2013 14:55:45 -0800 Subject: [PATCH] i965: Delete duplicate write_timestamp function. brw_queryobj.c needs a version of write_timestamp that works on all generations for the QueryCounter() driver hook. So there's no point in duplicating it in gen6_queryobj.c. Signed-off-by: Kenneth Graunke Reviewed-by: Chris Forbes Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/i965/brw_context.h | 1 + src/mesa/drivers/dri/i965/brw_queryobj.c | 10 +++---- src/mesa/drivers/dri/i965/gen6_queryobj.c | 36 ++--------------------- 3 files changed, 8 insertions(+), 39 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index df32ccbcf1a..63dd4a02619 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1559,6 +1559,7 @@ void brw_emit_query_end(struct brw_context *brw); /** gen6_queryobj.c */ void gen6_init_queryobj_functions(struct dd_function_table *functions); +void brw_write_timestamp(struct brw_context *brw, drm_intel_bo *bo, int idx); void brw_store_register_mem64(struct brw_context *brw, drm_intel_bo *bo, uint32_t reg, int idx); diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c index 2d6dd1ebfd0..64c602fb53e 100644 --- a/src/mesa/drivers/dri/i965/brw_queryobj.c +++ b/src/mesa/drivers/dri/i965/brw_queryobj.c @@ -46,8 +46,8 @@ /** * Emit PIPE_CONTROLs to write the current GPU timestamp into a buffer. */ -static void -write_timestamp(struct brw_context *brw, drm_intel_bo *query_bo, int idx) +void +brw_write_timestamp(struct brw_context *brw, drm_intel_bo *query_bo, int idx) { if (brw->gen >= 6) { /* Emit workaround flushes: */ @@ -269,7 +269,7 @@ brw_begin_query(struct gl_context *ctx, struct gl_query_object *q) */ drm_intel_bo_unreference(query->bo); query->bo = drm_intel_bo_alloc(brw->bufmgr, "timer query", 4096, 4096); - write_timestamp(brw, query->bo, 0); + brw_write_timestamp(brw, query->bo, 0); break; case GL_ANY_SAMPLES_PASSED: @@ -321,7 +321,7 @@ brw_end_query(struct gl_context *ctx, struct gl_query_object *q) switch (query->Base.Target) { case GL_TIME_ELAPSED_EXT: /* Write the final timestamp. */ - write_timestamp(brw, query->bo, 1); + brw_write_timestamp(brw, query->bo, 1); break; case GL_ANY_SAMPLES_PASSED: @@ -515,7 +515,7 @@ brw_query_counter(struct gl_context *ctx, struct gl_query_object *q) drm_intel_bo_unreference(query->bo); query->bo = drm_intel_bo_alloc(brw->bufmgr, "timestamp query", 4096, 4096); - write_timestamp(brw, query->bo, 0); + brw_write_timestamp(brw, query->bo, 0); } /** diff --git a/src/mesa/drivers/dri/i965/gen6_queryobj.c b/src/mesa/drivers/dri/i965/gen6_queryobj.c index 5b469b5ddd0..b96f9a20b18 100644 --- a/src/mesa/drivers/dri/i965/gen6_queryobj.c +++ b/src/mesa/drivers/dri/i965/gen6_queryobj.c @@ -39,38 +39,6 @@ #include "intel_batchbuffer.h" #include "intel_reg.h" -/** - * Emit PIPE_CONTROLs to write the current GPU timestamp into a buffer. - */ -static void -write_timestamp(struct brw_context *brw, drm_intel_bo *query_bo, int idx) -{ - /* Emit workaround flushes: */ - if (brw->gen == 6) { - /* The timestamp write below is a non-zero post-sync op, which on - * Gen6 necessitates a CS stall. CS stalls need stall at scoreboard - * set. See the comments for intel_emit_post_sync_nonzero_flush(). - */ - BEGIN_BATCH(4); - OUT_BATCH(_3DSTATE_PIPE_CONTROL | (4 - 2)); - OUT_BATCH(PIPE_CONTROL_CS_STALL | PIPE_CONTROL_STALL_AT_SCOREBOARD); - OUT_BATCH(0); - OUT_BATCH(0); - ADVANCE_BATCH(); - } - - BEGIN_BATCH(5); - OUT_BATCH(_3DSTATE_PIPE_CONTROL | (5 - 2)); - OUT_BATCH(PIPE_CONTROL_WRITE_TIMESTAMP); - OUT_RELOC(query_bo, - I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, - PIPE_CONTROL_GLOBAL_GTT_WRITE | - idx * sizeof(uint64_t)); - OUT_BATCH(0); - OUT_BATCH(0); - ADVANCE_BATCH(); -} - /** * Emit PIPE_CONTROLs to write the PS_DEPTH_COUNT register into a buffer. */ @@ -272,7 +240,7 @@ gen6_begin_query(struct gl_context *ctx, struct gl_query_object *q) * obtain the time elapsed. Notably, this includes time elapsed while * the system was doing other work, such as running other applications. */ - write_timestamp(brw, query->bo, 0); + brw_write_timestamp(brw, query->bo, 0); break; case GL_ANY_SAMPLES_PASSED: @@ -311,7 +279,7 @@ gen6_end_query(struct gl_context *ctx, struct gl_query_object *q) switch (query->Base.Target) { case GL_TIME_ELAPSED: - write_timestamp(brw, query->bo, 1); + brw_write_timestamp(brw, query->bo, 1); break; case GL_ANY_SAMPLES_PASSED: -- 2.30.2