summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c')
-rw-r--r--firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c68
1 files changed, 7 insertions, 61 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 */
36static bool display_on = false; /* Is the display turned on? */ 36extern bool lcd_on; /* lcd-memframe.c */
37static bool direct_fb_access = false; /* Does the DM320 has direct access to the FB? */ 37static 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
230void lcd_enable(bool on) 230void lcd_enable(bool on)
231{ 231{
232/* Disabled until properly working */ 232/* Disabled until properly working */
233return; 233return;
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)
251bool lcd_active(void)
252{
253 return display_on;
254}
255#endif
256
257void lcd_set_direct_fb(bool yes) 250void 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)
424This must be called after all other LCD functions that change the display. */ 417This must be called after all other LCD functions that change the display. */
425void lcd_update(void) 418void 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. */
438extern void lcd_write_yuv420_lines(fb_data *dst,
439unsigned char chroma_buf[LCD_HEIGHT/2*3],
440unsigned char const * const src[3],
441int width,
442int 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 */
446void 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