[Mesa-dev] [PATCH] panfrost: Resolve alignment issue on 32-bit

Eric Anholt eric at anholt.net
Mon Feb 11 17:44:17 UTC 2019


Alyssa Rosenzweig <alyssa at rosenzweig.io> writes:

> Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
> ---
>  src/gallium/drivers/panfrost/pan_blending.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/panfrost/pan_blending.c b/src/gallium/drivers/panfrost/pan_blending.c
> index 058fb6bda84..a19d048123b 100644
> --- a/src/gallium/drivers/panfrost/pan_blending.c
> +++ b/src/gallium/drivers/panfrost/pan_blending.c
> @@ -333,9 +333,10 @@ panfrost_make_constant(unsigned *factors, unsigned num_factors, const struct pip
>                  }
>          }
>  
> -        /* We have the constant -- success! */
> +        /* We have the constant -- success! Copy it in indirectly (to prevent
> +         * alignment issues on some platforms) */
>  
> -        *out = constant;
> +        memcpy(out, &constant, sizeof(float));
>          return true;

You've got a float *out that's unaligned?  I would recommend a void
pointer if you're breaking the alignment rules.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190211/8c5bac31/attachment.sig>


More information about the mesa-dev mailing list