mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 05:08:08 +02:00
intel/perf: create a vtable for low-level driver functions
Performance metrics collections requires several actions (eg bo_map()) that have different implementations for Iris and i965. The perf subsystem needs a vtable for each of these actions, so it can invoke the corresponding implementation for each driver. The first call to be added to the table is bo_alloc. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
ea66484e86
commit
439d5a3eff
2 changed files with 19 additions and 4 deletions
|
|
@ -188,6 +188,10 @@ struct gen_perf_config {
|
||||||
|
|
||||||
/* Location of the device's sysfs entry. */
|
/* Location of the device's sysfs entry. */
|
||||||
char sysfs_dev_dir[256];
|
char sysfs_dev_dir[256];
|
||||||
|
|
||||||
|
struct {
|
||||||
|
void *(*bo_alloc)(void *bufmgr, const char *name, uint64_t size);
|
||||||
|
} vtbl;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline size_t
|
static inline size_t
|
||||||
|
|
|
||||||
|
|
@ -1124,8 +1124,9 @@ brw_begin_perf_query(struct gl_context *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
obj->oa.bo =
|
obj->oa.bo =
|
||||||
brw_bo_alloc(brw->bufmgr, "perf. query OA MI_RPC bo", MI_RPC_BO_SIZE,
|
brw->perfquery.perf->vtbl.bo_alloc(brw->bufmgr,
|
||||||
BRW_MEMZONE_OTHER);
|
"perf. query OA MI_RPC bo",
|
||||||
|
MI_RPC_BO_SIZE);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
/* Pre-filling the BO helps debug whether writes landed. */
|
/* Pre-filling the BO helps debug whether writes landed. */
|
||||||
void *map = brw_bo_map(brw, obj->oa.bo, MAP_WRITE);
|
void *map = brw_bo_map(brw, obj->oa.bo, MAP_WRITE);
|
||||||
|
|
@ -1182,8 +1183,9 @@ brw_begin_perf_query(struct gl_context *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
obj->pipeline_stats.bo =
|
obj->pipeline_stats.bo =
|
||||||
brw_bo_alloc(brw->bufmgr, "perf. query pipeline stats bo",
|
brw->perfquery.perf->vtbl.bo_alloc(brw->bufmgr,
|
||||||
STATS_BO_SIZE, BRW_MEMZONE_OTHER);
|
"perf. query pipeline stats bo",
|
||||||
|
STATS_BO_SIZE);
|
||||||
|
|
||||||
/* Take starting snapshots. */
|
/* Take starting snapshots. */
|
||||||
snapshot_statistics_registers(brw, obj, 0);
|
snapshot_statistics_registers(brw, obj, 0);
|
||||||
|
|
@ -1723,6 +1725,12 @@ oa_metrics_kernel_support(int fd, const struct gen_device_info *devinfo)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
brw_oa_bo_alloc(void *bufmgr, const char *name, uint64_t size)
|
||||||
|
{
|
||||||
|
return brw_bo_alloc(bufmgr, name, size, BRW_MEMZONE_OTHER);
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
brw_init_perf_query_info(struct gl_context *ctx)
|
brw_init_perf_query_info(struct gl_context *ctx)
|
||||||
{
|
{
|
||||||
|
|
@ -1735,6 +1743,9 @@ brw_init_perf_query_info(struct gl_context *ctx)
|
||||||
|
|
||||||
brw->perfquery.perf = gen_perf_new(brw);
|
brw->perfquery.perf = gen_perf_new(brw);
|
||||||
|
|
||||||
|
struct gen_perf_config *perf_cfg = brw->perfquery.perf;
|
||||||
|
perf_cfg->vtbl.bo_alloc = brw_oa_bo_alloc;
|
||||||
|
|
||||||
init_pipeline_statistic_query_registers(brw);
|
init_pipeline_statistic_query_registers(brw);
|
||||||
brw_perf_query_register_mdapi_statistic_query(brw);
|
brw_perf_query_register_mdapi_statistic_query(brw);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue