diff options
Diffstat (limited to 'firmware/target/arm/tms320dm320/creative-zvm')
-rw-r--r-- | firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c | 68 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/creative-zvm/lcd-target.h | 18 |
2 files changed, 20 insertions, 66 deletions
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c index c92920337b..e6d9e034ed 100644 --- a/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c +++ b/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include "ltv350qv.h" | 33 | #include "ltv350qv.h" |
34 | 34 | ||
35 | /* Power and display status */ | 35 | /* Power and display status */ |
36 | static bool display_on = false; /* Is the display turned on? */ | 36 | extern bool lcd_on; /* lcd-memframe.c */ |
37 | static bool direct_fb_access = false; /* Does the DM320 has direct access to the FB? */ | 37 | static bool direct_fb_access = false; /* Does the DM320 has direct access to the FB? */ |
38 | 38 | ||
39 | /* Copies a rectangle from one framebuffer to another. Can be used in | 39 | /* Copies a rectangle from one framebuffer to another. Can be used in |
@@ -189,7 +189,7 @@ static void lcd_display_on(bool reset) | |||
189 | IO_VID_ENC_VMOD |= VENC_VMOD_VENC; | 189 | IO_VID_ENC_VMOD |= VENC_VMOD_VENC; |
190 | } | 190 | } |
191 | /* tell that we're on now */ | 191 | /* tell that we're on now */ |
192 | display_on = true; | 192 | lcd_on = true; |
193 | } | 193 | } |
194 | 194 | ||
195 | #ifdef HAVE_LCD_ENABLE | 195 | #ifdef HAVE_LCD_ENABLE |
@@ -224,14 +224,14 @@ static void lcd_display_off(void) | |||
224 | 224 | ||
225 | enable_venc(false); | 225 | enable_venc(false); |
226 | 226 | ||
227 | display_on = false; | 227 | lcd_on = false; |
228 | } | 228 | } |
229 | 229 | ||
230 | void lcd_enable(bool on) | 230 | void lcd_enable(bool on) |
231 | { | 231 | { |
232 | /* Disabled until properly working */ | 232 | /* Disabled until properly working */ |
233 | return; | 233 | return; |
234 | if (on == display_on) | 234 | if (on == lcd_on) |
235 | return; | 235 | return; |
236 | 236 | ||
237 | if (on) | 237 | if (on) |
@@ -247,13 +247,6 @@ return; | |||
247 | } | 247 | } |
248 | #endif | 248 | #endif |
249 | 249 | ||
250 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
251 | bool lcd_active(void) | ||
252 | { | ||
253 | return display_on; | ||
254 | } | ||
255 | #endif | ||
256 | |||
257 | void lcd_set_direct_fb(bool yes) | 250 | void lcd_set_direct_fb(bool yes) |
258 | { | 251 | { |
259 | unsigned int addr; | 252 | unsigned int addr; |
@@ -323,7 +316,7 @@ void lcd_init_device(void) | |||
323 | DM320_REG(0x0864) = 0; /* ???? */ | 316 | DM320_REG(0x0864) = 0; /* ???? */ |
324 | } | 317 | } |
325 | else | 318 | else |
326 | display_on = true; | 319 | lcd_on = true; |
327 | 320 | ||
328 | /* Based on lcd-mr500.c from Catalin Patulea */ | 321 | /* Based on lcd-mr500.c from Catalin Patulea */ |
329 | /* Clear the Frame */ | 322 | /* Clear the Frame */ |
@@ -369,7 +362,7 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
369 | { | 362 | { |
370 | register fb_data *dst, *src; | 363 | register fb_data *dst, *src; |
371 | 364 | ||
372 | if (!display_on || direct_fb_access) | 365 | if (!lcd_on || direct_fb_access) |
373 | return; | 366 | return; |
374 | 367 | ||
375 | if (x + width > LCD_WIDTH) | 368 | if (x + width > LCD_WIDTH) |
@@ -424,7 +417,7 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
424 | This must be called after all other LCD functions that change the display. */ | 417 | This must be called after all other LCD functions that change the display. */ |
425 | void lcd_update(void) | 418 | void lcd_update(void) |
426 | { | 419 | { |
427 | if (!display_on || direct_fb_access) | 420 | if (!lcd_on || direct_fb_access) |
428 | return; | 421 | return; |
429 | #if CONFIG_ORIENTATION == SCREEN_PORTRAIT | 422 | #if CONFIG_ORIENTATION == SCREEN_PORTRAIT |
430 | lcd_copy_buffer_rect((fb_data *)FRAME, &lcd_framebuffer[0][0], | 423 | lcd_copy_buffer_rect((fb_data *)FRAME, &lcd_framebuffer[0][0], |
@@ -433,50 +426,3 @@ void lcd_update(void) | |||
433 | lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); | 426 | lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); |
434 | #endif | 427 | #endif |
435 | } | 428 | } |
436 | |||
437 | /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ | ||
438 | extern void lcd_write_yuv420_lines(fb_data *dst, | ||
439 | unsigned char chroma_buf[LCD_HEIGHT/2*3], | ||
440 | unsigned char const * const src[3], | ||
441 | int width, | ||
442 | int stride); | ||
443 | /* Performance function to blit a YUV bitmap directly to the LCD */ | ||
444 | /* For the Gigabeat - show it rotated */ | ||
445 | /* So the LCD_WIDTH is now the height */ | ||
446 | void lcd_blit_yuv(unsigned char * const src[3], | ||
447 | int src_x, int src_y, int stride, | ||
448 | int x, int y, int width, int height) | ||
449 | { | ||
450 | /* Caches for chroma data so it only need be recalculated every other | ||
451 | line */ | ||
452 | unsigned char chroma_buf[LCD_HEIGHT/2*3]; /* 480 bytes */ | ||
453 | unsigned char const * yuv_src[3]; | ||
454 | off_t z; | ||
455 | |||
456 | if (!display_on || direct_fb_access) | ||
457 | return; | ||
458 | |||
459 | /* Sorry, but width and height must be >= 2 or else */ | ||
460 | width &= ~1; | ||
461 | height >>= 1; | ||
462 | |||
463 | fb_data *dst = (fb_data*)FRAME + x * LCD_WIDTH + (LCD_WIDTH - y) - 1; | ||
464 | |||
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 | |||
470 | do | ||
471 | { | ||
472 | lcd_write_yuv420_lines(dst, chroma_buf, yuv_src, width, | ||
473 | stride); | ||
474 | |||
475 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ | ||
476 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ | ||
477 | yuv_src[2] += stride >> 1; | ||
478 | dst -= 2; | ||
479 | } | ||
480 | while (--height > 0); | ||
481 | } | ||
482 | |||
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/lcd-target.h b/firmware/target/arm/tms320dm320/creative-zvm/lcd-target.h index 720aa0cf19..456f0e3cfe 100644 --- a/firmware/target/arm/tms320dm320/creative-zvm/lcd-target.h +++ b/firmware/target/arm/tms320dm320/creative-zvm/lcd-target.h | |||
@@ -19,12 +19,20 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #ifndef _LCD_TARGET_H_ | 22 | #ifndef LCD_TARGET_H |
23 | #define _LCD_TARGET_H_ | 23 | #define LCD_TARGET_H |
24 | |||
25 | extern void lcd_enable(bool state); | ||
26 | 24 | ||
27 | void lcd_set_direct_fb(bool yes); | 25 | void lcd_set_direct_fb(bool yes); |
28 | bool lcd_get_direct_fb(void); | 26 | bool lcd_get_direct_fb(void); |
29 | 27 | ||
30 | #endif | 28 | /* Direct FB access disables regular updates */ |
29 | #define lcd_write_enabled() \ | ||
30 | ({ lcd_on && !lcd_get_direct_fb(); }) | ||
31 | |||
32 | /* Very strange functions */ | ||
33 | #define LCD_OPTIMIZED_UPDATE | ||
34 | #define LCD_OPTIMIZED_UPDATE_RECT | ||
35 | |||
36 | #define LCD_FRAMEBUF_ADDR(col, row) ((fb_data *)FRAME + (row)*LCD_WIDTH + (col)) | ||
37 | |||
38 | #endif /* LCD_TARGET_H */ | ||