summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2021-02-02 11:33:23 +0200
committerDylan Baker <dylan.c.baker@intel.com>2021-02-04 14:08:35 -0800
commit76ba9da69111e32c4504a850210f658dbf13237b (patch)
tree385e132983a38c00a6de247fb9f51dff71660b6e
parente2a27c14387cd21ac0beb5eee0797f0bc2a2bb19 (diff)
i965: use aligned malloc for context instead of ralloc
Fixes: 3175b63a ("mesa: don't allocate matrices with malloc") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4118 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> (cherry picked from commit b609d4677d3f910c546c1d94d8ddfe4511e2f065) Conflicts: src/mesa/drivers/dri/i965/brw_performance_query.c
-rw-r--r--.pick_status.json2
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c11
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_performance_query.c2
-rw-r--r--src/mesa/drivers/dri/i965/intel_fbo.c4
5 files changed, 12 insertions, 8 deletions
diff --git a/.pick_status.json b/.pick_status.json
index c6f929b0a7d..69d7a9b00e9 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4,7 +4,7 @@
"description": "i965: use aligned malloc for context instead of ralloc",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "3175b63a0dfa290430f9f7eb651387788933a02b"
},
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index a6408cb51f2..61bcdb22123 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -924,7 +924,8 @@ brw_process_driconf_options(struct brw_context *brw)
if (*vendor_str)
ctx->Const.VendorOverride = vendor_str;
- ctx->Const.dri_config_options_sha1 = ralloc_array(brw, unsigned char, 20);
+ ctx->Const.dri_config_options_sha1 =
+ ralloc_array(brw->mem_ctx, unsigned char, 20);
driComputeOptionsSha1(&brw->screen->optionCache,
ctx->Const.dri_config_options_sha1);
}
@@ -968,13 +969,14 @@ brwCreateContext(gl_api api,
((ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY) &&
ctx_config->reset_strategy != __DRI_CTX_RESET_NO_NOTIFICATION);
- struct brw_context *brw = rzalloc(NULL, struct brw_context);
+ struct brw_context *brw = align_calloc(sizeof(struct brw_context), 16);
if (!brw) {
fprintf(stderr, "%s: failed to alloc context\n", __func__);
*dri_ctx_error = __DRI_CTX_ERROR_NO_MEMORY;
return false;
}
- brw->perf_ctx = gen_perf_new_context(brw);
+ brw->mem_ctx = ralloc_context(NULL);
+ brw->perf_ctx = gen_perf_new_context(brw->mem_ctx);
driContextPriv->driverPrivate = brw;
brw->driContext = driContextPriv;
@@ -1243,7 +1245,8 @@ intelDestroyContext(__DRIcontext * driContextPriv)
/* free the Mesa context */
_mesa_free_context_data(&brw->ctx, true);
- ralloc_free(brw);
+ ralloc_free(brw->mem_ctx);
+ align_free(brw);
driContextPriv->driverPrivate = NULL;
}
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index fac7802cbbc..a4019864e7f 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1250,6 +1250,7 @@ struct brw_context
__DRIcontext *driContext;
struct intel_screen *screen;
+ void *mem_ctx;
};
/* brw_clear.c */
diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c
index 277ac769f86..325bc16778c 100644
--- a/src/mesa/drivers/dri/i965/brw_performance_query.c
+++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
@@ -487,7 +487,7 @@ brw_init_perf_query_info(struct gl_context *ctx)
if (!oa_metrics_kernel_support(brw->screen->fd, devinfo))
return 0;
- perf_cfg = gen_perf_new(ctx);
+ perf_cfg = gen_perf_new(brw->mem_ctx);
perf_cfg->vtbl.bo_alloc = brw_oa_bo_alloc;
perf_cfg->vtbl.bo_unreference = (bo_unreference_t)brw_bo_unreference;
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c
index b1f24d4d1d3..f839e41a2fc 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -1132,8 +1132,8 @@ intel_fbo_init(struct brw_context *brw)
dd->EGLImageTargetRenderbufferStorage =
intel_image_target_renderbuffer_storage;
- brw->render_cache = _mesa_hash_table_create(brw, _mesa_hash_pointer,
+ brw->render_cache = _mesa_hash_table_create(brw->mem_ctx, _mesa_hash_pointer,
_mesa_key_pointer_equal);
- brw->depth_cache = _mesa_set_create(brw, _mesa_hash_pointer,
+ brw->depth_cache = _mesa_set_create(brw->mem_ctx, _mesa_hash_pointer,
_mesa_key_pointer_equal);
}