summaryrefslogtreecommitdiff
path: root/firmware/target/arm/ipod/video/lcd-video.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/ipod/video/lcd-video.c')
-rw-r--r--firmware/target/arm/ipod/video/lcd-video.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/firmware/target/arm/ipod/video/lcd-video.c b/firmware/target/arm/ipod/video/lcd-video.c
index 494bec8429..27d889aafa 100644
--- a/firmware/target/arm/ipod/video/lcd-video.c
+++ b/firmware/target/arm/ipod/video/lcd-video.c
@@ -439,6 +439,53 @@ void lcd_update(void)
439 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); 439 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
440} 440}
441 441
442/* Line write helper function for lcd_yuv_blit. Writes two lines of yuv420. */
443extern void lcd_write_yuv420_lines(unsigned char const * const src[3],
444 unsigned bcmaddr,
445 int width,
446 int stride);
447
448/* Performance function to blit a YUV bitmap directly to the LCD */
449void lcd_blit_yuv(unsigned char * const src[3],
450 int src_x, int src_y, int stride,
451 int x, int y, int width, int height)
452{
453 unsigned bcmaddr;
454 off_t z;
455 unsigned char const * yuv_src[3];
456
457#ifdef HAVE_LCD_SLEEP
458 if (!lcd_state.display_on)
459 return;
460#endif
461
462 /* Sorry, but width and height must be >= 2 or else */
463 width &= ~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 /* Prevent the tick from triggering BCM updates while we're writing. */
471 lcd_block_tick();
472
473 bcmaddr = BCMA_CMDPARAM + (LCD_WIDTH*2) * y + (x << 1);
474 height >>= 1;
475
476 do
477 {
478 lcd_write_yuv420_lines(yuv_src, bcmaddr, width, stride);
479 bcmaddr += (LCD_WIDTH*4); /* Skip up two lines */
480 yuv_src[0] += stride << 1;
481 yuv_src[1] += stride >> 1; /* Skip down one chroma line */
482 yuv_src[2] += stride >> 1;
483 }
484 while (--height > 0);
485
486 lcd_unblock_and_update();
487}
488
442#ifdef HAVE_LCD_SLEEP 489#ifdef HAVE_LCD_SLEEP
443/* Executes a BCM command immediately and waits for it to complete. 490/* Executes a BCM command immediately and waits for it to complete.
444 Other BCM commands (eg. LCD updates or lcd_tick) must not interfere. 491 Other BCM commands (eg. LCD updates or lcd_tick) must not interfere.