i915: use align_calloc for the context to fix m32 crashes
Fixes: 3175b63a0d
"mesa: don't allocate matrices with malloc"
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4295
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9220>
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "tnl/t_pipeline.h"
|
||||
#include "intel_tris.h"
|
||||
#include "util/ralloc.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
/***************************************
|
||||
* Mesa's Driver Functions
|
||||
@@ -61,7 +62,7 @@ i830CreateContext(int api,
|
||||
void *sharedContextPrivate)
|
||||
{
|
||||
struct dd_function_table functions;
|
||||
struct i830_context *i830 = rzalloc(NULL, struct i830_context);
|
||||
struct i830_context *i830 = align_calloc(sizeof(struct i830_context), 16);
|
||||
struct intel_context *intel = &i830->intel;
|
||||
struct gl_context *ctx = &intel->ctx;
|
||||
|
||||
@@ -78,7 +79,7 @@ i830CreateContext(int api,
|
||||
mesaVis, driContextPriv,
|
||||
sharedContextPrivate, &functions,
|
||||
error)) {
|
||||
ralloc_free(i830);
|
||||
align_free(i830);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -38,6 +38,7 @@
|
||||
#include "tnl/t_context.h"
|
||||
#include "tnl/t_pipeline.h"
|
||||
#include "tnl/t_vertex.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
#include "swrast/swrast.h"
|
||||
#include "swrast_setup/swrast_setup.h"
|
||||
@@ -165,7 +166,7 @@ i915CreateContext(int api,
|
||||
void *sharedContextPrivate)
|
||||
{
|
||||
struct dd_function_table functions;
|
||||
struct i915_context *i915 = rzalloc(NULL, struct i915_context);
|
||||
struct i915_context *i915 = align_calloc(sizeof(struct i915_context), 16);
|
||||
struct intel_context *intel = &i915->intel;
|
||||
struct gl_context *ctx = &intel->ctx;
|
||||
|
||||
@@ -182,7 +183,7 @@ i915CreateContext(int api,
|
||||
mesaVis, driContextPriv,
|
||||
sharedContextPrivate, &functions,
|
||||
error)) {
|
||||
ralloc_free(i915);
|
||||
align_free(i915);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -57,6 +57,7 @@
|
||||
#include "utils.h"
|
||||
#include "util/debug.h"
|
||||
#include "util/ralloc.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
int INTEL_DEBUG = (0);
|
||||
|
||||
@@ -600,7 +601,7 @@ intelDestroyContext(__DRIcontext * driContextPriv)
|
||||
/* free the Mesa context */
|
||||
_mesa_free_context_data(&intel->ctx, true);
|
||||
|
||||
ralloc_free(intel);
|
||||
align_free(intel);
|
||||
driContextPriv->driverPrivate = NULL;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user