[Mesa-dev] mesa: update packed format layout comments

Submitted by Brian Paul on Feb. 28, 2014, 5:59 p.m.

Details

Message ID 1393610351-1350-1-git-send-email-brianp@vmware.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Brian Paul Feb. 28, 2014, 5:59 p.m.
Update the comments for the packed formats to accurately reflect the
layout of the bits in the pixel.  For example, for the packed format
MESA_FORMAT_R8G8B8A8, R is in the least significant position while A
is in the most-significant position of the 32-bit word.
---
 src/mesa/main/formats.h |   98 +++++++++++++++++++++++------------------------
 1 file changed, 49 insertions(+), 49 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 3f44de9..72a6600 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -339,33 +339,33 @@  typedef enum
 
    /* Type P formats */          /* msb <------ TEXEL BITS -----------> lsb */
                                  /* ---- ---- ---- ---- ---- ---- ---- ---- */
-   MESA_FORMAT_A8B8G8R8_UNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
-   MESA_FORMAT_R8G8B8A8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
-   MESA_FORMAT_B8G8R8A8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
-   MESA_FORMAT_A8R8G8B8_UNORM,   /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
-   MESA_FORMAT_X8B8G8R8_UNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
-   MESA_FORMAT_R8G8B8X8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
-   MESA_FORMAT_B8G8R8X8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
-   MESA_FORMAT_X8R8G8B8_UNORM,   /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
+   MESA_FORMAT_A8B8G8R8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
+   MESA_FORMAT_R8G8B8A8_UNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
+   MESA_FORMAT_B8G8R8A8_UNORM,   /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
+   MESA_FORMAT_A8R8G8B8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
+   MESA_FORMAT_X8B8G8R8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
+   MESA_FORMAT_R8G8B8X8_UNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
+   MESA_FORMAT_B8G8R8X8_UNORM,   /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
+   MESA_FORMAT_X8R8G8B8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
 
    /* Type A formats */
    MESA_FORMAT_BGR_UNORM8,    /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */
    MESA_FORMAT_RGB_UNORM8,    /* uchar[i * 3] = R, [i * 3 + 1] = G, [i *3 + 2] = B */
 
    /* Type P formats */
-   MESA_FORMAT_B5G6R5_UNORM,                         /* BBBB BGGG GGGR RRRR */
-   MESA_FORMAT_R5G6B5_UNORM,                         /* RRRR RGGG GGGB BBBB */
-   MESA_FORMAT_B4G4R4A4_UNORM,                       /* BBBB GGGG RRRR AAAA */
-   MESA_FORMAT_A4R4G4B4_UNORM,                       /* AAAA RRRR GGGG BBBB */
+   MESA_FORMAT_B5G6R5_UNORM,                         /* RRRR RGGG GGGB BBBB */
+   MESA_FORMAT_R5G6B5_UNORM,                         /* BBBB BGGG GGGR RRRR */
+   MESA_FORMAT_B4G4R4A4_UNORM,                       /* AAAA RRRR GGGG BBBB */
+   MESA_FORMAT_A4R4G4B4_UNORM,                       /* BBBB GGGG RRRR AAAA */
    MESA_FORMAT_A1B5G5R5_UNORM,                       /* ABBB BBGG GGGR RRRR */
-   MESA_FORMAT_B5G5R5A1_UNORM,                       /* BBBB BGGG GGRR RRRA */
-   MESA_FORMAT_A1R5G5B5_UNORM,                       /* ARRR RRGG GGGB BBBB */
-   MESA_FORMAT_L4A4_UNORM,                                     /* LLLL AAAA */
-   MESA_FORMAT_L8A8_UNORM,                           /* LLLL LLLL AAAA AAAA */
-   MESA_FORMAT_A8L8_UNORM,                           /* AAAA AAAA LLLL LLLL */
-   MESA_FORMAT_L16A16_UNORM,     /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
-   MESA_FORMAT_A16L16_UNORM,     /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
-   MESA_FORMAT_B2G3R3_UNORM,                                   /* BBGG GRRR */
+   MESA_FORMAT_B5G5R5A1_UNORM,                       /* ARRR RRGG GGGB BBBB */
+   MESA_FORMAT_A1R5G5B5_UNORM,                       /* BBBB BGGG GGRR RRRA */
+   MESA_FORMAT_L4A4_UNORM,                                     /* AAAA LLLL */
+   MESA_FORMAT_L8A8_UNORM,                           /* AAAA AAAA LLLL LLLL */
+   MESA_FORMAT_A8L8_UNORM,                           /* LLLL LLLL AAAA AAAA */
+   MESA_FORMAT_L16A16_UNORM,     /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
+   MESA_FORMAT_A16L16_UNORM,     /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
+   MESA_FORMAT_B2G3R3_UNORM,                                   /* RRRG GGBB */
 
    /* Type A formats */
    MESA_FORMAT_A_UNORM8,     /* uchar[i] = A */
@@ -383,25 +383,25 @@  typedef enum
    MESA_FORMAT_R_UNORM8,      /* uchar[i] = R */
 
    /* Type P formats */
-   MESA_FORMAT_R8G8_UNORM,                           /* RRRR RRRR GGGG GGGG */
-   MESA_FORMAT_G8R8_UNORM,                           /* GGGG GGGG RRRR RRRR */
+   MESA_FORMAT_R8G8_UNORM,                           /* GGGG GGGG RRRR RRRR */
+   MESA_FORMAT_G8R8_UNORM,                           /* RRRR RRRR GGGG GGGG */
 
    /* Type A format(s) */
    MESA_FORMAT_R_UNORM16,     /* ushort[i] = R */
 
    /* Type P formats */
-   MESA_FORMAT_R16G16_UNORM,     /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
-   MESA_FORMAT_G16R16_UNORM,     /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
-   MESA_FORMAT_B10G10R10A2_UNORM,/* BBBB BBBB BBGG GGGG GGGG RRRR RRRR RRAA */
-   MESA_FORMAT_S8_UINT_Z24_UNORM,/* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
-   MESA_FORMAT_Z24_UNORM_S8_UINT,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
+   MESA_FORMAT_R16G16_UNORM,     /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
+   MESA_FORMAT_G16R16_UNORM,     /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
+   MESA_FORMAT_B10G10R10A2_UNORM,/* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */
+   MESA_FORMAT_S8_UINT_Z24_UNORM,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
+   MESA_FORMAT_Z24_UNORM_S8_UINT,/* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
 
    /* Type A format(s) */
    MESA_FORMAT_Z_UNORM16,     /* ushort[i] = Z */
 
    /* Type P formats */
-   MESA_FORMAT_Z24_UNORM_X8_UINT,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */
-   MESA_FORMAT_X8Z24_UNORM,      /* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
+   MESA_FORMAT_Z24_UNORM_X8_UINT,/* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
+   MESA_FORMAT_X8Z24_UNORM,      /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */
 
    /* Type A formats */
    MESA_FORMAT_Z_UNORM32,     /* uint[i] = Z */
@@ -416,14 +416,14 @@  typedef enum
    MESA_FORMAT_BGR_SRGB8,     /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */
 
    /* Type P formats */
-   MESA_FORMAT_A8B8G8R8_SRGB,    /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR*/
-   MESA_FORMAT_B8G8R8A8_SRGB,    /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
+   MESA_FORMAT_A8B8G8R8_SRGB,    /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
+   MESA_FORMAT_B8G8R8A8_SRGB,    /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
 
    /* Type A format(s) */
    MESA_FORMAT_L_SRGB8,       /* uchar[i] = L */
 
    /* Type P formats */
-   MESA_FORMAT_L8A8_SRGB,        /* LLLL LLLL AAAA AAAA */
+   MESA_FORMAT_L8A8_SRGB,                            /* AAAA AAAA LLLL LLLL */
 
    /* Type C formats */
    MESA_FORMAT_SRGB_DXT1,
@@ -548,16 +548,16 @@  typedef enum
    MESA_FORMAT_R_SNORM8,      /* char[i] = R */
 
    /* Type P formats */
-   MESA_FORMAT_R8G8_SNORM,                           /* RRRR RRRR GGGG GGGG */
-   MESA_FORMAT_X8B8G8R8_SNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
-   MESA_FORMAT_A8B8G8R8_SNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
-   MESA_FORMAT_R8G8B8A8_SNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
+   MESA_FORMAT_R8G8_SNORM,                           /* GGGG GGGG RRRR RRRR */
+   MESA_FORMAT_X8B8G8R8_SNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
+   MESA_FORMAT_A8B8G8R8_SNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
+   MESA_FORMAT_R8G8B8A8_SNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
 
    /* Type A format(s) */
    MESA_FORMAT_R_SNORM16,     /* short[i] = R */
 
    /* Type P format(s) */
-   MESA_FORMAT_R16G16_SNORM,     /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
+   MESA_FORMAT_R16G16_SNORM,     /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
 
    /* Type A format(s) */
    MESA_FORMAT_RGB_SNORM16,   /* short[i * 3] = R, [i * 3 + 1] = G, [i *3 + 2] = B */
@@ -597,7 +597,7 @@  typedef enum
    MESA_FORMAT_L_SNORM8,      /* char[i] = L */
 
    /* Type P format(s) */
-   MESA_FORMAT_L8A8_SNORM,                           /* LLLL LLLL AAAA AAAA */
+   MESA_FORMAT_L8A8_SNORM,                           /* AAAA AAAA LLLL LLLL */
 
    /* Type A format(s) */
    MESA_FORMAT_I_SNORM8,      /* char[i] = I */
@@ -608,21 +608,21 @@  typedef enum
 
    /* Type P format(s) */
    MESA_FORMAT_R9G9B9E5_FLOAT,
-   MESA_FORMAT_R11G11B10_FLOAT,
+   MESA_FORMAT_R11G11B10_FLOAT,   /* BBBB BBBB BBGG GGGG GGGG GRRR RRRR RRRR */
 
    /* Type A format(s) */
    MESA_FORMAT_Z_FLOAT32,
 
    /* Type P formats */
-   MESA_FORMAT_Z32_FLOAT_S8X24_UINT,
+   MESA_FORMAT_Z32_FLOAT_S8X24_UINT, /* (float, x24s8) */
 
-   MESA_FORMAT_B10G10R10A2_UINT,
-   MESA_FORMAT_R10G10B10A2_UINT,
+   MESA_FORMAT_B10G10R10A2_UINT, /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */
+   MESA_FORMAT_R10G10B10A2_UINT, /* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */
 
-   MESA_FORMAT_B4G4R4X4_UNORM,                       /* BBBB GGGG RRRR xxxx */
-   MESA_FORMAT_B5G5R5X1_UNORM,                       /* BBBB BGGG GGRR RRRx */
-   MESA_FORMAT_R8G8B8X8_SNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
-   MESA_FORMAT_R8G8B8X8_SRGB,    /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
+   MESA_FORMAT_B4G4R4X4_UNORM,                       /* xxxx RRRR GGGG BBBB */
+   MESA_FORMAT_B5G5R5X1_UNORM,                       /* xRRR RRGG GGGB BBBB */
+   MESA_FORMAT_R8G8B8X8_SNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
+   MESA_FORMAT_R8G8B8X8_SRGB,    /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
 
    /* Type A formats */
    MESA_FORMAT_RGBX_UINT8,    /* uchar[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */
@@ -643,9 +643,9 @@  typedef enum
    MESA_FORMAT_RGBX_SINT32,   /* ... */
 
    /* Type P formats */
-   MESA_FORMAT_R10G10B10A2_UNORM,
-   MESA_FORMAT_G8R8_SNORM,
-   MESA_FORMAT_G16R16_SNORM,
+   MESA_FORMAT_R10G10B10A2_UNORM, /* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */
+   MESA_FORMAT_G8R8_SNORM,        /*                     RRRR RRRR GGGG GGGG */
+   MESA_FORMAT_G16R16_SNORM,      /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
 
    MESA_FORMAT_COUNT
 } mesa_format;

Comments

Just one minor bug, otherwise

Reviewed-by: Roland Scheidegger <sroland@vmware.com>

Am 28.02.2014 18:59, schrieb Brian Paul:
> Update the comments for the packed formats to accurately reflect the
> layout of the bits in the pixel.  For example, for the packed format
> MESA_FORMAT_R8G8B8A8, R is in the least significant position while A
> is in the most-significant position of the 32-bit word.
> ---
>  src/mesa/main/formats.h |   98 +++++++++++++++++++++++------------------------
>  1 file changed, 49 insertions(+), 49 deletions(-)
> 
> diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
> index 3f44de9..72a6600 100644
> --- a/src/mesa/main/formats.h
> +++ b/src/mesa/main/formats.h
> @@ -339,33 +339,33 @@ typedef enum
>  
>     /* Type P formats */          /* msb <------ TEXEL BITS -----------> lsb */
>                                   /* ---- ---- ---- ---- ---- ---- ---- ---- */
> -   MESA_FORMAT_A8B8G8R8_UNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
> -   MESA_FORMAT_R8G8B8A8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
> -   MESA_FORMAT_B8G8R8A8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
> -   MESA_FORMAT_A8R8G8B8_UNORM,   /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
> -   MESA_FORMAT_X8B8G8R8_UNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
> -   MESA_FORMAT_R8G8B8X8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
> -   MESA_FORMAT_B8G8R8X8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
> -   MESA_FORMAT_X8R8G8B8_UNORM,   /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
> +   MESA_FORMAT_A8B8G8R8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
> +   MESA_FORMAT_R8G8B8A8_UNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
> +   MESA_FORMAT_B8G8R8A8_UNORM,   /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
> +   MESA_FORMAT_A8R8G8B8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
> +   MESA_FORMAT_X8B8G8R8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
> +   MESA_FORMAT_R8G8B8X8_UNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
> +   MESA_FORMAT_B8G8R8X8_UNORM,   /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
> +   MESA_FORMAT_X8R8G8B8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
>  
>     /* Type A formats */
>     MESA_FORMAT_BGR_UNORM8,    /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */
>     MESA_FORMAT_RGB_UNORM8,    /* uchar[i * 3] = R, [i * 3 + 1] = G, [i *3 + 2] = B */
>  
>     /* Type P formats */
> -   MESA_FORMAT_B5G6R5_UNORM,                         /* BBBB BGGG GGGR RRRR */
> -   MESA_FORMAT_R5G6B5_UNORM,                         /* RRRR RGGG GGGB BBBB */
> -   MESA_FORMAT_B4G4R4A4_UNORM,                       /* BBBB GGGG RRRR AAAA */
> -   MESA_FORMAT_A4R4G4B4_UNORM,                       /* AAAA RRRR GGGG BBBB */
> +   MESA_FORMAT_B5G6R5_UNORM,                         /* RRRR RGGG GGGB BBBB */
> +   MESA_FORMAT_R5G6B5_UNORM,                         /* BBBB BGGG GGGR RRRR */
> +   MESA_FORMAT_B4G4R4A4_UNORM,                       /* AAAA RRRR GGGG BBBB */
> +   MESA_FORMAT_A4R4G4B4_UNORM,                       /* BBBB GGGG RRRR AAAA */
>     MESA_FORMAT_A1B5G5R5_UNORM,                       /* ABBB BBGG GGGR RRRR */
This one seems wrong too.

> -   MESA_FORMAT_B5G5R5A1_UNORM,                       /* BBBB BGGG GGRR RRRA */
> -   MESA_FORMAT_A1R5G5B5_UNORM,                       /* ARRR RRGG GGGB BBBB */
> -   MESA_FORMAT_L4A4_UNORM,                                     /* LLLL AAAA */
> -   MESA_FORMAT_L8A8_UNORM,                           /* LLLL LLLL AAAA AAAA */
> -   MESA_FORMAT_A8L8_UNORM,                           /* AAAA AAAA LLLL LLLL */
> -   MESA_FORMAT_L16A16_UNORM,     /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
> -   MESA_FORMAT_A16L16_UNORM,     /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
> -   MESA_FORMAT_B2G3R3_UNORM,                                   /* BBGG GRRR */
> +   MESA_FORMAT_B5G5R5A1_UNORM,                       /* ARRR RRGG GGGB BBBB */
> +   MESA_FORMAT_A1R5G5B5_UNORM,                       /* BBBB BGGG GGRR RRRA */
> +   MESA_FORMAT_L4A4_UNORM,                                     /* AAAA LLLL */
> +   MESA_FORMAT_L8A8_UNORM,                           /* AAAA AAAA LLLL LLLL */
> +   MESA_FORMAT_A8L8_UNORM,                           /* LLLL LLLL AAAA AAAA */
> +   MESA_FORMAT_L16A16_UNORM,     /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
> +   MESA_FORMAT_A16L16_UNORM,     /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
> +   MESA_FORMAT_B2G3R3_UNORM,                                   /* RRRG GGBB */
>  
>     /* Type A formats */
>     MESA_FORMAT_A_UNORM8,     /* uchar[i] = A */
> @@ -383,25 +383,25 @@ typedef enum
>     MESA_FORMAT_R_UNORM8,      /* uchar[i] = R */
>  
>     /* Type P formats */
> -   MESA_FORMAT_R8G8_UNORM,                           /* RRRR RRRR GGGG GGGG */
> -   MESA_FORMAT_G8R8_UNORM,                           /* GGGG GGGG RRRR RRRR */
> +   MESA_FORMAT_R8G8_UNORM,                           /* GGGG GGGG RRRR RRRR */
> +   MESA_FORMAT_G8R8_UNORM,                           /* RRRR RRRR GGGG GGGG */
>  
>     /* Type A format(s) */
>     MESA_FORMAT_R_UNORM16,     /* ushort[i] = R */
>  
>     /* Type P formats */
> -   MESA_FORMAT_R16G16_UNORM,     /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
> -   MESA_FORMAT_G16R16_UNORM,     /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
> -   MESA_FORMAT_B10G10R10A2_UNORM,/* BBBB BBBB BBGG GGGG GGGG RRRR RRRR RRAA */
> -   MESA_FORMAT_S8_UINT_Z24_UNORM,/* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
> -   MESA_FORMAT_Z24_UNORM_S8_UINT,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
> +   MESA_FORMAT_R16G16_UNORM,     /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
> +   MESA_FORMAT_G16R16_UNORM,     /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
> +   MESA_FORMAT_B10G10R10A2_UNORM,/* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */
> +   MESA_FORMAT_S8_UINT_Z24_UNORM,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
> +   MESA_FORMAT_Z24_UNORM_S8_UINT,/* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
>  
>     /* Type A format(s) */
>     MESA_FORMAT_Z_UNORM16,     /* ushort[i] = Z */
>  
>     /* Type P formats */
> -   MESA_FORMAT_Z24_UNORM_X8_UINT,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */
> -   MESA_FORMAT_X8Z24_UNORM,      /* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
> +   MESA_FORMAT_Z24_UNORM_X8_UINT,/* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
> +   MESA_FORMAT_X8Z24_UNORM,      /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */
>  
>     /* Type A formats */
>     MESA_FORMAT_Z_UNORM32,     /* uint[i] = Z */
> @@ -416,14 +416,14 @@ typedef enum
>     MESA_FORMAT_BGR_SRGB8,     /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */
>  
>     /* Type P formats */
> -   MESA_FORMAT_A8B8G8R8_SRGB,    /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR*/
> -   MESA_FORMAT_B8G8R8A8_SRGB,    /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
> +   MESA_FORMAT_A8B8G8R8_SRGB,    /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
> +   MESA_FORMAT_B8G8R8A8_SRGB,    /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
>  
>     /* Type A format(s) */
>     MESA_FORMAT_L_SRGB8,       /* uchar[i] = L */
>  
>     /* Type P formats */
> -   MESA_FORMAT_L8A8_SRGB,        /* LLLL LLLL AAAA AAAA */
> +   MESA_FORMAT_L8A8_SRGB,                            /* AAAA AAAA LLLL LLLL */
>  
>     /* Type C formats */
>     MESA_FORMAT_SRGB_DXT1,
> @@ -548,16 +548,16 @@ typedef enum
>     MESA_FORMAT_R_SNORM8,      /* char[i] = R */
>  
>     /* Type P formats */
> -   MESA_FORMAT_R8G8_SNORM,                           /* RRRR RRRR GGGG GGGG */
> -   MESA_FORMAT_X8B8G8R8_SNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
> -   MESA_FORMAT_A8B8G8R8_SNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
> -   MESA_FORMAT_R8G8B8A8_SNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
> +   MESA_FORMAT_R8G8_SNORM,                           /* GGGG GGGG RRRR RRRR */
> +   MESA_FORMAT_X8B8G8R8_SNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
> +   MESA_FORMAT_A8B8G8R8_SNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
> +   MESA_FORMAT_R8G8B8A8_SNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
>  
>     /* Type A format(s) */
>     MESA_FORMAT_R_SNORM16,     /* short[i] = R */
>  
>     /* Type P format(s) */
> -   MESA_FORMAT_R16G16_SNORM,     /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
> +   MESA_FORMAT_R16G16_SNORM,     /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
>  
>     /* Type A format(s) */
>     MESA_FORMAT_RGB_SNORM16,   /* short[i * 3] = R, [i * 3 + 1] = G, [i *3 + 2] = B */
> @@ -597,7 +597,7 @@ typedef enum
>     MESA_FORMAT_L_SNORM8,      /* char[i] = L */
>  
>     /* Type P format(s) */
> -   MESA_FORMAT_L8A8_SNORM,                           /* LLLL LLLL AAAA AAAA */
> +   MESA_FORMAT_L8A8_SNORM,                           /* AAAA AAAA LLLL LLLL */
>  
>     /* Type A format(s) */
>     MESA_FORMAT_I_SNORM8,      /* char[i] = I */
> @@ -608,21 +608,21 @@ typedef enum
>  
>     /* Type P format(s) */
>     MESA_FORMAT_R9G9B9E5_FLOAT,
> -   MESA_FORMAT_R11G11B10_FLOAT,
> +   MESA_FORMAT_R11G11B10_FLOAT,   /* BBBB BBBB BBGG GGGG GGGG GRRR RRRR RRRR */
>  
>     /* Type A format(s) */
>     MESA_FORMAT_Z_FLOAT32,
>  
>     /* Type P formats */
> -   MESA_FORMAT_Z32_FLOAT_S8X24_UINT,
> +   MESA_FORMAT_Z32_FLOAT_S8X24_UINT, /* (float, x24s8) */
>  
> -   MESA_FORMAT_B10G10R10A2_UINT,
> -   MESA_FORMAT_R10G10B10A2_UINT,
> +   MESA_FORMAT_B10G10R10A2_UINT, /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */
> +   MESA_FORMAT_R10G10B10A2_UINT, /* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */
>  
> -   MESA_FORMAT_B4G4R4X4_UNORM,                       /* BBBB GGGG RRRR xxxx */
> -   MESA_FORMAT_B5G5R5X1_UNORM,                       /* BBBB BGGG GGRR RRRx */
> -   MESA_FORMAT_R8G8B8X8_SNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
> -   MESA_FORMAT_R8G8B8X8_SRGB,    /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
> +   MESA_FORMAT_B4G4R4X4_UNORM,                       /* xxxx RRRR GGGG BBBB */
> +   MESA_FORMAT_B5G5R5X1_UNORM,                       /* xRRR RRGG GGGB BBBB */
> +   MESA_FORMAT_R8G8B8X8_SNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
> +   MESA_FORMAT_R8G8B8X8_SRGB,    /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
>  
>     /* Type A formats */
>     MESA_FORMAT_RGBX_UINT8,    /* uchar[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */
> @@ -643,9 +643,9 @@ typedef enum
>     MESA_FORMAT_RGBX_SINT32,   /* ... */
>  
>     /* Type P formats */
> -   MESA_FORMAT_R10G10B10A2_UNORM,
> -   MESA_FORMAT_G8R8_SNORM,
> -   MESA_FORMAT_G16R16_SNORM,
> +   MESA_FORMAT_R10G10B10A2_UNORM, /* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */
> +   MESA_FORMAT_G8R8_SNORM,        /*                     RRRR RRRR GGGG GGGG */
> +   MESA_FORMAT_G16R16_SNORM,      /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
>  
>     MESA_FORMAT_COUNT
>  } mesa_format;
>
On 03/03/2014 10:45 AM, Roland Scheidegger wrote:
> Just one minor bug, otherwise
>
> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
>
> Am 28.02.2014 18:59, schrieb Brian Paul:
>> Update the comments for the packed formats to accurately reflect the
>> layout of the bits in the pixel.  For example, for the packed format
>> MESA_FORMAT_R8G8B8A8, R is in the least significant position while A
>> is in the most-significant position of the 32-bit word.
>> ---
>>   src/mesa/main/formats.h |   98 +++++++++++++++++++++++------------------------
>>   1 file changed, 49 insertions(+), 49 deletions(-)
>>
>> diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
>> index 3f44de9..72a6600 100644
>> --- a/src/mesa/main/formats.h
>> +++ b/src/mesa/main/formats.h
>> @@ -339,33 +339,33 @@ typedef enum
>>
>>      /* Type P formats */          /* msb <------ TEXEL BITS -----------> lsb */
>>                                    /* ---- ---- ---- ---- ---- ---- ---- ---- */
>> -   MESA_FORMAT_A8B8G8R8_UNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
>> -   MESA_FORMAT_R8G8B8A8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
>> -   MESA_FORMAT_B8G8R8A8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
>> -   MESA_FORMAT_A8R8G8B8_UNORM,   /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
>> -   MESA_FORMAT_X8B8G8R8_UNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
>> -   MESA_FORMAT_R8G8B8X8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
>> -   MESA_FORMAT_B8G8R8X8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
>> -   MESA_FORMAT_X8R8G8B8_UNORM,   /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
>> +   MESA_FORMAT_A8B8G8R8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
>> +   MESA_FORMAT_R8G8B8A8_UNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
>> +   MESA_FORMAT_B8G8R8A8_UNORM,   /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
>> +   MESA_FORMAT_A8R8G8B8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
>> +   MESA_FORMAT_X8B8G8R8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
>> +   MESA_FORMAT_R8G8B8X8_UNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
>> +   MESA_FORMAT_B8G8R8X8_UNORM,   /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
>> +   MESA_FORMAT_X8R8G8B8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
>>
>>      /* Type A formats */
>>      MESA_FORMAT_BGR_UNORM8,    /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */
>>      MESA_FORMAT_RGB_UNORM8,    /* uchar[i * 3] = R, [i * 3 + 1] = G, [i *3 + 2] = B */
>>
>>      /* Type P formats */
>> -   MESA_FORMAT_B5G6R5_UNORM,                         /* BBBB BGGG GGGR RRRR */
>> -   MESA_FORMAT_R5G6B5_UNORM,                         /* RRRR RGGG GGGB BBBB */
>> -   MESA_FORMAT_B4G4R4A4_UNORM,                       /* BBBB GGGG RRRR AAAA */
>> -   MESA_FORMAT_A4R4G4B4_UNORM,                       /* AAAA RRRR GGGG BBBB */
>> +   MESA_FORMAT_B5G6R5_UNORM,                         /* RRRR RGGG GGGB BBBB */
>> +   MESA_FORMAT_R5G6B5_UNORM,                         /* BBBB BGGG GGGR RRRR */
>> +   MESA_FORMAT_B4G4R4A4_UNORM,                       /* AAAA RRRR GGGG BBBB */
>> +   MESA_FORMAT_A4R4G4B4_UNORM,                       /* BBBB GGGG RRRR AAAA */
>>      MESA_FORMAT_A1B5G5R5_UNORM,                       /* ABBB BBGG GGGR RRRR */
> This one seems wrong too.

Thanks.  I'll fix that before pushing.

-Brian
On Sat, Mar 1, 2014 at 1:59 AM, Brian Paul <brianp@vmware.com> wrote:
> Update the comments for the packed formats to accurately reflect the
> layout of the bits in the pixel.  For example, for the packed format
> MESA_FORMAT_R8G8B8A8, R is in the least significant position while A
> is in the most-significant position of the 32-bit word.
Two comments below, and the patch is

Reviewed-by: Chia-I Wu <olv@lunarg.com>

> ---
>  src/mesa/main/formats.h |   98 +++++++++++++++++++++++------------------------
>  1 file changed, 49 insertions(+), 49 deletions(-)
>
> diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
> index 3f44de9..72a6600 100644
> --- a/src/mesa/main/formats.h
> +++ b/src/mesa/main/formats.h
> @@ -339,33 +339,33 @@ typedef enum
>
>     /* Type P formats */          /* msb <------ TEXEL BITS -----------> lsb */
>                                   /* ---- ---- ---- ---- ---- ---- ---- ---- */
> -   MESA_FORMAT_A8B8G8R8_UNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
> -   MESA_FORMAT_R8G8B8A8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
> -   MESA_FORMAT_B8G8R8A8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
> -   MESA_FORMAT_A8R8G8B8_UNORM,   /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
> -   MESA_FORMAT_X8B8G8R8_UNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
> -   MESA_FORMAT_R8G8B8X8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
> -   MESA_FORMAT_B8G8R8X8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
> -   MESA_FORMAT_X8R8G8B8_UNORM,   /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
> +   MESA_FORMAT_A8B8G8R8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
> +   MESA_FORMAT_R8G8B8A8_UNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
> +   MESA_FORMAT_B8G8R8A8_UNORM,   /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
> +   MESA_FORMAT_A8R8G8B8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
> +   MESA_FORMAT_X8B8G8R8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
> +   MESA_FORMAT_R8G8B8X8_UNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
> +   MESA_FORMAT_B8G8R8X8_UNORM,   /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
> +   MESA_FORMAT_X8R8G8B8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
>
>     /* Type A formats */
>     MESA_FORMAT_BGR_UNORM8,    /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */
>     MESA_FORMAT_RGB_UNORM8,    /* uchar[i * 3] = R, [i * 3 + 1] = G, [i *3 + 2] = B */
>
>     /* Type P formats */
> -   MESA_FORMAT_B5G6R5_UNORM,                         /* BBBB BGGG GGGR RRRR */
> -   MESA_FORMAT_R5G6B5_UNORM,                         /* RRRR RGGG GGGB BBBB */
> -   MESA_FORMAT_B4G4R4A4_UNORM,                       /* BBBB GGGG RRRR AAAA */
> -   MESA_FORMAT_A4R4G4B4_UNORM,                       /* AAAA RRRR GGGG BBBB */
> +   MESA_FORMAT_B5G6R5_UNORM,                         /* RRRR RGGG GGGB BBBB */
> +   MESA_FORMAT_R5G6B5_UNORM,                         /* BBBB BGGG GGGR RRRR */
> +   MESA_FORMAT_B4G4R4A4_UNORM,                       /* AAAA RRRR GGGG BBBB */
> +   MESA_FORMAT_A4R4G4B4_UNORM,                       /* BBBB GGGG RRRR AAAA */
The unpack function, unpack_ARGB4444_REV, assumes GGGG BBBB AAAA RRRR.
 Looks like a bug in the unpack function.

There are some other unpack functions that do not match the format
definitions (and are noted with warnings).  Should they be fixed too,
after this patch landed?

>     MESA_FORMAT_A1B5G5R5_UNORM,                       /* ABBB BBGG GGGR RRRR */
Should be RRRR RGGG GGBB BBBA.

> -   MESA_FORMAT_B5G5R5A1_UNORM,                       /* BBBB BGGG GGRR RRRA */
> -   MESA_FORMAT_A1R5G5B5_UNORM,                       /* ARRR RRGG GGGB BBBB */
> -   MESA_FORMAT_L4A4_UNORM,                                     /* LLLL AAAA */
> -   MESA_FORMAT_L8A8_UNORM,                           /* LLLL LLLL AAAA AAAA */
> -   MESA_FORMAT_A8L8_UNORM,                           /* AAAA AAAA LLLL LLLL */
> -   MESA_FORMAT_L16A16_UNORM,     /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
> -   MESA_FORMAT_A16L16_UNORM,     /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
> -   MESA_FORMAT_B2G3R3_UNORM,                                   /* BBGG GRRR */
> +   MESA_FORMAT_B5G5R5A1_UNORM,                       /* ARRR RRGG GGGB BBBB */
> +   MESA_FORMAT_A1R5G5B5_UNORM,                       /* BBBB BGGG GGRR RRRA */
> +   MESA_FORMAT_L4A4_UNORM,                                     /* AAAA LLLL */
> +   MESA_FORMAT_L8A8_UNORM,                           /* AAAA AAAA LLLL LLLL */
> +   MESA_FORMAT_A8L8_UNORM,                           /* LLLL LLLL AAAA AAAA */
> +   MESA_FORMAT_L16A16_UNORM,     /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
> +   MESA_FORMAT_A16L16_UNORM,     /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
> +   MESA_FORMAT_B2G3R3_UNORM,                                   /* RRRG GGBB */
>
>     /* Type A formats */
>     MESA_FORMAT_A_UNORM8,     /* uchar[i] = A */
> @@ -383,25 +383,25 @@ typedef enum
>     MESA_FORMAT_R_UNORM8,      /* uchar[i] = R */
>
>     /* Type P formats */
> -   MESA_FORMAT_R8G8_UNORM,                           /* RRRR RRRR GGGG GGGG */
> -   MESA_FORMAT_G8R8_UNORM,                           /* GGGG GGGG RRRR RRRR */
> +   MESA_FORMAT_R8G8_UNORM,                           /* GGGG GGGG RRRR RRRR */
> +   MESA_FORMAT_G8R8_UNORM,                           /* RRRR RRRR GGGG GGGG */
>
>     /* Type A format(s) */
>     MESA_FORMAT_R_UNORM16,     /* ushort[i] = R */
>
>     /* Type P formats */
> -   MESA_FORMAT_R16G16_UNORM,     /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
> -   MESA_FORMAT_G16R16_UNORM,     /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
> -   MESA_FORMAT_B10G10R10A2_UNORM,/* BBBB BBBB BBGG GGGG GGGG RRRR RRRR RRAA */
> -   MESA_FORMAT_S8_UINT_Z24_UNORM,/* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
> -   MESA_FORMAT_Z24_UNORM_S8_UINT,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
> +   MESA_FORMAT_R16G16_UNORM,     /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
> +   MESA_FORMAT_G16R16_UNORM,     /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
> +   MESA_FORMAT_B10G10R10A2_UNORM,/* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */
> +   MESA_FORMAT_S8_UINT_Z24_UNORM,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
> +   MESA_FORMAT_Z24_UNORM_S8_UINT,/* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
>
>     /* Type A format(s) */
>     MESA_FORMAT_Z_UNORM16,     /* ushort[i] = Z */
>
>     /* Type P formats */
> -   MESA_FORMAT_Z24_UNORM_X8_UINT,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */
> -   MESA_FORMAT_X8Z24_UNORM,      /* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
> +   MESA_FORMAT_Z24_UNORM_X8_UINT,/* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
> +   MESA_FORMAT_X8Z24_UNORM,      /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */
>
>     /* Type A formats */
>     MESA_FORMAT_Z_UNORM32,     /* uint[i] = Z */
> @@ -416,14 +416,14 @@ typedef enum
>     MESA_FORMAT_BGR_SRGB8,     /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */
>
>     /* Type P formats */
> -   MESA_FORMAT_A8B8G8R8_SRGB,    /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR*/
> -   MESA_FORMAT_B8G8R8A8_SRGB,    /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
> +   MESA_FORMAT_A8B8G8R8_SRGB,    /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
> +   MESA_FORMAT_B8G8R8A8_SRGB,    /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
>
>     /* Type A format(s) */
>     MESA_FORMAT_L_SRGB8,       /* uchar[i] = L */
>
>     /* Type P formats */
> -   MESA_FORMAT_L8A8_SRGB,        /* LLLL LLLL AAAA AAAA */
> +   MESA_FORMAT_L8A8_SRGB,                            /* AAAA AAAA LLLL LLLL */
>
>     /* Type C formats */
>     MESA_FORMAT_SRGB_DXT1,
> @@ -548,16 +548,16 @@ typedef enum
>     MESA_FORMAT_R_SNORM8,      /* char[i] = R */
>
>     /* Type P formats */
> -   MESA_FORMAT_R8G8_SNORM,                           /* RRRR RRRR GGGG GGGG */
> -   MESA_FORMAT_X8B8G8R8_SNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
> -   MESA_FORMAT_A8B8G8R8_SNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
> -   MESA_FORMAT_R8G8B8A8_SNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
> +   MESA_FORMAT_R8G8_SNORM,                           /* GGGG GGGG RRRR RRRR */
> +   MESA_FORMAT_X8B8G8R8_SNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
> +   MESA_FORMAT_A8B8G8R8_SNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
> +   MESA_FORMAT_R8G8B8A8_SNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
>
>     /* Type A format(s) */
>     MESA_FORMAT_R_SNORM16,     /* short[i] = R */
>
>     /* Type P format(s) */
> -   MESA_FORMAT_R16G16_SNORM,     /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
> +   MESA_FORMAT_R16G16_SNORM,     /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
>
>     /* Type A format(s) */
>     MESA_FORMAT_RGB_SNORM16,   /* short[i * 3] = R, [i * 3 + 1] = G, [i *3 + 2] = B */
> @@ -597,7 +597,7 @@ typedef enum
>     MESA_FORMAT_L_SNORM8,      /* char[i] = L */
>
>     /* Type P format(s) */
> -   MESA_FORMAT_L8A8_SNORM,                           /* LLLL LLLL AAAA AAAA */
> +   MESA_FORMAT_L8A8_SNORM,                           /* AAAA AAAA LLLL LLLL */
>
>     /* Type A format(s) */
>     MESA_FORMAT_I_SNORM8,      /* char[i] = I */
> @@ -608,21 +608,21 @@ typedef enum
>
>     /* Type P format(s) */
>     MESA_FORMAT_R9G9B9E5_FLOAT,
> -   MESA_FORMAT_R11G11B10_FLOAT,
> +   MESA_FORMAT_R11G11B10_FLOAT,   /* BBBB BBBB BBGG GGGG GGGG GRRR RRRR RRRR */
>
>     /* Type A format(s) */
>     MESA_FORMAT_Z_FLOAT32,
>
>     /* Type P formats */
> -   MESA_FORMAT_Z32_FLOAT_S8X24_UINT,
> +   MESA_FORMAT_Z32_FLOAT_S8X24_UINT, /* (float, x24s8) */
>
> -   MESA_FORMAT_B10G10R10A2_UINT,
> -   MESA_FORMAT_R10G10B10A2_UINT,
> +   MESA_FORMAT_B10G10R10A2_UINT, /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */
> +   MESA_FORMAT_R10G10B10A2_UINT, /* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */
>
> -   MESA_FORMAT_B4G4R4X4_UNORM,                       /* BBBB GGGG RRRR xxxx */
> -   MESA_FORMAT_B5G5R5X1_UNORM,                       /* BBBB BGGG GGRR RRRx */
> -   MESA_FORMAT_R8G8B8X8_SNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
> -   MESA_FORMAT_R8G8B8X8_SRGB,    /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
> +   MESA_FORMAT_B4G4R4X4_UNORM,                       /* xxxx RRRR GGGG BBBB */
> +   MESA_FORMAT_B5G5R5X1_UNORM,                       /* xRRR RRGG GGGB BBBB */
> +   MESA_FORMAT_R8G8B8X8_SNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
> +   MESA_FORMAT_R8G8B8X8_SRGB,    /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
>
>     /* Type A formats */
>     MESA_FORMAT_RGBX_UINT8,    /* uchar[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */
> @@ -643,9 +643,9 @@ typedef enum
>     MESA_FORMAT_RGBX_SINT32,   /* ... */
>
>     /* Type P formats */
> -   MESA_FORMAT_R10G10B10A2_UNORM,
> -   MESA_FORMAT_G8R8_SNORM,
> -   MESA_FORMAT_G16R16_SNORM,
> +   MESA_FORMAT_R10G10B10A2_UNORM, /* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */
> +   MESA_FORMAT_G8R8_SNORM,        /*                     RRRR RRRR GGGG GGGG */
> +   MESA_FORMAT_G16R16_SNORM,      /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
>
>     MESA_FORMAT_COUNT
>  } mesa_format;
> --
> 1.7.10.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
On 03/03/2014 08:38 PM, Chia-I Wu wrote:
> On Sat, Mar 1, 2014 at 1:59 AM, Brian Paul <brianp@vmware.com> wrote:
>> Update the comments for the packed formats to accurately reflect the
>> layout of the bits in the pixel.  For example, for the packed format
>> MESA_FORMAT_R8G8B8A8, R is in the least significant position while A
>> is in the most-significant position of the 32-bit word.
> Two comments below, and the patch is
>
> Reviewed-by: Chia-I Wu <olv@lunarg.com>
>
>> ---
>>   src/mesa/main/formats.h |   98 +++++++++++++++++++++++------------------------
>>   1 file changed, 49 insertions(+), 49 deletions(-)
>>
>> diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
>> index 3f44de9..72a6600 100644
>> --- a/src/mesa/main/formats.h
>> +++ b/src/mesa/main/formats.h
>> @@ -339,33 +339,33 @@ typedef enum
>>
>>      /* Type P formats */          /* msb <------ TEXEL BITS -----------> lsb */
>>                                    /* ---- ---- ---- ---- ---- ---- ---- ---- */
>> -   MESA_FORMAT_A8B8G8R8_UNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
>> -   MESA_FORMAT_R8G8B8A8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
>> -   MESA_FORMAT_B8G8R8A8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
>> -   MESA_FORMAT_A8R8G8B8_UNORM,   /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
>> -   MESA_FORMAT_X8B8G8R8_UNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
>> -   MESA_FORMAT_R8G8B8X8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
>> -   MESA_FORMAT_B8G8R8X8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
>> -   MESA_FORMAT_X8R8G8B8_UNORM,   /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
>> +   MESA_FORMAT_A8B8G8R8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
>> +   MESA_FORMAT_R8G8B8A8_UNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
>> +   MESA_FORMAT_B8G8R8A8_UNORM,   /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
>> +   MESA_FORMAT_A8R8G8B8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
>> +   MESA_FORMAT_X8B8G8R8_UNORM,   /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
>> +   MESA_FORMAT_R8G8B8X8_UNORM,   /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
>> +   MESA_FORMAT_B8G8R8X8_UNORM,   /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
>> +   MESA_FORMAT_X8R8G8B8_UNORM,   /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
>>
>>      /* Type A formats */
>>      MESA_FORMAT_BGR_UNORM8,    /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */
>>      MESA_FORMAT_RGB_UNORM8,    /* uchar[i * 3] = R, [i * 3 + 1] = G, [i *3 + 2] = B */
>>
>>      /* Type P formats */
>> -   MESA_FORMAT_B5G6R5_UNORM,                         /* BBBB BGGG GGGR RRRR */
>> -   MESA_FORMAT_R5G6B5_UNORM,                         /* RRRR RGGG GGGB BBBB */
>> -   MESA_FORMAT_B4G4R4A4_UNORM,                       /* BBBB GGGG RRRR AAAA */
>> -   MESA_FORMAT_A4R4G4B4_UNORM,                       /* AAAA RRRR GGGG BBBB */
>> +   MESA_FORMAT_B5G6R5_UNORM,                         /* RRRR RGGG GGGB BBBB */
>> +   MESA_FORMAT_R5G6B5_UNORM,                         /* BBBB BGGG GGGR RRRR */
>> +   MESA_FORMAT_B4G4R4A4_UNORM,                       /* AAAA RRRR GGGG BBBB */
>> +   MESA_FORMAT_A4R4G4B4_UNORM,                       /* BBBB GGGG RRRR AAAA */
> The unpack function, unpack_ARGB4444_REV, assumes GGGG BBBB AAAA RRRR.
>   Looks like a bug in the unpack function.

Yes, I'll post a patch for that.


> There are some other unpack functions that do not match the format
> definitions (and are noted with warnings).  Should they be fixed too,
> after this patch landed?

Yes.  I could try to fix those too later, unless someone else beats me 
to it.


>
>>      MESA_FORMAT_A1B5G5R5_UNORM,                       /* ABBB BBGG GGGR RRRR */
> Should be RRRR RGGG GGBB BBBA.

Roland spotted that too.  I fixed it.

-Brian