39eda8b54600491dc27b345c07681c933db41193
[openembedded.git] /
1 From 2f5774db49521e990c5e9f7cac684a06f4e67a43 Mon Sep 17 00:00:00 2001
2 From: Siarhei Siamashka <siarhei.siamashka@nokia.com>
3 Date: Thu, 10 Dec 2009 00:51:50 +0200
4 Subject: [PATCH 5/7] ARM: added NEON optimizations for fetch/store r5g6b5 scanline
5
6 ---
7  pixman/pixman-access.c       |   23 ++++++++++++++++++++++-
8  pixman/pixman-arm-neon-asm.S |   20 ++++++++++++++++++++
9  pixman/pixman-arm-neon.c     |   41 +++++++++++++++++++++++++++++++++++++++++
10  pixman/pixman-private.h      |    5 +++++
11  4 files changed, 88 insertions(+), 1 deletions(-)
12
13 diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
14 index fa0a267..5bb3e09 100644
15 --- a/pixman/pixman-access.c
16 +++ b/pixman/pixman-access.c
17 @@ -2748,7 +2748,7 @@ typedef struct
18             store_scanline_ ## format, store_scanline_generic_64        \
19      }
20  
21 -static const format_info_t accessors[] =
22 +static format_info_t accessors[] =
23  {
24  /* 32 bpp formats */
25      FORMAT_INFO (a8r8g8b8),
26 @@ -2891,6 +2891,27 @@ _pixman_bits_image_setup_raw_accessors (bits_image_t *image)
27         setup_accessors (image);
28  }
29  
30 +void
31 +_pixman_bits_override_accessors (pixman_format_code_t format,
32 +                                 fetch_scanline_t     fetch_func,
33 +                                 store_scanline_t     store_func)
34 +{
35 +    format_info_t *info = accessors;
36 +
37 +    while (info->format != PIXMAN_null)
38 +    {
39 +       if (info->format == format)
40 +       {
41 +           if (fetch_func)
42 +               info->fetch_scanline_raw_32 = fetch_func;
43 +           if (store_func)
44 +               info->store_scanline_raw_32 = store_func;
45 +           return;
46 +       }
47 +       info++;
48 +    }
49 +}
50 +
51  #else
52  
53  void
54 diff --git a/pixman/pixman-arm-neon-asm.S b/pixman/pixman-arm-neon-asm.S
55 index 51bc347..f30869e 100644
56 --- a/pixman/pixman-arm-neon-asm.S
57 +++ b/pixman/pixman-arm-neon-asm.S
58 @@ -458,6 +458,16 @@ generate_composite_function \
59      pixman_composite_src_8888_0565_process_pixblock_tail, \
60      pixman_composite_src_8888_0565_process_pixblock_tail_head
61  
62 +generate_composite_function_single_scanline \
63 +    pixman_store_scanline_r5g6b5_asm_neon, 32, 0, 16, \
64 +    FLAG_DST_WRITEONLY | FLAG_DEINTERLEAVE_32BPP, \
65 +    8, /* number of pixels, processed in a single block */ \
66 +    default_init, \
67 +    default_cleanup, \
68 +    pixman_composite_src_8888_0565_process_pixblock_head, \
69 +    pixman_composite_src_8888_0565_process_pixblock_tail, \
70 +    pixman_composite_src_8888_0565_process_pixblock_tail_head
71 +
72  /******************************************************************************/
73  
74  .macro pixman_composite_src_0565_8888_process_pixblock_head
75 @@ -493,6 +503,16 @@ generate_composite_function \
76      pixman_composite_src_0565_8888_process_pixblock_tail, \
77      pixman_composite_src_0565_8888_process_pixblock_tail_head
78  
79 +generate_composite_function_single_scanline \
80 +    pixman_fetch_scanline_r5g6b5_asm_neon, 16, 0, 32, \
81 +    FLAG_DST_WRITEONLY | FLAG_DEINTERLEAVE_32BPP, \
82 +    8, /* number of pixels, processed in a single block */ \
83 +    default_init, \
84 +    default_cleanup, \
85 +    pixman_composite_src_0565_8888_process_pixblock_head, \
86 +    pixman_composite_src_0565_8888_process_pixblock_tail, \
87 +    pixman_composite_src_0565_8888_process_pixblock_tail_head
88 +
89  /******************************************************************************/
90  
91  .macro pixman_composite_add_8000_8000_process_pixblock_head
92 diff --git a/pixman/pixman-arm-neon.c b/pixman/pixman-arm-neon.c
93 index 7feee1d..fda7a09 100644
94 --- a/pixman/pixman-arm-neon.c
95 +++ b/pixman/pixman-arm-neon.c
96 @@ -375,6 +375,43 @@ neon_combine_##name##_u (pixman_implementation_t *imp,                   \
97  BIND_COMBINE_U (over)
98  BIND_COMBINE_U (add)
99  
100 +void
101 +pixman_fetch_scanline_r5g6b5_asm_neon (int             width,
102 +                                       uint32_t       *buffer,
103 +                                       const uint16_t *pixel);
104 +void
105 +pixman_store_scanline_r5g6b5_asm_neon (int             width,
106 +                                       uint16_t       *pixel,
107 +                                       const uint32_t *values);
108 +
109 +static void
110 +neon_fetch_scanline_r5g6b5 (pixman_image_t *image,
111 +                            int             x,
112 +                            int             y,
113 +                            int             width,
114 +                            uint32_t *      buffer,
115 +                            const uint32_t *mask,
116 +                            uint32_t        mask_bits)
117 +{
118 +    const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
119 +    const uint16_t *pixel = (const uint16_t *)bits + x;
120 +
121 +    pixman_fetch_scanline_r5g6b5_asm_neon (width, buffer, pixel);
122 +}
123 +
124 +static void
125 +neon_store_scanline_r5g6b5 (bits_image_t *  image,
126 +                            int             x,
127 +                            int             y,
128 +                            int             width,
129 +                            const uint32_t *values)
130 +{
131 +    uint32_t *bits = image->bits + image->rowstride * y;
132 +    uint16_t *pixel = ((uint16_t *) bits) + x;
133 +
134 +    pixman_store_scanline_r5g6b5_asm_neon (width, pixel, values);
135 +}
136 +
137  pixman_implementation_t *
138  _pixman_implementation_create_arm_neon (void)
139  {
140 @@ -385,6 +422,10 @@ _pixman_implementation_create_arm_neon (void)
141      imp->combine_32[PIXMAN_OP_OVER] = neon_combine_over_u;
142      imp->combine_32[PIXMAN_OP_ADD] = neon_combine_add_u;
143  
144 +    _pixman_bits_override_accessors (PIXMAN_r5g6b5,
145 +                                     neon_fetch_scanline_r5g6b5,
146 +                                     neon_store_scanline_r5g6b5);
147 +
148      imp->blt = arm_neon_blt;
149      imp->fill = arm_neon_fill;
150  
151 diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
152 index eeb677d..ba2d401 100644
153 --- a/pixman/pixman-private.h
154 +++ b/pixman/pixman-private.h
155 @@ -220,6 +220,11 @@ void
156  _pixman_bits_image_setup_raw_accessors (bits_image_t *image);
157  
158  void
159 +_pixman_bits_override_accessors (pixman_format_code_t format,
160 +                                 fetch_scanline_t     fetch_func,
161 +                                 store_scanline_t     store_func);
162 +
163 +void
164  _pixman_image_get_scanline_generic_64  (pixman_image_t *image,
165                                          int             x,
166                                          int             y,
167 -- 
168 1.6.6.1
169