intel/perf: expose method to create query
By encapsulating this implementation within perf, we can eventually make struct gen_perf_ctx private. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -69,6 +69,23 @@
|
|||||||
#define MAP_READ (1 << 0)
|
#define MAP_READ (1 << 0)
|
||||||
#define MAP_WRITE (1 << 1)
|
#define MAP_WRITE (1 << 1)
|
||||||
|
|
||||||
|
struct gen_perf_query_object *
|
||||||
|
gen_perf_new_query(struct gen_perf_context *perf_ctx, unsigned query_index)
|
||||||
|
{
|
||||||
|
const struct gen_perf_query_info *query =
|
||||||
|
&perf_ctx->perf->queries[query_index];
|
||||||
|
struct gen_perf_query_object *obj =
|
||||||
|
calloc(1, sizeof(struct gen_perf_query_object));
|
||||||
|
|
||||||
|
if (!obj)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
obj->queryinfo = query;
|
||||||
|
|
||||||
|
perf_ctx->n_query_instances++;
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
get_sysfs_dev_dir(struct gen_perf_config *perf, int fd)
|
get_sysfs_dev_dir(struct gen_perf_config *perf, int fd)
|
||||||
{
|
{
|
||||||
|
@@ -564,6 +564,8 @@ void gen_perf_snapshot_statistics_registers(void *context,
|
|||||||
struct gen_perf_config *perf,
|
struct gen_perf_config *perf,
|
||||||
struct gen_perf_query_object *obj,
|
struct gen_perf_query_object *obj,
|
||||||
uint32_t offset_in_bytes);
|
uint32_t offset_in_bytes);
|
||||||
|
struct gen_perf_query_object *
|
||||||
|
gen_perf_new_query(struct gen_perf_context *, unsigned query_index);
|
||||||
|
|
||||||
void gen_perf_close(struct gen_perf_context *perfquery,
|
void gen_perf_close(struct gen_perf_context *perfquery,
|
||||||
const struct gen_perf_query_info *query);
|
const struct gen_perf_query_info *query);
|
||||||
|
@@ -375,21 +375,14 @@ brw_new_perf_query_object(struct gl_context *ctx, unsigned query_index)
|
|||||||
{
|
{
|
||||||
struct brw_context *brw = brw_context(ctx);
|
struct brw_context *brw = brw_context(ctx);
|
||||||
struct gen_perf_context *perf_ctx = &brw->perf_ctx;
|
struct gen_perf_context *perf_ctx = &brw->perf_ctx;
|
||||||
const struct gen_perf_query_info *queryinfo =
|
struct gen_perf_query_object * obj = gen_perf_new_query(perf_ctx, query_index);
|
||||||
&perf_ctx->perf->queries[query_index];
|
if (unlikely(!obj))
|
||||||
struct gen_perf_query_object *obj =
|
|
||||||
calloc(1, sizeof(struct gen_perf_query_object));
|
|
||||||
|
|
||||||
if (!obj)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
obj->queryinfo = queryinfo;
|
|
||||||
|
|
||||||
perf_ctx->n_query_instances++;
|
|
||||||
|
|
||||||
struct brw_perf_query_object *brw_query = calloc(1, sizeof(struct brw_perf_query_object));
|
struct brw_perf_query_object *brw_query = calloc(1, sizeof(struct brw_perf_query_object));
|
||||||
if (unlikely(!brw_query))
|
if (unlikely(!brw_query))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
brw_query->query = obj;
|
brw_query->query = obj;
|
||||||
return &brw_query->base;
|
return &brw_query->base;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user