summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Kyriazis <george.kyriazis@intel.com>2017-01-18 17:09:08 -0600
committerEmil Velikov <emil.l.velikov@gmail.com>2017-03-14 00:13:12 +0000
commit1665761bb07fed1fe8f4e9b8392b716b83b80042 (patch)
tree6036f18ea266788f90f3e8f9f8038d8c2a2d0e59 /src
parent59f76392a57d1e962b66320e1e1869021fdc9395 (diff)
swr: Align query results allocation
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> (cherry picked from commit 00847e4f14dd237dfcdb2c3d15be1325a08ccf5a)
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/swr/swr_query.cpp7
-rw-r--r--src/gallium/drivers/swr/swr_query.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/gallium/drivers/swr/swr_query.cpp b/src/gallium/drivers/swr/swr_query.cpp
index 8bb0b16f034..f784f1a71a7 100644
--- a/src/gallium/drivers/swr/swr_query.cpp
+++ b/src/gallium/drivers/swr/swr_query.cpp
@@ -29,7 +29,7 @@
#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)
@@ -45,7 +45,8 @@ swr_create_query(struct pipe_context *pipe, unsigned type, unsigned index)
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;
@@ -67,7 +68,7 @@ swr_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
swr_fence_reference(pipe->screen, &pq->fence, NULL);
}
- FREE(pq);
+ AlignedFree(pq);
}
diff --git a/src/gallium/drivers/swr/swr_query.h b/src/gallium/drivers/swr/swr_query.h
index c5160ceb453..1c736e4e1be 100644
--- a/src/gallium/drivers/swr/swr_query.h
+++ b/src/gallium/drivers/swr/swr_query.h
@@ -34,7 +34,7 @@ struct swr_query_result {
uint64_t timestamp_end;
};
-struct swr_query {
+OSALIGNLINE(struct) swr_query {
unsigned type; /* PIPE_QUERY_* */
unsigned index;