Mercurial > mplayer.hg
annotate libvo/vo_fbdev.c @ 11114:d8ddd7727084
More liberal codec id recognition for AC3 codecs (needed for transcoded DNET from RM).
author | mosu |
---|---|
date | Tue, 14 Oct 2003 13:45:31 +0000 |
parents | 497104408c30 |
children | 85f4534d1edb |
rev | line source |
---|---|
305 | 1 /* |
2 * Video driver for Framebuffer device | |
3 * by Szabolcs Berecz <szabi@inf.elte.hu> | |
359 | 4 * (C) 2001 |
305 | 5 * |
6 * Some idea and code borrowed from Chris Lawrence's ppmtofb-0.27 | |
10576 | 7 * Some fixes and small improvements by Joey Parrish <joey@nicewarrior.org> |
305 | 8 */ |
9 | |
225 | 10 #include <stdio.h> |
11 #include <stdlib.h> | |
12 #include <string.h> | |
13 #include <fcntl.h> | |
14 #include <unistd.h> | |
15 #include <errno.h> | |
16 | |
17 #include <sys/mman.h> | |
18 #include <sys/ioctl.h> | |
2354
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
19 #include <sys/kd.h> |
225 | 20 #include <linux/fb.h> |
21 | |
22 #include "config.h" | |
23 #include "video_out.h" | |
24 #include "video_out_internal.h" | |
658 | 25 #include "fastmemcpy.h" |
633 | 26 #include "sub.h" |
4089 | 27 #ifdef CONFIG_VIDIX |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
28 #include "vosub_vidix.h" |
4089 | 29 #endif |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
30 #include "aspect.h" |
10576 | 31 #include "mp_msg.h" |
4756 | 32 |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7980
diff
changeset
|
33 static vo_info_t info = { |
225 | 34 "Framebuffer Device", |
35 "fbdev", | |
36 "Szabolcs Berecz <szabi@inf.elte.hu>", | |
37 "" | |
38 }; | |
39 | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7980
diff
changeset
|
40 LIBVO_EXTERN(fbdev) |
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7980
diff
changeset
|
41 |
4089 | 42 #ifdef CONFIG_VIDIX |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
43 /* Name of VIDIX driver */ |
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
44 static const char *vidix_name = NULL; |
4386 | 45 #endif |
6164
aee9c32349a9
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
4756
diff
changeset
|
46 static signed int pre_init_err = -2; |
359 | 47 /****************************** |
393 | 48 * fb.modes support * |
359 | 49 ******************************/ |
50 | |
7069 | 51 extern char *monitor_hfreq_str; |
52 extern char *monitor_vfreq_str; | |
53 extern char *monitor_dotclock_str; | |
54 | |
55 static range_t *monitor_hfreq = NULL; | |
56 static range_t *monitor_vfreq = NULL; | |
57 static range_t *monitor_dotclock = NULL; | |
58 | |
359 | 59 typedef struct { |
60 char *name; | |
61 uint32_t xres, yres, vxres, vyres, depth; | |
62 uint32_t pixclock, left, right, upper, lower, hslen, vslen; | |
63 uint32_t sync; | |
64 uint32_t vmode; | |
65 } fb_mode_t; | |
66 | |
67 #define MAX_NR_TOKEN 16 | |
68 | |
69 #define MAX_LINE_LEN 1000 | |
70 | |
71 #define RET_EOF -1 | |
72 #define RET_EOL -2 | |
73 | |
74 static int validate_mode(fb_mode_t *m) | |
75 { | |
76 if (!m->xres) { | |
10576 | 77 mp_msg(MSGT_VO, MSGL_V, "needs geometry "); |
359 | 78 return 0; |
79 } | |
80 if (!m->pixclock) { | |
10576 | 81 mp_msg(MSGT_VO, MSGL_V, "needs timings "); |
359 | 82 return 0; |
83 } | |
84 return 1; | |
85 } | |
86 | |
87 static FILE *fp; | |
88 static int line_num = 0; | |
89 static char *line; | |
90 static char *token[MAX_NR_TOKEN]; | |
91 | |
92 static int get_token(int num) | |
93 { | |
94 static int read_nextline = 1; | |
95 static int line_pos; | |
96 int i; | |
97 char c; | |
98 | |
99 if (num >= MAX_NR_TOKEN) { | |
10576 | 100 mp_msg(MSGT_VO, MSGL_V, "get_token(): max >= MAX_NR_TOKEN!\n"); |
359 | 101 goto out_eof; |
102 } | |
103 | |
104 if (read_nextline) { | |
105 if (!fgets(line, MAX_LINE_LEN, fp)) | |
106 goto out_eof; | |
107 line_pos = 0; | |
108 ++line_num; | |
109 read_nextline = 0; | |
110 } | |
111 for (i = 0; i < num; i++) { | |
112 while (isspace(line[line_pos])) | |
113 ++line_pos; | |
114 if (line[line_pos] == '\0' || line[line_pos] == '#') { | |
115 read_nextline = 1; | |
116 goto out_eol; | |
117 } | |
118 token[i] = line + line_pos; | |
119 c = line[line_pos]; | |
120 if (c == '"' || c == '\'') { | |
121 token[i]++; | |
122 while (line[++line_pos] != c && line[line_pos]) | |
123 /* NOTHING */; | |
950 | 124 if (!line[line_pos]) |
125 goto out_eol; | |
126 line[line_pos] = ' '; | |
359 | 127 } else { |
128 for (/* NOTHING */; !isspace(line[line_pos]) && | |
129 line[line_pos]; line_pos++) | |
130 /* NOTHING */; | |
131 } | |
132 if (!line[line_pos]) { | |
133 read_nextline = 1; | |
134 if (i == num - 1) | |
135 goto out_ok; | |
136 goto out_eol; | |
137 } | |
950 | 138 line[line_pos++] = '\0'; |
359 | 139 } |
140 out_ok: | |
141 return i; | |
142 out_eof: | |
143 return RET_EOF; | |
144 out_eol: | |
145 return RET_EOL; | |
146 } | |
147 | |
148 static fb_mode_t *fb_modes = NULL; | |
149 static int nr_modes = 0; | |
150 | |
151 static int parse_fbmode_cfg(char *cfgfile) | |
152 { | |
977 | 153 #define CHECK_IN_MODE_DEF\ |
154 if (!in_mode_def) {\ | |
10576 | 155 mp_msg(MSGT_VO, MSGL_V, "'needs 'mode' first");\ |
977 | 156 goto err_out_print_linenum;\ |
10576 | 157 } |
359 | 158 fb_mode_t *mode = NULL; |
159 char *endptr; // strtoul()... | |
977 | 160 int in_mode_def = 0; |
359 | 161 int tmp, i; |
162 | |
10576 | 163 mp_msg(MSGT_VO, MSGL_V, "Reading %s: ", cfgfile); |
359 | 164 |
165 if ((fp = fopen(cfgfile, "r")) == NULL) { | |
10576 | 166 mp_msg(MSGT_VO, MSGL_V, "can't open '%s': %s\n", cfgfile, strerror(errno)); |
359 | 167 return -1; |
168 } | |
169 | |
170 if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) { | |
10576 | 171 mp_msg(MSGT_VO, MSGL_V, "can't get memory for 'line': %s\n", strerror(errno)); |
359 | 172 return -2; |
173 } | |
174 | |
175 /* | |
176 * check if the cfgfile starts with 'mode' | |
177 */ | |
178 while ((tmp = get_token(1)) == RET_EOL) | |
179 /* NOTHING */; | |
180 if (tmp == RET_EOF) | |
181 goto out; | |
182 if (!strcmp(token[0], "mode")) | |
183 goto loop_enter; | |
184 goto err_out_parse_error; | |
185 | |
186 while ((tmp = get_token(1)) != RET_EOF) { | |
187 if (tmp == RET_EOL) | |
188 continue; | |
189 if (!strcmp(token[0], "mode")) { | |
977 | 190 if (in_mode_def) { |
10576 | 191 mp_msg(MSGT_VO, MSGL_V, "'endmode' required"); |
977 | 192 goto err_out_print_linenum; |
193 } | |
359 | 194 if (!validate_mode(mode)) |
195 goto err_out_not_valid; | |
196 loop_enter: | |
197 if (!(fb_modes = (fb_mode_t *) realloc(fb_modes, | |
198 sizeof(fb_mode_t) * (nr_modes + 1)))) { | |
10576 | 199 mp_msg(MSGT_VO, MSGL_V, "can't realloc 'fb_modes' (nr_modes = %d):" |
950 | 200 " %s\n", nr_modes, strerror(errno)); |
359 | 201 goto err_out; |
202 } | |
203 mode=fb_modes + nr_modes; | |
204 ++nr_modes; | |
205 memset(mode,0,sizeof(fb_mode_t)); | |
225 | 206 |
359 | 207 if (get_token(1) < 0) |
208 goto err_out_parse_error; | |
209 for (i = 0; i < nr_modes - 1; i++) { | |
210 if (!strcmp(token[0], fb_modes[i].name)) { | |
10576 | 211 mp_msg(MSGT_VO, MSGL_V, "mode name '%s' isn't unique", token[0]); |
359 | 212 goto err_out_print_linenum; |
213 } | |
214 } | |
215 if (!(mode->name = strdup(token[0]))) { | |
10576 | 216 mp_msg(MSGT_VO, MSGL_V, "can't strdup -> 'name': %s\n", strerror(errno)); |
359 | 217 goto err_out; |
218 } | |
977 | 219 in_mode_def = 1; |
359 | 220 } else if (!strcmp(token[0], "geometry")) { |
977 | 221 CHECK_IN_MODE_DEF; |
359 | 222 if (get_token(5) < 0) |
223 goto err_out_parse_error; | |
224 mode->xres = strtoul(token[0], &endptr, 0); | |
225 if (*endptr) | |
226 goto err_out_parse_error; | |
227 mode->yres = strtoul(token[1], &endptr, 0); | |
228 if (*endptr) | |
229 goto err_out_parse_error; | |
230 mode->vxres = strtoul(token[2], &endptr, 0); | |
231 if (*endptr) | |
232 goto err_out_parse_error; | |
233 mode->vyres = strtoul(token[3], &endptr, 0); | |
234 if (*endptr) | |
235 goto err_out_parse_error; | |
236 mode->depth = strtoul(token[4], &endptr, 0); | |
237 if (*endptr) | |
238 goto err_out_parse_error; | |
239 } else if (!strcmp(token[0], "timings")) { | |
977 | 240 CHECK_IN_MODE_DEF; |
359 | 241 if (get_token(7) < 0) |
242 goto err_out_parse_error; | |
243 mode->pixclock = strtoul(token[0], &endptr, 0); | |
244 if (*endptr) | |
245 goto err_out_parse_error; | |
246 mode->left = strtoul(token[1], &endptr, 0); | |
247 if (*endptr) | |
248 goto err_out_parse_error; | |
249 mode->right = strtoul(token[2], &endptr, 0); | |
250 if (*endptr) | |
251 goto err_out_parse_error; | |
252 mode->upper = strtoul(token[3], &endptr, 0); | |
253 if (*endptr) | |
254 goto err_out_parse_error; | |
255 mode->lower = strtoul(token[4], &endptr, 0); | |
256 if (*endptr) | |
257 goto err_out_parse_error; | |
258 mode->hslen = strtoul(token[5], &endptr, 0); | |
259 if (*endptr) | |
260 goto err_out_parse_error; | |
261 mode->vslen = strtoul(token[6], &endptr, 0); | |
262 if (*endptr) | |
263 goto err_out_parse_error; | |
264 } else if (!strcmp(token[0], "endmode")) { | |
977 | 265 CHECK_IN_MODE_DEF; |
266 in_mode_def = 0; | |
383 | 267 } else if (!strcmp(token[0], "accel")) { |
977 | 268 CHECK_IN_MODE_DEF; |
383 | 269 if (get_token(1) < 0) |
270 goto err_out_parse_error; | |
393 | 271 /* |
272 * it's only used for text acceleration | |
273 * so we just ignore it. | |
274 */ | |
359 | 275 } else if (!strcmp(token[0], "hsync")) { |
977 | 276 CHECK_IN_MODE_DEF; |
359 | 277 if (get_token(1) < 0) |
278 goto err_out_parse_error; | |
279 if (!strcmp(token[0], "low")) | |
280 mode->sync &= ~FB_SYNC_HOR_HIGH_ACT; | |
281 else if(!strcmp(token[0], "high")) | |
282 mode->sync |= FB_SYNC_HOR_HIGH_ACT; | |
283 else | |
284 goto err_out_parse_error; | |
285 } else if (!strcmp(token[0], "vsync")) { | |
977 | 286 CHECK_IN_MODE_DEF; |
359 | 287 if (get_token(1) < 0) |
288 goto err_out_parse_error; | |
289 if (!strcmp(token[0], "low")) | |
290 mode->sync &= ~FB_SYNC_VERT_HIGH_ACT; | |
291 else if(!strcmp(token[0], "high")) | |
292 mode->sync |= FB_SYNC_VERT_HIGH_ACT; | |
293 else | |
294 goto err_out_parse_error; | |
295 } else if (!strcmp(token[0], "csync")) { | |
977 | 296 CHECK_IN_MODE_DEF; |
359 | 297 if (get_token(1) < 0) |
298 goto err_out_parse_error; | |
299 if (!strcmp(token[0], "low")) | |
300 mode->sync &= ~FB_SYNC_COMP_HIGH_ACT; | |
301 else if(!strcmp(token[0], "high")) | |
302 mode->sync |= FB_SYNC_COMP_HIGH_ACT; | |
303 else | |
304 goto err_out_parse_error; | |
305 } else if (!strcmp(token[0], "extsync")) { | |
977 | 306 CHECK_IN_MODE_DEF; |
359 | 307 if (get_token(1) < 0) |
308 goto err_out_parse_error; | |
309 if (!strcmp(token[0], "false")) | |
310 mode->sync &= ~FB_SYNC_EXT; | |
311 else if(!strcmp(token[0], "true")) | |
312 mode->sync |= FB_SYNC_EXT; | |
313 else | |
314 goto err_out_parse_error; | |
315 } else if (!strcmp(token[0], "laced")) { | |
977 | 316 CHECK_IN_MODE_DEF; |
359 | 317 if (get_token(1) < 0) |
318 goto err_out_parse_error; | |
319 if (!strcmp(token[0], "false")) | |
320 mode->vmode = FB_VMODE_NONINTERLACED; | |
321 else if (!strcmp(token[0], "true")) | |
322 mode->vmode = FB_VMODE_INTERLACED; | |
323 else | |
324 goto err_out_parse_error; | |
479 | 325 } else if (!strcmp(token[0], "double")) { |
977 | 326 CHECK_IN_MODE_DEF; |
359 | 327 if (get_token(1) < 0) |
328 goto err_out_parse_error; | |
329 if (!strcmp(token[0], "false")) | |
330 ; | |
331 else if (!strcmp(token[0], "true")) | |
332 mode->vmode = FB_VMODE_DOUBLE; | |
333 else | |
334 goto err_out_parse_error; | |
335 } else | |
336 goto err_out_parse_error; | |
337 } | |
338 if (!validate_mode(mode)) | |
339 goto err_out_not_valid; | |
340 out: | |
10576 | 341 mp_msg(MSGT_VO, MSGL_V, "%d modes\n", nr_modes); |
359 | 342 free(line); |
343 fclose(fp); | |
344 return nr_modes; | |
345 err_out_parse_error: | |
10576 | 346 mp_msg(MSGT_VO, MSGL_V, "parse error"); |
359 | 347 err_out_print_linenum: |
10576 | 348 mp_msg(MSGT_VO, MSGL_V, " at line %d\n", line_num); |
359 | 349 err_out: |
393 | 350 if (fb_modes) { |
359 | 351 free(fb_modes); |
393 | 352 fb_modes = NULL; |
353 } | |
354 nr_modes = 0; | |
359 | 355 free(line); |
356 free(fp); | |
357 return -2; | |
358 err_out_not_valid: | |
10576 | 359 mp_msg(MSGT_VO, MSGL_V, "previous mode is not correct"); |
359 | 360 goto err_out_print_linenum; |
361 } | |
362 | |
363 static fb_mode_t *find_mode_by_name(char *name) | |
364 { | |
365 int i; | |
366 | |
658 | 367 for (i = 0; i < nr_modes; i++) |
359 | 368 if (!strcmp(name, fb_modes[i].name)) |
369 return fb_modes + i; | |
370 return NULL; | |
371 } | |
372 | |
393 | 373 static float dcf(fb_mode_t *m) //driving clock frequency |
374 { | |
519 | 375 return 1e12f / m->pixclock; |
393 | 376 } |
377 | |
378 static float hsf(fb_mode_t *m) //horizontal scan frequency | |
379 { | |
380 int htotal = m->left + m->xres + m->right + m->hslen; | |
381 return dcf(m) / htotal; | |
382 } | |
383 | |
384 static float vsf(fb_mode_t *m) //vertical scan frequency | |
385 { | |
386 int vtotal = m->upper + m->yres + m->lower + m->vslen; | |
387 return hsf(m) / vtotal; | |
388 } | |
389 | |
390 | |
1561 | 391 static int mode_works(fb_mode_t *m, range_t *hfreq, range_t *vfreq, |
392 range_t *dotclock) | |
393 { | |
394 float h = hsf(m); | |
395 float v = vsf(m); | |
396 float d = dcf(m); | |
397 int ret = 1; | |
398 | |
10576 | 399 mp_msg(MSGT_VO, MSGL_DBG2, "mode %dx%d:", m->xres, m->yres); |
1561 | 400 if (!in_range(hfreq, h)) { |
401 ret = 0; | |
10576 | 402 mp_msg(MSGT_VO, MSGL_DBG2, " hsync out of range."); |
1561 | 403 } |
404 if (!in_range(vfreq, v)) { | |
405 ret = 0; | |
10576 | 406 mp_msg(MSGT_VO, MSGL_DBG2, " vsync out of range."); |
1561 | 407 } |
408 if (!in_range(dotclock, d)) { | |
409 ret = 0; | |
10576 | 410 mp_msg(MSGT_VO, MSGL_DBG2, " dotclock out of range."); |
1561 | 411 } |
10576 | 412 if (ret) |
413 mp_msg(MSGT_VO, MSGL_DBG2, " hsync, vsync, dotclock ok.\n"); | |
414 else | |
415 mp_msg(MSGT_VO, MSGL_DBG2, "\n"); | |
1561 | 416 |
417 return ret; | |
418 } | |
419 | |
418 | 420 static fb_mode_t *find_best_mode(int xres, int yres, range_t *hfreq, |
421 range_t *vfreq, range_t *dotclock) | |
393 | 422 { |
423 int i; | |
424 fb_mode_t *best = fb_modes; | |
519 | 425 fb_mode_t *curr; |
426 | |
10576 | 427 mp_msg(MSGT_VO, MSGL_DBG2, "Searching for first working mode\n"); |
1561 | 428 |
950 | 429 for (i = 0; i < nr_modes; i++, best++) |
1561 | 430 if (mode_works(best, hfreq, vfreq, dotclock)) |
519 | 431 break; |
432 | |
950 | 433 if (i == nr_modes) |
519 | 434 return NULL; |
950 | 435 if (i == nr_modes - 1) |
519 | 436 return best; |
393 | 437 |
10576 | 438 mp_msg(MSGT_VO, MSGL_DBG2, "First working mode: %dx%d\n", best->xres, best->yres); |
439 mp_msg(MSGT_VO, MSGL_DBG2, "Searching for better modes\n"); | |
950 | 440 |
1561 | 441 for (curr = best + 1; i < nr_modes - 1; i++, curr++) { |
442 if (!mode_works(curr, hfreq, vfreq, dotclock)) | |
519 | 443 continue; |
1561 | 444 |
445 if (best->xres < xres || best->yres < yres) { | |
446 if (curr->xres > best->xres || curr->yres > best->yres) { | |
10576 | 447 mp_msg(MSGT_VO, MSGL_DBG2, "better than %dx%d, which is too small.\n", |
519 | 448 best->xres, best->yres); |
393 | 449 best = curr; |
10576 | 450 } else |
451 mp_msg(MSGT_VO, MSGL_DBG2, "too small.\n"); | |
1561 | 452 } else if (curr->xres == best->xres && curr->yres == best->yres && |
453 vsf(curr) > vsf(best)) { | |
10576 | 454 mp_msg(MSGT_VO, MSGL_DBG2, "faster screen refresh.\n"); |
1561 | 455 best = curr; |
456 } else if ((curr->xres <= best->xres && curr->yres <= best->yres) && | |
457 (curr->xres >= xres && curr->yres >= yres)) { | |
10576 | 458 mp_msg(MSGT_VO, MSGL_DBG2, "better than %dx%d, which is too large.\n", |
1561 | 459 best->xres, best->yres); |
460 best = curr; | |
10576 | 461 } else { |
1561 | 462 if (curr->xres < xres || curr->yres < yres) |
10576 | 463 mp_msg(MSGT_VO, MSGL_DBG2, "too small.\n"); |
1561 | 464 else if (curr->xres > best->xres || curr->yres > best->yres) |
10576 | 465 mp_msg(MSGT_VO, MSGL_DBG2, "too large.\n"); |
466 else mp_msg(MSGT_VO, MSGL_DBG2, "it's worse, don't know why.\n"); | |
1561 | 467 } |
393 | 468 } |
1561 | 469 |
393 | 470 return best; |
471 } | |
472 | |
418 | 473 static void set_bpp(struct fb_var_screeninfo *p, int bpp) |
474 { | |
476 | 475 p->bits_per_pixel = (bpp + 1) & ~1; |
1087 | 476 p->red.msb_right = p->green.msb_right = p->blue.msb_right = p->transp.msb_right = 0; |
563 | 477 p->transp.offset = p->transp.length = 0; |
950 | 478 p->blue.offset = 0; |
418 | 479 switch (bpp) { |
480 case 32: | |
563 | 481 p->transp.offset = 24; |
482 p->transp.length = 8; | |
418 | 483 case 24: |
484 p->red.offset = 16; | |
485 p->red.length = 8; | |
486 p->green.offset = 8; | |
487 p->green.length = 8; | |
550 | 488 p->blue.length = 8; |
418 | 489 break; |
490 case 16: | |
491 p->red.offset = 11; | |
550 | 492 p->green.length = 6; |
418 | 493 p->red.length = 5; |
494 p->green.offset = 5; | |
550 | 495 p->blue.length = 5; |
418 | 496 break; |
497 case 15: | |
498 p->red.offset = 10; | |
550 | 499 p->green.length = 5; |
418 | 500 p->red.length = 5; |
501 p->green.offset = 5; | |
550 | 502 p->blue.length = 5; |
418 | 503 break; |
504 } | |
505 } | |
506 | |
507 static void fb_mode2fb_vinfo(fb_mode_t *m, struct fb_var_screeninfo *v) | |
508 { | |
509 v->xres = m->xres; | |
510 v->yres = m->yres; | |
511 v->xres_virtual = m->vxres; | |
512 v->yres_virtual = m->vyres; | |
513 set_bpp(v, m->depth); | |
514 v->pixclock = m->pixclock; | |
515 v->left_margin = m->left; | |
516 v->right_margin = m->right; | |
517 v->upper_margin = m->upper; | |
518 v->lower_margin = m->lower; | |
519 v->hsync_len = m->hslen; | |
520 v->vsync_len = m->vslen; | |
521 v->sync = m->sync; | |
522 v->vmode = m->vmode; | |
523 } | |
524 | |
525 | |
359 | 526 /****************************** |
527 * vo_fbdev * | |
528 ******************************/ | |
529 | |
658 | 530 /* command line/config file options */ |
393 | 531 char *fb_dev_name = NULL; |
10618
7901f7d6e0eb
4x10l fix. Vars used by the config layer must be malloc'd (strdup) as they will be freed at exit.
alex
parents:
10578
diff
changeset
|
532 char *fb_mode_cfgfile = NULL; |
393 | 533 char *fb_mode_name = NULL; |
418 | 534 |
658 | 535 static fb_mode_t *fb_mode = NULL; |
393 | 536 |
950 | 537 /* vt related variables */ |
10576 | 538 static FILE *vt_fp = NULL; |
1087 | 539 static int vt_doit = 1; |
950 | 540 |
658 | 541 /* vo_fbdev related variables */ |
225 | 542 static int fb_dev_fd; |
10576 | 543 static int fb_tty_fd = -1; |
225 | 544 static size_t fb_size; |
545 static uint8_t *frame_buffer; | |
10426
c3345a8fbc57
removed yv12 support, but left some swscaler support for fast 15 vs 16bpp conversion
alex
parents:
9941
diff
changeset
|
546 static uint8_t *center; /* thx .so :) */ |
359 | 547 static struct fb_fix_screeninfo fb_finfo; |
548 static struct fb_var_screeninfo fb_orig_vinfo; | |
549 static struct fb_var_screeninfo fb_vinfo; | |
481 | 550 static struct fb_cmap fb_oldcmap; |
551 static int fb_cmap_changed = 0; | |
359 | 552 static int fb_pixel_size; // 32: 4 24: 3 16: 2 15: 2 |
553 static int fb_bpp; // 32: 32 24: 24 16: 16 15: 15 | |
393 | 554 static int fb_bpp_we_want; // 32: 32 24: 24 16: 16 15: 15 |
950 | 555 static int fb_line_len; |
556 static int fb_xres; | |
557 static int fb_yres; | |
658 | 558 static void (*draw_alpha_p)(int w, int h, unsigned char *src, |
559 unsigned char *srca, int stride, unsigned char *dst, | |
560 int dstride); | |
359 | 561 |
225 | 562 static int in_width; |
563 static int in_height; | |
564 static int out_width; | |
565 static int out_height; | |
950 | 566 static int first_row; |
567 static int last_row; | |
225 | 568 static uint32_t pixel_format; |
804 | 569 static int fs; |
225 | 570 |
305 | 571 /* |
572 * Note: this function is completely cut'n'pasted from | |
573 * Chris Lawrence's code. | |
311 | 574 * (modified a bit to fit in my code...) |
305 | 575 */ |
10426
c3345a8fbc57
removed yv12 support, but left some swscaler support for fast 15 vs 16bpp conversion
alex
parents:
9941
diff
changeset
|
576 static struct fb_cmap *make_directcolor_cmap(struct fb_var_screeninfo *var) |
305 | 577 { |
578 /* Hopefully any DIRECTCOLOR device will have a big enough palette | |
579 * to handle mapping the full color depth. | |
580 * e.g. 8 bpp -> 256 entry palette | |
581 * | |
582 * We could handle some sort of gamma here | |
583 */ | |
584 int i, cols, rcols, gcols, bcols; | |
585 uint16_t *red, *green, *blue; | |
586 struct fb_cmap *cmap; | |
587 | |
588 rcols = 1 << var->red.length; | |
589 gcols = 1 << var->green.length; | |
590 bcols = 1 << var->blue.length; | |
591 | |
592 /* Make our palette the length of the deepest color */ | |
593 cols = (rcols > gcols ? rcols : gcols); | |
594 cols = (cols > bcols ? cols : bcols); | |
595 | |
596 red = malloc(cols * sizeof(red[0])); | |
597 if(!red) { | |
10576 | 598 mp_msg(MSGT_VO, MSGL_V, "Can't allocate red palette with %d entries.\n", cols); |
305 | 599 return NULL; |
600 } | |
601 for(i=0; i< rcols; i++) | |
602 red[i] = (65535/(rcols-1)) * i; | |
603 | |
604 green = malloc(cols * sizeof(green[0])); | |
605 if(!green) { | |
10576 | 606 mp_msg(MSGT_VO, MSGL_V, "Can't allocate green palette with %d entries.\n", cols); |
305 | 607 free(red); |
608 return NULL; | |
609 } | |
610 for(i=0; i< gcols; i++) | |
611 green[i] = (65535/(gcols-1)) * i; | |
612 | |
613 blue = malloc(cols * sizeof(blue[0])); | |
614 if(!blue) { | |
10576 | 615 mp_msg(MSGT_VO, MSGL_V, "Can't allocate blue palette with %d entries.\n", cols); |
305 | 616 free(red); |
617 free(green); | |
618 return NULL; | |
619 } | |
620 for(i=0; i< bcols; i++) | |
621 blue[i] = (65535/(bcols-1)) * i; | |
622 | |
623 cmap = malloc(sizeof(struct fb_cmap)); | |
624 if(!cmap) { | |
10576 | 625 mp_msg(MSGT_VO, MSGL_V, "Can't allocate color map\n"); |
305 | 626 free(red); |
627 free(green); | |
628 free(blue); | |
629 return NULL; | |
630 } | |
631 cmap->start = 0; | |
632 cmap->transp = 0; | |
633 cmap->len = cols; | |
634 cmap->red = red; | |
635 cmap->blue = blue; | |
636 cmap->green = green; | |
637 cmap->transp = NULL; | |
638 | |
639 return cmap; | |
640 } | |
225 | 641 |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
642 |
10426
c3345a8fbc57
removed yv12 support, but left some swscaler support for fast 15 vs 16bpp conversion
alex
parents:
9941
diff
changeset
|
643 static int fb_preinit(int reset) |
225 | 644 { |
950 | 645 static int fb_preinit_done = 0; |
646 static int fb_works = 0; | |
647 | |
10426
c3345a8fbc57
removed yv12 support, but left some swscaler support for fast 15 vs 16bpp conversion
alex
parents:
9941
diff
changeset
|
648 if (reset) |
c3345a8fbc57
removed yv12 support, but left some swscaler support for fast 15 vs 16bpp conversion
alex
parents:
9941
diff
changeset
|
649 { |
c3345a8fbc57
removed yv12 support, but left some swscaler support for fast 15 vs 16bpp conversion
alex
parents:
9941
diff
changeset
|
650 fb_preinit_done = 0; |
c3345a8fbc57
removed yv12 support, but left some swscaler support for fast 15 vs 16bpp conversion
alex
parents:
9941
diff
changeset
|
651 return 0; |
c3345a8fbc57
removed yv12 support, but left some swscaler support for fast 15 vs 16bpp conversion
alex
parents:
9941
diff
changeset
|
652 } |
c3345a8fbc57
removed yv12 support, but left some swscaler support for fast 15 vs 16bpp conversion
alex
parents:
9941
diff
changeset
|
653 |
950 | 654 if (fb_preinit_done) |
655 return fb_works; | |
656 | |
393 | 657 if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER"))) |
10618
7901f7d6e0eb
4x10l fix. Vars used by the config layer must be malloc'd (strdup) as they will be freed at exit.
alex
parents:
10578
diff
changeset
|
658 fb_dev_name = strdup("/dev/fb0"); |
10576 | 659 mp_msg(MSGT_VO, MSGL_V, "using %s\n", fb_dev_name); |
225 | 660 |
393 | 661 if ((fb_dev_fd = open(fb_dev_name, O_RDWR)) == -1) { |
10576 | 662 mp_msg(MSGT_VO, MSGL_ERR, "Can't open %s: %s\n", fb_dev_name, strerror(errno)); |
393 | 663 goto err_out; |
664 } | |
665 if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo)) { | |
10576 | 666 mp_msg(MSGT_VO, MSGL_ERR, "Can't get VSCREENINFO: %s\n", strerror(errno)); |
393 | 667 goto err_out_fd; |
668 } | |
418 | 669 fb_orig_vinfo = fb_vinfo; |
393 | 670 |
2354
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
671 if ((fb_tty_fd = open("/dev/tty", O_RDWR)) < 0) { |
10576 | 672 mp_msg(MSGT_VO, MSGL_ERR, "notice: Can't open /dev/tty: %s\n", strerror(errno)); |
2354
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
673 } |
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
674 |
10576 | 675 fb_bpp = fb_vinfo.red.length + fb_vinfo.green.length + |
676 fb_vinfo.blue.length + fb_vinfo.transp.length; | |
663 | 677 |
1076 | 678 if (fb_bpp == 8 && !vo_dbpp) { |
10576 | 679 mp_msg(MSGT_VO, MSGL_ERR, "8 bpp output is not supported.\n"); |
2354
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
680 goto err_out_tty_fd; |
1076 | 681 } |
682 | |
418 | 683 if (vo_dbpp) { |
684 if (vo_dbpp != 15 && vo_dbpp != 16 && vo_dbpp != 24 && | |
685 vo_dbpp != 32) { | |
10576 | 686 mp_msg(MSGT_VO, MSGL_ERR, "can't switch to %d bpp\n", vo_dbpp); |
1076 | 687 goto err_out_fd; |
359 | 688 } |
418 | 689 fb_bpp = vo_dbpp; |
359 | 690 } |
10618
7901f7d6e0eb
4x10l fix. Vars used by the config layer must be malloc'd (strdup) as they will be freed at exit.
alex
parents:
10578
diff
changeset
|
691 |
7901f7d6e0eb
4x10l fix. Vars used by the config layer must be malloc'd (strdup) as they will be freed at exit.
alex
parents:
10578
diff
changeset
|
692 if (!fb_mode_cfgfile) |
7901f7d6e0eb
4x10l fix. Vars used by the config layer must be malloc'd (strdup) as they will be freed at exit.
alex
parents:
10578
diff
changeset
|
693 fb_mode_cfgfile = strdup("/etc/fb.modes"); |
245
cb4c682746c0
disabled scrollback buffer (virtual fb size set to real screen size)
szabii
parents:
231
diff
changeset
|
694 |
393 | 695 fb_preinit_done = 1; |
696 fb_works = 1; | |
950 | 697 return 1; |
2354
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
698 err_out_tty_fd: |
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
699 close(fb_tty_fd); |
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
700 fb_tty_fd = -1; |
393 | 701 err_out_fd: |
702 close(fb_dev_fd); | |
703 fb_dev_fd = -1; | |
704 err_out: | |
705 fb_preinit_done = 1; | |
950 | 706 fb_works = 0; |
707 return 0; | |
393 | 708 } |
245
cb4c682746c0
disabled scrollback buffer (virtual fb size set to real screen size)
szabii
parents:
231
diff
changeset
|
709 |
633 | 710 static void lots_of_printf(void) |
711 { | |
10576 | 712 mp_msg(MSGT_VO, MSGL_V, "var info:\n"); |
713 mp_msg(MSGT_VO, MSGL_V, "xres: %u\n", fb_vinfo.xres); | |
714 mp_msg(MSGT_VO, MSGL_V, "yres: %u\n", fb_vinfo.yres); | |
715 mp_msg(MSGT_VO, MSGL_V, "xres_virtual: %u\n", fb_vinfo.xres_virtual); | |
716 mp_msg(MSGT_VO, MSGL_V, "yres_virtual: %u\n", fb_vinfo.yres_virtual); | |
717 mp_msg(MSGT_VO, MSGL_V, "xoffset: %u\n", fb_vinfo.xoffset); | |
718 mp_msg(MSGT_VO, MSGL_V, "yoffset: %u\n", fb_vinfo.yoffset); | |
719 mp_msg(MSGT_VO, MSGL_V, "bits_per_pixel: %u\n", fb_vinfo.bits_per_pixel); | |
720 mp_msg(MSGT_VO, MSGL_V, "grayscale: %u\n", fb_vinfo.grayscale); | |
721 mp_msg(MSGT_VO, MSGL_V, "red: %lu %lu %lu\n", | |
722 (unsigned long) fb_vinfo.red.offset, | |
723 (unsigned long) fb_vinfo.red.length, | |
724 (unsigned long) fb_vinfo.red.msb_right); | |
725 mp_msg(MSGT_VO, MSGL_V, "green: %lu %lu %lu\n", | |
726 (unsigned long) fb_vinfo.green.offset, | |
727 (unsigned long) fb_vinfo.green.length, | |
728 (unsigned long) fb_vinfo.green.msb_right); | |
729 mp_msg(MSGT_VO, MSGL_V, "blue: %lu %lu %lu\n", | |
730 (unsigned long) fb_vinfo.blue.offset, | |
731 (unsigned long) fb_vinfo.blue.length, | |
732 (unsigned long) fb_vinfo.blue.msb_right); | |
733 mp_msg(MSGT_VO, MSGL_V, "transp: %lu %lu %lu\n", | |
734 (unsigned long) fb_vinfo.transp.offset, | |
735 (unsigned long) fb_vinfo.transp.length, | |
736 (unsigned long) fb_vinfo.transp.msb_right); | |
737 mp_msg(MSGT_VO, MSGL_V, "nonstd: %u\n", fb_vinfo.nonstd); | |
738 mp_msg(MSGT_VO, MSGL_DBG2, "activate: %u\n", fb_vinfo.activate); | |
739 mp_msg(MSGT_VO, MSGL_DBG2, "height: %u\n", fb_vinfo.height); | |
740 mp_msg(MSGT_VO, MSGL_DBG2, "width: %u\n", fb_vinfo.width); | |
741 mp_msg(MSGT_VO, MSGL_DBG2, "accel_flags: %u\n", fb_vinfo.accel_flags); | |
742 mp_msg(MSGT_VO, MSGL_DBG2, "timing:\n"); | |
743 mp_msg(MSGT_VO, MSGL_DBG2, "pixclock: %u\n", fb_vinfo.pixclock); | |
744 mp_msg(MSGT_VO, MSGL_DBG2, "left_margin: %u\n", fb_vinfo.left_margin); | |
745 mp_msg(MSGT_VO, MSGL_DBG2, "right_margin: %u\n", fb_vinfo.right_margin); | |
746 mp_msg(MSGT_VO, MSGL_DBG2, "upper_margin: %u\n", fb_vinfo.upper_margin); | |
747 mp_msg(MSGT_VO, MSGL_DBG2, "lower_margin: %u\n", fb_vinfo.lower_margin); | |
748 mp_msg(MSGT_VO, MSGL_DBG2, "hsync_len: %u\n", fb_vinfo.hsync_len); | |
749 mp_msg(MSGT_VO, MSGL_DBG2, "vsync_len: %u\n", fb_vinfo.vsync_len); | |
750 mp_msg(MSGT_VO, MSGL_DBG2, "sync: %u\n", fb_vinfo.sync); | |
751 mp_msg(MSGT_VO, MSGL_DBG2, "vmode: %u\n", fb_vinfo.vmode); | |
752 mp_msg(MSGT_VO, MSGL_V, "fix info:\n"); | |
753 mp_msg(MSGT_VO, MSGL_V, "framebuffer size: %d bytes\n", fb_finfo.smem_len); | |
754 mp_msg(MSGT_VO, MSGL_V, "type: %lu\n", (unsigned long) fb_finfo.type); | |
755 mp_msg(MSGT_VO, MSGL_V, "type_aux: %lu\n", (unsigned long) fb_finfo.type_aux); | |
756 mp_msg(MSGT_VO, MSGL_V, "visual: %lu\n", (unsigned long) fb_finfo.visual); | |
757 mp_msg(MSGT_VO, MSGL_V, "line_length: %lu bytes\n", (unsigned long) fb_finfo.line_length); | |
758 mp_msg(MSGT_VO, MSGL_DBG2, "id: %.16s\n", fb_finfo.id); | |
759 mp_msg(MSGT_VO, MSGL_DBG2, "smem_start: %p\n", (void *) fb_finfo.smem_start); | |
760 mp_msg(MSGT_VO, MSGL_DBG2, "xpanstep: %u\n", fb_finfo.xpanstep); | |
761 mp_msg(MSGT_VO, MSGL_DBG2, "ypanstep: %u\n", fb_finfo.ypanstep); | |
762 mp_msg(MSGT_VO, MSGL_DBG2, "ywrapstep: %u\n", fb_finfo.ywrapstep); | |
763 mp_msg(MSGT_VO, MSGL_DBG2, "mmio_start: %p\n", (void *) fb_finfo.mmio_start); | |
764 mp_msg(MSGT_VO, MSGL_DBG2, "mmio_len: %u bytes\n", fb_finfo.mmio_len); | |
765 mp_msg(MSGT_VO, MSGL_DBG2, "accel: %u\n", fb_finfo.accel); | |
766 mp_msg(MSGT_VO, MSGL_V, "fb_bpp: %d\n", fb_bpp); | |
767 mp_msg(MSGT_VO, MSGL_V, "fb_pixel_size: %d bytes\n", fb_pixel_size); | |
768 mp_msg(MSGT_VO, MSGL_V, "other:\n"); | |
769 mp_msg(MSGT_VO, MSGL_V, "in_width: %d\n", in_width); | |
770 mp_msg(MSGT_VO, MSGL_V, "in_height: %d\n", in_height); | |
771 mp_msg(MSGT_VO, MSGL_V, "out_width: %d\n", out_width); | |
772 mp_msg(MSGT_VO, MSGL_V, "out_height: %d\n", out_height); | |
773 mp_msg(MSGT_VO, MSGL_V, "first_row: %d\n", first_row); | |
774 mp_msg(MSGT_VO, MSGL_V, "last_row: %d\n", last_row); | |
775 mp_msg(MSGT_VO, MSGL_DBG2, "draw_alpha_p:%dbpp = %p\n", fb_bpp, draw_alpha_p); | |
633 | 776 } |
658 | 777 |
950 | 778 static void vt_set_textarea(int u, int l) |
779 { | |
780 /* how can I determine the font height? | |
781 * just use 16 for now | |
782 */ | |
783 int urow = ((u + 15) / 16) + 1; | |
784 int lrow = l / 16; | |
785 | |
10576 | 786 mp_msg(MSGT_VO, MSGL_DBG2, "vt_set_textarea(%d,%d): %d,%d\n", u, l, urow, lrow); |
7980 | 787 if(vt_fp) { |
788 fprintf(vt_fp, "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0); | |
789 fflush(vt_fp); | |
790 } | |
950 | 791 } |
792 | |
4433 | 793 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, |
6851 | 794 uint32_t d_height, uint32_t flags, char *title, |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
7069
diff
changeset
|
795 uint32_t format) |
393 | 796 { |
950 | 797 struct fb_cmap *cmap; |
6851 | 798 int vm = flags & 0x02; |
799 int zoom = flags & 0x04; | |
10576 | 800 int vt_fd; |
418 | 801 |
6851 | 802 fs = flags & 0x01; |
393 | 803 |
6164
aee9c32349a9
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
4756
diff
changeset
|
804 if(pre_init_err == -2) |
4380 | 805 { |
10576 | 806 mp_msg(MSGT_VO, MSGL_ERR, "Internal fatal error: config() was called before preinit()\n"); |
4380 | 807 return -1; |
808 } | |
809 | |
810 if (pre_init_err) return 1; | |
245
cb4c682746c0
disabled scrollback buffer (virtual fb size set to real screen size)
szabii
parents:
231
diff
changeset
|
811 |
950 | 812 if (fb_mode_name && !vm) { |
10576 | 813 mp_msg(MSGT_VO, MSGL_ERR, "-fbmode can only be used with -vm\n"); |
418 | 814 return 1; |
815 } | |
950 | 816 if (vm && (parse_fbmode_cfg(fb_mode_cfgfile) < 0)) |
418 | 817 return 1; |
950 | 818 if (d_width && (fs || vm)) { |
418 | 819 out_width = d_width; |
820 out_height = d_height; | |
821 } else { | |
822 out_width = width; | |
823 out_height = height; | |
824 } | |
825 in_width = width; | |
826 in_height = height; | |
827 pixel_format = format; | |
828 | |
393 | 829 if (fb_mode_name) { |
418 | 830 if (!(fb_mode = find_mode_by_name(fb_mode_name))) { |
10576 | 831 mp_msg(MSGT_VO, MSGL_ERR, "can't find requested video mode\n"); |
418 | 832 return 1; |
833 } | |
834 fb_mode2fb_vinfo(fb_mode, &fb_vinfo); | |
950 | 835 } else if (vm) { |
418 | 836 monitor_hfreq = str2range(monitor_hfreq_str); |
837 monitor_vfreq = str2range(monitor_vfreq_str); | |
838 monitor_dotclock = str2range(monitor_dotclock_str); | |
839 if (!monitor_hfreq || !monitor_vfreq || !monitor_dotclock) { | |
10576 | 840 mp_msg(MSGT_VO, MSGL_ERR, "you have to specify the capabilities of" |
418 | 841 " the monitor.\n"); |
842 return 1; | |
843 } | |
844 if (!(fb_mode = find_best_mode(out_width, out_height, | |
845 monitor_hfreq, monitor_vfreq, | |
846 monitor_dotclock))) { | |
10576 | 847 mp_msg(MSGT_VO, MSGL_ERR, "can't find best video mode\n"); |
418 | 848 return 1; |
849 } | |
10576 | 850 mp_msg(MSGT_VO, MSGL_V, "using mode %dx%d @ %.1fHz\n", fb_mode->xres, |
519 | 851 fb_mode->yres, vsf(fb_mode)); |
418 | 852 fb_mode2fb_vinfo(fb_mode, &fb_vinfo); |
359 | 853 } |
418 | 854 fb_bpp_we_want = fb_bpp; |
855 set_bpp(&fb_vinfo, fb_bpp); | |
359 | 856 fb_vinfo.xres_virtual = fb_vinfo.xres; |
857 fb_vinfo.yres_virtual = fb_vinfo.yres; | |
245
cb4c682746c0
disabled scrollback buffer (virtual fb size set to real screen size)
szabii
parents:
231
diff
changeset
|
858 |
2354
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
859 if (fb_tty_fd >= 0 && ioctl(fb_tty_fd, KDSETMODE, KD_GRAPHICS) < 0) { |
10576 | 860 mp_msg(MSGT_VO, MSGL_V, "Can't set graphics mode: %s\n", strerror(errno)); |
2354
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
861 close(fb_tty_fd); |
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
862 fb_tty_fd = -1; |
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
863 } |
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
864 |
359 | 865 if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo)) { |
10576 | 866 mp_msg(MSGT_VO, MSGL_ERR, "Can't put VSCREENINFO: %s\n", strerror(errno)); |
2354
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
867 if (fb_tty_fd >= 0 && ioctl(fb_tty_fd, KDSETMODE, KD_TEXT) < 0) { |
10576 | 868 mp_msg(MSGT_VO, MSGL_ERR, "Can't restore text mode: %s\n", strerror(errno)); |
2354
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
869 } |
393 | 870 return 1; |
871 } | |
950 | 872 |
873 fb_pixel_size = fb_vinfo.bits_per_pixel / 8; | |
10576 | 874 fb_bpp = fb_vinfo.red.length + fb_vinfo.green.length + |
875 fb_vinfo.blue.length + fb_vinfo.transp.length; | |
950 | 876 if (fb_bpp_we_want != fb_bpp) |
10576 | 877 mp_msg(MSGT_VO, MSGL_WARN, "requested %d bpp, got %d bpp!!!\n", |
950 | 878 fb_bpp_we_want, fb_bpp); |
879 | |
880 switch (fb_bpp) { | |
10576 | 881 case 32: draw_alpha_p = vo_draw_alpha_rgb32; break; |
882 case 24: draw_alpha_p = vo_draw_alpha_rgb24; break; | |
883 case 16: draw_alpha_p = vo_draw_alpha_rgb16; break; | |
884 case 15: draw_alpha_p = vo_draw_alpha_rgb15; break; | |
885 default: return 1; | |
950 | 886 } |
887 | |
888 fb_xres = fb_vinfo.xres; | |
889 fb_yres = fb_vinfo.yres; | |
890 | |
891 if (vm || fs) { | |
892 out_width = fb_xres; | |
893 out_height = fb_yres; | |
894 } | |
895 if (out_width < in_width || out_height < in_height) { | |
10576 | 896 mp_msg(MSGT_VO, MSGL_ERR, "screensize is smaller than video size\n"); |
950 | 897 return 1; |
898 } | |
899 | |
900 first_row = (out_height - in_height) / 2; | |
901 last_row = (out_height + in_height) / 2; | |
902 | |
618 | 903 if (ioctl(fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo)) { |
10576 | 904 mp_msg(MSGT_VO, MSGL_ERR, "Can't get FSCREENINFO: %s\n", strerror(errno)); |
618 | 905 return 1; |
906 } | |
633 | 907 |
908 lots_of_printf(); | |
245
cb4c682746c0
disabled scrollback buffer (virtual fb size set to real screen size)
szabii
parents:
231
diff
changeset
|
909 |
633 | 910 if (fb_finfo.type != FB_TYPE_PACKED_PIXELS) { |
10576 | 911 mp_msg(MSGT_VO, MSGL_ERR, "type %d not supported\n", fb_finfo.type); |
633 | 912 return 1; |
305 | 913 } |
618 | 914 |
379 | 915 switch (fb_finfo.visual) { |
393 | 916 case FB_VISUAL_TRUECOLOR: |
917 break; | |
918 case FB_VISUAL_DIRECTCOLOR: | |
10576 | 919 mp_msg(MSGT_VO, MSGL_V, "creating cmap for directcolor\n"); |
481 | 920 if (ioctl(fb_dev_fd, FBIOGETCMAP, &fb_oldcmap)) { |
10576 | 921 mp_msg(MSGT_VO, MSGL_ERR, "can't get cmap: %s\n", |
393 | 922 strerror(errno)); |
923 return 1; | |
924 } | |
925 if (!(cmap = make_directcolor_cmap(&fb_vinfo))) | |
926 return 1; | |
927 if (ioctl(fb_dev_fd, FBIOPUTCMAP, cmap)) { | |
10576 | 928 mp_msg(MSGT_VO, MSGL_ERR, "can't put cmap: %s\n", |
393 | 929 strerror(errno)); |
930 return 1; | |
931 } | |
481 | 932 fb_cmap_changed = 1; |
393 | 933 free(cmap->red); |
934 free(cmap->green); | |
935 free(cmap->blue); | |
936 free(cmap); | |
937 break; | |
938 default: | |
10576 | 939 mp_msg(MSGT_VO, MSGL_ERR, "visual: %d not yet supported\n", |
393 | 940 fb_finfo.visual); |
941 return 1; | |
245
cb4c682746c0
disabled scrollback buffer (virtual fb size set to real screen size)
szabii
parents:
231
diff
changeset
|
942 } |
618 | 943 |
950 | 944 fb_line_len = fb_finfo.line_length; |
359 | 945 fb_size = fb_finfo.smem_len; |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
946 frame_buffer = NULL; |
4089 | 947 #ifdef CONFIG_VIDIX |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
948 if(vidix_name) |
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
949 { |
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
950 unsigned image_width,image_height,x_offset,y_offset; |
6851 | 951 if(zoom || fs){ |
952 aspect_save_orig(width,height); | |
953 aspect_save_prescale(d_width,d_height); | |
954 aspect_save_screenres(fb_xres,fb_yres); | |
955 aspect(&image_width,&image_height,fs ? A_ZOOM : A_NOZOOM); | |
956 } else { | |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
957 image_width=width; |
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
958 image_height=height; |
6851 | 959 } |
8918 | 960 |
961 if(fb_xres > image_width) | |
962 x_offset = (fb_xres - image_width) / 2; | |
963 else x_offset = 0; | |
964 if(fb_yres > image_height) | |
965 y_offset = (fb_yres - image_height) / 2; | |
966 else y_offset = 0; | |
9517 | 967 |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
968 if(vidix_init(width,height,x_offset,y_offset,image_width, |
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
969 image_height,format,fb_bpp, |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
7069
diff
changeset
|
970 fb_xres,fb_yres) != 0) |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
971 { |
10576 | 972 mp_msg(MSGT_VO, MSGL_ERR, "Can't initialize VIDIX driver\n"); |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
973 vidix_name = NULL; |
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
974 vidix_term(); |
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
975 return -1; |
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
976 } |
10576 | 977 else mp_msg(MSGT_VO, MSGL_V, "Using VIDIX\n"); |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4089
diff
changeset
|
978 vidix_start(); |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
979 } |
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
980 else |
4089 | 981 #endif |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
982 { |
8918 | 983 int x_offset=0,y_offset=0; |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
984 if ((frame_buffer = (uint8_t *) mmap(0, fb_size, PROT_READ | PROT_WRITE, |
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
985 MAP_SHARED, fb_dev_fd, 0)) == (uint8_t *) -1) { |
10576 | 986 mp_msg(MSGT_VO, MSGL_ERR, "Can't mmap %s: %s\n", fb_dev_name, strerror(errno)); |
393 | 987 return 1; |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
988 } |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
7863
diff
changeset
|
989 |
10426
c3345a8fbc57
removed yv12 support, but left some swscaler support for fast 15 vs 16bpp conversion
alex
parents:
9941
diff
changeset
|
990 center = frame_buffer + (out_width - in_width) * fb_pixel_size / |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
7863
diff
changeset
|
991 2 + ( (out_height - in_height) / 2 ) * fb_line_len + |
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
7863
diff
changeset
|
992 x_offset * fb_pixel_size + y_offset * fb_line_len; |
229 | 993 |
10576 | 994 mp_msg(MSGT_VO, MSGL_DBG2, "frame_buffer @ %p\n", frame_buffer); |
995 mp_msg(MSGT_VO, MSGL_DBG2, "center @ %p\n", center); | |
996 mp_msg(MSGT_VO, MSGL_V, "pixel per line: %d\n", fb_line_len / fb_pixel_size); | |
225 | 997 |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
998 if (fs || vm) |
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
999 memset(frame_buffer, '\0', fb_line_len * fb_yres); |
225 | 1000 } |
950 | 1001 if (vt_doit && (vt_fd = open("/dev/tty", O_WRONLY)) == -1) { |
10576 | 1002 mp_msg(MSGT_VO, MSGL_ERR, "can't open /dev/tty: %s\n", strerror(errno)); |
950 | 1003 vt_doit = 0; |
1004 } | |
1005 if (vt_doit && !(vt_fp = fdopen(vt_fd, "w"))) { | |
10576 | 1006 mp_msg(MSGT_VO, MSGL_ERR, "can't fdopen /dev/tty: %s\n", strerror(errno)); |
950 | 1007 vt_doit = 0; |
804 | 1008 } |
950 | 1009 |
1010 if (vt_doit) | |
1011 vt_set_textarea(last_row, fb_yres); | |
1012 | |
225 | 1013 return 0; |
1014 } | |
1015 | |
1016 static uint32_t query_format(uint32_t format) | |
1017 { | |
10426
c3345a8fbc57
removed yv12 support, but left some swscaler support for fast 15 vs 16bpp conversion
alex
parents:
9941
diff
changeset
|
1018 if (!fb_preinit(0)) |
305 | 1019 return 0; |
6851 | 1020 #ifdef CONFIG_VIDIX |
1021 if(vidix_name) | |
1022 return (vidix_query_fourcc(format)); | |
1023 #endif | |
311 | 1024 if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR) { |
1025 int bpp = format & 0xff; | |
519 | 1026 |
359 | 1027 if (bpp == fb_bpp) |
10576 | 1028 return VFCAP_ACCEPT_STRIDE | VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; |
311 | 1029 } |
1030 return 0; | |
225 | 1031 } |
1032 | |
1033 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, | |
1034 unsigned char *srca, int stride) | |
1035 { | |
4210
d43f0e4ac781
fbdev nocopy option - Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com>
arpi
parents:
4198
diff
changeset
|
1036 unsigned char *dst; |
d43f0e4ac781
fbdev nocopy option - Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com>
arpi
parents:
4198
diff
changeset
|
1037 |
10578
b9d289fd8a57
10000l, the old code was slow as hell, copying stuff extra times and
rfelker
parents:
10576
diff
changeset
|
1038 dst = center + (fb_line_len * y0 + x0) * fb_pixel_size; |
359 | 1039 |
10578
b9d289fd8a57
10000l, the old code was slow as hell, copying stuff extra times and
rfelker
parents:
10576
diff
changeset
|
1040 (*draw_alpha_p)(w, h, src, srca, stride, dst, fb_line_len); |
225 | 1041 } |
1042 | |
10576 | 1043 static uint32_t draw_frame(uint8_t *src[]) { return 1; } |
225 | 1044 |
1045 static uint32_t draw_slice(uint8_t *src[], int stride[], int w, int h, int x, | |
1046 int y) | |
1047 { | |
10576 | 1048 uint8_t *d; |
1049 uint8_t *s; | |
1050 | |
10578
b9d289fd8a57
10000l, the old code was slow as hell, copying stuff extra times and
rfelker
parents:
10576
diff
changeset
|
1051 d = center + (fb_line_len * y + x) * fb_pixel_size; |
10576 | 1052 |
1053 s = src[0]; | |
1054 while (h) { | |
1055 memcpy(d, s, w * fb_pixel_size); | |
10578
b9d289fd8a57
10000l, the old code was slow as hell, copying stuff extra times and
rfelker
parents:
10576
diff
changeset
|
1056 d += fb_line_len; |
10576 | 1057 s += stride[0]; |
1058 h--; | |
1059 } | |
1060 | |
225 | 1061 return 0; |
1062 } | |
1063 | |
1064 static void check_events(void) | |
1065 { | |
1066 } | |
1067 | |
246 | 1068 static void flip_page(void) |
1069 { | |
1070 } | |
1071 | |
10576 | 1072 static void draw_osd(void) |
1073 { | |
1074 vo_draw_text(in_width, in_height, draw_alpha); | |
1075 } | |
1076 | |
225 | 1077 static void uninit(void) |
1078 { | |
481 | 1079 if (fb_cmap_changed) { |
1080 if (ioctl(fb_dev_fd, FBIOPUTCMAP, &fb_oldcmap)) | |
10576 | 1081 mp_msg(MSGT_VO, MSGL_WARN, "Can't restore original cmap\n"); |
481 | 1082 fb_cmap_changed = 0; |
306 | 1083 } |
503 | 1084 if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo)) |
10576 | 1085 mp_msg(MSGT_VO, MSGL_WARN, "ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno)); |
503 | 1086 fb_orig_vinfo.xoffset = fb_vinfo.xoffset; |
1087 fb_orig_vinfo.yoffset = fb_vinfo.yoffset; | |
379 | 1088 if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo)) |
10576 | 1089 mp_msg(MSGT_VO, MSGL_WARN, "Can't reset original fb_var_screeninfo: %s\n", strerror(errno)); |
2354
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
1090 if (fb_tty_fd >= 0) { |
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
1091 if (ioctl(fb_tty_fd, KDSETMODE, KD_TEXT) < 0) |
10576 | 1092 mp_msg(MSGT_VO, MSGL_WARN, "Can't restore text mode: %s\n", strerror(errno)); |
2354
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
1093 } |
950 | 1094 if (vt_doit) |
1095 vt_set_textarea(0, fb_orig_vinfo.yres); | |
2354
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
1096 close(fb_tty_fd); |
359 | 1097 close(fb_dev_fd); |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
1098 if(frame_buffer) munmap(frame_buffer, fb_size); |
10578
b9d289fd8a57
10000l, the old code was slow as hell, copying stuff extra times and
rfelker
parents:
10576
diff
changeset
|
1099 frame_buffer = NULL; |
4089 | 1100 #ifdef CONFIG_VIDIX |
4084
e7be28567230
VIDIX expansion, Usage: -vo fbdev:vidix (-fs -zoom). Zoom is supported for VIDIX!!!
nick
parents:
2732
diff
changeset
|
1101 if(vidix_name) vidix_term(); |
4089 | 1102 #endif |
10576 | 1103 fb_preinit(1); |
225 | 1104 } |
2354
0e2f4c4e55d4
Applied patch to switch to graphics mode with -fs by achurch@achurch.org (Andrew Church)
atmos4
parents:
1561
diff
changeset
|
1105 |
7676 | 1106 static uint32_t preinit(const char *vo_subdevice) |
4352 | 1107 { |
4380 | 1108 pre_init_err = 0; |
11055
497104408c30
correct handling of subdevice, -fb device is obsoleted
alex
parents:
11036
diff
changeset
|
1109 |
497104408c30
correct handling of subdevice, -fb device is obsoleted
alex
parents:
11036
diff
changeset
|
1110 if(vo_subdevice) |
497104408c30
correct handling of subdevice, -fb device is obsoleted
alex
parents:
11036
diff
changeset
|
1111 { |
4380 | 1112 #ifdef CONFIG_VIDIX |
11055
497104408c30
correct handling of subdevice, -fb device is obsoleted
alex
parents:
11036
diff
changeset
|
1113 if (memcmp(vo_subdevice, "vidix", 5) == 0) |
497104408c30
correct handling of subdevice, -fb device is obsoleted
alex
parents:
11036
diff
changeset
|
1114 vidix_name = &vo_subdevice[5]; |
497104408c30
correct handling of subdevice, -fb device is obsoleted
alex
parents:
11036
diff
changeset
|
1115 if(vidix_name) |
497104408c30
correct handling of subdevice, -fb device is obsoleted
alex
parents:
11036
diff
changeset
|
1116 pre_init_err = vidix_preinit(vidix_name,&video_out_fbdev); |
497104408c30
correct handling of subdevice, -fb device is obsoleted
alex
parents:
11036
diff
changeset
|
1117 else |
4380 | 1118 #endif |
11055
497104408c30
correct handling of subdevice, -fb device is obsoleted
alex
parents:
11036
diff
changeset
|
1119 { |
497104408c30
correct handling of subdevice, -fb device is obsoleted
alex
parents:
11036
diff
changeset
|
1120 if (fb_dev_name) free(fb_dev_name); |
497104408c30
correct handling of subdevice, -fb device is obsoleted
alex
parents:
11036
diff
changeset
|
1121 fb_dev_name = strdup(vo_subdevice); |
497104408c30
correct handling of subdevice, -fb device is obsoleted
alex
parents:
11036
diff
changeset
|
1122 } |
497104408c30
correct handling of subdevice, -fb device is obsoleted
alex
parents:
11036
diff
changeset
|
1123 } |
10426
c3345a8fbc57
removed yv12 support, but left some swscaler support for fast 15 vs 16bpp conversion
alex
parents:
9941
diff
changeset
|
1124 if(!pre_init_err) return (pre_init_err=(fb_preinit(0)?0:-1)); |
6164
aee9c32349a9
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
4756
diff
changeset
|
1125 return(-1); |
4352 | 1126 } |
1127 | |
10576 | 1128 static uint32_t get_image(mp_image_t *mpi) |
1129 { | |
1130 if ( | |
1131 !IMGFMT_IS_BGR(mpi->imgfmt) || | |
1132 (IMGFMT_BGR_DEPTH(mpi->imgfmt) != fb_bpp) || | |
1133 ((mpi->type != MP_IMGTYPE_STATIC) && (mpi->type != MP_IMGTYPE_TEMP)) || | |
1134 (mpi->flags & MP_IMGFLAG_PLANAR) || | |
1135 (mpi->flags & MP_IMGFLAG_YUV) || | |
1136 (mpi->width != in_width) || | |
1137 (mpi->height != in_height) | |
1138 ) | |
1139 return(VO_FALSE); | |
1140 | |
1141 mpi->planes[0] = center; | |
1142 mpi->stride[0] = fb_line_len; | |
1143 mpi->flags |= MP_IMGFLAG_DIRECT; | |
1144 return(VO_TRUE); | |
1145 } | |
1146 | |
4596 | 1147 static uint32_t control(uint32_t request, void *data, ...) |
4352 | 1148 { |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4434
diff
changeset
|
1149 switch (request) { |
10576 | 1150 case VOCTRL_GET_IMAGE: |
1151 return get_image(data); | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4434
diff
changeset
|
1152 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4434
diff
changeset
|
1153 return query_format(*((uint32_t*)data)); |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4434
diff
changeset
|
1154 } |
11036
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1155 |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1156 #ifdef CONFIG_VIDIX |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1157 if (vidix_name) { |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1158 switch (request) { |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1159 case VOCTRL_SET_EQUALIZER: |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1160 { |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1161 va_list ap; |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1162 int value; |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1163 |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1164 va_start(ap, data); |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1165 value = va_arg(ap, int); |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1166 va_end(ap); |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1167 |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1168 return vidix_control(request, data, (int *)value); |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1169 } |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1170 case VOCTRL_GET_EQUALIZER: |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1171 { |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1172 va_list ap; |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1173 int *value; |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1174 |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1175 va_start(ap, data); |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1176 value = va_arg(ap, int*); |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1177 va_end(ap); |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1178 |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1179 return vidix_control(request, data, value); |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1180 } |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1181 } |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1182 } |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1183 #endif |
8e55228b6102
vidix equalizer support by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
10618
diff
changeset
|
1184 |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4434
diff
changeset
|
1185 return VO_NOTIMPL; |
4352 | 1186 } |