[Mesa-dev] [PATCH] llvmpipe: use aligned data for the assembly program in setup

Oded Gabbay oded.gabbay at gmail.com
Thu Dec 31 01:11:47 PST 2015


On Thu, Dec 31, 2015 at 5:46 AM,  <sroland at vmware.com> wrote:
> From: Roland Scheidegger <sroland at vmware.com>
>
> Back in the day (before 24678700edaf5bb9da9be93a1367f1a24cfaa471) the values
> were not actually in a struct but even then I can't see why we didn't simply
> align the values. Especially since it's trivial to do so.
> (Not that it actually matters since the code is pretty much unused for now.)
> ---
>  src/gallium/drivers/llvmpipe/lp_setup_tri.c | 38 ++++++++++++++++-------------
>  1 file changed, 21 insertions(+), 17 deletions(-)
>
> diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
> index b1671dd..0c40fb3 100644
> --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
> +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
> @@ -387,6 +387,10 @@ do_triangle_ccw(struct lp_setup_context *setup,
>     plane = GET_PLANES(tri);
>
>  #if defined(PIPE_ARCH_SSE)
> +   /*
> +    * XXX this code is effectively disabled for all practical purposes,
> +    * as the allowed fb size is tiny if FIXED_ORDER is 8.
> +    */
>     if (setup->fb.width <= MAX_FIXED_LENGTH32 &&
>         setup->fb.height <= MAX_FIXED_LENGTH32 &&
>         (bbox.x1 - bbox.x0) <= MAX_FIXED_LENGTH32 &&
> @@ -404,8 +408,8 @@ do_triangle_ccw(struct lp_setup_context *setup,
>        __m128i zero = _mm_setzero_si128();
>        PIPE_ALIGN_VAR(16) int32_t temp_vec[4];
>
> -      vertx = _mm_loadu_si128((__m128i *)position->x); /* vertex x coords */
> -      verty = _mm_loadu_si128((__m128i *)position->y); /* vertex y coords */
> +      vertx = _mm_load_si128((__m128i *)position->x); /* vertex x coords */
> +      verty = _mm_load_si128((__m128i *)position->y); /* vertex y coords */
>
>        shufx = _mm_shuffle_epi32(vertx, _MM_SHUFFLE(3,0,2,1));
>        shufy = _mm_shuffle_epi32(verty, _MM_SHUFFLE(3,0,2,1));
> @@ -932,12 +936,12 @@ rotate_fixed_position_12( struct fixed_position* position )
>  /**
>   * Draw triangle if it's CW, cull otherwise.
>   */
> -static void triangle_cw( struct lp_setup_context *setup,
> -                        const float (*v0)[4],
> -                        const float (*v1)[4],
> -                        const float (*v2)[4] )
> +static void triangle_cw(struct lp_setup_context *setup,
> +                        const float (*v0)[4],
> +                        const float (*v1)[4],
> +                        const float (*v2)[4])
>  {
> -   struct fixed_position position;
> +   PIPE_ALIGN_VAR(16) struct fixed_position position;
>
>     calc_fixed_position(setup, &position, v0, v1, v2);
>
> @@ -953,12 +957,12 @@ static void triangle_cw( struct lp_setup_context *setup,
>  }
>
>
> -static void triangle_ccw( struct lp_setup_context *setup,
> -                          const float (*v0)[4],
> -                          const float (*v1)[4],
> -                          const float (*v2)[4])
> +static void triangle_ccw(struct lp_setup_context *setup,
> +                         const float (*v0)[4],
> +                         const float (*v1)[4],
> +                         const float (*v2)[4])
>  {
> -   struct fixed_position position;
> +   PIPE_ALIGN_VAR(16) struct fixed_position position;
>
>     calc_fixed_position(setup, &position, v0, v1, v2);
>
> @@ -969,12 +973,12 @@ static void triangle_ccw( struct lp_setup_context *setup,
>  /**
>   * Draw triangle whether it's CW or CCW.
>   */
> -static void triangle_both( struct lp_setup_context *setup,
> -                          const float (*v0)[4],
> -                          const float (*v1)[4],
> -                          const float (*v2)[4] )
> +static void triangle_both(struct lp_setup_context *setup,
> +                          const float (*v0)[4],
> +                          const float (*v1)[4],
> +                          const float (*v2)[4])
>  {
> -   struct fixed_position position;
> +   PIPE_ALIGN_VAR(16) struct fixed_position position;
>     struct llvmpipe_context *lp_context = (struct llvmpipe_context *)setup->pipe;
>
>     if (lp_context->active_statistics_queries &&
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reviewed-by: Oded Gabbay <oded.gabbay at gmail.com>


More information about the mesa-dev mailing list