[Mesa-dev] [PATCH 1/1] mesa: Add some convention to MESA_FORMATs with attention to PIPE_FORMATs
Kenneth Graunke
kenneth at whitecape.org
Fri Dec 20 11:58:27 PST 2013
On 12/18/2013 08:44 PM, Mark Mueller wrote:
> Though a large patch, this is simply a series of global search
> and replace operations. Please refer to formats.h for the core
> deltas. In summary this change adds UNORM, and UINT to formats
> where no type is given, as necessary; replaces the SIGNED designation
> inside the named format with an appened SNORM qualifier; and replaces
> *_INT with *_SINT, thus making MESA_FORMATs more consistent
> with PIPE_FORMATs. This is the first and most intrusive change
> in a crusade to clean up and conventionalize MESA_FORMATs to
> meet needs of contemporary drivers.
>
> No regressions were observed with piglit testing on i965.
> There were no build regressions on gallium ilo, nouveau, r300,
> or r600 after the change.
>
> Signed-off-by: Mark Mueller <MarkKMueller at gmail.com>
> diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
> index 64b4b9a..94fc7a0 100644
> --- a/src/mesa/main/formats.h
> +++ b/src/mesa/main/formats.h
> @@ -67,51 +67,51 @@ typedef enum
> /*@{*/
> /* msb <------ TEXEL BITS -----------> lsb */
> /* ---- ---- ---- ---- ---- ---- ---- ---- */
> - MESA_FORMAT_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
> - MESA_FORMAT_RGBA8888_REV, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
> - MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
> - MESA_FORMAT_ARGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
> - MESA_FORMAT_RGBX8888, /* RRRR RRRR GGGG GGGG BBBB BBBB XXXX XXXX */
> - MESA_FORMAT_RGBX8888_REV, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
> - MESA_FORMAT_XRGB8888, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
> - MESA_FORMAT_XRGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
> - MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */
> - MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */
> - MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */
> - MESA_FORMAT_RGB565_REV, /* GGGB BBBB RRRR RGGG */
> - MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */
> - MESA_FORMAT_ARGB4444_REV, /* GGGG BBBB AAAA RRRR */
> - MESA_FORMAT_RGBA5551, /* RRRR RGGG GGBB BBBA */
> - MESA_FORMAT_ARGB1555, /* ARRR RRGG GGGB BBBB */
> - MESA_FORMAT_ARGB1555_REV, /* GGGB BBBB ARRR RRGG */
> - MESA_FORMAT_AL44, /* AAAA LLLL */
> - MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */
> - MESA_FORMAT_AL88_REV, /* LLLL LLLL AAAA AAAA */
> - MESA_FORMAT_AL1616, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
> - MESA_FORMAT_AL1616_REV, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
> - MESA_FORMAT_RGB332, /* RRRG GGBB */
> - MESA_FORMAT_A8, /* AAAA AAAA */
> - MESA_FORMAT_A16, /* AAAA AAAA AAAA AAAA */
> - MESA_FORMAT_L8, /* LLLL LLLL */
> - MESA_FORMAT_L16, /* LLLL LLLL LLLL LLLL */
> - MESA_FORMAT_I8, /* IIII IIII */
> - MESA_FORMAT_I16, /* IIII IIII IIII IIII */
> - MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */
> - MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */
> - MESA_FORMAT_R8, /* RRRR RRRR */
> - MESA_FORMAT_GR88, /* GGGG GGGG RRRR RRRR */
> - MESA_FORMAT_RG88, /* RRRR RRRR GGGG GGGG */
> - MESA_FORMAT_R16, /* RRRR RRRR RRRR RRRR */
> - MESA_FORMAT_GR1616, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
> - MESA_FORMAT_RG1616, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
> - MESA_FORMAT_ARGB2101010, /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */
> - MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
> - MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
> - MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */
> - MESA_FORMAT_X8_Z24, /* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
> - MESA_FORMAT_Z24_X8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */
> - MESA_FORMAT_Z32, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
> - MESA_FORMAT_S8, /* SSSS SSSS */
> + MESA_FORMAT_RGBA8888_UNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
> + MESA_FORMAT_RGBA8888_REV_UNORM, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
> + MESA_FORMAT_ARGB8888_UNORM, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
> + MESA_FORMAT_ARGB8888_REV_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
> + MESA_FORMAT_RGBX8888_UNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB XXXX XXXX */
> + MESA_FORMAT_RGBX8888_REV_UNORM, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
> + MESA_FORMAT_XRGB8888_UNORM, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
> + MESA_FORMAT_XRGB8888_REV_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
> + MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */
> + MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */
> + MESA_FORMAT_RGB565_UNORM, /* RRRR RGGG GGGB BBBB */
> + MESA_FORMAT_RGB565_REV_UNORM, /* GGGB BBBB RRRR RGGG */
> + MESA_FORMAT_ARGB4444_UNORM, /* AAAA RRRR GGGG BBBB */
> + MESA_FORMAT_ARGB4444_REV_UNORM, /* GGGG BBBB AAAA RRRR */
> + MESA_FORMAT_RGBA5551_UNORM, /* RRRR RGGG GGBB BBBA */
> + MESA_FORMAT_ARGB1555_UNORM, /* ARRR RRGG GGGB BBBB */
> + MESA_FORMAT_ARGB1555_REV_UNORM, /* GGGB BBBB ARRR RRGG */
> + MESA_FORMAT_AL44_UNORM, /* AAAA LLLL */
> + MESA_FORMAT_AL88_UNORM, /* AAAA AAAA LLLL LLLL */
> + MESA_FORMAT_AL88_REV_UNORM, /* LLLL LLLL AAAA AAAA */
> + MESA_FORMAT_AL1616_UNORM, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
> + MESA_FORMAT_AL1616_REV_UNORM, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
> + MESA_FORMAT_RGB332_UNORM, /* RRRG GGBB */
> + MESA_FORMAT_A8_UNORM, /* AAAA AAAA */
> + MESA_FORMAT_A16_UNORM, /* AAAA AAAA AAAA AAAA */
> + MESA_FORMAT_L8_UNORM, /* LLLL LLLL */
> + MESA_FORMAT_L16_UNORM, /* LLLL LLLL LLLL LLLL */
> + MESA_FORMAT_I8_UNORM, /* IIII IIII */
> + MESA_FORMAT_I16_UNORM, /* IIII IIII IIII IIII */
> + MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */
> + MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */
> + MESA_FORMAT_R8_UNORM, /* RRRR RRRR */
> + MESA_FORMAT_GR88_UNORM, /* GGGG GGGG RRRR RRRR */
> + MESA_FORMAT_RG88_UNORM, /* RRRR RRRR GGGG GGGG */
> + MESA_FORMAT_R16_UNORM, /* RRRR RRRR RRRR RRRR */
> + MESA_FORMAT_GR1616_UNORM, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
> + MESA_FORMAT_RG1616_UNORM, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
> + MESA_FORMAT_ARGB2101010_UNORM, /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */
> + MESA_FORMAT_Z24_UNORM_S8_UINT, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
> + MESA_FORMAT_S8_UINT_Z24_UNORM, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
> + MESA_FORMAT_Z16_UNORM, /* ZZZZ ZZZZ ZZZZ ZZZZ */
> + MESA_FORMAT_X8_Z24_UNORM, /* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
> + MESA_FORMAT_Z24_X8_UNORM, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */
> + MESA_FORMAT_Z32_UNORM, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
> + MESA_FORMAT_S8_UNORM, /* SSSS SSSS */
MESA_FORMAT_S8 is UINT, not UNORM.
Other than that, the format renames look good. Adding UNORM is
definitely clearer than leaving them undecorated, and consistently using
SINT instead of INT or SIGNED...INT is nice.
This also brings Mesa's formats closer to Gallium's PIPE_FORMAT_*, and
also closer to i965's hardware naming convention. I like that.
I didn't review the search and replace exhaustively; I'm trusting you
did that correctly via a sed job.
Assuming you fix the S8 issue, this is:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
As an aside...I would also love to see a patch that renames the
"gl_format" enum to "mesa_format". To me, "GL format" brings to mind
GL_LUMINANCE8 and such, not MESA_FORMAT.
--Ken
More information about the mesa-dev
mailing list