[Mesa-dev] [PATCH] mesa: update packed format layout comments
Brian Paul
brianp at vmware.com
Tue Mar 4 07:57:26 PST 2014
On 03/03/2014 08:38 PM, Chia-I Wu wrote:
> On Sat, Mar 1, 2014 at 1:59 AM, Brian Paul <brianp at 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 at 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
More information about the mesa-dev
mailing list