<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Reviewed-by: Tim Rowley <<a href="mailto:timothy.o.rowley@intel.com" class="">timothy.o.rowley@intel.com</a>>
<div class=""><br class="">
<div class="">
<div>
<blockquote type="cite" class="">
<div class="">On Apr 12, 2017, at 6:43 PM, Bruce Cherniak <<a href="mailto:bruce.cherniak@intel.com" class="">bruce.cherniak@intel.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">The context now contains SIMD vectors which must be aligned (specifically<br class="">
samplePositions in the rastState in the derived state).  Failure to align<br class="">
can result in segv crash on unaligned memory access in vector<br class="">
instructions.<br class="">
<br class="">
---<br class="">
src/gallium/drivers/swr/swr_context.cpp | 7 +++++--<br class="">
1 file changed, 5 insertions(+), 2 deletions(-)<br class="">
<br class="">
diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp<br class="">
index 8c5a269..6f46d66 100644<br class="">
--- a/src/gallium/drivers/swr/swr_context.cpp<br class="">
+++ b/src/gallium/drivers/swr/swr_context.cpp<br class="">
@@ -386,7 +386,7 @@ swr_destroy(struct pipe_context *pipe)<br class="">
   if (screen->pipe == pipe)<br class="">
      screen->pipe = NULL;<br class="">
<br class="">
-   FREE(ctx);<br class="">
+   AlignedFree(ctx);<br class="">
}<br class="">
<br class="">
<br class="">
@@ -452,7 +452,10 @@ swr_UpdateStatsFE(HANDLE hPrivateContext, const SWR_STATS_FE *pStats)<br class="">
struct pipe_context *<br class="">
swr_create_context(struct pipe_screen *p_screen, void *priv, unsigned flags)<br class="">
{<br class="">
-   struct swr_context *ctx = CALLOC_STRUCT(swr_context);<br class="">
+   struct swr_context *ctx = (struct swr_context *)<br class="">
+      AlignedMalloc(sizeof(struct swr_context), KNOB_SIMD_BYTES);<br class="">
+   memset(ctx, 0, sizeof(struct swr_context));<br class="">
+<br class="">
   ctx->blendJIT =<br class="">
      new std::unordered_map<BLEND_COMPILE_STATE, PFN_BLEND_JIT_FUNC>;<br class="">
<br class="">
-- <br class="">
2.7.4<br class="">
<br class="">
_______________________________________________<br class="">
mesa-dev mailing list<br class="">
<a href="mailto:mesa-dev@lists.freedesktop.org" class="">mesa-dev@lists.freedesktop.org</a><br class="">
https://lists.freedesktop.org/mailman/listinfo/mesa-dev<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</body>
</html>