diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2009-04-21 04:29:10 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2009-04-21 04:29:10 +0000 |
commit | acbe8599b65314729b2a7d094e2b969931aa3290 (patch) | |
tree | c458d1e1ccf02bbc4e64e06bba596a3291fe4866 /firmware | |
parent | 4855006aabd7243ff30903b126560f7790dd74dd (diff) | |
download | rockbox-acbe8599b65314729b2a7d094e2b969931aa3290.tar.gz rockbox-acbe8599b65314729b2a7d094e2b969931aa3290.zip |
Add second buffer for YUV blitting, progressbar and FPS display in mpegplayer work correct now.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20766 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/dm320.h | 6 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/app.lds | 13 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c | 1 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | 157 |
4 files changed, 96 insertions, 81 deletions
diff --git a/firmware/export/dm320.h b/firmware/export/dm320.h index d6599a6745..a1bbc3cd30 100644 --- a/firmware/export/dm320.h +++ b/firmware/export/dm320.h | |||
@@ -30,11 +30,13 @@ | |||
30 | #if !defined(__ASSEMBLER__) && !defined(__LD__) | 30 | #if !defined(__ASSEMBLER__) && !defined(__LD__) |
31 | /* These variables are created during linking (app/boot.lds) */ | 31 | /* These variables are created during linking (app/boot.lds) */ |
32 | extern unsigned long _lcdbuf; | 32 | extern unsigned long _lcdbuf; |
33 | extern unsigned long _lcdbuf2; | ||
33 | extern unsigned long _ttbstart; | 34 | extern unsigned long _ttbstart; |
34 | #endif | 35 | #endif |
35 | 36 | ||
36 | #define TTB_BASE_ADDR (_ttbstart) /* End of memory */ | 37 | #define TTB_BASE_ADDR (_ttbstart) /* End of memory */ |
37 | #define FRAME ((short *) (&_lcdbuf)) /* Right before TTB */ | 38 | #define FRAME ((short *) (&_lcdbuf)) /* Right after TTB */ |
39 | #define FRAME2 ((short *) (&_lcdbuf2)) /* Right after FRAME */ | ||
38 | 40 | ||
39 | #define PHY_IO_BASE 0x00030000 | 41 | #define PHY_IO_BASE 0x00030000 |
40 | #define DM320_REG(addr) (*(volatile unsigned short *)(PHY_IO_BASE + (addr))) | 42 | #define DM320_REG(addr) (*(volatile unsigned short *)(PHY_IO_BASE + (addr))) |
@@ -651,7 +653,7 @@ extern unsigned long _ttbstart; | |||
651 | #define IO_MEM_STICK_DMA_STATUS DM320_REG(0x0C96) | 653 | #define IO_MEM_STICK_DMA_STATUS DM320_REG(0x0C96) |
652 | 654 | ||
653 | /* ATM : WBB Need to find these Register values */ | 655 | /* ATM : WBB Need to find these Register values */ |
654 | #define IO_ATM_ DM320_REG(0x0D00 | 656 | #define IO_ATM_ DM320_REG(0x0D00) |
655 | 657 | ||
656 | /* I2C */ | 658 | /* I2C */ |
657 | #define IO_I2C_TXDATA DM320_REG(0x0D80) | 659 | #define IO_I2C_TXDATA DM320_REG(0x0D80) |
diff --git a/firmware/target/arm/tms320dm320/app.lds b/firmware/target/arm/tms320dm320/app.lds index 635d9a8842..14b44153a6 100644 --- a/firmware/target/arm/tms320dm320/app.lds +++ b/firmware/target/arm/tms320dm320/app.lds | |||
@@ -27,8 +27,11 @@ STARTUP(target/arm/tms320dm320/crt0.o) | |||
27 | /* must be 16Kb (0x4000) aligned */ | 27 | /* must be 16Kb (0x4000) aligned */ |
28 | #define TTB_SIZE 0x4000 | 28 | #define TTB_SIZE 0x4000 |
29 | 29 | ||
30 | /* Give this 1 meg to allow it to align to the MMU boundary */ | 30 | /* Give this some memory to allow it to align to the MMU boundary. |
31 | #define LCD_TTB_AREA 0x100000 | 31 | * Note that since there are two buffers (YUV/RGB) it calculates the approximate |
32 | * memory needed in steps of 1 Meg. | ||
33 | */ | ||
34 | #define LCD_TTB_AREA 0x100000*((LCD_BUFFER_SIZE>>19)+1) | ||
32 | 35 | ||
33 | #define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET | 36 | #define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET |
34 | 37 | ||
@@ -174,5 +177,11 @@ SECTIONS | |||
174 | _lcdbuf = .; | 177 | _lcdbuf = .; |
175 | . += LCD_BUFFER_SIZE; | 178 | . += LCD_BUFFER_SIZE; |
176 | } > DRAM | 179 | } > DRAM |
180 | |||
181 | .lcdbuffer2 (NOLOAD) : | ||
182 | { | ||
183 | _lcdbuf2 = .; | ||
184 | . += LCD_BUFFER_SIZE; | ||
185 | } > DRAM | ||
177 | } | 186 | } |
178 | 187 | ||
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c index a2729adacd..d64a9cd958 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include "kernel.h" | 28 | #include "kernel.h" |
29 | #include "backlight.h" | 29 | #include "backlight.h" |
30 | #include "adc.h" | 30 | #include "adc.h" |
31 | #include "system.h" | ||
32 | #include "backlight-target.h" | 31 | #include "backlight-target.h" |
33 | #include "lcd-remote-target.h" | 32 | #include "lcd-remote-target.h" |
34 | #include "uart-target.h" | 33 | #include "uart-target.h" |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c index ec85821649..e26a88704d 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | |||
@@ -209,6 +209,8 @@ void lcd_init_device(void) | |||
209 | 209 | ||
210 | IO_OSD_VIDWINMD=0x0002; | 210 | IO_OSD_VIDWINMD=0x0002; |
211 | 211 | ||
212 | addr = ((int)FRAME2-CONFIG_SDRAM_START) / 32; | ||
213 | |||
212 | /* This is a bit messy, the LCD transfers appear to happen in chunks of 32 | 214 | /* This is a bit messy, the LCD transfers appear to happen in chunks of 32 |
213 | * pixels. (based on OF) | 215 | * pixels. (based on OF) |
214 | */ | 216 | */ |
@@ -242,6 +244,40 @@ void lcd_init_device(void) | |||
242 | IO_VID_ENC_VMOD|=0x01; | 244 | IO_VID_ENC_VMOD|=0x01; |
243 | } | 245 | } |
244 | 246 | ||
247 | #if defined(HAVE_LCD_MODES) | ||
248 | void lcd_set_mode(int mode) | ||
249 | { | ||
250 | if(mode==LCD_MODE_YUV) | ||
251 | { | ||
252 | /* Turn off the RGB buffer and enable the YUV buffer */ | ||
253 | IO_OSD_OSDWINMD0 |=0x04; | ||
254 | IO_OSD_VIDWINMD |=0x01; | ||
255 | memset16(FRAME2, 0x0080, LCD_NATIVE_HEIGHT*(LCD_NATIVE_WIDTH+LCD_FUDGE)); | ||
256 | } | ||
257 | else if(mode==LCD_MODE_RGB565) | ||
258 | { | ||
259 | /* Turn on the RGB window, set it to 16 bit and turn YUV window off */ | ||
260 | IO_OSD_VIDWINMD &=~(0x01); | ||
261 | IO_OSD_OSDWIN0OFST=LCD_NATIVE_WIDTH / 16; | ||
262 | IO_OSD_OSDWINMD0 |=(1<<13); | ||
263 | IO_OSD_OSDWINMD0 &=~0x04; | ||
264 | lcd_clear_display(); | ||
265 | } | ||
266 | else if(mode==LCD_MODE_PAL256) | ||
267 | { | ||
268 | #if LCD_NATIVE_WIDTH%32!=0 | ||
269 | IO_OSD_OSDWIN0OFST=LCD_NATIVE_WIDTH / 32+1; | ||
270 | #else | ||
271 | IO_OSD_OSDWIN0OFST=LCD_NATIVE_WIDTH / 32; | ||
272 | #endif | ||
273 | |||
274 | IO_OSD_VIDWINMD &=~(0x01); | ||
275 | IO_OSD_OSDWINMD0 &=~(1<<13); | ||
276 | IO_OSD_OSDWINMD0 |=0x01; | ||
277 | } | ||
278 | } | ||
279 | #endif | ||
280 | |||
245 | /* Update a fraction of the display. */ | 281 | /* Update a fraction of the display. */ |
246 | void lcd_update_rect(int x, int y, int width, int height) | 282 | void lcd_update_rect(int x, int y, int width, int height) |
247 | { | 283 | { |
@@ -317,39 +353,6 @@ void lcd_update(void) | |||
317 | #endif | 353 | #endif |
318 | } | 354 | } |
319 | 355 | ||
320 | #if defined(HAVE_LCD_MODES) | ||
321 | void lcd_set_mode(int mode) | ||
322 | { | ||
323 | if(mode==LCD_MODE_YUV) | ||
324 | { | ||
325 | /* Turn off the RGB buffer and enable the YUV buffer */ | ||
326 | IO_OSD_OSDWINMD0 &=~(0x01); | ||
327 | IO_OSD_VIDWINMD |=0x01; | ||
328 | memset16(FRAME, 0x0080, LCD_NATIVE_HEIGHT*(LCD_NATIVE_WIDTH+LCD_FUDGE)); | ||
329 | } | ||
330 | else if(mode==LCD_MODE_RGB565) | ||
331 | { | ||
332 | /* Turn on the RGB window, set it to 16 bit and turn YUV window off */ | ||
333 | IO_OSD_VIDWINMD &=~(0x01); | ||
334 | IO_OSD_OSDWIN0OFST=LCD_NATIVE_WIDTH / 16; | ||
335 | IO_OSD_OSDWINMD0 |=(1<<13)|0x01; | ||
336 | lcd_clear_display(); | ||
337 | } | ||
338 | else if(mode==LCD_MODE_PAL256) | ||
339 | { | ||
340 | #if LCD_NATIVE_WIDTH%32!=0 | ||
341 | IO_OSD_OSDWIN0OFST=LCD_NATIVE_WIDTH / 32+1; | ||
342 | #else | ||
343 | IO_OSD_OSDWIN0OFST=LCD_NATIVE_WIDTH / 32; | ||
344 | #endif | ||
345 | |||
346 | IO_OSD_VIDWINMD &=~(0x01); | ||
347 | IO_OSD_OSDWINMD0 &=~(1<<13); | ||
348 | IO_OSD_OSDWINMD0 |=0x01; | ||
349 | } | ||
350 | } | ||
351 | #endif | ||
352 | |||
353 | #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) | 356 | #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) |
354 | void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, | 357 | void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, |
355 | int width, int height) | 358 | int width, int height) |
@@ -362,7 +365,7 @@ void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, | |||
362 | { | 365 | { |
363 | memcpy ( dst, src, width); | 366 | memcpy ( dst, src, width); |
364 | 367 | ||
365 | dst=dst+width+(LCD_NATIVE_WIDTH-x-width)+LCD_FUDGE; | 368 | dst=dst+(LCD_NATIVE_WIDTH-x+LCD_FUDGE); |
366 | src+=width; | 369 | src+=width; |
367 | } | 370 | } |
368 | 371 | ||
@@ -425,10 +428,7 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
425 | int src_x, int src_y, int stride, | 428 | int src_x, int src_y, int stride, |
426 | int x, int y, int width, int height) | 429 | int x, int y, int width, int height) |
427 | { | 430 | { |
428 | /* Caches for chroma data so it only need be recaculated every other | 431 | register unsigned char const * yuv_src[3]; |
429 | line */ | ||
430 | unsigned char const * yuv_src[3]; | ||
431 | off_t z; | ||
432 | 432 | ||
433 | if (!lcd_on) | 433 | if (!lcd_on) |
434 | return; | 434 | return; |
@@ -455,50 +455,55 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
455 | width &= ~1; | 455 | width &= ~1; |
456 | height>>=1; | 456 | height>>=1; |
457 | 457 | ||
458 | fb_data * dst = FRAME + ((LCD_NATIVE_WIDTH+LCD_FUDGE)*(LCD_NATIVE_HEIGHT-1)) | 458 | fb_data * dst = FRAME2 |
459 | + ((LCD_NATIVE_WIDTH+LCD_FUDGE)*(LCD_NATIVE_HEIGHT-1)) | ||
459 | - (LCD_NATIVE_WIDTH+LCD_FUDGE)*x + y ; | 460 | - (LCD_NATIVE_WIDTH+LCD_FUDGE)*x + y ; |
460 | 461 | ||
461 | z = stride*src_y; | 462 | /* Scope z */ |
462 | yuv_src[0] = src[0] + z + src_x; | 463 | { |
463 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); | 464 | off_t z; |
464 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); | 465 | z = stride*src_y; |
466 | yuv_src[0] = src[0] + z + src_x; | ||
467 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); | ||
468 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); | ||
469 | } | ||
465 | 470 | ||
471 | register int cbcr_remain=(stride>>1)-(width>>1); | ||
472 | register int y_remain=(stride<<1)-width; | ||
473 | do | ||
466 | { | 474 | { |
467 | do | 475 | register fb_data *c_dst=dst; |
468 | { | 476 | register int c_width=width; |
469 | register fb_data *c_dst=dst; | 477 | |
470 | register int c_width=width; | 478 | do |
471 | unsigned char const * c_yuv_src[3]; | 479 | { |
472 | c_yuv_src[0] = yuv_src[0]; | 480 | /* This needs to be done in a block of 4 pixels */ |
473 | c_yuv_src[1] = yuv_src[1]; | 481 | |
474 | c_yuv_src[2] = yuv_src[2]; | 482 | *c_dst=*yuv_src[0]<<8 | *yuv_src[1]; |
475 | 483 | *(c_dst+1)=*(yuv_src[0]+stride)<<8 | *yuv_src[2]; | |
476 | do | 484 | c_dst-=(LCD_NATIVE_WIDTH+LCD_FUDGE); |
477 | { | ||
478 | /* This needs to be done in a block of 4 pixels */ | ||
479 | *c_dst=*c_yuv_src[0]<<8 | *c_yuv_src[1]; | ||
480 | *(c_dst+1)=*(c_yuv_src[0]+stride)<<8 | *c_yuv_src[2]; | ||
481 | c_dst-=(LCD_NATIVE_WIDTH+LCD_FUDGE); | ||
482 | c_yuv_src[0]++; | ||
483 | *c_dst=*c_yuv_src[0]<<8 | *c_yuv_src[1]; | ||
484 | *(c_dst+1)=*(c_yuv_src[0]+stride)<<8 | *c_yuv_src[2]; | ||
485 | c_dst-=(LCD_NATIVE_WIDTH+LCD_FUDGE); | ||
486 | c_yuv_src[0]++; | ||
487 | |||
488 | c_yuv_src[1]++; | ||
489 | c_yuv_src[2]++; | ||
490 | |||
491 | c_width -= 2; | ||
492 | } | ||
493 | while (c_width > 0); | ||
494 | 485 | ||
495 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ | 486 | yuv_src[0]++; |
496 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ | 487 | |
497 | yuv_src[2] += stride >> 1; | 488 | *c_dst=*yuv_src[0]<<8 | *yuv_src[1]; |
498 | dst+=2; | 489 | *(c_dst+1)=*(yuv_src[0]+stride)<<8 | *yuv_src[2]; |
499 | } | 490 | c_dst-=(LCD_NATIVE_WIDTH+LCD_FUDGE); |
500 | while (--height > 0); | 491 | |
492 | yuv_src[0]++; | ||
493 | |||
494 | yuv_src[1]++; | ||
495 | yuv_src[2]++; | ||
496 | |||
497 | c_width -= 2; | ||
498 | } | ||
499 | while (c_width > 0); | ||
500 | |||
501 | yuv_src[0] += y_remain; /* Skip down two luma lines-width */ | ||
502 | yuv_src[1] += cbcr_remain; /* Skip down one chroma line-width/2 */ | ||
503 | yuv_src[2] += cbcr_remain; | ||
504 | dst+=2; | ||
501 | } | 505 | } |
506 | while (--height > 0); | ||
502 | } | 507 | } |
503 | 508 | ||
504 | void lcd_set_contrast(int val) { | 509 | void lcd_set_contrast(int val) { |