annotate libvo/vo_wii.c @ 31344:5d0b3552ea01

Replace forward declarations by loader/wine/winbase.h #include.
author diego
date Mon, 14 Jun 2010 11:45:33 +0000
parents f8939d5b14b5
children fbe5c829c69b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
1 /*
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
2 * Video driver for Nintendo Wii/GameCube Framebuffer device
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
3 *
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
4 * Copyright (C) 2008 Jing Liu <fatersh-1@yahoo.com>
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
5 *
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
6 * Maintainer: Benjamin Zores <ben@geexbox.org>
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
7 *
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
8 * This file is part of MPlayer.
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
9 *
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
10 * MPlayer is free software; you can redistribute it and/or modify
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
13 * (at your option) any later version.
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
14 *
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
15 * MPlayer is distributed in the hope that it will be useful,
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
18 * GNU General Public License for more details.
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
19 *
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License along
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
21 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
23 */
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
24
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
25 /*
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
26 * This driver handles dedicated ATI GPU, which can be found in:
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
27 * - Nintendo GameCube (ATI LSI Flipper @ 162 MHz)
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
28 * - Nintendo Wii (ATI Hollywood @ 243 MHz)
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
29 *
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
30 * Flipper and Hollywood chipsets are pretty similar, except from clock speed:
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
31 * - Embedded framebuffer is 2MB.
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
32 * - Texture cache is 1MB.
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
33 * - Vertex cache is 0.1 MB.
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
34 * - Framebuffer is YUY2, not RGB.
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
35 * - Best resolution is 480p (854x480)
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
36 */
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
37
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
38 #include <stdio.h>
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
39 #include <stdlib.h>
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
40 #include <string.h>
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
41 #include <fcntl.h>
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
42 #include <unistd.h>
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
43 #include <errno.h>
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
44 #include <ctype.h>
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
45
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
46 #include <sys/mman.h>
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
47 #include <sys/ioctl.h>
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
48 #include <sys/kd.h>
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
49 #include <linux/fb.h>
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
50
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
51 #include "config.h"
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
52 #include "video_out.h"
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
53 #include "video_out_internal.h"
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
54 #include "sub.h"
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
55 #include "mp_msg.h"
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
56
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
57 static const vo_info_t info = {
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
58 "Nintendo Wii/GameCube Framebuffer Device",
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
59 "wii",
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
60 "Jing Liu <fartersh-1@yahoo.com>",
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
61 ""
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
62 };
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
63
30925
f8939d5b14b5 Mark some more LIBVO_EXTERN declarations as const where possible.
reimar
parents: 27994
diff changeset
64 const LIBVO_EXTERN(wii)
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
65
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
66 static signed int pre_init_err = -2;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
67
27965
1388c6a08a50 Handle fb_dev_name similar to vo_fbdev in vo_wii.
diego
parents: 27964
diff changeset
68 static char *fb_dev_name = NULL;
1388c6a08a50 Handle fb_dev_name similar to vo_fbdev in vo_wii.
diego
parents: 27964
diff changeset
69
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
70 static FILE *vt_fp = NULL;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
71 static int vt_doit = 1;
27993
8a2cee973272 cosmetics: Add/remove a few newlines similar to vo_fbdev.c.
diego
parents: 27983
diff changeset
72
27994
6aaa7be68416 Do not initialize fb_dev_fd to -1, similar to vo_fbdev.c.
diego
parents: 27993
diff changeset
73 static int fb_dev_fd;
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
74 static int fb_tty_fd = -1;
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
75 static size_t fb_size;
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
76 static uint8_t *frame_buffer;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
77 static uint8_t *center;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
78 static struct fb_var_screeninfo fb_orig_vinfo;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
79 static struct fb_var_screeninfo fb_vinfo;
27963
55a3f6cf9784 Use static variable instead of #define to lessen differences to vo_fbdev.c.
diego
parents: 27962
diff changeset
80 static int fb_pixel_size; // 32: 4 24: 3 16: 2 15: 2
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
81 static int fb_line_len;
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
82 static int in_width;
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
83 static int in_height;
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
84 static int out_width;
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
85 static int out_height;
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
86 static int fs;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
87
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
88 static int fb_preinit(int reset)
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
89 {
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
90 static int fb_preinit_done = 0;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
91 static int fb_works = 0;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
92
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
93 if (reset) {
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
94 fb_preinit_done = 0;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
95 return 0;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
96 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
97
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
98 if (fb_preinit_done)
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
99 return fb_works;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
100
27965
1388c6a08a50 Handle fb_dev_name similar to vo_fbdev in vo_wii.
diego
parents: 27964
diff changeset
101 if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER")))
1388c6a08a50 Handle fb_dev_name similar to vo_fbdev in vo_wii.
diego
parents: 27964
diff changeset
102 fb_dev_name = strdup("/dev/fb0");
1388c6a08a50 Handle fb_dev_name similar to vo_fbdev in vo_wii.
diego
parents: 27964
diff changeset
103 mp_msg(MSGT_VO, MSGL_V, "using %s\n", fb_dev_name);
1388c6a08a50 Handle fb_dev_name similar to vo_fbdev in vo_wii.
diego
parents: 27964
diff changeset
104
1388c6a08a50 Handle fb_dev_name similar to vo_fbdev in vo_wii.
diego
parents: 27964
diff changeset
105 if ((fb_dev_fd = open(fb_dev_name, O_RDWR)) == -1) {
1388c6a08a50 Handle fb_dev_name similar to vo_fbdev in vo_wii.
diego
parents: 27964
diff changeset
106 mp_msg(MSGT_VO, MSGL_ERR, "Can't open %s: %s\n", fb_dev_name, strerror(errno));
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
107 goto err_out;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
108 }
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
109 if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo)) {
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
110 mp_msg(MSGT_VO, MSGL_ERR, "Can't get VSCREENINFO: %s\n", strerror(errno));
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
111 goto err_out_fd;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
112 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
113 fb_orig_vinfo = fb_vinfo;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
114
27962
c9204a95ead1 Get rid of TTY_DEV_NAME #define to lessen differences to vo_fbdev.c.
diego
parents: 27961
diff changeset
115 if ((fb_tty_fd = open("/dev/tty", O_RDWR)) < 0) {
c9204a95ead1 Get rid of TTY_DEV_NAME #define to lessen differences to vo_fbdev.c.
diego
parents: 27961
diff changeset
116 mp_msg(MSGT_VO, MSGL_ERR, "notice: Can't open /dev/tty: %s\n", strerror(errno));
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
117 goto err_out_fd;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
118 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
119
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
120 fb_preinit_done = 1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
121 fb_works = 1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
122 return 1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
123
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
124 err_out_fd:
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
125 close(fb_dev_fd);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
126 fb_dev_fd = -1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
127 err_out:
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
128 fb_preinit_done = 1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
129 fb_works = 0;
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
130
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
131 return 0;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
132 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
133
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
134 static void vt_set_textarea(int u, int l)
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
135 {
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
136 /* how can I determine the font height?
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
137 * just use 16 for now
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
138 */
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
139 int urow = ((u + 15) / 16) + 1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
140 int lrow = l / 16;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
141
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
142 mp_msg(MSGT_VO, MSGL_DBG2, "vt_set_textarea(%d, %d): %d,%d\n", u, l, urow, lrow);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
143
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
144 if (vt_fp) {
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
145 fprintf(vt_fp, "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0);
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
146 fflush(vt_fp);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
147 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
148 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
149
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
150 static int config(uint32_t width, uint32_t height, uint32_t d_width,
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
151 uint32_t d_height, uint32_t flags, char *title,
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
152 uint32_t format)
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
153 {
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
154 struct fb_fix_screeninfo fb_finfo;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
155 uint32_t black = 0x00800080;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
156 long temp;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
157 int vt_fd;
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
158
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
159 fs = flags & VOFLAG_FULLSCREEN;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
160
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
161 if (pre_init_err == -2) {
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
162 mp_msg(MSGT_VO, MSGL_ERR, "Internal fatal error: config() was called before preinit()\n");
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
163 return -1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
164 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
165
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
166 if (pre_init_err)
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
167 return 1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
168
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
169 in_width = width;
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
170 in_height = height;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
171
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
172 out_width = (d_width && fs) ? d_width : width;
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
173 out_height = (d_width && fs) ? d_height : height;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
174
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
175 fb_vinfo.xres_virtual = fb_vinfo.xres;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
176 fb_vinfo.yres_virtual = fb_vinfo.yres;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
177
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
178 if (fb_tty_fd >= 0 && ioctl(fb_tty_fd, KDSETMODE, KD_GRAPHICS) < 0) {
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
179 mp_msg(MSGT_VO, MSGL_V, "Can't set graphics mode: %s\n", strerror(errno));
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
180 close(fb_tty_fd);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
181 fb_tty_fd = -1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
182 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
183
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
184 if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo)) {
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
185 mp_msg(MSGT_VO, MSGL_ERR, "Can't put VSCREENINFO: %s\n", strerror(errno));
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
186 if (fb_tty_fd >= 0 && ioctl(fb_tty_fd, KDSETMODE, KD_TEXT) < 0) {
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
187 mp_msg(MSGT_VO, MSGL_ERR, "Can't restore text mode: %s\n", strerror(errno));
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
188 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
189 return 1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
190 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
191
27963
55a3f6cf9784 Use static variable instead of #define to lessen differences to vo_fbdev.c.
diego
parents: 27962
diff changeset
192 fb_pixel_size = 2;
55a3f6cf9784 Use static variable instead of #define to lessen differences to vo_fbdev.c.
diego
parents: 27962
diff changeset
193
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
194 if (fs) {
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
195 out_width = fb_vinfo.xres;
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
196 out_height = fb_vinfo.yres;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
197 }
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
198 if (out_width < in_width || out_height < in_height) {
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
199 mp_msg(MSGT_VO, MSGL_ERR, "screensize is smaller than video size\n");
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
200 return 1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
201 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
202
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
203 if (ioctl(fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo)) {
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
204 mp_msg(MSGT_VO, MSGL_ERR, "Can't get FSCREENINFO: %s\n", strerror(errno));
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
205 return 1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
206 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
207
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
208 if (fb_finfo.type != FB_TYPE_PACKED_PIXELS) {
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
209 mp_msg(MSGT_VO, MSGL_ERR, "type %d not supported\n", fb_finfo.type);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
210 return 1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
211 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
212
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
213 fb_line_len = fb_finfo.line_length;
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
214 fb_size = fb_finfo.smem_len;
27981
53912f852a86 Move setting of frame_buffer variable out of 'if', as preferred by Reimar.
diego
parents: 27965
diff changeset
215
53912f852a86 Move setting of frame_buffer variable out of 'if', as preferred by Reimar.
diego
parents: 27965
diff changeset
216 frame_buffer = (uint8_t *) mmap(0, fb_size, PROT_READ | PROT_WRITE,
53912f852a86 Move setting of frame_buffer variable out of 'if', as preferred by Reimar.
diego
parents: 27965
diff changeset
217 MAP_SHARED, fb_dev_fd, 0);
53912f852a86 Move setting of frame_buffer variable out of 'if', as preferred by Reimar.
diego
parents: 27965
diff changeset
218 if (frame_buffer == (uint8_t *) -1) {
27965
1388c6a08a50 Handle fb_dev_name similar to vo_fbdev in vo_wii.
diego
parents: 27964
diff changeset
219 mp_msg(MSGT_VO, MSGL_ERR, "Can't mmap %s: %s\n", fb_dev_name, strerror(errno));
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
220 return 1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
221 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
222
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
223 center = frame_buffer +
27963
55a3f6cf9784 Use static variable instead of #define to lessen differences to vo_fbdev.c.
diego
parents: 27962
diff changeset
224 ((out_width - in_width) / 2) * fb_pixel_size +
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
225 ((out_height - in_height) / 2) * fb_line_len;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
226
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
227 mp_msg(MSGT_VO, MSGL_DBG2, "frame_buffer @ %p\n", frame_buffer);
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
228 mp_msg(MSGT_VO, MSGL_DBG2, "center @ %p\n", center);
27963
55a3f6cf9784 Use static variable instead of #define to lessen differences to vo_fbdev.c.
diego
parents: 27962
diff changeset
229 mp_msg(MSGT_VO, MSGL_V, "pixel per line: %d\n", fb_line_len / fb_pixel_size);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
230
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
231 /* blanking screen */
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
232 for (temp = 0; temp < fb_size; temp += 4)
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
233 memcpy(frame_buffer + temp, (void *) &black, 4);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
234
27962
c9204a95ead1 Get rid of TTY_DEV_NAME #define to lessen differences to vo_fbdev.c.
diego
parents: 27961
diff changeset
235 if (vt_doit && (vt_fd = open("/dev/tty", O_WRONLY)) == -1) {
c9204a95ead1 Get rid of TTY_DEV_NAME #define to lessen differences to vo_fbdev.c.
diego
parents: 27961
diff changeset
236 mp_msg(MSGT_VO, MSGL_ERR, "can't open /dev/tty: %s\n", strerror(errno));
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
237 vt_doit = 0;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
238 }
27960
68854212bd04 Merge if condition check to lessen differences to vo_fbdev.c.
diego
parents: 27958
diff changeset
239 if (vt_doit && !(vt_fp = fdopen(vt_fd, "w"))) {
27962
c9204a95ead1 Get rid of TTY_DEV_NAME #define to lessen differences to vo_fbdev.c.
diego
parents: 27961
diff changeset
240 mp_msg(MSGT_VO, MSGL_ERR, "can't fdopen /dev/tty: %s\n", strerror(errno));
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
241 vt_doit = 0;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
242 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
243
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
244 if (vt_doit)
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
245 vt_set_textarea((out_height + in_height) / 2, fb_vinfo.yres);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
246
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
247 return 0;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
248 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
249
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
250 static int query_format(uint32_t format)
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
251 {
27958
10e5a902bcb4 cosmetics: one more round of whitespace changes
diego
parents: 27957
diff changeset
252 if (!fb_preinit(0))
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
253 return 0;
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
254
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
255 if (format != IMGFMT_YUY2)
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
256 return 0;
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
257
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
258 return VFCAP_ACCEPT_STRIDE | VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
259 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
260
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
261 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
262 unsigned char *srca, int stride)
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
263 {
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
264 unsigned char *dst;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
265
27963
55a3f6cf9784 Use static variable instead of #define to lessen differences to vo_fbdev.c.
diego
parents: 27962
diff changeset
266 dst = center + fb_line_len * y0 + fb_pixel_size * x0;
55a3f6cf9784 Use static variable instead of #define to lessen differences to vo_fbdev.c.
diego
parents: 27962
diff changeset
267
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
268 vo_draw_alpha_yuy2(w, h, src, srca, stride, dst, fb_line_len);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
269 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
270
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
271 static int draw_frame(uint8_t *src[])
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
272 {
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
273 return 1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
274 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
275
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
276 static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
277 {
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
278 uint8_t *d, *s;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
279
27963
55a3f6cf9784 Use static variable instead of #define to lessen differences to vo_fbdev.c.
diego
parents: 27962
diff changeset
280 d = center + fb_line_len * y + fb_pixel_size * x;
55a3f6cf9784 Use static variable instead of #define to lessen differences to vo_fbdev.c.
diego
parents: 27962
diff changeset
281
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
282 s = src[0];
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
283 while (h) {
27963
55a3f6cf9784 Use static variable instead of #define to lessen differences to vo_fbdev.c.
diego
parents: 27962
diff changeset
284 memcpy(d, s, w * fb_pixel_size);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
285 d += fb_line_len;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
286 s += stride[0];
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
287 h--;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
288 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
289
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
290 return 0;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
291 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
292
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
293 static void check_events(void)
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
294 {
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
295 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
296
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
297 static void flip_page(void)
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
298 {
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
299 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
300
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
301 static void draw_osd(void)
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
302 {
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
303 vo_draw_text(in_width, in_height, draw_alpha);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
304 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
305
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
306 static void uninit(void)
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
307 {
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
308 if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo))
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
309 mp_msg(MSGT_VO, MSGL_WARN, "ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno));
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
310 fb_orig_vinfo.xoffset = fb_vinfo.xoffset;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
311 fb_orig_vinfo.yoffset = fb_vinfo.yoffset;
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
312 if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo))
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
313 mp_msg(MSGT_VO, MSGL_WARN, "Can't reset original fb_var_screeninfo: %s\n", strerror(errno));
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
314 if (fb_tty_fd >= 0) {
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
315 if (ioctl(fb_tty_fd, KDSETMODE, KD_TEXT) < 0)
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
316 mp_msg(MSGT_VO, MSGL_WARN, "Can't restore text mode: %s\n", strerror(errno));
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
317 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
318 if (vt_doit)
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
319 vt_set_textarea(0, fb_orig_vinfo.yres);
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
320 close(fb_tty_fd);
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
321 close(fb_dev_fd);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
322 if (frame_buffer)
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
323 munmap(frame_buffer, fb_size);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
324 frame_buffer = NULL;
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
325 fb_preinit(1);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
326 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
327
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
328 static int preinit(const char *vo_subdevice)
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
329 {
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
330 pre_init_err = 0;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
331
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
332 if (!pre_init_err)
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
333 return pre_init_err = (fb_preinit(0) ? 0 : -1);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
334 return -1;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
335 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
336
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
337 static uint32_t get_image(mp_image_t *mpi)
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
338 {
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
339 if (((mpi->type != MP_IMGTYPE_STATIC) && (mpi->type != MP_IMGTYPE_TEMP)) ||
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
340 (mpi->flags & MP_IMGFLAG_PLANAR) ||
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
341 (mpi->flags & MP_IMGFLAG_YUV) ||
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
342 (mpi->width != in_width) ||
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
343 (mpi->height != in_height)
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
344 )
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
345 return VO_FALSE;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
346
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
347 mpi->planes[0] = center;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
348 mpi->stride[0] = fb_line_len;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
349 mpi->flags |= MP_IMGFLAG_DIRECT;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
350
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
351 return VO_TRUE;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
352 }
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
353
27950
31837cfbb63c cosmetics: Reformat some lines to lessen differences to vo_fbdev.c.
diego
parents: 27375
diff changeset
354 static int control(uint32_t request, void *data, ...)
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
355 {
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
356 if (request == VOCTRL_GET_IMAGE)
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
357 return get_image(data);
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
358 else if (request == VOCTRL_QUERY_FORMAT)
27957
bada57652ab2 cosmetics: further reformatting to lessen differences to vo_fbdev.c
diego
parents: 27950
diff changeset
359 return query_format(*((uint32_t*) data));
27375
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
360
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
361 return VO_NOTIMPL;
80d93ca55238 Add video driver for Nintendo Wii/GameCube.
ben
parents:
diff changeset
362 }