diff --git a/src/newgal/commlcd/axlinux_c33l05.c b/src/newgal/commlcd/axlinux_c33l05.c index feb5bb98..61716d52 100644 --- a/src/newgal/commlcd/axlinux_c33l05.c +++ b/src/newgal/commlcd/axlinux_c33l05.c @@ -201,7 +201,7 @@ static int L2F50113T00_open (void) return 0; } -static int L2F50113T00_getscreeninfo (struct commlcd_info *li) +static int L2F50113T00_getscreeninfo (struct commlcd_info *li, int width, int height, int bpp) { li->type = COMMLCD_TRUE_RGB565; li->height = SCREEN_HEIGHT; @@ -209,6 +209,7 @@ static int L2F50113T00_getscreeninfo (struct commlcd_info *li) li->fb = (void*)VRAM_ADDR_1; li->bpp = LCD_BPP; li->rlen = SCREEN_WIDTH * LCD_BPP_UNIT; + li->async_update = 0; return 0; } diff --git a/src/newgal/commlcd/commlcd.c b/src/newgal/commlcd/commlcd.c index 21fc4df6..0120054c 100644 --- a/src/newgal/commlcd/commlcd.c +++ b/src/newgal/commlcd/commlcd.c @@ -107,6 +107,20 @@ static void COMMLCD_UpdateRects (_THIS, int numrects, GAL_Rect *rects) return; } + if (this->hidden->update_th == 0) { + /* sync update */ + for (i = 0; i < numrects; i++) { + RECT rc; + SetRect (&rc, rects[i].x, rects[i].y, + rects[i].x + rects[i].w, rects[i].y + rects[i].h); + if (!IsRectEmpty (&rc)) { + __mg_commlcd_ops.update (&rc); + } + } + + return; + } + pthread_mutex_lock (&this->hidden->update_lock); bound = this->hidden->rc_dirty; @@ -200,9 +214,10 @@ static GAL_Surface *COMMLCD_SetVideoMode(_THIS, GAL_Surface *current, int width, int height, int bpp, Uint32 flags) { Uint32 Rmask = 0, Gmask = 0, Bmask = 0, Amask = 0; - struct commlcd_info li; - if (__mg_commlcd_ops.getinfo (&li)) { + memset (&li, 0, sizeof (struct commlcd_info)); + + if (__mg_commlcd_ops.getinfo (&li, width, height, bpp)) { fprintf (stderr, "NEWGAL>COMMLCD: " "Couldn't get the LCD information\n"); return NULL; @@ -216,6 +231,11 @@ static GAL_Surface *COMMLCD_SetVideoMode(_THIS, GAL_Surface *current, memset (li.fb, 0, li.rlen * height); switch (li.type) { + case COMMLCD_PSEUDO_RGB332: + Rmask = 0xE0; + Gmask = 0x1C; + Bmask = 0x03; + break; case COMMLCD_TRUE_RGB555: Rmask = 0x7C00; Gmask = 0x03E0; @@ -226,15 +246,23 @@ static GAL_Surface *COMMLCD_SetVideoMode(_THIS, GAL_Surface *current, Gmask = 0x07E0; Bmask = 0x001F; break; - case COMMLCD_TRUE_BGR565: - Rmask = 0x001F; - Gmask = 0x07E0; - Bmask = 0xF800; + case COMMLCD_TRUE_RGB888: + case COMMLCD_TRUE_RGB0888: + Rmask = 0x00FF0000; + Gmask = 0x0000FF00; + Bmask = 0x000000FF; break; - case COMMLCD_TRUE_BGR888: - Bmask = 0xFF0000; - Gmask = 0x00FF00; - Rmask = 0x0000FF; + case COMMLCD_TRUE_ARGB1555: + Amask = 0x8000; + Rmask = 0x7C00; + Gmask = 0x03E0; + Bmask = 0x001F; + break; + case COMMLCD_TRUE_ARGB8888: + Amask = 0xFF000000; + Rmask = 0x00FF0000; + Gmask = 0x0000FF00; + Bmask = 0x000000FF; break; } @@ -256,7 +284,7 @@ static GAL_Surface *COMMLCD_SetVideoMode(_THIS, GAL_Surface *current, current->pitch = this->hidden->pitch; current->pixels = this->hidden->fb; - if (__mg_commlcd_ops.update) { + if (li.async_update && __mg_commlcd_ops.update) { pthread_attr_t new_attr; pthread_attr_init (&new_attr); @@ -264,6 +292,10 @@ static GAL_Surface *COMMLCD_SetVideoMode(_THIS, GAL_Surface *current, pthread_create (&this->hidden->update_th, &new_attr, task_do_update, this); pthread_attr_destroy (&new_attr); + pthread_mutex_init(&this->hidden->update_lock, NULL) + } + else { + this->hidden->update_th = 0; } /* We're done */ diff --git a/src/newgal/commlcd/commlcd.h b/src/newgal/commlcd/commlcd.h index 83870060..61147639 100644 --- a/src/newgal/commlcd/commlcd.h +++ b/src/newgal/commlcd/commlcd.h @@ -59,27 +59,28 @@ struct GAL_PrivateVideoData { /* The pixel format defined by depth */ #define COMMLCD_PSEUDO_RGB332 1 #define COMMLCD_TRUE_RGB555 2 - #define COMMLCD_TRUE_RGB565 3 #define COMMLCD_TRUE_RGB888 4 #define COMMLCD_TRUE_RGB0888 5 - -#define COMMLCD_TRUE_BGR565 6 -#define COMMLCD_TRUE_BGR888 7 +#define COMMLCD_TRUE_ARGB1555 6 +#define COMMLCD_TRUE_ARGB8888 7 struct commlcd_info { - short height, width; // Size of the screen + short height; // vertical resolution of the screen + short width; // horinzontal resolution of the screen short bpp; // Depth (bits-per-pixel) short type; // Pixel type short rlen; // Length of one scan line in bytes void *fb; // Frame buffer + + short async_update; // update asynchronously or synchronously. 0 for synchronously; others for asynchronously. }; struct commlcd_ops { /* return value: zero for OK */ int (*init) (void); /* return value: zero for OK */ - int (*getinfo) (struct commlcd_info *li); + int (*getinfo) (struct commlcd_info *li, int width, int height, int bpp); /* return value: zero for OK */ int (*release) (void); /* return value: number set, zero on error */ diff --git a/src/newgal/commlcd/ecos_generic.c b/src/newgal/commlcd/ecos_generic.c index a1137ee1..c7cd5045 100644 --- a/src/newgal/commlcd/ecos_generic.c +++ b/src/newgal/commlcd/ecos_generic.c @@ -61,9 +61,18 @@ static int a_init (void) return 0; } -static int a_getinfo (struct commlcd_info *li) +static int a_getinfo (struct commlcd_info *li, int width, int height, int bpp) { - lcd_getinfo ((struct lcd_info*) li); + struct lcd_info ecos_lcd_info; + + lcd_getinfo (&ecos_lcd_info); + + li->height = ecos_lcd_info.height; + li->width = ecos_lcd_info.width; + li->fb = ecos_lcd_info.fb; + li->bpp = ecos_lcd_info.bpp; + li->rlen = ecos_lcd_info.rlen; + li->async_update = 0; return 0; } diff --git a/src/newgal/commlcd/ecos_mv6600.c b/src/newgal/commlcd/ecos_mv6600.c index 9b387c8c..e5dd3060 100644 --- a/src/newgal/commlcd/ecos_mv6600.c +++ b/src/newgal/commlcd/ecos_mv6600.c @@ -64,25 +64,20 @@ extern INT32 lcd_graphic_overlay_display(UINT32 image_buf_addr, UINT32 image_wid static int a_init (void) { - // lcd_init (16); -// MV_TRACE(FLASH, "FILE=%s.........LINE=%d\n", __FILE__, __LINE__); toppoly_init(); lcd_graphic_overlay_display(0xe40000, 320, 240, 0, 0, 0); - //MV_TRACE(FLASH, "FILE=%s.........LINE=%d\n", __FILE__, __LINE__); return 0; } -static int a_getinfo (struct commlcd_info *li) +static int a_getinfo (struct commlcd_info *li, int width, int height, int bpp) { - // lcd_getinfo ((struct lcd_info*) li); - // MV_TRACE(FLASH, "FILE=%s.........LINE=%d\n", __FILE__, __LINE__); li->height = 240; li->width = 320; li->bpp = 32; li->rlen = 320 * 32 / 8; li->fb = 0xe40000; li->type = COMMLCD_TRUE_RGB0888; - return 0; + return 0; } struct commlcd_ops __mg_commlcd_ops = { diff --git a/src/newgal/commlcd/extern.c b/src/newgal/commlcd/extern.c index 97be3541..149f55e8 100644 --- a/src/newgal/commlcd/extern.c +++ b/src/newgal/commlcd/extern.c @@ -53,7 +53,7 @@ #include "commlcd.h" extern int __commlcd_drv_init (void); -extern int __commlcd_drv_getinfo (struct commlcd_info *li); +extern int __commlcd_drv_getinfo (struct commlcd_info *li, int width, int height, int bpp); extern int __commlcd_drv_release (void); extern int __commlcd_drv_setclut (int firstcolor, int ncolors, GAL_Color *colors); extern int __commlcd_drv_update (const RECT* rc_dirty); diff --git a/src/newgal/commlcd/ose_mx21.c b/src/newgal/commlcd/ose_mx21.c index d1b3445a..131bec28 100644 --- a/src/newgal/commlcd/ose_mx21.c +++ b/src/newgal/commlcd/ose_mx21.c @@ -87,7 +87,7 @@ static int a_init (void) return 0; } -static int a_getinfo (struct commlcd_info *li) +static int a_getinfo (struct commlcd_info *li, int width, int height, int bpp) { struct FbdevQuery *fbinfo; union SIGNAL *lcdsig = alloc(sizeof(struct FbdevQuery), FBDEV_QUERY_REQUEST); diff --git a/src/newgal/commlcd/vxworks_i386.c b/src/newgal/commlcd/vxworks_i386.c index df33d62f..66f3488a 100644 --- a/src/newgal/commlcd/vxworks_i386.c +++ b/src/newgal/commlcd/vxworks_i386.c @@ -67,7 +67,7 @@ static int a_init (void) return 0; } -static int a_getinfo (struct lcd_info *li) +static int a_getinfo (struct lcd_info *li, int width, int height, int bpp) { UGL_MODE_INFO modeInfo; @@ -115,11 +115,11 @@ struct lcd_ops __mg_commlcd_ops = { a_init, a_getinfo, NULL, - #ifndef _VESA_SUPPORT - a_setclut, - #else - NULL, - #endif +#ifndef _VESA_SUPPORT + a_setclut, +#else + NULL, +#endif NULL }; diff --git a/src/newgal/commlcd/vxworks_ppc.c b/src/newgal/commlcd/vxworks_ppc.c index c849f3cd..c6002ce9 100644 --- a/src/newgal/commlcd/vxworks_ppc.c +++ b/src/newgal/commlcd/vxworks_ppc.c @@ -68,7 +68,7 @@ static int a_init (void) return 0; } -static int a_getinfo (struct lcd_info *li) +static int a_getinfo (struct lcd_info *li, int width, int height, int bpp) { UGL_MODE_INFO modeInfo; diff --git a/src/newgal/commlcd/win_generic.c b/src/newgal/commlcd/win_generic.c index e2a096ec..550af195 100644 --- a/src/newgal/commlcd/win_generic.c +++ b/src/newgal/commlcd/win_generic.c @@ -53,17 +53,27 @@ extern int wvfb_drv_lcd_init (void); extern int wvfb_drv_lcd_getinfo (struct commlcd_info *li); -static int wvfb_drv_setclut (int firstcolor, int ncolors, GAL_Color *colors) +static int a_init (void) +{ + return wvfb_drv_lcd_init (); +} + +static int a_getinfo (struct commlcd_info *li, int width, int height, int bpp) +{ + return wvfb_drv_lcd_getinfo (li); +} + +static int a_setclut (int firstcolor, int ncolors, GAL_Color *colors) { /* do nothing of note. */ return 1; } struct commlcd_ops __mg_commlcd_ops = { - wvfb_drv_lcd_init, - wvfb_drv_lcd_getinfo, + a_init, + a_getinfo, NULL, - wvfb_drv_setclut, + a_setclut, NULL };