File: testsuite-Fix-alignment-handling-in-testutils.patch

package info (click to toggle)
gtk4 4.20.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 180,224 kB
  • sloc: ansic: 778,743; xml: 3,093; javascript: 3,054; python: 1,911; java: 752; sh: 682; makefile: 315; perl: 162; cpp: 21
file content (41 lines) | stat: -rw-r--r-- 1,428 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From: Gregor Riepl <onitake@gmail.com>
Date: Mon, 27 Oct 2025 08:50:19 +0100
Subject: testsuite: Fix alignment handling in testutils

We need to respect gdk_memory_alignment() when creating fudged buffers,
because we use internal APIs to access those buffers and those internal
APIs require the alignment.

For public API usage this already happens because we copy the memory if
necessary.

This broke the mipmap test on sparc64.

Fixes #7801

Part-of: <https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/9085>
(cherry picked from commit 5139eebd189602c9938b837386db7f54ef84861d)

Origin: upstream, after 4.21.0
---
 testsuite/gdk/gdktestutils.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/testsuite/gdk/gdktestutils.c b/testsuite/gdk/gdktestutils.c
index 91ec99a..02e901b 100644
--- a/testsuite/gdk/gdktestutils.c
+++ b/testsuite/gdk/gdktestutils.c
@@ -658,8 +658,11 @@ texture_builder_init (TextureBuilder  *builder,
                       int              width,
                       int              height)
 {
-  gdk_memory_layout_init (&builder->layout, format, width, height, 1);
-  gdk_memory_layout_fudge (&builder->layout, 1);
+  gsize align;
+
+  align = gdk_memory_format_alignment (format);
+  gdk_memory_layout_init (&builder->layout, format, width, height, align);
+  gdk_memory_layout_fudge (&builder->layout, align);
   builder->pixels = g_malloc0 (builder->layout.size);
 }