diff --git a/Mesa-drivers.changes b/Mesa-drivers.changes index a507894..cc9975c 100644 --- a/Mesa-drivers.changes +++ b/Mesa-drivers.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Feb 6 11:32:05 UTC 2020 - Stefan Dirsch + +- u_Revert_gallium_Fix_big-endian_addressing_of_non-bitmask_array_formats.patch + * replaces U_gallium-Fix-big-endian-addressing-of-non-bitmask-arr.patch + by an official merge request (bsc#1162252, gitlab issue#2472) + ------------------------------------------------------------------- Mon Feb 3 17:17:44 UTC 2020 - Stefan Dirsch diff --git a/Mesa-drivers.spec b/Mesa-drivers.spec index 088ad8e..974c438 100644 --- a/Mesa-drivers.spec +++ b/Mesa-drivers.spec @@ -1,7 +1,7 @@ # # spec file for package Mesa-drivers # -# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -126,7 +126,7 @@ Source6: %{name}-rpmlintrc Source7: Mesa.keyring Patch1: n_opencl_dep_libclang.patch Patch2: n_add-Mesa-headers-again.patch -Patch3: U_gallium-Fix-big-endian-addressing-of-non-bitmask-arr.patch +Patch3: u_Revert_gallium_Fix_big-endian_addressing_of_non-bitmask_array_formats.patch # never to be upstreamed Patch54: n_drirc-disable-rgb10-for-chromium-on-amd.patch Patch58: u_dep_xcb.patch @@ -749,7 +749,7 @@ rm -rf docs/README.{VMS,WIN32,OS2} %endif %patch2 -p1 # reverse apply since it caused a regression in rendering on s390x (bsc#1162252) -%patch3 -p1 -R +%patch3 -p1 %patch54 -p1 %patch58 -p1 %patch61 -p1 diff --git a/Mesa.changes b/Mesa.changes index a507894..cc9975c 100644 --- a/Mesa.changes +++ b/Mesa.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Feb 6 11:32:05 UTC 2020 - Stefan Dirsch + +- u_Revert_gallium_Fix_big-endian_addressing_of_non-bitmask_array_formats.patch + * replaces U_gallium-Fix-big-endian-addressing-of-non-bitmask-arr.patch + by an official merge request (bsc#1162252, gitlab issue#2472) + ------------------------------------------------------------------- Mon Feb 3 17:17:44 UTC 2020 - Stefan Dirsch diff --git a/Mesa.spec b/Mesa.spec index 9df9b85..457980b 100644 --- a/Mesa.spec +++ b/Mesa.spec @@ -1,7 +1,7 @@ # # spec file for package Mesa # -# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -125,7 +125,7 @@ Source6: %{name}-rpmlintrc Source7: Mesa.keyring Patch1: n_opencl_dep_libclang.patch Patch2: n_add-Mesa-headers-again.patch -Patch3: U_gallium-Fix-big-endian-addressing-of-non-bitmask-arr.patch +Patch3: u_Revert_gallium_Fix_big-endian_addressing_of_non-bitmask_array_formats.patch # never to be upstreamed Patch54: n_drirc-disable-rgb10-for-chromium-on-amd.patch Patch58: u_dep_xcb.patch @@ -748,7 +748,7 @@ rm -rf docs/README.{VMS,WIN32,OS2} %endif %patch2 -p1 # reverse apply since it caused a regression in rendering on s390x (bsc#1162252) -%patch3 -p1 -R +%patch3 -p1 %patch54 -p1 %patch58 -p1 %patch61 -p1 diff --git a/U_gallium-Fix-big-endian-addressing-of-non-bitmask-arr.patch b/U_gallium-Fix-big-endian-addressing-of-non-bitmask-arr.patch deleted file mode 100644 index bf1cf39..0000000 --- a/U_gallium-Fix-big-endian-addressing-of-non-bitmask-arr.patch +++ /dev/null @@ -1,113 +0,0 @@ -From d17ff2f7f1864c81c1e00d04baf20f953c6d276a Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Thu, 15 Aug 2019 15:38:00 -0700 -Subject: [PATCH] gallium: Fix big-endian addressing of non-bitmask array - formats. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The formats affected are: - -- LA x (16_FLOAT, 32_FLOAT, 32_UINT, 32_SINT) -- R8G8B8 x (UNORM, SNORM, SRGB, USCALED, SSCALED, UINT, SINT) -- RG/RGB/RGBA x (64_FLOAT, 32_FLOAT, 16_FLOAT, 32_UNORM, 32_SNORM, - 32_USCALED, 32_SSCALED, 32_FIXED, 32_UINT, 32_SINT) -- RGB/RGBA x (16_UNORM, 16_SNORM, 16_USCALED, 16_SSCALED, - 16_UINT, 16_SINT) -- RGBx16 x (UNORM, SNORM, FLOAT, UINT, SINT) -- RGBx32 x (FLOAT, UINT, SINT) -- RA x (16_FLOAT, 32_FLOAT, 32_UINT, 32_SINT) - -The updated st_formats.c unit test checks that the formats affected by -this change are all array formats in the equivalent Mesa format (if -any). Mesa's array format definition is clear: the value stored is an -array (increasing memory address) of values of the channel's type. -It's also the only thing that makes sense for the RGB types, or very -large types like RGBA64_FLOAT (A should not move to the low address -because the cpu is BE). - -Acked-by: Roland Scheidegger -Acked-by: Adam Jackson -Tested-by: Matt Turner (unit tests on BE) -Reviewed-by: Marek Olšák ---- - src/gallium/auxiliary/util/u_format_parse.py | 23 +++++++++++++++++------ - src/mesa/state_tracker/tests/st_format.c | 23 +++++++++++++++++++++++ - 2 files changed, 40 insertions(+), 6 deletions(-) - -diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py -index b9627055cda..541ae69d4dc 100644 ---- a/src/gallium/auxiliary/util/u_format_parse.py -+++ b/src/gallium/auxiliary/util/u_format_parse.py -@@ -379,16 +379,27 @@ def parse(filename): - channel.shift = le_shift - le_shift += channel.size - -- be_shift = 0 -- for channel in be_channels[3::-1]: -- channel.shift = be_shift -- 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, block_depth, le_channels, le_swizzles, be_channels, be_swizzles, colorspace) -+ -+ if format.is_array() and not format.is_bitmask(): -+ # Formats accessed as arrays by the pack functions (R32G32_FLOAT or -+ # R8G8B8_UNORM, for example) should not be channel-ordering-reversed -+ # for BE. -+ # Note that __eq__ on channels ignores .shift! -+ assert(format.be_channels == format.le_channels) -+ assert(format.be_swizzles == format.le_swizzles) -+ format.be_channels = format.le_channels -+ else: -+ be_shift = 0 -+ for channel in format.be_channels[3::-1]: -+ channel.shift = be_shift -+ be_shift += channel.size -+ -+ assert le_shift == be_shift -+ - formats.append(format) - return formats - -diff --git a/src/mesa/state_tracker/tests/st_format.c b/src/mesa/state_tracker/tests/st_format.c -index 12cb74bd0be..e42a1873d5e 100644 ---- a/src/mesa/state_tracker/tests/st_format.c -+++ b/src/mesa/state_tracker/tests/st_format.c -@@ -87,6 +87,29 @@ int main(int argc, char **argv) - continue; - - if (mf != MESA_FORMAT_NONE) { -+ const struct util_format_description *desc = util_format_description(i); -+ -+ /* Make sure that gallium and Mesa agree on whether the format is an -+ * array format. -+ */ -+ if (desc->nr_channels > 1) { -+ bool mesa_array = (_mesa_get_format_layout(mf) == -+ MESA_FORMAT_LAYOUT_ARRAY); -+ bool gallium_array = desc->is_array && !desc->is_bitmask; -+ /* We should probably be checking equality here, but we have some -+ * UINT and SINT types that are array formats in Mesa but not in -+ * gallium. -+ */ -+ if (gallium_array && !mesa_array) { -+ fprintf(stderr, "%s is %sarray, %s is %sarray\n", -+ util_format_short_name(i), -+ gallium_array ? "" : "not ", -+ _mesa_get_format_name(mf), -+ mesa_array ? "" : "not "); -+ return 1; -+ } -+ } -+ - enum pipe_format pf = - st_mesa_format_to_pipe_format(st, mf); - if (pf != i) { --- -2.16.4 - diff --git a/u_Revert_gallium_Fix_big-endian_addressing_of_non-bitmask_array_formats.patch b/u_Revert_gallium_Fix_big-endian_addressing_of_non-bitmask_array_formats.patch new file mode 100644 index 0000000..5e6a7a9 --- /dev/null +++ b/u_Revert_gallium_Fix_big-endian_addressing_of_non-bitmask_array_formats.patch @@ -0,0 +1,58 @@ +This reverts the functional part of commit +d17ff2f7, leaving the unit test for +mesa/pipe agreement on what's an array. + +The issue is that the util_channel_desc.shift values on array formats are +not used for bit addressing in memory, they're bit addressing within a +word treating a pixel of the format as a native type, as seen by +llvmpipe's use of the values to do shifts (see +lp_build_unpack_arith_rgba_aos() for example). This means the values are +nonsensical for 3-byte RGB, but then llvmpipe doesn't expose those formats +so it works out. + +I still want to clean up our big-endian format handling at some point, but +let's fix the s390x regression first, sort out our format unit tests in +CI, then be able to refactor with confidence. + +Fixes: d17ff2f7 ("gallium: Fix big-endian addressing of non-bitmask array formats.") +Closes: #2440 +Closes: #2472 + +diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/util/gallium/auxiliary/u_format_parse.py +index 541ae69d4dc662e16c08ed7c27a9e65534a4b08f..b9627055cda3f5277bddc1936614a983f1359d00 100644 +--- a/src/gallium/auxiliary/util/u_format_parse.py ++++ b/src/gallium/auxiliary/util/u_format_parse.py +@@ -379,27 +379,16 @@ def parse(filename): + channel.shift = le_shift + le_shift += channel.size + ++ be_shift = 0 ++ for channel in be_channels[3::-1]: ++ channel.shift = be_shift ++ 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, block_depth, le_channels, le_swizzles, be_channels, be_swizzles, colorspace) +- +- if format.is_array() and not format.is_bitmask(): +- # Formats accessed as arrays by the pack functions (R32G32_FLOAT or +- # R8G8B8_UNORM, for example) should not be channel-ordering-reversed +- # for BE. +- # Note that __eq__ on channels ignores .shift! +- assert(format.be_channels == format.le_channels) +- assert(format.be_swizzles == format.le_swizzles) +- format.be_channels = format.le_channels +- else: +- be_shift = 0 +- for channel in format.be_channels[3::-1]: +- channel.shift = be_shift +- be_shift += channel.size +- +- assert le_shift == be_shift +- + formats.append(format) + return formats +