From: notaz Date: Sat, 12 Feb 2011 21:52:26 +0000 (+0200) Subject: fb: support caanoo X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2798b18cd4b43be61c95ed1af12b02237424c06f;p=ginge.git fb: support caanoo --- diff --git a/common/host_fb.c b/common/host_fb.c index 46cd033..d0cc754 100644 --- a/common/host_fb.c +++ b/common/host_fb.c @@ -32,7 +32,7 @@ int host_video_init(int *stride, int no_dblbuf) fbdev_name = "/dev/fb1"; w = h = 0; - fbdev = vout_fbdev_init(fbdev_name, &w, &h, no_dblbuf); + fbdev = vout_fbdev_init(fbdev_name, &w, &h, 16, no_dblbuf); if (fbdev == NULL) return -1; @@ -173,17 +173,33 @@ void host_video_blit4(const unsigned char *src, int w, int h, int stride) void host_video_blit8(const unsigned char *src, int w, int h, int stride) { - extern void rotated_blit8(void *dst, const void *linesx4); + if (probably_caanoo) { + unsigned char *dst = host_screen; + int i; + for (i = 0; i < 240; i++, dst += 320, src += stride) + memcpy(dst, src, w); + } + else { + extern void rotated_blit8(void *dst, const void *linesx4); + rotated_blit8(host_screen, src); + } - rotated_blit8(host_screen, src); host_video_flip(); } void host_video_blit16(const unsigned short *src, int w, int h, int stride) { - extern void rotated_blit16(void *dst, const void *linesx4); + if (probably_caanoo) { + unsigned short *dst = host_screen; + int i; + for (i = 0; i < 240; i++, dst += 320, src += stride / 2) + memcpy(dst, src, w*2); + } + else { + extern void rotated_blit16(void *dst, const void *linesx4); + rotated_blit16(host_screen, src); + } - rotated_blit16(host_screen, src); host_video_flip(); } #endif // LOADER diff --git a/common/wiz_video.c b/common/wiz_video.c index b98bce8..8545618 100644 --- a/common/wiz_video.c +++ b/common/wiz_video.c @@ -12,6 +12,7 @@ static volatile unsigned short *memregs; static volatile unsigned int *memregl; +int probably_caanoo; int memdev = -1; #define FB_BUF_COUNT 4 @@ -67,6 +68,8 @@ static int vout_gp2x_init(int no_dblbuf) printf("framebuffer: \"%s\" @ %08lx\n", fbfix.id, fbfix.smem_start); fb_paddr[0] = fbfix.smem_start; + probably_caanoo = fb_paddr[0] >= 0x4000000; + printf("looking like Caanoo? %s.\n", probably_caanoo ? "yes" : "no"); gp2x_screens[0] = mmap(0, 320*240*2*FB_BUF_COUNT, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, fb_paddr[0]); @@ -107,6 +110,9 @@ static void vout_gp2x_set_mode(int bpp, int rot) unsigned int r; int ret; + if (probably_caanoo) + rot = 0; + rot_cmd[0] = rot ? 6 : 5; ret = ioctl(fbdev, _IOW('D', 90, int[2]), rot_cmd); if (ret < 0)