diff options
author | Jens Arnold <amiconn@rockbox.org> | 2009-07-11 23:43:44 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2009-07-11 23:43:44 +0000 |
commit | 47d4c4739bafcb9864dc8d1c2b44903ad4f75b68 (patch) | |
tree | 7a9f510c72a0df2ddacb0f6ec393658cf676b8d4 /firmware/target/arm/lcd-as-memframe.S | |
parent | fa59ed6ae724b3f75c8ba35efcf7ce18f21e3ed2 (diff) | |
download | rockbox-47d4c4739bafcb9864dc8d1c2b44903ad4f75b68.tar.gz rockbox-47d4c4739bafcb9864dc8d1c2b44903ad4f75b68.zip |
ARM asm LCD and ATA driver functions: Don't save r12 as it is a scratch reg. Saves a bit of stack and execution time.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21795 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/lcd-as-memframe.S')
-rw-r--r-- | firmware/target/arm/lcd-as-memframe.S | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/firmware/target/arm/lcd-as-memframe.S b/firmware/target/arm/lcd-as-memframe.S index 84f549036f..2d0aff937f 100644 --- a/firmware/target/arm/lcd-as-memframe.S +++ b/firmware/target/arm/lcd-as-memframe.S | |||
@@ -37,7 +37,7 @@ | |||
37 | @ r2 = width | 37 | @ r2 = width |
38 | @ r3 = height | 38 | @ r3 = height |
39 | lcd_copy_buffer_rect: @ | 39 | lcd_copy_buffer_rect: @ |
40 | stmfd sp!, { r4-r12, lr } @ save non-scratch regs | 40 | stmfd sp!, { r4-r11, lr } @ save non-scratch regs |
41 | mov r5, r2 @ r5 = cached width | 41 | mov r5, r2 @ r5 = cached width |
42 | rsb r4, r2, #LCD_WIDTH @ r4 = LCD_WIDTH - width | 42 | rsb r4, r2, #LCD_WIDTH @ r4 = LCD_WIDTH - width |
43 | 10: @ copy line @ | 43 | 10: @ copy line @ |
@@ -101,7 +101,7 @@ lcd_copy_buffer_rect: @ | |||
101 | add r0, r0, r4, lsl #1 @ | 101 | add r0, r0, r4, lsl #1 @ |
102 | subs r3, r3, #1 @ next line | 102 | subs r3, r3, #1 @ next line |
103 | bgt 10b @ copy line @ | 103 | bgt 10b @ copy line @ |
104 | ldmfd sp!, { r4-r12, pc } @ restore regs and return | 104 | ldmfd sp!, { r4-r11, pc } @ restore regs and return |
105 | .ltorg @ dump constant pool | 105 | .ltorg @ dump constant pool |
106 | .size lcd_copy_buffer_rect, .-lcd_copy_buffer_rect | 106 | .size lcd_copy_buffer_rect, .-lcd_copy_buffer_rect |
107 | 107 | ||
@@ -132,7 +132,7 @@ lcd_write_yuv420_lines: | |||
132 | @ r1 = yuv_src | 132 | @ r1 = yuv_src |
133 | @ r2 = width | 133 | @ r2 = width |
134 | @ r3 = stride | 134 | @ r3 = stride |
135 | stmfd sp!, { r4-r12 } @ save non-scratch | 135 | stmfd sp!, { r4-r10, lr } @ save non-scratch |
136 | ldmia r1, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p | 136 | ldmia r1, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p |
137 | @ r5 = yuv_src[1] = Cb_p | 137 | @ r5 = yuv_src[1] = Cb_p |
138 | @ r6 = yuv_src[2] = Cr_p | 138 | @ r6 = yuv_src[2] = Cr_p |
@@ -155,9 +155,9 @@ lcd_write_yuv420_lines: | |||
155 | add r10, r10, r8, asl #3 @ | 155 | add r10, r10, r8, asl #3 @ |
156 | add r10, r10, r8, asl #4 @ | 156 | add r10, r10, r8, asl #4 @ |
157 | @ | 157 | @ |
158 | add r11, r9, r9, asl #2 @ r9 = Cr*101 | 158 | add lr, r9, r9, asl #2 @ r9 = Cr*101 |
159 | add r11, r11, r9, asl #5 @ | 159 | add lr, lr, r9, asl #5 @ |
160 | add r9, r11, r9, asl #6 @ | 160 | add r9, lr, r9, asl #6 @ |
161 | @ | 161 | @ |
162 | add r8, r8, #2 @ r8 = bu = (Cb*128 + 128) >> 8 | 162 | add r8, r8, #2 @ r8 = bu = (Cb*128 + 128) >> 8 |
163 | mov r8, r8, asr #2 @ | 163 | mov r8, r8, asr #2 @ |
@@ -167,19 +167,19 @@ lcd_write_yuv420_lines: | |||
167 | mov r10, r10, asr #8 @ | 167 | mov r10, r10, asr #8 @ |
168 | @ compute R, G, and B | 168 | @ compute R, G, and B |
169 | add r1, r8, r7, asr #8 @ r1 = b = (Y >> 9) + bu | 169 | add r1, r8, r7, asr #8 @ r1 = b = (Y >> 9) + bu |
170 | add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv | 170 | add lr, r9, r7, asr #8 @ lr = r = (Y >> 9) + rv |
171 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv | 171 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv |
172 | @ | 172 | @ |
173 | orr r12, r1, r11 @ check if clamping is needed... | 173 | orr r12, r1, lr @ check if clamping is needed... |
174 | orr r12, r12, r7, asr #1 @ ...at all | 174 | orr r12, r12, r7, asr #1 @ ...at all |
175 | cmp r12, #31 @ | 175 | cmp r12, #31 @ |
176 | bls 15f @ no clamp @ | 176 | bls 15f @ no clamp @ |
177 | cmp r1, #31 @ clamp b | 177 | cmp r1, #31 @ clamp b |
178 | mvnhi r1, r1, asr #31 @ | 178 | mvnhi r1, r1, asr #31 @ |
179 | andhi r1, r1, #31 @ | 179 | andhi r1, r1, #31 @ |
180 | cmp r11, #31 @ clamp r | 180 | cmp lr, #31 @ clamp r |
181 | mvnhi r11, r11, asr #31 @ | 181 | mvnhi lr, lr, asr #31 @ |
182 | andhi r11, r11, #31 @ | 182 | andhi lr, lr, #31 @ |
183 | cmp r7, #63 @ clamp g | 183 | cmp r7, #63 @ clamp g |
184 | mvnhi r7, r7, asr #31 @ | 184 | mvnhi r7, r7, asr #31 @ |
185 | andhi r7, r7, #63 @ | 185 | andhi r7, r7, #63 @ |
@@ -188,7 +188,7 @@ lcd_write_yuv420_lines: | |||
188 | ldrb r12, [r4, r3] @ r12 = Y' = *(Y'_p + stride) | 188 | ldrb r12, [r4, r3] @ r12 = Y' = *(Y'_p + stride) |
189 | @ | 189 | @ |
190 | orr r1, r1, r7, lsl #5 @ r4 |= (g << 5) | 190 | orr r1, r1, r7, lsl #5 @ r4 |= (g << 5) |
191 | orr r1, r1, r11, lsl #11 @ r4 = b | (r << 11) | 191 | orr r1, r1, lr, lsl #11 @ r4 = b | (r << 11) |
192 | 192 | ||
193 | #if LCD_WIDTH >= LCD_HEIGHT | 193 | #if LCD_WIDTH >= LCD_HEIGHT |
194 | strh r1, [r0] @ | 194 | strh r1, [r0] @ |
@@ -203,19 +203,19 @@ lcd_write_yuv420_lines: | |||
203 | add r7, r12, r7, asl #5 @ | 203 | add r7, r12, r7, asl #5 @ |
204 | @ compute R, G, and B | 204 | @ compute R, G, and B |
205 | add r1, r8, r7, asr #8 @ r1 = b = (Y >> 9) + bu | 205 | add r1, r8, r7, asr #8 @ r1 = b = (Y >> 9) + bu |
206 | add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv | 206 | add lr, r9, r7, asr #8 @ lr = r = (Y >> 9) + rv |
207 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv | 207 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv |
208 | @ | 208 | @ |
209 | orr r12, r1, r11 @ check if clamping is needed... | 209 | orr r12, r1, lr @ check if clamping is needed... |
210 | orr r12, r12, r7, asr #1 @ ...at all | 210 | orr r12, r12, r7, asr #1 @ ...at all |
211 | cmp r12, #31 @ | 211 | cmp r12, #31 @ |
212 | bls 15f @ no clamp @ | 212 | bls 15f @ no clamp @ |
213 | cmp r1, #31 @ clamp b | 213 | cmp r1, #31 @ clamp b |
214 | mvnhi r1, r1, asr #31 @ | 214 | mvnhi r1, r1, asr #31 @ |
215 | andhi r1, r1, #31 @ | 215 | andhi r1, r1, #31 @ |
216 | cmp r11, #31 @ clamp r | 216 | cmp lr, #31 @ clamp r |
217 | mvnhi r11, r11, asr #31 @ | 217 | mvnhi lr, lr, asr #31 @ |
218 | andhi r11, r11, #31 @ | 218 | andhi lr, lr, #31 @ |
219 | cmp r7, #63 @ clamp g | 219 | cmp r7, #63 @ clamp g |
220 | mvnhi r7, r7, asr #31 @ | 220 | mvnhi r7, r7, asr #31 @ |
221 | andhi r7, r7, #63 @ | 221 | andhi r7, r7, #63 @ |
@@ -223,7 +223,7 @@ lcd_write_yuv420_lines: | |||
223 | @ | 223 | @ |
224 | ldrb r12, [r4], #1 @ r12 = Y' = *(Y'_p++) | 224 | ldrb r12, [r4], #1 @ r12 = Y' = *(Y'_p++) |
225 | @ | 225 | @ |
226 | orr r1, r1, r11, lsl #11 @ r1 = b | (r << 11) | 226 | orr r1, r1, lr, lsl #11 @ r1 = b | (r << 11) |
227 | orr r1, r1, r7, lsl #5 @ r1 |= (g << 5) | 227 | orr r1, r1, r7, lsl #5 @ r1 |= (g << 5) |
228 | 228 | ||
229 | #if LCD_WIDTH >= LCD_HEIGHT | 229 | #if LCD_WIDTH >= LCD_HEIGHT |
@@ -242,19 +242,19 @@ lcd_write_yuv420_lines: | |||
242 | add r7, r12, r7, asl #5 @ | 242 | add r7, r12, r7, asl #5 @ |
243 | @ compute R, G, and B | 243 | @ compute R, G, and B |
244 | add r1, r8, r7, asr #8 @ r1 = b = (Y >> 9) + bu | 244 | add r1, r8, r7, asr #8 @ r1 = b = (Y >> 9) + bu |
245 | add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv | 245 | add lr, r9, r7, asr #8 @ lr = r = (Y >> 9) + rv |
246 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv | 246 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv |
247 | @ | 247 | @ |
248 | orr r12, r1, r11 @ check if clamping is needed... | 248 | orr r12, r1, lr @ check if clamping is needed... |
249 | orr r12, r12, r7, asr #1 @ ...at all | 249 | orr r12, r12, r7, asr #1 @ ...at all |
250 | cmp r12, #31 @ | 250 | cmp r12, #31 @ |
251 | bls 15f @ no clamp @ | 251 | bls 15f @ no clamp @ |
252 | cmp r1, #31 @ clamp b | 252 | cmp r1, #31 @ clamp b |
253 | mvnhi r1, r1, asr #31 @ | 253 | mvnhi r1, r1, asr #31 @ |
254 | andhi r1, r1, #31 @ | 254 | andhi r1, r1, #31 @ |
255 | cmp r11, #31 @ clamp r | 255 | cmp lr, #31 @ clamp r |
256 | mvnhi r11, r11, asr #31 @ | 256 | mvnhi lr, lr, asr #31 @ |
257 | andhi r11, r11, #31 @ | 257 | andhi lr, lr, #31 @ |
258 | cmp r7, #63 @ clamp g | 258 | cmp r7, #63 @ clamp g |
259 | mvnhi r7, r7, asr #31 @ | 259 | mvnhi r7, r7, asr #31 @ |
260 | andhi r7, r7, #63 @ | 260 | andhi r7, r7, #63 @ |
@@ -263,7 +263,7 @@ lcd_write_yuv420_lines: | |||
263 | ldrb r12, [r4, r3] @ r12 = Y' = *(Y'_p + stride) | 263 | ldrb r12, [r4, r3] @ r12 = Y' = *(Y'_p + stride) |
264 | @ | 264 | @ |
265 | orr r1, r1, r7, lsl #5 @ r1 = b | (g << 5) | 265 | orr r1, r1, r7, lsl #5 @ r1 = b | (g << 5) |
266 | orr r1, r1, r11, lsl #11 @ r1 |= (r << 11) | 266 | orr r1, r1, lr, lsl #11 @ r1 |= (r << 11) |
267 | 267 | ||
268 | #if LCD_WIDTH >= LCD_HEIGHT | 268 | #if LCD_WIDTH >= LCD_HEIGHT |
269 | strh r1, [r0, #2] | 269 | strh r1, [r0, #2] |
@@ -278,25 +278,25 @@ lcd_write_yuv420_lines: | |||
278 | add r7, r12, r7, asl #5 @ | 278 | add r7, r12, r7, asl #5 @ |
279 | @ compute R, G, and B | 279 | @ compute R, G, and B |
280 | add r1, r8, r7, asr #8 @ r1 = b = (Y >> 9) + bu | 280 | add r1, r8, r7, asr #8 @ r1 = b = (Y >> 9) + bu |
281 | add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv | 281 | add lr, r9, r7, asr #8 @ lr = r = (Y >> 9) + rv |
282 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv | 282 | add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv |
283 | @ | 283 | @ |
284 | orr r12, r1, r11 @ check if clamping is needed... | 284 | orr r12, r1, lr @ check if clamping is needed... |
285 | orr r12, r12, r7, asr #1 @ ...at all | 285 | orr r12, r12, r7, asr #1 @ ...at all |
286 | cmp r12, #31 @ | 286 | cmp r12, #31 @ |
287 | bls 15f @ no clamp @ | 287 | bls 15f @ no clamp @ |
288 | cmp r1, #31 @ clamp b | 288 | cmp r1, #31 @ clamp b |
289 | mvnhi r1, r1, asr #31 @ | 289 | mvnhi r1, r1, asr #31 @ |
290 | andhi r1, r1, #31 @ | 290 | andhi r1, r1, #31 @ |
291 | cmp r11, #31 @ clamp r | 291 | cmp lr, #31 @ clamp r |
292 | mvnhi r11, r11, asr #31 @ | 292 | mvnhi lr, lr, asr #31 @ |
293 | andhi r11, r11, #31 @ | 293 | andhi lr, lr, #31 @ |
294 | cmp r7, #63 @ clamp g | 294 | cmp r7, #63 @ clamp g |
295 | mvnhi r7, r7, asr #31 @ | 295 | mvnhi r7, r7, asr #31 @ |
296 | andhi r7, r7, #63 @ | 296 | andhi r7, r7, #63 @ |
297 | 15: @ no clamp @ | 297 | 15: @ no clamp @ |
298 | @ | 298 | @ |
299 | orr r12, r1, r11, lsl #11 @ r12 = b | (r << 11) | 299 | orr r12, r1, lr, lsl #11 @ r12 = b | (r << 11) |
300 | orr r12, r12, r7, lsl #5 @ r12 |= (g << 5) | 300 | orr r12, r12, r7, lsl #5 @ r12 |= (g << 5) |
301 | 301 | ||
302 | #if LCD_WIDTH >= LCD_HEIGHT | 302 | #if LCD_WIDTH >= LCD_HEIGHT |
@@ -320,8 +320,7 @@ lcd_write_yuv420_lines: | |||
320 | subs r2, r2, #2 @ subtract block from width | 320 | subs r2, r2, #2 @ subtract block from width |
321 | bgt 10b @ loop line @ | 321 | bgt 10b @ loop line @ |
322 | @ | 322 | @ |
323 | ldmfd sp!, { r4-r12 } @ restore registers and return | 323 | ldmfd sp!, { r4-r10, pc } @ restore registers and return |
324 | bx lr @ | ||
325 | .ltorg @ dump constant pool | 324 | .ltorg @ dump constant pool |
326 | .size lcd_write_yuv420_lines, .-lcd_write_yuv420_lines | 325 | .size lcd_write_yuv420_lines, .-lcd_write_yuv420_lines |
327 | 326 | ||
@@ -364,7 +363,7 @@ lcd_write_yuv420_lines_odither: | |||
364 | @ r3 = stride | 363 | @ r3 = stride |
365 | @ [sp] = x_screen | 364 | @ [sp] = x_screen |
366 | @ [sp+4] = y_screen | 365 | @ [sp+4] = y_screen |
367 | stmfd sp!, { r4-r12, lr } @ save non-scratch | 366 | stmfd sp!, { r4-r11, lr } @ save non-scratch |
368 | ldmia r1, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p | 367 | ldmia r1, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p |
369 | @ r5 = yuv_src[1] = Cb_p | 368 | @ r5 = yuv_src[1] = Cb_p |
370 | @ r6 = yuv_src[2] = Cr_p | 369 | @ r6 = yuv_src[2] = Cr_p |
@@ -626,6 +625,6 @@ lcd_write_yuv420_lines_odither: | |||
626 | subs r2, r2, #2 @ subtract block from width | 625 | subs r2, r2, #2 @ subtract block from width |
627 | bgt 10b @ loop line @ | 626 | bgt 10b @ loop line @ |
628 | @ | 627 | @ |
629 | ldmfd sp!, { r4-r12, pc } @ restore registers and return | 628 | ldmfd sp!, { r4-r11, pc } @ restore registers and return |
630 | .ltorg @ dump constant pool | 629 | .ltorg @ dump constant pool |
631 | .size lcd_write_yuv420_lines_odither, .-lcd_write_yuv420_lines_odither | 630 | .size lcd_write_yuv420_lines_odither, .-lcd_write_yuv420_lines_odither |