[Mesa-dev] [PATCH 1/7] i965: Add all surface types to the batch decode

Kenneth Graunke kenneth at whitecape.org
Fri Apr 24 10:52:30 PDT 2015


On Thursday, April 23, 2015 04:49:57 PM Ben Widawsky wrote:
> It's true that not all surfaces apply for every gen, but for the most part this
> is what we want. (The unfortunate case is when we use an valid surface, but not
> for the specific GEN).
> 
> This was automated with a vim macro.
> 
> v2: Shortened common forms such as R8G8B8A8->RGBA8. Note that this makes some of
> the sample output in subsequent commits slightly incorrect.
> 
> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> ---
>  src/mesa/drivers/dri/i965/brw_state_dump.c | 226 ++++++++++++++++++++++++++++-
>  1 file changed, 219 insertions(+), 7 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c b/src/mesa/drivers/dri/i965/brw_state_dump.c
> index 5cf70eb..a688ba3 100644
> --- a/src/mesa/drivers/dri/i965/brw_state_dump.c
> +++ b/src/mesa/drivers/dri/i965/brw_state_dump.c
> @@ -67,13 +67,225 @@ get_965_surfacetype(unsigned int surfacetype)
>  static const char *
>  get_965_surface_format(unsigned int surface_format)
>  {
> -    switch (surface_format) {
> -    case 0x000: return "r32g32b32a32_float";
> -    case 0x0c1: return "b8g8r8a8_unorm";
> -    case 0x100: return "b5g6r5_unorm";
> -    case 0x102: return "b5g5r5a1_unorm";
> -    case 0x104: return "b4g4r4a4_unorm";
> -    default: return "unknown";
> +   switch (surface_format) {
> +      case BRW_SURFACEFORMAT_R32G32B32A32_FLOAT: return "RGBA32_FLOAT";
> +      case BRW_SURFACEFORMAT_R32G32B32A32_SINT: return "RGBA32_SINT";
> +      case BRW_SURFACEFORMAT_R32G32B32A32_UINT: return "RGBA32_UINT";
> +      case BRW_SURFACEFORMAT_R32G32B32A32_UNORM: return "RGBA32_UNORM";
> +      case BRW_SURFACEFORMAT_R32G32B32A32_SNORM: return "RGBA32_SNORM";

I'd prefer to decode these exactly as they are..."R32G32B32A32_FLOAT".

I think a better plan would be to edit the table in
brw_surface_formats.c - add a const char *name field, and change the
macro to:

#define SF(sampl, filt, shad, ck, rt, ab, vb, so, color, sf) \
   [BRW_SURFACEFORMAT_##sf] = { true, sampl, filt, shad, ck, rt, ab, vb, so, color, #sf },

then remove BRW_SURFACEFORMAT_* from the entries in the table.

With that in place, you can just look it up in the table, and adding new
formats will be easy - all in one place.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150424/6ffdb6d2/attachment.sig>


More information about the mesa-dev mailing list