summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Janes <[email protected]>2019-05-24 14:31:27 -0700
committerMark Janes <[email protected]>2019-08-07 21:33:55 -0700
commit9a2a2e8bea72e4f23dfd09a5eb261e4a4eacb1f2 (patch)
treecaa3388fab1a625173023e5f5b40204071eabab0
parent439d5a3eff188b4e0be42fd6da3a4d233fffcbf3 (diff)
intel/perf: create a vtable entry for bo_unreference
In preparation for calling both Iris and i965 implementions from perf. Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/intel/perf/gen_perf.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_performance_query.c12
2 files changed, 9 insertions, 4 deletions
diff --git a/src/intel/perf/gen_perf.h b/src/intel/perf/gen_perf.h
index fa7d7f87c57..2e50345c1db 100644
--- a/src/intel/perf/gen_perf.h
+++ b/src/intel/perf/gen_perf.h
@@ -191,6 +191,7 @@ struct gen_perf_config {
struct {
void *(*bo_alloc)(void *bufmgr, const char *name, uint64_t size);
+ void (*bo_unreference)(void *bo);
} vtbl;
};
diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c
index 190769b92cc..980a042fc49 100644
--- a/src/mesa/drivers/dri/i965/brw_performance_query.c
+++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
@@ -1119,7 +1119,7 @@ brw_begin_perf_query(struct gl_context *ctx,
}
if (obj->oa.bo) {
- brw_bo_unreference(obj->oa.bo);
+ brw->perfquery.perf->vtbl.bo_unreference(obj->oa.bo);
obj->oa.bo = NULL;
}
@@ -1178,7 +1178,7 @@ brw_begin_perf_query(struct gl_context *ctx,
case GEN_PERF_QUERY_TYPE_PIPELINE:
if (obj->pipeline_stats.bo) {
- brw_bo_unreference(obj->pipeline_stats.bo);
+ brw->perfquery.perf->vtbl.bo_unreference(obj->pipeline_stats.bo);
obj->pipeline_stats.bo = NULL;
}
@@ -1545,6 +1545,7 @@ brw_delete_perf_query(struct gl_context *ctx,
{
struct brw_context *brw = brw_context(ctx);
struct brw_perf_query_object *obj = brw_perf_query(o);
+ struct gen_perf_config *perf_cfg = brw->perfquery.perf;
/* We can assume that the frontend waits for a query to complete
* before ever calling into here, so we don't have to worry about
@@ -1564,7 +1565,7 @@ brw_delete_perf_query(struct gl_context *ctx,
dec_n_oa_users(brw);
}
- brw_bo_unreference(obj->oa.bo);
+ perf_cfg->vtbl.bo_unreference(obj->oa.bo);
obj->oa.bo = NULL;
}
@@ -1573,7 +1574,7 @@ brw_delete_perf_query(struct gl_context *ctx,
case GEN_PERF_QUERY_TYPE_PIPELINE:
if (obj->pipeline_stats.bo) {
- brw_bo_unreference(obj->pipeline_stats.bo);
+ perf_cfg->vtbl.bo_unreference(obj->pipeline_stats.bo);
obj->pipeline_stats.bo = NULL;
}
break;
@@ -1731,6 +1732,8 @@ brw_oa_bo_alloc(void *bufmgr, const char *name, uint64_t size)
return brw_bo_alloc(bufmgr, name, size, BRW_MEMZONE_OTHER);
}
+typedef void (*bo_unreference_t)(void *);
+
static unsigned
brw_init_perf_query_info(struct gl_context *ctx)
{
@@ -1745,6 +1748,7 @@ brw_init_perf_query_info(struct gl_context *ctx)
struct gen_perf_config *perf_cfg = brw->perfquery.perf;
perf_cfg->vtbl.bo_alloc = brw_oa_bo_alloc;
+ perf_cfg->vtbl.bo_unreference = (bo_unreference_t)brw_bo_unreference;
init_pipeline_statistic_query_registers(brw);
brw_perf_query_register_mdapi_statistic_query(brw);