intel/perf: introduce additional ralloc context parameter

This makes it possible to use a separate ralloc context, not gl context
itself which might not be allocated with ralloc.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8805>
This commit is contained in:
Tapani Pälli 2021-02-02 11:26:16 +02:00 committed by Marge Bot
parent 095fd121a3
commit a545fe9742
5 changed files with 9 additions and 3 deletions

View file

@ -153,6 +153,7 @@ iris_init_monitor_ctx(struct iris_context *ice)
gen_perf_init_context(perf_ctx,
perf_cfg,
ice,
ice,
screen->bufmgr,
&screen->devinfo,
ice->batches[IRIS_BATCH_RENDER].hw_ctx_id,

View file

@ -68,6 +68,7 @@ iris_init_perf_query_info(struct pipe_context *pipe)
gen_perf_init_context(ice->perf_ctx,
perf_cfg,
ice,
ice,
screen->bufmgr,
&screen->devinfo,
ice->batches[IRIS_BATCH_RENDER].hw_ctx_id,

View file

@ -252,6 +252,7 @@ struct gen_perf_query_object
struct gen_perf_context {
struct gen_perf_config *perf;
void * mem_ctx; /* ralloc context */
void * ctx; /* driver context (eg, brw_context) */
void * bufmgr;
const struct gen_device_info *devinfo;
@ -568,6 +569,7 @@ gen_perf_config(struct gen_perf_context *ctx)
void
gen_perf_init_context(struct gen_perf_context *perf_ctx,
struct gen_perf_config *perf_cfg,
void * mem_ctx, /* ralloc context */
void * ctx, /* driver context (eg, brw_context) */
void * bufmgr, /* eg brw_bufmgr */
const struct gen_device_info *devinfo,
@ -575,6 +577,7 @@ gen_perf_init_context(struct gen_perf_context *perf_ctx,
int drm_fd)
{
perf_ctx->perf = perf_cfg;
perf_ctx->mem_ctx = mem_ctx;
perf_ctx->ctx = ctx;
perf_ctx->bufmgr = bufmgr;
perf_ctx->drm_fd = drm_fd;
@ -582,7 +585,7 @@ gen_perf_init_context(struct gen_perf_context *perf_ctx,
perf_ctx->devinfo = devinfo;
perf_ctx->unaccumulated =
ralloc_array(ctx, struct gen_perf_query_object *, 2);
ralloc_array(mem_ctx, struct gen_perf_query_object *, 2);
perf_ctx->unaccumulated_elements = 0;
perf_ctx->unaccumulated_array_size = 2;
@ -617,7 +620,7 @@ add_to_unaccumulated_query_list(struct gen_perf_context *perf_ctx,
{
perf_ctx->unaccumulated_array_size *= 1.5;
perf_ctx->unaccumulated =
reralloc(perf_ctx->ctx, perf_ctx->unaccumulated,
reralloc(perf_ctx->mem_ctx, perf_ctx->unaccumulated,
struct gen_perf_query_object *,
perf_ctx->unaccumulated_array_size);
}

View file

@ -36,6 +36,7 @@ struct gen_perf_context *gen_perf_new_context(void *parent);
void gen_perf_init_context(struct gen_perf_context *perf_ctx,
struct gen_perf_config *perf_cfg,
void * mem_ctx, /* ralloc context */
void * ctx, /* driver context (eg, brw_context) */
void * bufmgr, /* eg brw_bufmgr */
const struct gen_device_info *devinfo,

View file

@ -504,7 +504,7 @@ brw_init_perf_query_info(struct gl_context *ctx)
perf_cfg->vtbl.bo_wait_rendering = (bo_wait_rendering_t)brw_bo_wait_rendering;
perf_cfg->vtbl.bo_busy = (bo_busy_t)brw_bo_busy;
gen_perf_init_context(perf_ctx, perf_cfg, brw, brw->bufmgr, devinfo,
gen_perf_init_context(perf_ctx, perf_cfg, brw, brw, brw->bufmgr, devinfo,
brw->hw_ctx, brw->screen->fd);
gen_perf_init_metrics(perf_cfg, devinfo, brw->screen->fd,
true /* pipeline stats */);