1 // vim:shiftwidth=2:expandtab
4 #include "../loader/realfuncs.h"
9 static void *host_screen;
10 static int host_stride;
16 static struct vout_fbdev *fbdev;
17 static unsigned short host_pal[256];
19 void *host_video_flip(void)
21 host_screen = vout_fbdev_flip(fbdev);
25 int host_video_init(int *stride, int no_dblbuf)
27 const char *fbdev_name;
30 fbdev_name = getenv("FBDEV");
31 if (fbdev_name == NULL)
32 fbdev_name = "/dev/fb1";
34 fbdev = vout_fbdev_init(fbdev_name, &w, &h, no_dblbuf);
40 *stride = host_stride;
46 void host_video_finish(void)
48 vout_fbdev_finish(fbdev);
52 void host_video_update_pal(unsigned int *pal)
54 unsigned short *dstp = host_pal;
57 for (i = 0; i < 256; i++, pal++, dstp++) {
58 unsigned int t = *pal;
59 *dstp = ((t >> 8) & 0xf800) | ((t >> 5) & 0x07e0) | ((t >> 3) & 0x001f);
63 void host_video_change_bpp(int bpp)
67 void host_video_blit4(const unsigned char *src, int w, int h)
69 unsigned short *dst = host_screen;
70 unsigned short *hpal = host_pal;
73 for (i = 0; i < 240; i++, dst += host_stride / 2 - 320) {
74 for (u = 320 / 2; u > 0; u--, src++) {
75 *dst++ = hpal[*src >> 4];
76 *dst++ = hpal[*src & 0x0f];
83 void host_video_blit8(const unsigned char *src, int w, int h)
85 unsigned short *dst = host_screen;
86 unsigned short *hpal = host_pal;
89 for (i = 0; i < 240; i++, dst += host_stride / 2 - 320) {
90 for (u = 320 / 4; u > 0; u--) {
91 *dst++ = hpal[*src++];
92 *dst++ = hpal[*src++];
93 *dst++ = hpal[*src++];
94 *dst++ = hpal[*src++];
101 void host_video_blit16(const unsigned short *src, int w, int h)
103 unsigned short *dst = host_screen;
106 for (i = 0; i < 240; i++, dst += host_stride / 2, src += 320)
107 memcpy(dst, src, 320*2);
115 #include "wiz_video.c"
117 void *host_video_flip(void)
120 host_screen = g_screen_ptr;
124 int host_video_init(int *stride, int no_dblbuf)
128 host_stride = 320 * 2;
130 *stride = host_stride;
132 ret = vout_gp2x_init(no_dblbuf);
136 vout_gp2x_set_mode(16, !no_dblbuf);
141 void host_video_finish(void)
146 void host_video_update_pal(unsigned int *pal)
148 vout_gp2x_set_palette(pal, 256);
151 void host_video_change_bpp(int bpp)
153 vout_gp2x_set_mode(bpp, 1);
157 void host_video_blit4(const unsigned char *src, int w, int h)
159 memcpy(host_screen, src, 320*240/2); // FIXME
163 void host_video_blit8(const unsigned char *src, int w, int h)
165 extern void rotated_blit8(void *dst, const void *linesx4);
167 rotated_blit8(host_screen, src);
171 void host_video_blit16(const unsigned short *src, int w, int h)
173 extern void rotated_blit16(void *dst, const void *linesx4);
175 rotated_blit16(host_screen, src);