summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/plugin.c7
-rw-r--r--apps/plugin.h8
-rw-r--r--apps/plugins/doom/i_video.c95
-rw-r--r--apps/plugins/plugin.lds20
4 files changed, 85 insertions, 45 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 17e9ac670b..087bf74a38 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -636,6 +636,13 @@ static const struct plugin_api rockbox_api = {
636#if defined(HAVE_LCD_MODES) 636#if defined(HAVE_LCD_MODES)
637 lcd_set_mode, 637 lcd_set_mode,
638#endif 638#endif
639
640#if defined(HAVE_LCD_MODES)
641#if HAVE_LCD_MODES & LCD_MODE_PAL256
642 lcd_blit_pal256,
643 lcd_pal256_update_pal,
644#endif
645#endif
639}; 646};
640 647
641int plugin_load(const char* plugin, const void* parameter) 648int plugin_load(const char* plugin, const void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index fdcf3c2afa..d38cc42ee7 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -794,6 +794,14 @@ struct plugin_api {
794#if defined(HAVE_LCD_MODES) 794#if defined(HAVE_LCD_MODES)
795 void (*lcd_set_mode)(int mode); 795 void (*lcd_set_mode)(int mode);
796#endif 796#endif
797
798#if defined(HAVE_LCD_MODES)
799#if HAVE_LCD_MODES & LCD_MODE_PAL256
800 void (*lcd_blit_pal256)(unsigned char *src, int src_x, int src_y, int x, int y,
801 int width, int height);
802 void (*lcd_pal256_update_pal)(fb_data *palette);
803#endif
804#endif
797}; 805};
798 806
799/* plugin header */ 807/* plugin header */
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c
index c148d17077..418fcd4404 100644
--- a/apps/plugins/doom/i_video.c
+++ b/apps/plugins/doom/i_video.c
@@ -140,6 +140,12 @@ static fb_data *paldata=NULL;
140// 140//
141void I_ShutdownGraphics(void) 141void I_ShutdownGraphics(void)
142{ 142{
143#if defined(HAVE_LCD_MODES)
144#if (HAVE_LCD_MODES & LCD_MODE_PAL256)
145 rb->lcd_set_mode(LCD_MODE_RGB565);
146#endif
147#endif
148
143#ifndef HAVE_LCD_COLOR 149#ifndef HAVE_LCD_COLOR
144 grey_release(); 150 grey_release();
145#endif 151#endif
@@ -597,13 +603,19 @@ static void I_UploadNewPalette(int pal)
597 } 603 }
598 604
599#ifdef RANGECHECK 605#ifdef RANGECHECK
600 if ((size_t)pal >= num_pals) 606 if ((size_t)pal >= num_pals)
601 I_Error("I_UploadNewPalette: Palette number out of range (%d>=%d)", 607 I_Error("I_UploadNewPalette: Palette number out of range (%d>=%d)",
602 pal, num_pals); 608 pal, num_pals);
603#endif 609#endif
604 memcpy(palette,paldata+256*pal,256*sizeof(fb_data));
605}
606 610
611 memcpy(palette,paldata+256*pal,256*sizeof(fb_data));
612
613#if defined(HAVE_LCD_MODES)
614#if (HAVE_LCD_MODES & LCD_MODE_PAL256)
615 rb->lcd_pal256_update_pal(paldata+256*pal);
616#endif
617#endif
618}
607 619
608// 620//
609// I_FinishUpdate 621// I_FinishUpdate
@@ -613,36 +625,37 @@ void I_FinishUpdate (void)
613{ 625{
614 int count; 626 int count;
615 byte *src = d_screens[0]; 627 byte *src = d_screens[0];
628
616#if (CONFIG_LCD == LCD_H300) && !defined(SIMULATOR) 629#if (CONFIG_LCD == LCD_H300) && !defined(SIMULATOR)
617 count = SCREENWIDTH*SCREENHEIGHT; 630 count = SCREENWIDTH*SCREENHEIGHT;
618 631
619 /* ASM screen update (drops ~300 tics) */ 632 /* ASM screen update (drops ~300 tics) */
620 asm volatile ( 633 asm volatile (
621 "move.w #33, (%[LCD]) \n" /* Setup the LCD controller */ 634 "move.w #33, (%[LCD]) \n" /* Setup the LCD controller */
622 "nop \n" 635 "nop \n"
623 "clr.w (%[LCD2]) \n" 636 "clr.w (%[LCD2]) \n"
624 "nop \n" 637 "nop \n"
625 "move.w #34, (%[LCD]) \n" /* End LCD controller setup */ 638 "move.w #34, (%[LCD]) \n" /* End LCD controller setup */
626 "clr.l %%d1 \n" 639 "clr.l %%d1 \n"
627 ".loop: \n" 640 ".loop: \n"
628 "move.l (%[scrp])+, %%d0 \n" 641 "move.l (%[scrp])+, %%d0 \n"
629 "swap.w %%d0 \n" 642 "swap.w %%d0 \n"
630 "move.w %%d0, %%d1 \n" 643 "move.w %%d0, %%d1 \n"
631 "lsr.l #8,%%d1 \n" 644 "lsr.l #8,%%d1 \n"
632 "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n" 645 "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n"
633 "move.b %%d0,%%d1 \n" 646 "move.b %%d0,%%d1 \n"
634 "swap.w %%d0 \n" 647 "swap.w %%d0 \n"
635 "nop \n" 648 "nop \n"
636 "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n" 649 "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n"
637 "move.w %%d0, %%d1 \n" 650 "move.w %%d0, %%d1 \n"
638 "lsr.l #8,%%d1 \n" 651 "lsr.l #8,%%d1 \n"
639 "nop \n" 652 "nop \n"
640 "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n" 653 "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n"
641 "move.b %%d0,%%d1 \n" 654 "move.b %%d0,%%d1 \n"
642 "nop \n" 655 "nop \n"
643 "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n" 656 "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n"
644 "subq.l #4,%[cnt] \n" 657 "subq.l #4,%[cnt] \n"
645 "bne.b .loop \n" 658 "bne.b .loop \n"
646 : /* outputs */ 659 : /* outputs */
647 [scrp]"+a"(src), 660 [scrp]"+a"(src),
648 [cnt] "+d"(count) 661 [cnt] "+d"(count)
@@ -713,7 +726,14 @@ void I_FinishUpdate (void)
713 "d0", "d1", "d2", "d3" 726 "d0", "d1", "d2", "d3"
714 ); 727 );
715#else 728#else
716#ifdef HAVE_LCD_COLOR 729
730/* If the hardware has support for a paletted mode it takes precidence */
731#if defined(HAVE_LCD_MODES)
732#if (HAVE_LCD_MODES & LCD_MODE_PAL256)
733 (void) count;
734 rb->lcd_blit_pal256(src, 0, 0, 0, 0, LCD_WIDTH, LCD_HEIGHT);
735#endif
736#elif defined(HAVE_LCD_COLOR)
717#if(LCD_HEIGHT>LCD_WIDTH) 737#if(LCD_HEIGHT>LCD_WIDTH)
718 if(rotate_screen) 738 if(rotate_screen)
719 { 739 {
@@ -742,8 +762,9 @@ void I_FinishUpdate (void)
742 *dst++ = palette[*src++]; 762 *dst++ = palette[*src++];
743 while (--count); 763 while (--count);
744 } 764 }
745 rb->lcd_update(); 765 rb->lcd_update();
746#else /* !HAVE_LCD_COLOR */ 766#else /* !HAVE_LCD_COLOR */
767
747 unsigned char *dst; 768 unsigned char *dst;
748 int y; 769 int y;
749 770
@@ -758,8 +779,8 @@ void I_FinishUpdate (void)
758 779
759 grey_ub_gray_bitmap(greybuffer, 0, y, SCREENWIDTH, 1); 780 grey_ub_gray_bitmap(greybuffer, 0, y, SCREENWIDTH, 1);
760 } 781 }
761#endif /* !HAVE_LCD_COLOR */ 782#endif
762#endif 783#endif
763} 784}
764 785
765// 786//
@@ -786,6 +807,12 @@ void I_InitGraphics(void)
786 printf("Starting Graphics engine\n"); 807 printf("Starting Graphics engine\n");
787 808
788 noprintf=1; 809 noprintf=1;
810
811#if defined(HAVE_LCD_MODES)
812#if (HAVE_LCD_MODES & LCD_MODE_PAL256)
813 rb->lcd_set_mode(LCD_MODE_PAL256);
814#endif
815#endif
789 816
790 /* Note: The other screens are allocated as needed */ 817 /* Note: The other screens are allocated as needed */
791 818
diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds
index 9c65f31779..d6f62341ce 100644
--- a/apps/plugins/plugin.lds
+++ b/apps/plugins/plugin.lds
@@ -35,18 +35,20 @@ OUTPUT_FORMAT(elf32-littlemips)
35#define NOCACHE_BASE 0x00000000 35#define NOCACHE_BASE 0x00000000
36#endif 36#endif
37 37
38#if CONFIG_CPU==DM320 || CONFIG_CPU==S3C2440 38#if CONFIG_CPU==DM320 || CONFIG_CPU==IMX31L
39#define LCD_BUFFER_SIZE (LCD_WIDTH*LCD_HEIGHT*2) 39/* Give this 1 meg to allow it to align to the MMU boundary */
40#define LCD_TTB_AREA 0x100000
41#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_TTB_AREA
40 42
43#elif CONFIG_CPU==S3C2440
44#define LCD_BUFFER_SIZE (LCD_WIDTH*LCD_HEIGHT*2)
41/* must be 16Kb (0x4000) aligned */ 45/* must be 16Kb (0x4000) aligned */
42#define TTB_SIZE (0x4000) 46#define TTB_SIZE (0x4000)
43#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_BUFFER_SIZE - TTB_SIZE 47#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_BUFFER_SIZE - TTB_SIZE
44#elif CONFIG_CPU==IMX31L 48
45#include "imx31l.h"
46/* Reserve 1mb for LCD buffer/TTB as in app.lds */
47#define DRAMSIZE (MEMORYSIZE * 0x100000 - 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE
48#elif CONFIG_CPU==AS3525 && MEMORYSIZE <= 2 49#elif CONFIG_CPU==AS3525 && MEMORYSIZE <= 2
49#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET 50#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET
51
50#else 52#else
51#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE 53#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE
52#endif 54#endif
@@ -77,11 +79,7 @@ OUTPUT_FORMAT(elf32-littlemips)
77#define DRAMORIG 0xc00000 + STUBOFFSET 79#define DRAMORIG 0xc00000 + STUBOFFSET
78#define IRAMORIG 0x407000 80#define IRAMORIG 0x407000
79#define IRAMSIZE 0x9000 81#define IRAMSIZE 0x9000
80#elif CONFIG_CPU == S3C2440 82#elif CONFIG_CPU == IMX31L || CONFIG_CPU == S3C2440
81#define DRAMORIG 0x0 + STUBOFFSET
82#define IRAM DRAM
83#define IRAMSIZE 0
84#elif CONFIG_CPU == IMX31L
85#define DRAMORIG 0x0 + STUBOFFSET 83#define DRAMORIG 0x0 + STUBOFFSET
86#define IRAM DRAM 84#define IRAM DRAM
87#define IRAMSIZE 0 85#define IRAMSIZE 0