diff options
Diffstat (limited to 'meta/recipes-graphics/xorg-lib/pixman/0002-Generic-C-implementation-of-pixman_blt-with-overlapp.patch')
-rw-r--r-- | meta/recipes-graphics/xorg-lib/pixman/0002-Generic-C-implementation-of-pixman_blt-with-overlapp.patch | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/meta/recipes-graphics/xorg-lib/pixman/0002-Generic-C-implementation-of-pixman_blt-with-overlapp.patch b/meta/recipes-graphics/xorg-lib/pixman/0002-Generic-C-implementation-of-pixman_blt-with-overlapp.patch new file mode 100644 index 0000000000..abd501a106 --- /dev/null +++ b/meta/recipes-graphics/xorg-lib/pixman/0002-Generic-C-implementation-of-pixman_blt-with-overlapp.patch | |||
@@ -0,0 +1,127 @@ | |||
1 | From 211b2bcdb19f86f3868a18520df7dcb4fd122f05 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com> | ||
3 | Date: Sun, 19 Aug 2012 14:48:00 +0200 | ||
4 | Subject: [PATCH 2/2] Generic C implementation of pixman_blt with overlapping | ||
5 | support | ||
6 | MIME-Version: 1.0 | ||
7 | Content-Type: text/plain; charset=UTF-8 | ||
8 | Content-Transfer-Encoding: 8bit | ||
9 | |||
10 | This was ported from meta-oe's patch [1]: | ||
11 | Uses memcpy/memmove functions to copy pixels, can handle the | ||
12 | case when both source and destination areas are in the same | ||
13 | image (this is useful for scrolling). | ||
14 | |||
15 | It is assumed that copying direction is only important when | ||
16 | using the same image for both source and destination (and | ||
17 | src_stride == dst_stride). Copying direction is undefined | ||
18 | for the images with different source and destination stride | ||
19 | which happen to be in the overlapped areas (but this is an | ||
20 | unrealistic case anyway). | ||
21 | |||
22 | [1] http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-graphics/xorg-lib/pixman-0.26.2/0008-Generic-C-implementation-of-pixman_blt-with-overlapp.patch | ||
23 | |||
24 | Upstream-Status: Unknown - this patch is in meta-oe for a while | ||
25 | |||
26 | Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com> | ||
27 | --- | ||
28 | pixman/pixman-general.c | 21 ++++++++++++++++++--- | ||
29 | pixman/pixman-private.h | 43 +++++++++++++++++++++++++++++++++++++++++++ | ||
30 | 2 files changed, 61 insertions(+), 3 deletions(-) | ||
31 | |||
32 | diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c | ||
33 | index d4b2daa..a86b206 100644 | ||
34 | --- a/pixman/pixman-general.c | ||
35 | +++ b/pixman/pixman-general.c | ||
36 | @@ -215,9 +215,24 @@ general_blt (pixman_implementation_t *imp, | ||
37 | int width, | ||
38 | int height) | ||
39 | { | ||
40 | - /* We can't blit unless we have sse2 or mmx */ | ||
41 | - | ||
42 | - return FALSE; | ||
43 | + uint8_t *dst_bytes = (uint8_t *)dst_bits; | ||
44 | + uint8_t *src_bytes = (uint8_t *)src_bits; | ||
45 | + int bpp; | ||
46 | + | ||
47 | + if (src_bpp != dst_bpp || src_bpp & 7) | ||
48 | + return FALSE; | ||
49 | + | ||
50 | + bpp = src_bpp >> 3; | ||
51 | + width *= bpp; | ||
52 | + src_stride *= 4; | ||
53 | + dst_stride *= 4; | ||
54 | + pixman_blt_helper (src_bytes + src_y * src_stride + src_x * bpp, | ||
55 | + dst_bytes + dest_y * dst_stride + dest_x * bpp, | ||
56 | + src_stride, | ||
57 | + dst_stride, | ||
58 | + width, | ||
59 | + height); | ||
60 | + return TRUE; | ||
61 | } | ||
62 | |||
63 | static pixman_bool_t | ||
64 | diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h | ||
65 | index d5e6a72..c77d256 100644 | ||
66 | --- a/pixman/pixman-private.h | ||
67 | +++ b/pixman/pixman-private.h | ||
68 | @@ -24,6 +24,7 @@ | ||
69 | |||
70 | #include "pixman.h" | ||
71 | #include <time.h> | ||
72 | +#include <string.h> | ||
73 | #include <assert.h> | ||
74 | #include <stdio.h> | ||
75 | #include <string.h> | ||
76 | @@ -1096,6 +1097,48 @@ void pixman_timer_register (pixman_timer_t *timer); | ||
77 | extern const uint8_t linear_to_srgb[4096]; | ||
78 | extern const uint16_t srgb_to_linear[256]; | ||
79 | |||
80 | +/* a helper function, can blit 8-bit images with src/dst overlapping support */ | ||
81 | +static inline void | ||
82 | +pixman_blt_helper (uint8_t *src_bytes, | ||
83 | + uint8_t *dst_bytes, | ||
84 | + int src_stride, | ||
85 | + int dst_stride, | ||
86 | + int width, | ||
87 | + int height) | ||
88 | +{ | ||
89 | + /* | ||
90 | + * The second part of this check is not strictly needed, but it prevents | ||
91 | + * unnecessary upside-down processing of areas which belong to different | ||
92 | + * images. Upside-down processing can be slower with fixed-distance-ahead | ||
93 | + * prefetch and perceived as having more tearing. | ||
94 | + */ | ||
95 | + if (src_bytes < dst_bytes + width && | ||
96 | + src_bytes + src_stride * height > dst_bytes) | ||
97 | + { | ||
98 | + src_bytes += src_stride * height - src_stride; | ||
99 | + dst_bytes += dst_stride * height - dst_stride; | ||
100 | + dst_stride = -dst_stride; | ||
101 | + src_stride = -src_stride; | ||
102 | + /* Horizontal scrolling to the left needs memmove */ | ||
103 | + if (src_bytes + width > dst_bytes) | ||
104 | + { | ||
105 | + while (--height >= 0) | ||
106 | + { | ||
107 | + memmove (dst_bytes, src_bytes, width); | ||
108 | + dst_bytes += dst_stride; | ||
109 | + src_bytes += src_stride; | ||
110 | + } | ||
111 | + return; | ||
112 | + } | ||
113 | + } | ||
114 | + while (--height >= 0) | ||
115 | + { | ||
116 | + memcpy (dst_bytes, src_bytes, width); | ||
117 | + dst_bytes += dst_stride; | ||
118 | + src_bytes += src_stride; | ||
119 | + } | ||
120 | +} | ||
121 | + | ||
122 | #endif /* __ASSEMBLER__ */ | ||
123 | |||
124 | #endif /* PIXMAN_PRIVATE_H */ | ||
125 | -- | ||
126 | 1.7.4.4 | ||
127 | |||