fsogsmd: should now depend on msmcomm-specs rather than msmcommd-specs
[openembedded.git] / recipes / xorg-lib / pixman-0.21.2 / 0004-C-fast-path-for-a1-fill-operation.patch
blob75eaac7bf276aca0212d1533ef72226c2a3d2ba3
1 From 4b5b5a2a832cd67f2a0ec231f75a2825b45571fa Mon Sep 17 00:00:00 2001
2 From: Siarhei Siamashka <siarhei.siamashka@nokia.com>
3 Date: Mon, 15 Nov 2010 18:26:43 +0200
4 Subject: [PATCH 04/24] C fast path for a1 fill operation
6 Can be used as one of the solutions to fix bug
7 https://bugs.freedesktop.org/show_bug.cgi?id=31604
8 ---
9 pixman/pixman-fast-path.c | 87 ++++++++++++++++++++++++++++++++++++++++++++-
10 pixman/pixman.c | 7 +++-
11 2 files changed, 91 insertions(+), 3 deletions(-)
13 diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
14 index 5d5fa95..37dfbae 100644
15 --- a/pixman/pixman-fast-path.c
16 +++ b/pixman/pixman-fast-path.c
17 @@ -1334,7 +1334,11 @@ fast_composite_solid_fill (pixman_implementation_t *imp,
19 src = _pixman_image_get_solid (src_image, dst_image->bits.format);
21 - if (dst_image->bits.format == PIXMAN_a8)
22 + if (dst_image->bits.format == PIXMAN_a1)
23 + {
24 + src = src >> 31;
25 + }
26 + else if (dst_image->bits.format == PIXMAN_a8)
28 src = src >> 24;
30 @@ -1655,6 +1659,7 @@ static const pixman_fast_path_t c_fast_paths[] =
31 PIXMAN_STD_FAST_PATH (SRC, solid, null, x8r8g8b8, fast_composite_solid_fill),
32 PIXMAN_STD_FAST_PATH (SRC, solid, null, a8b8g8r8, fast_composite_solid_fill),
33 PIXMAN_STD_FAST_PATH (SRC, solid, null, x8b8g8r8, fast_composite_solid_fill),
34 + PIXMAN_STD_FAST_PATH (SRC, solid, null, a1, fast_composite_solid_fill),
35 PIXMAN_STD_FAST_PATH (SRC, solid, null, a8, fast_composite_solid_fill),
36 PIXMAN_STD_FAST_PATH (SRC, solid, null, r5g6b5, fast_composite_solid_fill),
37 PIXMAN_STD_FAST_PATH (SRC, x8r8g8b8, null, a8r8g8b8, fast_composite_src_x888_8888),
38 @@ -1733,6 +1738,82 @@ static const pixman_fast_path_t c_fast_paths[] =
39 { PIXMAN_OP_NONE },
42 +#ifdef WORDS_BIGENDIAN
43 +#define A1_FILL_MASK(n, offs) (((1 << (n)) - 1) << (32 - (offs) - (n)))
44 +#else
45 +#define A1_FILL_MASK(n, offs) (((1 << (n)) - 1) << (offs))
46 +#endif
48 +static force_inline void
49 +pixman_fill1_line (uint32_t *dst, int offs, int width, int v)
51 + if (offs)
52 + {
53 + int leading_pixels = 32 - offs;
54 + if (leading_pixels >= width)
55 + {
56 + if (v)
57 + *dst |= A1_FILL_MASK (width, offs);
58 + else
59 + *dst &= ~A1_FILL_MASK (width, offs);
60 + return;
61 + }
62 + else
63 + {
64 + if (v)
65 + *dst++ |= A1_FILL_MASK (leading_pixels, offs);
66 + else
67 + *dst++ &= ~A1_FILL_MASK (leading_pixels, offs);
68 + width -= leading_pixels;
69 + }
70 + }
71 + while (width >= 32)
72 + {
73 + if (v)
74 + *dst++ = 0xFFFFFFFF;
75 + else
76 + *dst++ = 0;
77 + width -= 32;
78 + }
79 + if (width > 0)
80 + {
81 + if (v)
82 + *dst |= A1_FILL_MASK (width, 0);
83 + else
84 + *dst &= ~A1_FILL_MASK (width, 0);
85 + }
88 +static void
89 +pixman_fill1 (uint32_t *bits,
90 + int stride,
91 + int x,
92 + int y,
93 + int width,
94 + int height,
95 + uint32_t xor)
97 + uint32_t *dst = bits + y * stride + (x >> 5);
98 + int offs = x & 31;
100 + if (xor & 1)
102 + while (height--)
104 + pixman_fill1_line (dst, offs, width, 1);
105 + dst += stride;
108 + else
110 + while (height--)
112 + pixman_fill1_line (dst, offs, width, 0);
113 + dst += stride;
118 static void
119 pixman_fill8 (uint32_t *bits,
120 int stride,
121 @@ -1819,6 +1900,10 @@ fast_path_fill (pixman_implementation_t *imp,
123 switch (bpp)
125 + case 1:
126 + pixman_fill1 (bits, stride, x, y, width, height, xor);
127 + break;
129 case 8:
130 pixman_fill8 (bits, stride, x, y, width, height, xor);
131 break;
132 diff --git a/pixman/pixman.c b/pixman/pixman.c
133 index 045c556..ec565f9 100644
134 --- a/pixman/pixman.c
135 +++ b/pixman/pixman.c
136 @@ -875,7 +875,8 @@ color_to_pixel (pixman_color_t * color,
137 format == PIXMAN_b8g8r8x8 ||
138 format == PIXMAN_r5g6b5 ||
139 format == PIXMAN_b5g6r5 ||
140 - format == PIXMAN_a8))
141 + format == PIXMAN_a8 ||
142 + format == PIXMAN_a1))
144 return FALSE;
146 @@ -895,7 +896,9 @@ color_to_pixel (pixman_color_t * color,
147 ((c & 0x000000ff) << 24);
150 - if (format == PIXMAN_a8)
151 + if (format == PIXMAN_a1)
152 + c = c >> 31;
153 + else if (format == PIXMAN_a8)
154 c = c >> 24;
155 else if (format == PIXMAN_r5g6b5 ||
156 format == PIXMAN_b5g6r5)
158 1.6.6.1