Some query results struct contents are declared as cache line aligned.
Use aligned malloc, and align the whole struct, to be safe.
Fixes crash when compiling with clang.
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
#include "swr_query.h"
#include "swr_screen.h"
#include "swr_state.h"
-
+#include "common/os.h"
static struct swr_query *
swr_query(struct pipe_query *p)
assert(type < PIPE_QUERY_TYPES);
assert(index < MAX_SO_STREAMS);
- pq = CALLOC_STRUCT(swr_query);
+ pq = (struct swr_query *) AlignedMalloc(sizeof(struct swr_query), 64);
+ memset(pq, 0, sizeof(*pq));
if (pq) {
pq->type = type;
swr_fence_reference(pipe->screen, &pq->fence, NULL);
}
- FREE(pq);
+ AlignedFree(pq);
}
uint64_t timestamp_end;
};
-struct swr_query {
+OSALIGNLINE(struct) swr_query {
unsigned type; /* PIPE_QUERY_* */
unsigned index;