[Mesa-dev] [PATCH 2/2] i965: Allocate the whole URB to the VS and clarify calculations.

Ian Romanick idr at freedesktop.org
Fri Apr 8 08:32:39 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/07/2011 04:49 PM, Kenneth Graunke wrote:
> Since we currently do not support Geometry Shaders, there's no need to
> allocate any URB space to the GS unit.  Give all of it to the VS, and
> document some of the units, restrictions, and calculations.
> ---
>  src/mesa/drivers/dri/i965/brw_context.h |    2 +-
>  src/mesa/drivers/dri/i965/gen6_urb.c    |   18 +++++++++++-------
>  2 files changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
> index d63e8a4..6be7188 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -560,7 +560,7 @@ struct brw_context
>         * a number of 1024-bit (128-byte) units.  Should be >= 1.
>         */
>        GLuint vs_size;
> -/*       GLuint gs_size; */
> +      GLuint gs_size;
>  
>        GLuint vs_start;
>        GLuint gs_start;
> diff --git a/src/mesa/drivers/dri/i965/gen6_urb.c b/src/mesa/drivers/dri/i965/gen6_urb.c
> index c3819f9..83a6b97 100644
> --- a/src/mesa/drivers/dri/i965/gen6_urb.c
> +++ b/src/mesa/drivers/dri/i965/gen6_urb.c
> @@ -45,15 +45,19 @@ prepare_urb( struct brw_context *brw )
>  	max_urb_entry = 256;
>     }
>  
> -   brw->urb.nr_vs_entries = max_urb_entry;
> -   brw->urb.nr_gs_entries = max_urb_entry;
> -
>     /* CACHE_NEW_VS_PROG */
> +   /* According to volume 2a, nr_vs_entries must be a multiple of 4 in the
> +    * range [24, 256] on GT2 and [24, 128] on GT1.
> +    */
> +   brw->urb.nr_vs_entries = max_urb_entry;
>     brw->urb.vs_size = MAX2(brw->vs.prog_data->urb_entry_size, 1);

It occurs to me that this might not work.  Is it possible for
urb_entry_size * max_urb_entry to be larger than will fit?

    32k / 256 = 128 bytes

On SNB, it looks like the max entry size is (16 attributes + 4 header
regs) * (16 bytes per entry) = 320 bytes.  Right?

>  
> -   if (2 * brw->urb.vs_size > urb_size)
> -	   brw->urb.nr_vs_entries = brw->urb.nr_gs_entries = 
> -		(urb_size ) / (2 * brw->urb.vs_size);
> +   /* CACHE_NEW_GS_PROG */
> +   /* nr_gs_entries must be a multiple of 4 in the range [0, 256] on GT2
> +    * and [0, 254] on GT1.  We don't believe it either.
> +    */
> +   brw->urb.nr_gs_entries = 0;
> +   brw->urb.gs_size = 1; /* wrong, but with 0 GS entries it doesn't matter */
>  }
>  
>  static void
> @@ -70,7 +74,7 @@ upload_urb(struct brw_context *brw)
>     OUT_BATCH(_3DSTATE_URB << 16 | (3 - 2));
>     OUT_BATCH(((brw->urb.vs_size - 1) << GEN6_URB_VS_SIZE_SHIFT) |
>  	     ((brw->urb.nr_vs_entries) << GEN6_URB_VS_ENTRIES_SHIFT));
> -   OUT_BATCH(((brw->urb.vs_size - 1) << GEN6_URB_GS_SIZE_SHIFT) |
> +   OUT_BATCH(((brw->urb.gs_size - 1) << GEN6_URB_GS_SIZE_SHIFT) |
>  	     ((brw->urb.nr_gs_entries) << GEN6_URB_GS_ENTRIES_SHIFT));
>     ADVANCE_BATCH();
>  }

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk2fKpcACgkQX1gOwKyEAw8/bgCeMJ6bpSJMtlXKy4TOW5Y/9FOO
A0IAn25zPtHx+t0Zx5vT5cbdHii/67Qh
=aXhL
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list