Add proposed patch to fix test failure on big-endian CPUs
authorSimon McVittie <smcv@debian.org>
Fri, 8 Dec 2023 17:36:18 +0000 (17:36 +0000)
committerSimon McVittie <smcv@debian.org>
Fri, 8 Dec 2023 17:36:18 +0000 (17:36 +0000)
Closes: #1057782
debian/patches/Revert-build-Drop-the-install-tests-option.patch
debian/patches/gsk-Always-use-RGBA-on-big-endian-architectures.patch [new file with mode: 0644]
debian/patches/series

index f1736490b1ae312e660d765f092bb5f8552c070b..258f5345f9283150b971867785b20a11bbc5db94 100644 (file)
@@ -22,10 +22,10 @@ This reverts commit 3121f88265ac61733e257f5335473d6f139f158c.
  12 files changed, 353 insertions(+), 43 deletions(-)
 
 diff --git a/meson.build b/meson.build
-index 2e6cb1e..0a4b1ef 100644
+index 0c42d4c..05c71bf 100644
 --- a/meson.build
 +++ b/meson.build
-@@ -924,6 +924,7 @@ summary('Documentation', get_option('documentation'), section: 'Build')
+@@ -921,6 +921,7 @@ summary('Documentation', get_option('documentation'), section: 'Build')
  summary('Man pages', get_option('man-pages'), section: 'Build')
  summary('Testsuite', get_option('build-testsuite'), section: 'Build')
  summary('Tests', get_option('build-tests'), section: 'Build')
@@ -477,7 +477,7 @@ index 2cc27d5..92dc6ab 100644
 +  install_subdir('image-data', install_dir: testexecdir)
 +endif
 diff --git a/testsuite/gsk/meson.build b/testsuite/gsk/meson.build
-index e48e9a3..8ba45b8 100644
+index 7c7e3e9..77cbe47 100644
 --- a/testsuite/gsk/meson.build
 +++ b/testsuite/gsk/meson.build
 @@ -1,12 +1,22 @@
@@ -505,7 +505,7 @@ index e48e9a3..8ba45b8 100644
  )
  
  compare_render_tests = [
-@@ -370,9 +380,11 @@ foreach t : tests
+@@ -380,9 +390,11 @@ foreach t : tests
    test_extra_ldflags = t.get(3, [])
  
    test_exe = executable(test_name, test_srcs,
@@ -518,7 +518,7 @@ index e48e9a3..8ba45b8 100644
    )
  
    test(test_name, test_exe,
-@@ -401,11 +413,12 @@ foreach t : internal_tests
+@@ -411,11 +423,12 @@ foreach t : internal_tests
    test_extra_cargs = t.get(2, [])
    test_extra_ldflags = t.get(3, [])
  
diff --git a/debian/patches/gsk-Always-use-RGBA-on-big-endian-architectures.patch b/debian/patches/gsk-Always-use-RGBA-on-big-endian-architectures.patch
new file mode 100644 (file)
index 0000000..b9fcc62
--- /dev/null
@@ -0,0 +1,89 @@
+From: Simon McVittie <smcv@debian.org>
+Date: Fri, 8 Dec 2023 16:42:56 +0000
+Subject: gsk: Always use RGBA on big-endian architectures
+
+The memorytexture test started failing on big-endian CPUs while using
+"desktop" GL (not GLES) in commit b0e26873 "gsk: Use has_bgra in more
+places". The subsequent commit f5812808 "gsk: Restore bigendian support"
+was meant to fix this, but it seems it did not.
+
+Always taking the RGBA code-path on big-endian might not be optimal,
+but it seems to result in the test passing again.
+
+Signed-off-by: Simon McVittie <smcv@debian.org>
+Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/6260
+Bug-Debian: https://bugs.debian.org/1057782
+Forwarded: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6653
+---
+ gsk/gl/gskglglyphlibrary.c | 16 +++++++++++-----
+ gsk/gl/gskgliconlibrary.c  | 16 +++++++++++-----
+ 2 files changed, 22 insertions(+), 10 deletions(-)
+
+diff --git a/gsk/gl/gskglglyphlibrary.c b/gsk/gl/gskglglyphlibrary.c
+index 2e6d4da..981a5f8 100644
+--- a/gsk/gl/gskglglyphlibrary.c
++++ b/gsk/gl/gskglglyphlibrary.c
+@@ -95,6 +95,16 @@ gsk_gl_glyph_library_clear_cache (GskGLTextureLibrary *library)
+   memset (self->front, 0, sizeof self->front);
+ }
++static gboolean
++can_use_bgra (void)
++{
++#if G_BYTE_ORDER == G_BIG_ENDIAN
++  return FALSE;
++#else
++  return gdk_gl_context_has_bgra (gdk_gl_context_get_current ());
++#endif
++}
++
+ static void
+ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
+                                  GskGLTextureAtlas   *atlas)
+@@ -119,11 +129,7 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
+   memset (pixel_data, 255, sizeof pixel_data);
+-  if (!gdk_gl_context_has_bgra (gdk_gl_context_get_current ())
+-#if G_BYTE_ORDER == G_BIG_ENDIAN
+-      || gdk_gl_context_get_use_es (gdk_gl_context_get_current ())
+-#endif
+-     )
++  if (!can_use_bgra ())
+     {
+       gl_format = GL_RGBA;
+       gl_type = GL_UNSIGNED_BYTE;
+diff --git a/gsk/gl/gskgliconlibrary.c b/gsk/gl/gskgliconlibrary.c
+index 9040d8e..9ea87da 100644
+--- a/gsk/gl/gskgliconlibrary.c
++++ b/gsk/gl/gskgliconlibrary.c
+@@ -71,6 +71,16 @@ gsk_gl_icon_library_init (GskGLIconLibrary *self)
+                                     gsk_gl_icon_data_free);
+ }
++static gboolean
++can_use_bgra (void)
++{
++#if G_BYTE_ORDER == G_BIG_ENDIAN
++  return FALSE;
++#else
++  return gdk_gl_context_has_bgra (gdk_gl_context_get_current ());
++#endif
++}
++
+ void
+ gsk_gl_icon_library_add (GskGLIconLibrary     *self,
+                          GdkTexture           *key,
+@@ -111,11 +121,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary     *self,
+   gdk_gl_context_push_debug_group_printf (gdk_gl_context_get_current (),
+                                           "Uploading texture");
+-  if (!gdk_gl_context_has_bgra (gdk_gl_context_get_current ())
+-#if G_BYTE_ORDER == G_BIG_ENDIAN
+-      || gdk_gl_context_get_use_es (gdk_gl_context_get_current ())
+-#endif
+-     )
++  if (!can_use_bgra ())
+     {
+       pixel_data = free_data = g_malloc (width * height * 4);
+       gdk_memory_convert (pixel_data, width * 4,
index 481a9bcb6c11290da43747560ff3ff781561ee31..504b5ba3b1e1eb5a7c067d9a7fbf4efb4fcf4e99 100644 (file)
@@ -1,3 +1,4 @@
+gsk-Always-use-RGBA-on-big-endian-architectures.patch
 Revert-tests-Stop-copying-the-tool-tests.patch
 Revert-build-Drop-the-install-tests-option.patch
 tests-mark-headless-tests-as-flaky.patch