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_pal16(unsigned short *pal)
54 memcpy(host_pal, pal, sizeof(host_pal));
57 void host_video_update_pal32(unsigned int *pal)
59 unsigned short *dstp = host_pal;
62 for (i = 0; i < 256; i++, pal++, dstp++) {
63 unsigned int t = *pal;
64 *dstp = ((t >> 8) & 0xf800) | ((t >> 5) & 0x07e0) | ((t >> 3) & 0x001f);
68 void host_video_change_bpp(int bpp)
72 void host_video_blit4(const unsigned char *src, int w, int h, int stride)
74 unsigned short *dst = host_screen;
75 unsigned short *hpal = host_pal;
78 for (i = 0; i < 240; i++, dst += host_stride / 2, src += stride) {
79 for (u = 0; i < w / 2; u++) {
80 dst[u*2 + 0] = hpal[src[u] >> 4];
81 dst[u*2 + 1] = hpal[src[u] & 0x0f];
88 void host_video_blit8(const unsigned char *src, int w, int h, int stride)
90 unsigned short *dst = host_screen;
91 unsigned short *hpal = host_pal;
94 for (i = 0; i < 240; i++, dst += host_stride / 2, src += stride) {
95 for (u = 0; u < w; u += 4) {
96 dst[u + 0] = hpal[src[u + 0]];
97 dst[u + 1] = hpal[src[u + 1]];
98 dst[u + 2] = hpal[src[u + 2]];
99 dst[u + 3] = hpal[src[u + 3]];
106 void host_video_blit16(const unsigned short *src, int w, int h, int stride)
108 unsigned short *dst = host_screen;
111 for (i = 0; i < 240; i++, dst += host_stride / 2, src += stride / 2)
112 memcpy(dst, src, w*2);
120 #include "wiz_video.c"
122 void *host_video_flip(void)
125 host_screen = g_screen_ptr;
129 int host_video_init(int *stride, int no_dblbuf)
133 host_stride = 320 * 2;
135 *stride = host_stride;
137 ret = vout_gp2x_init(no_dblbuf);
141 vout_gp2x_set_mode(16, !no_dblbuf);
146 void host_video_finish(void)
151 void host_video_update_pal16(unsigned short *pal)
153 vout_gp2x_set_palette16(pal, 256);
156 void host_video_update_pal32(unsigned int *pal)
158 vout_gp2x_set_palette32(pal, 256);
161 void host_video_change_bpp(int bpp)
163 vout_gp2x_set_mode(bpp, 1);
167 void host_video_blit4(const unsigned char *src, int w, int h, int stride)
169 memcpy(host_screen, src, 320*240/2); // FIXME
173 void host_video_blit8(const unsigned char *src, int w, int h, int stride)
175 extern void rotated_blit8(void *dst, const void *linesx4);
177 rotated_blit8(host_screen, src);
181 void host_video_blit16(const unsigned short *src, int w, int h, int stride)
183 extern void rotated_blit16(void *dst, const void *linesx4);
185 rotated_blit16(host_screen, src);