Mesa (master): intel/perf: introduce additional ralloc context parameter
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Feb 3 16:50:03 UTC 2021
Module: Mesa
Branch: master
Commit: a545fe9742cd580245290da97c18e6e77e0524ea
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a545fe9742cd580245290da97c18e6e77e0524ea
Author: Tapani Pälli <tapani.palli at intel.com>
Date: Tue Feb 2 11:26:16 2021 +0200
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 at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8805>
---
src/gallium/drivers/iris/iris_monitor.c | 1 +
src/gallium/drivers/iris/iris_performance_query.c | 1 +
src/intel/perf/gen_perf_query.c | 7 +++++--
src/intel/perf/gen_perf_query.h | 1 +
src/mesa/drivers/dri/i965/brw_performance_query.c | 2 +-
5 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/iris/iris_monitor.c b/src/gallium/drivers/iris/iris_monitor.c
index 919aebca478..675302fd5ff 100644
--- a/src/gallium/drivers/iris/iris_monitor.c
+++ b/src/gallium/drivers/iris/iris_monitor.c
@@ -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,
diff --git a/src/gallium/drivers/iris/iris_performance_query.c b/src/gallium/drivers/iris/iris_performance_query.c
index 0ef5c206fe3..60aaf3c00c9 100644
--- a/src/gallium/drivers/iris/iris_performance_query.c
+++ b/src/gallium/drivers/iris/iris_performance_query.c
@@ -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,
diff --git a/src/intel/perf/gen_perf_query.c b/src/intel/perf/gen_perf_query.c
index b236c10ebbf..c32ff2df043 100644
--- a/src/intel/perf/gen_perf_query.c
+++ b/src/intel/perf/gen_perf_query.c
@@ -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);
}
diff --git a/src/intel/perf/gen_perf_query.h b/src/intel/perf/gen_perf_query.h
index ea5d29e9696..b029e01d03e 100644
--- a/src/intel/perf/gen_perf_query.h
+++ b/src/intel/perf/gen_perf_query.h
@@ -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,
diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c
index 277ac769f86..404c55432bc 100644
--- a/src/mesa/drivers/dri/i965/brw_performance_query.c
+++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
@@ -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 */);
More information about the mesa-commit
mailing list