[Mesa-dev] [PATCH] llvmpipe: fix lp_rast_plane alignment on 32bit
Jose Fonseca
jfonseca at vmware.com
Tue Mar 15 07:15:13 UTC 2016
On 15/03/16 04:41, sroland at vmware.com wrote:
> From: Roland Scheidegger <sroland at vmware.com>
>
> Some rasterization code relies (for sse) on the first and third planes
> (but not the second for now) being 128bit aligned, and we didn't get that
> on 32bit - I mistakenly thought the 64bit number in the struct would get
> the thing aligned to 64bit even on 32bit archs.
> Stephane Marchesin really figured this out.
>
> This fixes https://bugs.freedesktop.org/show_bug.cgi?id=94522
>
> CC: <mesa-stable at lists.freedesktop.org>
> ---
> src/gallium/drivers/llvmpipe/lp_rast.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h
> index 34008e1..d9be7f3 100644
> --- a/src/gallium/drivers/llvmpipe/lp_rast.h
> +++ b/src/gallium/drivers/llvmpipe/lp_rast.h
> @@ -116,6 +116,12 @@ struct lp_rast_plane {
>
> /* one-pixel sized trivial reject offsets for each plane */
> uint32_t eo;
> + /*
> + * We rely on this struct being 64bit aligned (ideally it would be 128bit
> + * but that's quite the waste) and therefore on 32bit we need padding
> + * since otherwise (even with the 64bit number in there) it wouldn't be.
> + */
> + uint32_t pad;
> };
>
> /**
>
Looks good, but lets add
STATIC_ASSERT(sizeof(struct lp_rast_plane) % 8 == 0);
somewhere, and move the comment there (as the "pad" might come and go if
the structure is ever changed again, but the static assertion should
remain.)
Jose
More information about the mesa-dev
mailing list