| @@ -1,83 +1,80 @@ | | | @@ -1,83 +1,80 @@ |
1 | $NetBSD: patch-pixman_pixman-vmx.c,v 1.4 2022/10/20 09:35:15 jperkin Exp $ | | 1 | $NetBSD: patch-pixman_pixman-vmx.c,v 1.5 2022/10/22 12:22:01 he Exp $ |
2 | | | 2 | |
3 | Add a fix so that this builds on NetBSD/powerpc. Otherwise we get | | 3 | Add a fix so that this builds without warnings on NetBSD/powerpc. |
4 | pixman-vmx.c:2936:5: error: subscripted value is neither array nor pointer | | 4 | Also do some simplification. |
5 | Also fix something which clearly must be bugs with loading | | | |
6 | vector registers from single 32-bit ints. | | | |
7 | | | 5 | |
8 | https://gitlab.freedesktop.org/pixman/pixman/-/merge_requests/64/ | | 6 | https://gitlab.freedesktop.org/pixman/pixman/-/merge_requests/64/ |
9 | | | 7 | |
10 | --- pixman/pixman-vmx.c.orig 2021-03-01 13:49:17.000000000 +0000 | | 8 | --- pixman/pixman-vmx.c.orig 2021-03-01 13:49:17.000000000 +0000 |
11 | +++ pixman/pixman-vmx.c | | 9 | +++ pixman/pixman-vmx.c |
12 | @@ -292,7 +292,9 @@ create_mask_1x32_128 (const uint32_t *sr | | 10 | @@ -278,21 +278,10 @@ save_128_aligned (uint32_t* data, |
| | | 11 | STORE_VECTOR(data) |
| | | 12 | } |
| | | 13 | |
| | | 14 | -static force_inline vector unsigned int |
| | | 15 | -create_mask_1x32_128 (const uint32_t *src) |
| | | 16 | -{ |
| | | 17 | - vector unsigned int vsrc; |
| | | 18 | - DECLARE_SRC_MASK_VAR; |
| | | 19 | - |
| | | 20 | - COMPUTE_SHIFT_MASK (src); |
| | | 21 | - LOAD_VECTOR (src); |
| | | 22 | - return vec_splat(vsrc, 0); |
| | | 23 | -} |
| | | 24 | - |
13 | static force_inline vector unsigned int | | 25 | static force_inline vector unsigned int |
14 | create_mask_32_128 (uint32_t mask) | | 26 | create_mask_32_128 (uint32_t mask) |
15 | { | | 27 | { |
16 | - return create_mask_1x32_128(&mask); | | 28 | - return create_mask_1x32_128(&mask); |
17 | + uint32_t nmask[4]; /* vector sized array */ | | 29 | + return (vector unsigned int) {mask, mask, mask, mask}; |
18 | + nmask[3] = nmask[2] = nmask[1] = nmask[0] = mask; | | | |
19 | + return create_mask_1x32_128(nmask); | | | |
20 | } | | 30 | } |
21 | | | 31 | |
22 | static force_inline vector unsigned int | | 32 | static force_inline vector unsigned int |
23 | @@ -2435,6 +2437,9 @@ vmx_fill (pixman_implementation_t *imp, | | 33 | @@ -2471,7 +2460,7 @@ vmx_fill (pixman_implementation_t *imp, |
24 | uint8_t *byte_line; | | | |
25 | | | | |
26 | vector unsigned int vfiller; | | | |
27 | + uint32_t fillers[4]; | | | |
28 | + | | | |
29 | + fillers[3] = fillers[2] = fillers[1] = fillers[0] = filler; | | | |
30 | | | | |
31 | if (bpp == 8) | | | |
32 | { | | | |
33 | @@ -2471,7 +2476,7 @@ vmx_fill (pixman_implementation_t *imp, | | | |
34 | return FALSE; | | 34 | return FALSE; |
35 | } | | 35 | } |
36 | | | 36 | |
37 | - vfiller = create_mask_1x32_128(&filler); | | 37 | - vfiller = create_mask_1x32_128(&filler); |
38 | + vfiller = create_mask_1x32_128(fillers); | | 38 | + vfiller = create_mask_32_128(filler); |
39 | | | 39 | |
40 | while (height--) | | 40 | while (height--) |
41 | { | | 41 | { |
42 | @@ -2913,32 +2918,29 @@ scaled_nearest_scanline_vmx_8888_8888_OV | | 42 | @@ -2913,32 +2902,26 @@ scaled_nearest_scanline_vmx_8888_8888_OVER (uint32_t* pd, |
43 | | | 43 | |
44 | while (w >= 4) | | 44 | while (w >= 4) |
45 | { | | 45 | { |
46 | - vector unsigned int tmp; | | 46 | - vector unsigned int tmp; |
47 | - uint32_t tmp1, tmp2, tmp3, tmp4; | | 47 | - uint32_t tmp1, tmp2, tmp3, tmp4; |
48 | + union { | | 48 | + uint32_t tmp[4]; |
49 | + vector unsigned int tmp; | | | |
50 | + uint32_t tmp1[4]; | | | |
51 | + } u; | | | |
52 | | | 49 | |
53 | - tmp1 = *(ps + pixman_fixed_to_int (vx)); | | 50 | - tmp1 = *(ps + pixman_fixed_to_int (vx)); |
54 | + u.tmp1[0] = *(ps + pixman_fixed_to_int (vx)); | | 51 | + tmp[0] = *(ps + pixman_fixed_to_int (vx)); |
55 | vx += unit_x; | | 52 | vx += unit_x; |
56 | while (vx >= 0) | | 53 | while (vx >= 0) |
57 | vx -= src_width_fixed; | | 54 | vx -= src_width_fixed; |
58 | - tmp2 = *(ps + pixman_fixed_to_int (vx)); | | 55 | - tmp2 = *(ps + pixman_fixed_to_int (vx)); |
59 | + u.tmp1[1] = *(ps + pixman_fixed_to_int (vx)); | | 56 | + tmp[1] = *(ps + pixman_fixed_to_int (vx)); |
60 | vx += unit_x; | | 57 | vx += unit_x; |
61 | while (vx >= 0) | | 58 | while (vx >= 0) |
62 | vx -= src_width_fixed; | | 59 | vx -= src_width_fixed; |
63 | - tmp3 = *(ps + pixman_fixed_to_int (vx)); | | 60 | - tmp3 = *(ps + pixman_fixed_to_int (vx)); |
64 | + u.tmp1[2] = *(ps + pixman_fixed_to_int (vx)); | | 61 | + tmp[2] = *(ps + pixman_fixed_to_int (vx)); |
65 | vx += unit_x; | | 62 | vx += unit_x; |
66 | while (vx >= 0) | | 63 | while (vx >= 0) |
67 | vx -= src_width_fixed; | | 64 | vx -= src_width_fixed; |
68 | - tmp4 = *(ps + pixman_fixed_to_int (vx)); | | 65 | - tmp4 = *(ps + pixman_fixed_to_int (vx)); |
69 | + u.tmp1[3] = *(ps + pixman_fixed_to_int (vx)); | | 66 | + tmp[3] = *(ps + pixman_fixed_to_int (vx)); |
70 | vx += unit_x; | | 67 | vx += unit_x; |
71 | while (vx >= 0) | | 68 | while (vx >= 0) |
72 | vx -= src_width_fixed; | | 69 | vx -= src_width_fixed; |
73 | | | 70 | |
74 | - tmp[0] = tmp1; | | 71 | - tmp[0] = tmp1; |
75 | - tmp[1] = tmp2; | | 72 | - tmp[1] = tmp2; |
76 | - tmp[2] = tmp3; | | 73 | - tmp[2] = tmp3; |
77 | - tmp[3] = tmp4; | | 74 | - tmp[3] = tmp4; |
78 | - | | 75 | - |
79 | - vsrc = combine4 ((const uint32_t *) &tmp, pm); | | 76 | - vsrc = combine4 ((const uint32_t *) &tmp, pm); |
80 | + vsrc = combine4 ((const uint32_t *) &u.tmp, pm); | | 77 | + vsrc = combine4 (tmp, pm); |
81 | | | 78 | |
82 | if (is_opaque (vsrc)) | | 79 | if (is_opaque (vsrc)) |
83 | { | | 80 | { |