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
42
43
44
|
Reduce the stack footprint of pixman's function
general_composite_rect() which allocates a large buffer
`stack_scanline_buffer`. Make it `static __thread` instead.
--- pixman-0.42.2/pixman/pixman-general.c.old 2022-02-01 14:51:25.000000000 -0600
+++ pixman-0.42.2/pixman/pixman-general.c 2022-11-20 22:12:40.313477382 -0600
@@ -128,8 +128,8 @@
pixman_composite_info_t *info)
{
PIXMAN_COMPOSITE_ARGS (info);
- uint8_t stack_scanline_buffer[3 * SCANLINE_BUFFER_LENGTH];
- uint8_t *scanline_buffer = (uint8_t *) stack_scanline_buffer;
+ static __thread uint8_t static_scanline_buffer[3 * SCANLINE_BUFFER_LENGTH];
+ uint8_t *scanline_buffer = (uint8_t *) static_scanline_buffer;
uint8_t *src_buffer, *mask_buffer, *dest_buffer;
pixman_iter_t src_iter, mask_iter, dest_iter;
pixman_combine_32_func_t compose;
@@ -159,7 +159,7 @@
if (width <= 0 || _pixman_multiply_overflows_int (width, Bpp * 3))
return;
- if (width * Bpp * 3 > sizeof (stack_scanline_buffer) - 15 * 3)
+ if (width * Bpp * 3 > sizeof (static_scanline_buffer) - 15 * 3)
{
scanline_buffer = pixman_malloc_ab_plus_c (width, Bpp * 3, 15 * 3);
@@ -170,7 +170,7 @@
}
else
{
- memset (stack_scanline_buffer, 0, sizeof (stack_scanline_buffer));
+ memset (static_scanline_buffer, 0, sizeof (static_scanline_buffer));
}
src_buffer = ALIGN (scanline_buffer);
@@ -239,7 +239,7 @@
if (dest_iter.fini)
dest_iter.fini (&dest_iter);
- if (scanline_buffer != (uint8_t *) stack_scanline_buffer)
+ if (scanline_buffer != (uint8_t *) static_scanline_buffer)
free (scanline_buffer);
}
|