This series is a replacement for the util part of: http://lists.freedesktop.org/archives/mesa-dev/2013-May/039419.html
It doesn't include any of the controversial format name parts of those patches (although of course they're still needed in some form). The original version took the endianness from the build system and only produced output for that endianness. This version instead generates both big- and little-endian code, with preprocessor guards to choose the right version. The x8y8z8w8 formats could be handled by adding separate big- and little-endian shift amounts to u_format_parse.Channel. The patches go a bit further and separate the entire channel and swizzle lists. That is, u_format_parse.Format now has separate channel and swizzle lists for each endianness. The reason for this is that (AFAICT) depth-and-stencil formats are universally treated as uint32_t-based or (float x uint32_t)-based. E.g. PIPE_FORMAT_Z24_UNORM_S8_UINT is always a 32-bit int with the depth in the lower 24 bits and the stencil in the upper 8 bits. (This is called S8_Z24 in mesa and elsewhere.) The easiest way of dealing with that seemed to be to add the big-endian form directly to u_format.csv, as with the attached patch. No other changes seem to be needed to support these particular formats on big-endian. I'm not submitting the patch below yet because it doesn't make sense without the other endianness changes. When applied on top of those changes though, it fixes glxgears on System z. It also fixes many piglit tests. No piglit regressions on x86_64. Thanks, Richard
commit 40dca05874d21afdb62a03f593e256f93e988ac0 Author: Richard Sandiford <rsand...@linux.vnet.ibm.com> Date: Wed Jun 12 10:14:48 2013 +0100 util: Fix stencil and depth formats for big endian diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv index f3925bb..8f69a41 100644 --- a/src/gallium/auxiliary/util/u_format.csv +++ b/src/gallium/auxiliary/util/u_format.csv @@ -46,6 +46,8 @@ # - number of bits # - channel swizzle # - color space: rgb, yub, sz +# - (optional) channel encoding for big-endian targets +# - (optional) channel swizzle for big-endian targets # # See also: # - http://msdn.microsoft.com/en-us/library/bb172558.aspx (D3D9) @@ -128,14 +130,14 @@ PIPE_FORMAT_S8_UINT , plain, 1, 1, up8 , , , , _x__, PIPE_FORMAT_Z16_UNORM , plain, 1, 1, un16, , , , x___, zs PIPE_FORMAT_Z32_UNORM , plain, 1, 1, un32, , , , x___, zs PIPE_FORMAT_Z32_FLOAT , plain, 1, 1, f32 , , , , x___, zs -PIPE_FORMAT_Z24_UNORM_S8_UINT , plain, 1, 1, un24, up8 , , , xy__, zs -PIPE_FORMAT_S8_UINT_Z24_UNORM , plain, 1, 1, up8 , un24, , , yx__, zs -PIPE_FORMAT_X24S8_UINT , plain, 1, 1, x24 , up8 , , , _y__, zs -PIPE_FORMAT_S8X24_UINT , plain, 1, 1, up8 , x24 , , , _x__, zs -PIPE_FORMAT_Z24X8_UNORM , plain, 1, 1, un24, x8 , , , x___, zs -PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, x8 , un24, , , y___, zs -PIPE_FORMAT_Z32_FLOAT_S8X24_UINT , plain, 1, 1, f32 , up8 , x24, , xy__, zs -PIPE_FORMAT_X32_S8X24_UINT , plain, 1, 1, x32 , up8 , x24, , _y__, zs +PIPE_FORMAT_Z24_UNORM_S8_UINT , plain, 1, 1, un24, up8 , , , xy__, zs, up8 , un24, , , yx__ +PIPE_FORMAT_S8_UINT_Z24_UNORM , plain, 1, 1, up8 , un24, , , yx__, zs, un24, up8 , , , xy__ +PIPE_FORMAT_X24S8_UINT , plain, 1, 1, x24 , up8 , , , _y__, zs, up8 , x24 , , , _x__ +PIPE_FORMAT_S8X24_UINT , plain, 1, 1, up8 , x24 , , , _x__, zs, x24 , up8 , , , _y__ +PIPE_FORMAT_Z24X8_UNORM , plain, 1, 1, un24, x8 , , , x___, zs, x8 , un24, , , y___ +PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, x8 , un24, , , y___, zs, un24, x8 , , , x___ +PIPE_FORMAT_Z32_FLOAT_S8X24_UINT , plain, 1, 1, f32 , up8 , x24, , xy__, zs, f32 , x24 , up8, , xz__ +PIPE_FORMAT_X32_S8X24_UINT , plain, 1, 1, x32 , up8 , x24, , _y__, zs, x32 , x24 , up8, , _z__ # YUV formats # http://www.fourcc.org/yuv.php#UYVY diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py index 15cc6d4..929017a 100755 --- a/src/gallium/auxiliary/util/u_format_parse.py +++ b/src/gallium/auxiliary/util/u_format_parse.py @@ -330,6 +330,9 @@ def parse(filename): continue fields = [field.strip() for field in line.split(',')] + if len (fields) == 10: + fields += fields[4:9] + assert len (fields) == 15 name = fields[0] layout = fields[1] @@ -339,8 +342,8 @@ def parse(filename): le_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[8]] le_channels = _parse_channels(fields[4:8], layout, colorspace, le_swizzles) - be_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[8]] - be_channels = _parse_channels(fields[4:8], layout, colorspace, be_swizzles) + be_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[14]] + be_channels = _parse_channels(fields[10:14], layout, colorspace, be_swizzles) le_shift = 0 for channel in le_channels: @@ -353,6 +356,8 @@ def parse(filename): be_shift += channel.size assert le_shift == be_shift + for i in range(4): + assert (le_swizzles[i] != SWIZZLE_NONE) == (be_swizzles[i] != SWIZZLE_NONE) format = Format(name, layout, block_width, block_height, le_channels, le_swizzles, be_channels, be_swizzles, colorspace) formats.append(format)
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev