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