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