summaryrefslogtreecommitdiff
path: root/firmware/target/arm/philips/sa9200/lcd-sa9200.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/philips/sa9200/lcd-sa9200.c')
-rw-r--r--firmware/target/arm/philips/sa9200/lcd-sa9200.c82
1 files changed, 0 insertions, 82 deletions
diff --git a/firmware/target/arm/philips/sa9200/lcd-sa9200.c b/firmware/target/arm/philips/sa9200/lcd-sa9200.c
index e30a298045..c6c297e6ca 100644
--- a/firmware/target/arm/philips/sa9200/lcd-sa9200.c
+++ b/firmware/target/arm/philips/sa9200/lcd-sa9200.c
@@ -75,9 +75,6 @@ static void lcd_display_off(void);
75#define R_GATE_OUT_PERIOD_CTRL 0x71 75#define R_GATE_OUT_PERIOD_CTRL 0x71
76#define R_SOFTWARE_RESET 0x72 76#define R_SOFTWARE_RESET 0x72
77 77
78/* Display status */
79static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
80
81/* wait for LCD */ 78/* wait for LCD */
82static inline void lcd_wait_write(void) 79static inline void lcd_wait_write(void)
83{ 80{
@@ -407,85 +404,6 @@ void lcd_set_flip(bool yesno)
407 lcd_write_reg(R_DRV_OUTPUT_CONTROL, flip ? 0x090c : 0x0a0c); 404 lcd_write_reg(R_DRV_OUTPUT_CONTROL, flip ? 0x090c : 0x0a0c);
408} 405}
409 406
410void lcd_yuv_set_options(unsigned options)
411{
412 lcd_yuv_options = options;
413}
414
415/* Performance function to blit a YUV bitmap directly to the LCD */
416void lcd_write_yuv420_lines(unsigned char const * const src[3],
417 int width,
418 int stride);
419void lcd_write_yuv420_lines_odither(unsigned char const * const src[3],
420 int width,
421 int stride,
422 int x_screen,
423 int y_screen);
424void lcd_blit_yuv(unsigned char * const src[3],
425 int src_x, int src_y, int stride,
426 int x, int y, int width, int height)
427{
428 const unsigned char *yuv_src[3];
429 const unsigned char *ysrc_max;
430 int options;
431
432 if (!display_on)
433 return;
434
435 width &= ~1;
436 height &= ~1;
437
438 /* calculate the drawing region */
439 lcd_write_reg(R_VERT_RAM_ADDR_POS, ((x + width - 1) << 8) | x);
440
441 /* convert YUV coordinates to screen coordinates */
442 y = LCD_WIDTH - 1 - y;
443
444 /* 2px strip: cursor moves left, then down in gram */
445 /* BGR=1, MDT1-0=00, I/D1-0=10, AM=0 */
446 lcd_write_reg(R_ENTRY_MODE, 0x1020);
447
448 yuv_src[0] = src[0] + src_y * stride + src_x;
449 yuv_src[1] = src[1] + (src_y * stride >> 2) + (src_x >> 1);
450 yuv_src[2] = src[2] + (yuv_src[1] - src[1]);
451 ysrc_max = yuv_src[0] + height * stride;
452
453 /* cache options setting */
454 options = lcd_yuv_options;
455
456 do
457 {
458 /* max horiz << 8 | start horiz */
459 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (y << 8) | (y - 1));
460
461 /* position cursor (set AD0-AD15) */
462 lcd_write_reg(R_RAM_ADDR_SET, (x << 8) | y);
463
464 /* start drawing */
465 lcd_send_command(R_WRITE_DATA_2_GRAM);
466
467 if (options & LCD_YUV_DITHER)
468 {
469 lcd_write_yuv420_lines_odither(yuv_src, width, stride,
470 y, x);
471 }
472 else
473 {
474 lcd_write_yuv420_lines(yuv_src, width, stride);
475 }
476
477 y -= 2; /* move strip by "down" 2 px */
478 yuv_src[0] += stride << 1;
479 yuv_src[1] += stride >> 1;
480 yuv_src[2] += stride >> 1;
481 }
482 while (yuv_src[0] < ysrc_max);
483
484 /* back to normal right, then down cursor in gram */
485 /* BGR=1, MDT1-0=00, I/D1-0=11, AM=0 */
486 lcd_write_reg(R_ENTRY_MODE, 0x1030);
487}
488
489/* Update the display. 407/* Update the display.
490 This must be called after all other LCD functions that change the display. */ 408 This must be called after all other LCD functions that change the display. */
491void lcd_update(void) 409void lcd_update(void)