diff options
author | Tapani Pälli <tapani.palli@intel.com> | 2021-02-02 11:33:23 +0200 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-02-03 16:37:59 +0000 |
commit | b609d4677d3f910c546c1d94d8ddfe4511e2f065 (patch) | |
tree | 38887fd6104665fe737137dc1ff26d8cb36c2cfd /src/mesa/drivers/dri/i965/brw_context.c | |
parent | a545fe9742cd580245290da97c18e6e77e0524ea (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>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_context.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 43a150f1c84..a156c2534c3 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; @@ -1266,7 +1268,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; } |