Mercurial > mplayer.hg
annotate libvo/vo_fbdev.c @ 471:50e990d816f9
new YUV formats added, some fixes & updates
author | arpi_esp |
---|---|
date | Mon, 16 Apr 2001 04:03:56 +0000 |
parents | bb28d8242239 |
children | 1897ed6661bf |
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> | |
22 #include <linux/fb.h> | |
23 #include <linux/vt.h> | |
24 | |
25 #include "config.h" | |
26 #include "video_out.h" | |
27 #include "video_out_internal.h" | |
28 | |
29 #include "yuv2rgb.h" | |
311 | 30 extern void rgb15to16_mmx(char *s0, char *d0, int count); |
225 | 31 |
354 | 32 #include "fastmemcpy.h" |
350 | 33 |
225 | 34 LIBVO_EXTERN(fbdev) |
35 | |
36 static vo_info_t vo_info = { | |
37 "Framebuffer Device", | |
38 "fbdev", | |
39 "Szabolcs Berecz <szabi@inf.elte.hu>", | |
40 "" | |
41 }; | |
42 | |
379 | 43 extern int verbose; |
44 | |
359 | 45 /****************************** |
393 | 46 * fb.modes support * |
359 | 47 ******************************/ |
48 | |
49 /* | |
50 * read the fb.modes manual page! | |
51 */ | |
52 | |
53 typedef struct { | |
54 char *name; | |
55 uint32_t xres, yres, vxres, vyres, depth; | |
56 uint32_t pixclock, left, right, upper, lower, hslen, vslen; | |
57 uint32_t sync; | |
58 uint32_t vmode; | |
59 } fb_mode_t; | |
60 | |
61 #define PRINT_LINENUM printf(" at line %d\n", line_num) | |
62 | |
63 #define MAX_NR_TOKEN 16 | |
64 | |
65 #define MAX_LINE_LEN 1000 | |
66 | |
67 #define RET_EOF -1 | |
68 #define RET_EOL -2 | |
69 | |
70 static int validate_mode(fb_mode_t *m) | |
71 { | |
72 if (!m->xres) { | |
73 printf("needs geometry "); | |
74 return 0; | |
75 } | |
76 if (!m->pixclock) { | |
77 printf("needs timings "); | |
78 return 0; | |
79 } | |
80 return 1; | |
81 } | |
82 | |
83 static FILE *fp; | |
84 static int line_num = 0; | |
85 static char *line; | |
86 static char *token[MAX_NR_TOKEN]; | |
87 | |
88 static int get_token(int num) | |
89 { | |
90 static int read_nextline = 1; | |
91 static int line_pos; | |
92 int i; | |
93 char c; | |
94 | |
95 if (num >= MAX_NR_TOKEN) { | |
96 printf("get_token(): max >= MAX_NR_TOKEN!"); | |
97 goto out_eof; | |
98 } | |
99 | |
100 if (read_nextline) { | |
101 if (!fgets(line, MAX_LINE_LEN, fp)) | |
102 goto out_eof; | |
103 line_pos = 0; | |
104 ++line_num; | |
105 read_nextline = 0; | |
106 } | |
107 for (i = 0; i < num; i++) { | |
108 while (isspace(line[line_pos])) | |
109 ++line_pos; | |
110 if (line[line_pos] == '\0' || line[line_pos] == '#') { | |
111 read_nextline = 1; | |
112 if (i == num) | |
113 goto out_ok; | |
114 goto out_eol; | |
115 } | |
116 token[i] = line + line_pos; | |
117 c = line[line_pos]; | |
118 if (c == '"' || c == '\'') { | |
119 token[i]++; | |
120 while (line[++line_pos] != c && line[line_pos]) | |
121 /* NOTHING */; | |
122 } else { | |
123 for (/* NOTHING */; !isspace(line[line_pos]) && | |
124 line[line_pos]; line_pos++) | |
125 /* NOTHING */; | |
126 } | |
127 if (!line[line_pos]) { | |
128 read_nextline = 1; | |
129 if (i == num - 1) | |
130 goto out_ok; | |
131 goto out_eol; | |
132 } | |
133 line[line_pos] = '\0'; | |
134 line_pos++; | |
135 } | |
136 out_ok: | |
137 return i; | |
138 out_eof: | |
139 return RET_EOF; | |
140 out_eol: | |
141 return RET_EOL; | |
142 } | |
143 | |
144 static fb_mode_t *fb_modes = NULL; | |
145 static int nr_modes = 0; | |
146 | |
147 static int parse_fbmode_cfg(char *cfgfile) | |
148 { | |
149 fb_mode_t *mode = NULL; | |
150 char *endptr; // strtoul()... | |
151 int tmp, i; | |
152 | |
153 #ifdef DEBUG | |
154 assert(cfgfile != NULL); | |
155 #endif | |
156 | |
157 printf("Reading %s: ", cfgfile); | |
158 | |
159 if ((fp = fopen(cfgfile, "r")) == NULL) { | |
160 printf("can't open '%s': %s\n", cfgfile, strerror(errno)); | |
161 return -1; | |
162 } | |
163 | |
164 if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) { | |
165 printf("can't get memory for 'line': %s\n", strerror(errno)); | |
166 return -2; | |
167 } | |
168 | |
169 /* | |
170 * check if the cfgfile starts with 'mode' | |
171 */ | |
172 while ((tmp = get_token(1)) == RET_EOL) | |
173 /* NOTHING */; | |
174 if (tmp == RET_EOF) | |
175 goto out; | |
176 if (!strcmp(token[0], "mode")) | |
177 goto loop_enter; | |
178 goto err_out_parse_error; | |
179 | |
180 while ((tmp = get_token(1)) != RET_EOF) { | |
181 if (tmp == RET_EOL) | |
182 continue; | |
183 if (!strcmp(token[0], "mode")) { | |
184 if (!validate_mode(mode)) | |
185 goto err_out_not_valid; | |
186 loop_enter: | |
187 if (!(fb_modes = (fb_mode_t *) realloc(fb_modes, | |
188 sizeof(fb_mode_t) * (nr_modes + 1)))) { | |
189 printf("can't realloc 'fb_modes': %s\n", strerror(errno)); | |
190 goto err_out; | |
191 } | |
192 mode=fb_modes + nr_modes; | |
193 ++nr_modes; | |
194 memset(mode,0,sizeof(fb_mode_t)); | |
225 | 195 |
359 | 196 if (get_token(1) < 0) |
197 goto err_out_parse_error; | |
198 for (i = 0; i < nr_modes - 1; i++) { | |
199 if (!strcmp(token[0], fb_modes[i].name)) { | |
200 printf("mode name '%s' isn't unique", token[0]); | |
201 goto err_out_print_linenum; | |
202 } | |
203 } | |
204 if (!(mode->name = strdup(token[0]))) { | |
205 printf("can't strdup -> 'name': %s\n", strerror(errno)); | |
206 goto err_out; | |
207 } | |
208 } else if (!strcmp(token[0], "geometry")) { | |
209 if (get_token(5) < 0) | |
210 goto err_out_parse_error; | |
211 mode->xres = strtoul(token[0], &endptr, 0); | |
212 if (*endptr) | |
213 goto err_out_parse_error; | |
214 mode->yres = strtoul(token[1], &endptr, 0); | |
215 if (*endptr) | |
216 goto err_out_parse_error; | |
217 mode->vxres = strtoul(token[2], &endptr, 0); | |
218 if (*endptr) | |
219 goto err_out_parse_error; | |
220 mode->vyres = strtoul(token[3], &endptr, 0); | |
221 if (*endptr) | |
222 goto err_out_parse_error; | |
223 mode->depth = strtoul(token[4], &endptr, 0); | |
224 if (*endptr) | |
225 goto err_out_parse_error; | |
226 } else if (!strcmp(token[0], "timings")) { | |
227 if (get_token(7) < 0) | |
228 goto err_out_parse_error; | |
229 mode->pixclock = strtoul(token[0], &endptr, 0); | |
230 if (*endptr) | |
231 goto err_out_parse_error; | |
232 mode->left = strtoul(token[1], &endptr, 0); | |
233 if (*endptr) | |
234 goto err_out_parse_error; | |
235 mode->right = strtoul(token[2], &endptr, 0); | |
236 if (*endptr) | |
237 goto err_out_parse_error; | |
238 mode->upper = strtoul(token[3], &endptr, 0); | |
239 if (*endptr) | |
240 goto err_out_parse_error; | |
241 mode->lower = strtoul(token[4], &endptr, 0); | |
242 if (*endptr) | |
243 goto err_out_parse_error; | |
244 mode->hslen = strtoul(token[5], &endptr, 0); | |
245 if (*endptr) | |
246 goto err_out_parse_error; | |
247 mode->vslen = strtoul(token[6], &endptr, 0); | |
248 if (*endptr) | |
249 goto err_out_parse_error; | |
250 } else if (!strcmp(token[0], "endmode")) { | |
251 /* NOTHING for now*/ | |
383 | 252 } else if (!strcmp(token[0], "accel")) { |
253 if (get_token(1) < 0) | |
254 goto err_out_parse_error; | |
393 | 255 /* |
256 * it's only used for text acceleration | |
257 * so we just ignore it. | |
258 */ | |
359 | 259 } else if (!strcmp(token[0], "hsync")) { |
260 if (get_token(1) < 0) | |
261 goto err_out_parse_error; | |
262 if (!strcmp(token[0], "low")) | |
263 mode->sync &= ~FB_SYNC_HOR_HIGH_ACT; | |
264 else if(!strcmp(token[0], "high")) | |
265 mode->sync |= FB_SYNC_HOR_HIGH_ACT; | |
266 else | |
267 goto err_out_parse_error; | |
268 } else if (!strcmp(token[0], "vsync")) { | |
269 if (get_token(1) < 0) | |
270 goto err_out_parse_error; | |
271 if (!strcmp(token[0], "low")) | |
272 mode->sync &= ~FB_SYNC_VERT_HIGH_ACT; | |
273 else if(!strcmp(token[0], "high")) | |
274 mode->sync |= FB_SYNC_VERT_HIGH_ACT; | |
275 else | |
276 goto err_out_parse_error; | |
277 } else if (!strcmp(token[0], "csync")) { | |
278 if (get_token(1) < 0) | |
279 goto err_out_parse_error; | |
280 if (!strcmp(token[0], "low")) | |
281 mode->sync &= ~FB_SYNC_COMP_HIGH_ACT; | |
282 else if(!strcmp(token[0], "high")) | |
283 mode->sync |= FB_SYNC_COMP_HIGH_ACT; | |
284 else | |
285 goto err_out_parse_error; | |
286 } else if (!strcmp(token[0], "extsync")) { | |
287 if (get_token(1) < 0) | |
288 goto err_out_parse_error; | |
289 if (!strcmp(token[0], "false")) | |
290 mode->sync &= ~FB_SYNC_EXT; | |
291 else if(!strcmp(token[0], "true")) | |
292 mode->sync |= FB_SYNC_EXT; | |
293 else | |
294 goto err_out_parse_error; | |
295 } else if (!strcmp(token[0], "laced")) { | |
296 if (get_token(1) < 0) | |
297 goto err_out_parse_error; | |
298 if (!strcmp(token[0], "false")) | |
299 mode->vmode = FB_VMODE_NONINTERLACED; | |
300 else if (!strcmp(token[0], "true")) | |
301 mode->vmode = FB_VMODE_INTERLACED; | |
302 else | |
303 goto err_out_parse_error; | |
304 } else if (!strcmp(token[0], "dblscan")) { | |
305 if (get_token(1) < 0) | |
306 goto err_out_parse_error; | |
307 if (!strcmp(token[0], "false")) | |
308 ; | |
309 else if (!strcmp(token[0], "true")) | |
310 mode->vmode = FB_VMODE_DOUBLE; | |
311 else | |
312 goto err_out_parse_error; | |
313 } else | |
314 goto err_out_parse_error; | |
315 } | |
316 if (!validate_mode(mode)) | |
317 goto err_out_not_valid; | |
318 out: | |
319 printf("%d modes\n", nr_modes); | |
320 free(line); | |
321 fclose(fp); | |
322 return nr_modes; | |
323 err_out_parse_error: | |
324 printf("parse error"); | |
325 err_out_print_linenum: | |
326 PRINT_LINENUM; | |
327 err_out: | |
393 | 328 if (fb_modes) { |
359 | 329 free(fb_modes); |
393 | 330 fb_modes = NULL; |
331 } | |
332 nr_modes = 0; | |
359 | 333 free(line); |
334 free(fp); | |
335 return -2; | |
336 err_out_not_valid: | |
337 printf("mode is not definied correctly"); | |
338 goto err_out_print_linenum; | |
339 } | |
340 | |
341 static fb_mode_t *find_mode_by_name(char *name) | |
342 { | |
343 int i; | |
344 | |
345 for (i = 0; i < nr_modes; i++) { | |
346 if (!strcmp(name, fb_modes[i].name)) | |
347 return fb_modes + i; | |
348 } | |
349 return NULL; | |
350 } | |
351 | |
393 | 352 static float dcf(fb_mode_t *m) //driving clock frequency |
353 { | |
354 return 1000000.0f / m->pixclock; | |
355 } | |
356 | |
357 static float hsf(fb_mode_t *m) //horizontal scan frequency | |
358 { | |
359 int htotal = m->left + m->xres + m->right + m->hslen; | |
360 return dcf(m) / htotal; | |
361 } | |
362 | |
363 static float vsf(fb_mode_t *m) //vertical scan frequency | |
364 { | |
365 int vtotal = m->upper + m->yres + m->lower + m->vslen; | |
366 return hsf(m) / vtotal; | |
367 } | |
368 | |
369 typedef struct { | |
370 float min; | |
371 float max; | |
418 | 372 } range_t; |
393 | 373 |
418 | 374 static int in_range(range_t *r, float f) |
393 | 375 { |
418 | 376 for (/* NOTHING */; (r->min != -1 && r->max != -1); r++) { |
393 | 377 if (f >= r->min && f <= r->max) |
378 return 1; | |
379 } | |
380 return 0; | |
381 } | |
382 | |
418 | 383 static fb_mode_t *find_best_mode(int xres, int yres, range_t *hfreq, |
384 range_t *vfreq, range_t *dotclock) | |
393 | 385 { |
386 int i; | |
387 fb_mode_t *best = fb_modes; | |
388 fb_mode_t *curr = fb_modes + 1; | |
389 | |
390 for (i = nr_modes - 1; i; i--, curr++) { | |
391 if (curr->xres >= xres && curr->yres >= yres) { | |
392 if (curr->xres < best->xres && curr->yres < best->yres) { | |
393 if (!in_range(hfreq, hsf(curr))) | |
394 continue; | |
395 if (!in_range(vfreq, vsf(curr))) | |
396 continue; | |
397 if (!in_range(dotclock, dcf(curr))) | |
398 continue; | |
399 best = curr; | |
400 } | |
401 } | |
402 } | |
403 if ((best->xres < xres || best->yres < yres) || | |
404 !in_range(hfreq, hsf(best)) || | |
405 !in_range(vfreq, vsf(best)) || | |
406 !in_range(dotclock, dcf(curr))) | |
407 return NULL; | |
408 return best; | |
409 } | |
410 | |
418 | 411 static void set_bpp(struct fb_var_screeninfo *p, int bpp) |
412 { | |
413 p->bits_per_pixel = (bpp == 15) ? 16 : bpp; | |
414 p->red.msb_right = p->green.msb_right = p->blue.msb_right = 0; | |
415 switch (bpp) { | |
416 case 32: | |
417 case 24: | |
418 p->red.offset = 16; | |
419 p->red.length = 8; | |
420 p->green.offset = 8; | |
421 p->green.length = 8; | |
422 p->blue.offset = 0; | |
423 p->blue.length = 8; | |
424 break; | |
425 case 16: | |
426 p->red.offset = 11; | |
427 p->red.length = 5; | |
428 p->green.offset = 5; | |
429 p->green.length = 6; | |
430 p->blue.offset = 0; | |
431 p->blue.length = 5; | |
432 break; | |
433 case 15: | |
434 p->red.offset = 10; | |
435 p->red.length = 5; | |
436 p->green.offset = 5; | |
437 p->green.length = 5; | |
438 p->blue.offset = 0; | |
439 p->blue.length = 5; | |
440 break; | |
441 } | |
442 } | |
443 | |
444 static void fb_mode2fb_vinfo(fb_mode_t *m, struct fb_var_screeninfo *v) | |
445 { | |
446 v->xres = m->xres; | |
447 v->yres = m->yres; | |
448 v->xres_virtual = m->vxres; | |
449 v->yres_virtual = m->vyres; | |
450 set_bpp(v, m->depth); | |
451 v->pixclock = m->pixclock; | |
452 v->left_margin = m->left; | |
453 v->right_margin = m->right; | |
454 v->upper_margin = m->upper; | |
455 v->lower_margin = m->lower; | |
456 v->hsync_len = m->hslen; | |
457 v->vsync_len = m->vslen; | |
458 v->sync = m->sync; | |
459 v->vmode = m->vmode; | |
460 } | |
461 | |
462 static range_t *str2range(char *s) | |
463 { | |
464 float tmp_min, tmp_max; | |
465 char *endptr = s; // to start the loop | |
466 range_t *r = NULL; | |
467 int i, j; | |
468 | |
469 if (!s) | |
470 return NULL; | |
471 for (i = 0; *endptr; i++) { | |
472 if (*s == ',') | |
473 goto out_err; | |
474 if (!(r = (range_t *) realloc(r, sizeof(*r) * i + 2))) { | |
475 printf("can't realloc 'r'\n"); | |
476 return NULL; | |
477 } | |
478 tmp_min = strtod(s, &endptr); | |
479 if (*endptr == 'k' || *endptr == 'K') { | |
480 tmp_min *= 1000.0; | |
481 endptr++; | |
482 } else if (*endptr == 'm' || *endptr == 'M') { | |
483 tmp_min *= 1000000.0; | |
484 endptr++; | |
485 } | |
486 if (*endptr == '-') { | |
487 tmp_max = strtod(endptr + 1, &endptr); | |
488 if (*endptr == 'k' || *endptr == 'K') { | |
489 tmp_max *= 1000.0; | |
490 endptr++; | |
491 } else if (*endptr == 'm' || *endptr == 'M') { | |
492 tmp_max *= 1000000.0; | |
493 endptr++; | |
494 } | |
495 if (*endptr != ',' && *endptr) | |
496 goto out_err; | |
497 } else if (*endptr == ',' || !*endptr) { | |
498 tmp_max = tmp_min; | |
499 } else | |
500 goto out_err; | |
501 r[i].min = tmp_min; | |
502 r[i].max = tmp_max; | |
503 s = endptr + 1; | |
504 } | |
505 /* check if we have negative numbers... */ | |
506 for (j = 0; j < i; j++) | |
507 if (r[j].min < 0 || r[j].max < 0) | |
508 goto out_err; | |
509 r[i].min = r[i].max = -1; | |
510 return r; | |
511 out_err: | |
512 if (r) | |
513 free(r); | |
514 return NULL; | |
515 } | |
516 | |
359 | 517 /****************************** |
518 * vo_fbdev * | |
519 ******************************/ | |
520 | |
393 | 521 /* |
522 * command line/config file options | |
523 */ | |
524 char *fb_dev_name = NULL; | |
525 char *fb_mode_cfgfile = "/etc/fb.modes"; | |
526 char *fb_mode_name = NULL; | |
418 | 527 char *monitor_hfreq_str = NULL; |
528 char *monitor_vfreq_str = NULL; | |
529 char *monitor_dotclock_str = NULL; | |
530 | |
531 range_t *monitor_hfreq = NULL; | |
532 range_t *monitor_vfreq = NULL; | |
533 range_t *monitor_dotclock = NULL; | |
393 | 534 |
535 static int fb_preinit_done = 0; | |
359 | 536 static int fb_works = 0; |
225 | 537 static int fb_dev_fd; |
538 static size_t fb_size; | |
539 static uint8_t *frame_buffer; | |
359 | 540 static struct fb_fix_screeninfo fb_finfo; |
541 static struct fb_var_screeninfo fb_orig_vinfo; | |
542 static struct fb_var_screeninfo fb_vinfo; | |
543 static struct fb_cmap *fb_oldcmap = NULL; | |
544 static int fb_pixel_size; // 32: 4 24: 3 16: 2 15: 2 | |
545 static int fb_real_bpp; // 32: 24 24: 24 16: 16 15: 15 | |
546 static int fb_bpp; // 32: 32 24: 24 16: 16 15: 15 | |
393 | 547 static int fb_bpp_we_want; // 32: 32 24: 24 16: 16 15: 15 |
359 | 548 static int fb_screen_width; |
549 static fb_mode_t *fb_mode = NULL; | |
550 | |
418 | 551 static void (*put_frame)(void); |
552 static int left_band_width; | |
553 static int right_band_width; | |
554 static int upper_band_height; | |
555 static int lower_band_height; | |
359 | 556 static uint8_t *next_frame; |
225 | 557 static int in_width; |
558 static int in_height; | |
559 static int out_width; | |
560 static int out_height; | |
561 static uint32_t pixel_format; | |
562 | |
305 | 563 /* |
564 * Note: this function is completely cut'n'pasted from | |
565 * Chris Lawrence's code. | |
311 | 566 * (modified a bit to fit in my code...) |
305 | 567 */ |
568 struct fb_cmap *make_directcolor_cmap(struct fb_var_screeninfo *var) | |
569 { | |
570 /* Hopefully any DIRECTCOLOR device will have a big enough palette | |
571 * to handle mapping the full color depth. | |
572 * e.g. 8 bpp -> 256 entry palette | |
573 * | |
574 * We could handle some sort of gamma here | |
575 */ | |
576 int i, cols, rcols, gcols, bcols; | |
577 uint16_t *red, *green, *blue; | |
578 struct fb_cmap *cmap; | |
579 | |
580 rcols = 1 << var->red.length; | |
581 gcols = 1 << var->green.length; | |
582 bcols = 1 << var->blue.length; | |
583 | |
584 /* Make our palette the length of the deepest color */ | |
585 cols = (rcols > gcols ? rcols : gcols); | |
586 cols = (cols > bcols ? cols : bcols); | |
587 | |
588 red = malloc(cols * sizeof(red[0])); | |
589 if(!red) { | |
590 printf("Can't allocate red palette with %d entries.\n", cols); | |
591 return NULL; | |
592 } | |
593 for(i=0; i< rcols; i++) | |
594 red[i] = (65535/(rcols-1)) * i; | |
595 | |
596 green = malloc(cols * sizeof(green[0])); | |
597 if(!green) { | |
598 printf("Can't allocate green palette with %d entries.\n", cols); | |
599 free(red); | |
600 return NULL; | |
601 } | |
602 for(i=0; i< gcols; i++) | |
603 green[i] = (65535/(gcols-1)) * i; | |
604 | |
605 blue = malloc(cols * sizeof(blue[0])); | |
606 if(!blue) { | |
607 printf("Can't allocate blue palette with %d entries.\n", cols); | |
608 free(red); | |
609 free(green); | |
610 return NULL; | |
611 } | |
612 for(i=0; i< bcols; i++) | |
613 blue[i] = (65535/(bcols-1)) * i; | |
614 | |
615 cmap = malloc(sizeof(struct fb_cmap)); | |
616 if(!cmap) { | |
617 printf("Can't allocate color map\n"); | |
618 free(red); | |
619 free(green); | |
620 free(blue); | |
621 return NULL; | |
622 } | |
623 cmap->start = 0; | |
624 cmap->transp = 0; | |
625 cmap->len = cols; | |
626 cmap->red = red; | |
627 cmap->blue = blue; | |
628 cmap->green = green; | |
629 cmap->transp = NULL; | |
630 | |
631 return cmap; | |
632 } | |
225 | 633 |
393 | 634 static int fb_preinit(void) |
225 | 635 { |
393 | 636 if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER"))) |
637 fb_dev_name = "/dev/fb0"; | |
638 if (verbose > 0) | |
639 printf(FBDEV "using %s\n", fb_dev_name); | |
225 | 640 |
393 | 641 if ((fb_dev_fd = open(fb_dev_name, O_RDWR)) == -1) { |
642 printf(FBDEV "Can't open %s: %s\n", fb_dev_name, strerror(errno)); | |
643 goto err_out; | |
644 } | |
645 if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo)) { | |
646 printf(FBDEV "Can't get VSCREENINFO: %s\n", strerror(errno)); | |
647 goto err_out_fd; | |
648 } | |
418 | 649 fb_orig_vinfo = fb_vinfo; |
393 | 650 |
651 fb_bpp = (fb_vinfo.bits_per_pixel == 32) ? 32 : | |
652 (fb_vinfo.red.length + fb_vinfo.green.length + | |
653 fb_vinfo.blue.length); | |
418 | 654 if (vo_dbpp) { |
655 if (vo_dbpp != 15 && vo_dbpp != 16 && vo_dbpp != 24 && | |
656 vo_dbpp != 32) { | |
657 printf(FBDEV "can't switch to %d bpp\n", vo_dbpp); | |
383 | 658 goto err_out; |
359 | 659 } |
418 | 660 fb_bpp = vo_dbpp; |
359 | 661 } |
245
cb4c682746c0
disabled scrollback buffer (virtual fb size set to real screen size)
szabii
parents:
231
diff
changeset
|
662 |
393 | 663 fb_preinit_done = 1; |
664 fb_works = 1; | |
665 return 0; | |
666 err_out_fd: | |
667 close(fb_dev_fd); | |
668 fb_dev_fd = -1; | |
669 err_out: | |
670 fb_preinit_done = 1; | |
671 return 1; | |
672 } | |
245
cb4c682746c0
disabled scrollback buffer (virtual fb size set to real screen size)
szabii
parents:
231
diff
changeset
|
673 |
418 | 674 static void put_frame_without_bands(void); |
675 static void put_frame_with_bands(void); | |
676 | |
393 | 677 static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, |
678 uint32_t d_height, uint32_t fullscreen, char *title, | |
679 uint32_t format) | |
680 { | |
418 | 681 #define FS (fullscreen & 0x01) |
682 #define VM (fullscreen & 0x02) | |
683 #define ZOOM (fullscreen & 0x04) | |
684 | |
393 | 685 struct fb_cmap *cmap; |
686 | |
687 if (!fb_preinit_done) | |
688 if (fb_preinit()) | |
689 return 1; | |
690 if (!fb_works) | |
691 return 1; | |
245
cb4c682746c0
disabled scrollback buffer (virtual fb size set to real screen size)
szabii
parents:
231
diff
changeset
|
692 |
418 | 693 if (ZOOM) { |
694 printf(FBDEV "-zoom is not supported\n"); | |
695 return 1; | |
696 } | |
697 if (fb_mode_name && !VM) { | |
698 printf(FBDEV "-fbmode can be used only with -vm" | |
699 " (is it the right behaviour?)\n"); | |
700 return 1; | |
701 } | |
702 if (VM) | |
703 if (parse_fbmode_cfg(fb_mode_cfgfile) < 0) | |
704 return 1; | |
705 if ((!d_width + !d_height) == 1) { | |
706 printf(FBDEV "use both -x and -y, or none of them\n"); | |
707 return 1; | |
708 } | |
709 if (d_width) { | |
710 out_width = d_width; | |
711 out_height = d_height; | |
712 } else { | |
713 out_width = width; | |
714 out_height = height; | |
715 } | |
716 in_width = width; | |
717 in_height = height; | |
718 pixel_format = format; | |
719 | |
393 | 720 if (fb_mode_name) { |
418 | 721 if (!(fb_mode = find_mode_by_name(fb_mode_name))) { |
722 printf(FBDEV "can't find requested video mode\n"); | |
723 return 1; | |
724 } | |
725 fb_mode2fb_vinfo(fb_mode, &fb_vinfo); | |
726 } else if (VM) { | |
727 monitor_hfreq = str2range(monitor_hfreq_str); | |
728 monitor_vfreq = str2range(monitor_vfreq_str); | |
729 monitor_dotclock = str2range(monitor_dotclock_str); | |
730 if (!monitor_hfreq || !monitor_vfreq || !monitor_dotclock) { | |
731 printf(FBDEV "you have to specify the capabilities of" | |
732 " the monitor.\n"); | |
733 return 1; | |
734 } | |
735 if (!(fb_mode = find_best_mode(out_width, out_height, | |
736 monitor_hfreq, monitor_vfreq, | |
737 monitor_dotclock))) { | |
738 printf(FBDEV "can't find best video mode\n"); | |
739 return 1; | |
740 } | |
741 fb_mode2fb_vinfo(fb_mode, &fb_vinfo); | |
359 | 742 } |
418 | 743 fb_bpp_we_want = fb_bpp; |
744 set_bpp(&fb_vinfo, fb_bpp); | |
359 | 745 fb_vinfo.xres_virtual = fb_vinfo.xres; |
746 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
|
747 |
359 | 748 if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo)) { |
393 | 749 printf(FBDEV "Can't put VSCREENINFO: %s\n", strerror(errno)); |
750 return 1; | |
751 } | |
752 if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo)) { | |
753 printf(FBDEV "Can't get VSCREENINFO: %s\n", strerror(errno)); | |
754 return 1; | |
245
cb4c682746c0
disabled scrollback buffer (virtual fb size set to real screen size)
szabii
parents:
231
diff
changeset
|
755 } |
cb4c682746c0
disabled scrollback buffer (virtual fb size set to real screen size)
szabii
parents:
231
diff
changeset
|
756 |
393 | 757 if (verbose > 0) { |
758 printf(FBDEV "var info:\n"); | |
759 printf(FBDEV "xres: %ul\n", fb_vinfo.xres); | |
760 printf(FBDEV "yres: %ul\n", fb_vinfo.yres); | |
761 printf(FBDEV "xres_virtual: %ul\n", fb_vinfo.xres_virtual); | |
762 printf(FBDEV "yres_virtual: %ul\n", fb_vinfo.yres_virtual); | |
763 printf(FBDEV "xoffset: %ul\n", fb_vinfo.xoffset); | |
764 printf(FBDEV "yoffset: %ul\n", fb_vinfo.yoffset); | |
765 printf(FBDEV "bits_per_pixel: %ul\n", fb_vinfo.bits_per_pixel); | |
766 printf(FBDEV "grayscale: %ul\n", fb_vinfo.grayscale); | |
767 printf(FBDEV "red: %lu %lu %lu\n", | |
768 (unsigned long) fb_vinfo.red.offset, | |
769 (unsigned long) fb_vinfo.red.length, | |
770 (unsigned long) fb_vinfo.red.msb_right); | |
771 printf(FBDEV "green: %lu %lu %lu\n", | |
772 (unsigned long) fb_vinfo.green.offset, | |
773 (unsigned long) fb_vinfo.green.length, | |
774 (unsigned long) fb_vinfo.green.msb_right); | |
775 printf(FBDEV "blue: %lu %lu %lu\n", | |
776 (unsigned long) fb_vinfo.blue.offset, | |
777 (unsigned long) fb_vinfo.blue.length, | |
778 (unsigned long) fb_vinfo.blue.msb_right); | |
779 printf(FBDEV "transp: %lu %lu %lu\n", | |
780 (unsigned long) fb_vinfo.transp.offset, | |
781 (unsigned long) fb_vinfo.transp.length, | |
782 (unsigned long) fb_vinfo.transp.msb_right); | |
783 printf(FBDEV "nonstd: %ul\n", fb_vinfo.nonstd); | |
784 if (verbose > 1) { | |
785 printf(FBDEV "activate: %ul\n", fb_vinfo.activate); | |
786 printf(FBDEV "height: %ul\n", fb_vinfo.height); | |
787 printf(FBDEV "width: %ul\n", fb_vinfo.width); | |
788 printf(FBDEV "accel_flags: %ul\n", fb_vinfo.accel_flags); | |
789 printf(FBDEV "timing:\n"); | |
790 printf(FBDEV "pixclock: %ul\n", fb_vinfo.pixclock); | |
791 printf(FBDEV "left_margin: %ul\n", fb_vinfo.left_margin); | |
792 printf(FBDEV "right_margin: %ul\n", fb_vinfo.right_margin); | |
793 printf(FBDEV "upper_margin: %ul\n", fb_vinfo.upper_margin); | |
794 printf(FBDEV "lower_margin: %ul\n", fb_vinfo.lower_margin); | |
795 printf(FBDEV "hsync_len: %ul\n", fb_vinfo.hsync_len); | |
796 printf(FBDEV "vsync_len: %ul\n", fb_vinfo.vsync_len); | |
797 printf(FBDEV "sync: %ul\n", fb_vinfo.sync); | |
798 printf(FBDEV "vmode: %ul\n", fb_vinfo.vmode); | |
799 } | |
800 } | |
359 | 801 if (ioctl(fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo)) { |
393 | 802 printf(FBDEV "Can't get FSCREENINFO: %s\n", strerror(errno)); |
225 | 803 return 1; |
804 } | |
393 | 805 if (verbose > 0) { |
806 printf(FBDEV "fix info:\n"); | |
807 if (verbose > 1) { | |
808 printf(FBDEV "id: %.16s\n", fb_finfo.id); | |
809 printf(FBDEV "smem_start: %p\n", (void *) fb_finfo.smem_start); | |
810 } | |
811 printf(FBDEV "framebuffer size: %d bytes\n", fb_size); | |
812 printf(FBDEV "type: %lu\n", (unsigned long) fb_finfo.type); | |
813 printf(FBDEV "type_aux: %lu\n", (unsigned long) fb_finfo.type_aux); | |
814 printf(FBDEV "visual: %lu\n", (unsigned long) fb_finfo.visual); | |
815 if (verbose > 1) { | |
816 printf(FBDEV "xpanstep: %u\n", fb_finfo.xpanstep); | |
817 printf(FBDEV "ypanstep: %u\n", fb_finfo.ypanstep); | |
818 printf(FBDEV "ywrapstep: %u\n", fb_finfo.ywrapstep); | |
819 } | |
820 printf(FBDEV "line_length: %lu bytes\n", (unsigned long) fb_finfo.line_length); | |
821 if (verbose > 1) { | |
822 printf(FBDEV "mmio_start: %p\n", (void *) fb_finfo.mmio_start); | |
823 printf(FBDEV "mmio_len: %ul bytes\n", fb_finfo.mmio_len); | |
824 printf(FBDEV "accel: %ul\n", fb_finfo.accel); | |
825 } | |
826 } | |
359 | 827 switch (fb_finfo.type) { |
225 | 828 case FB_TYPE_VGA_PLANES: |
393 | 829 printf(FBDEV "FB_TYPE_VGA_PLANES not supported.\n"); |
830 return 1; | |
225 | 831 case FB_TYPE_PLANES: |
393 | 832 printf(FBDEV "FB_TYPE_PLANES not supported.\n"); |
833 return 1; | |
225 | 834 case FB_TYPE_INTERLEAVED_PLANES: |
393 | 835 printf(FBDEV "FB_TYPE_INTERLEAVED_PLANES not supported.\n"); |
836 return 1; | |
225 | 837 #ifdef FB_TYPE_TEXT |
838 case FB_TYPE_TEXT: | |
393 | 839 printf(FBDEV "FB_TYPE_TEXT not supported.\n"); |
840 return 1; | |
225 | 841 #endif |
842 case FB_TYPE_PACKED_PIXELS: | |
843 /* OK */ | |
379 | 844 if (verbose > 0) |
393 | 845 printf(FBDEV "FB_TYPE_PACKED_PIXELS: OK\n"); |
225 | 846 break; |
847 default: | |
393 | 848 printf(FBDEV "unknown FB_TYPE: %d\n", fb_finfo.type); |
849 return 1; | |
305 | 850 } |
379 | 851 switch (fb_finfo.visual) { |
393 | 852 case FB_VISUAL_TRUECOLOR: |
853 break; | |
854 case FB_VISUAL_DIRECTCOLOR: | |
855 if (verbose > 0) | |
856 printf(FBDEV "creating cmap for directcolor\n"); | |
857 if (ioctl(fb_dev_fd, FBIOGETCMAP, fb_oldcmap)) { | |
858 printf(FBDEV "can't get cmap: %s\n", | |
859 strerror(errno)); | |
860 return 1; | |
861 } | |
862 if (!(cmap = make_directcolor_cmap(&fb_vinfo))) | |
863 return 1; | |
864 if (ioctl(fb_dev_fd, FBIOPUTCMAP, cmap)) { | |
865 printf(FBDEV "can't put cmap: %s\n", | |
866 strerror(errno)); | |
867 return 1; | |
868 } | |
869 free(cmap->red); | |
870 free(cmap->green); | |
871 free(cmap->blue); | |
872 free(cmap); | |
873 break; | |
874 case FB_VISUAL_PSEUDOCOLOR: | |
875 printf(FBDEV "visual is FB_VISUAL_PSEUDOCOLOR." | |
876 "it's not tested!\n"); | |
877 break; | |
878 default: | |
879 printf(FBDEV "visual: %d not yet supported\n", | |
880 fb_finfo.visual); | |
881 return 1; | |
245
cb4c682746c0
disabled scrollback buffer (virtual fb size set to real screen size)
szabii
parents:
231
diff
changeset
|
882 } |
418 | 883 if (FS || (d_width && VM)) { |
884 out_width = fb_vinfo.xres; | |
885 out_height = fb_vinfo.yres; | |
886 } | |
887 if (out_width < in_width || out_height < in_height) { | |
888 printf(FBDEV "screensize is smaller than video size\n"); | |
889 return 1; | |
890 } | |
891 left_band_width = (out_width - in_width) / 2; | |
892 right_band_width = (out_width - in_width + 1) / 2; | |
893 upper_band_height = (out_height - in_height) / 2; | |
894 lower_band_height = (out_height - in_height + 1) / 2; | |
895 if (left_band_width || right_band_width || upper_band_height || | |
896 lower_band_height) | |
897 put_frame = put_frame_with_bands; | |
898 else | |
899 put_frame = put_frame_without_bands; | |
245
cb4c682746c0
disabled scrollback buffer (virtual fb size set to real screen size)
szabii
parents:
231
diff
changeset
|
900 |
359 | 901 fb_pixel_size = fb_vinfo.bits_per_pixel / 8; |
902 fb_real_bpp = fb_vinfo.red.length + fb_vinfo.green.length + | |
903 fb_vinfo.blue.length; | |
904 fb_bpp = (fb_pixel_size == 4) ? 32 : fb_real_bpp; | |
393 | 905 if (fb_bpp_we_want != fb_bpp) |
418 | 906 printf(FBDEV "requested %d bpp, got %d bpp)!!!\n", |
393 | 907 fb_bpp_we_want, fb_bpp); |
359 | 908 fb_screen_width = fb_finfo.line_length; |
909 fb_size = fb_finfo.smem_len; | |
225 | 910 if ((frame_buffer = (uint8_t *) mmap(0, fb_size, PROT_READ | PROT_WRITE, |
911 MAP_SHARED, fb_dev_fd, 0)) == (uint8_t *) -1) { | |
393 | 912 printf(FBDEV "Can't mmap %s: %s\n", fb_dev_name, strerror(errno)); |
913 return 1; | |
225 | 914 } |
229 | 915 |
393 | 916 if (verbose > 0) { |
917 printf(FBDEV "other:\n"); | |
918 if (verbose > 1) | |
919 printf(FBDEV "frame_buffer @ %p\n", frame_buffer); | |
920 printf(FBDEV "fb_bpp: %d\n", fb_bpp); | |
921 printf(FBDEV "fb_real_bpp: %d\n", fb_real_bpp); | |
922 printf(FBDEV "fb_pixel_size: %d bytes\n", fb_pixel_size); | |
923 printf(FBDEV "pixel per line: %d\n", fb_screen_width / fb_pixel_size); | |
379 | 924 } |
225 | 925 |
278 | 926 if (!(next_frame = (uint8_t *) malloc(in_width * in_height * fb_pixel_size))) { |
393 | 927 printf(FBDEV "Can't malloc next_frame: %s\n", strerror(errno)); |
225 | 928 return 1; |
929 } | |
930 | |
931 if (format == IMGFMT_YV12) | |
359 | 932 yuv2rgb_init(fb_bpp, MODE_RGB); |
225 | 933 return 0; |
934 } | |
935 | |
936 static uint32_t query_format(uint32_t format) | |
937 { | |
393 | 938 if (!fb_preinit_done) |
939 if (fb_preinit()) | |
229 | 940 return 0; |
305 | 941 if (!fb_works) |
942 return 0; | |
943 | |
380 | 944 if (verbose > 0) |
393 | 945 printf(FBDEV "query_format(%#lx(%.4s))\n",(unsigned long) format, |
946 (char *) &format); | |
311 | 947 if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR) { |
948 int bpp = format & 0xff; | |
359 | 949 if (bpp == fb_bpp) |
311 | 950 return 1; |
359 | 951 else if (bpp == 15 && fb_bpp == 16) |
311 | 952 return 1; |
359 | 953 else if (bpp == 24 && fb_bpp == 32) |
311 | 954 return 1; |
955 } | |
956 if (format == IMGFMT_YV12) | |
957 return 1; | |
958 return 0; | |
225 | 959 } |
960 | |
961 static const vo_info_t *get_info(void) | |
962 { | |
963 return &vo_info; | |
964 } | |
965 | |
393 | 966 extern void vo_draw_alpha_rgb32(int w, int h, unsigned char* src, |
967 unsigned char *srca, int srcstride, unsigned char* dstbase, | |
968 int dststride); | |
969 extern void vo_draw_alpha_rgb24(int w, int h, unsigned char* src, | |
970 unsigned char *srca, int srcstride, unsigned char* dstbase, | |
971 int dststride); | |
972 extern void vo_draw_alpha_rgb16(int w, int h, unsigned char* src, | |
973 unsigned char *srca, int srcstride, unsigned char* dstbase, | |
974 int dststride); | |
975 extern void vo_draw_alpha_rgb15(int w, int h, unsigned char* src, | |
976 unsigned char *srca, int srcstride, unsigned char* dstbase, | |
977 int dststride); | |
978 | |
225 | 979 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, |
980 unsigned char *srca, int stride) | |
981 { | |
359 | 982 uint8_t *dst = next_frame + (in_width * y0 + x0) * fb_pixel_size; |
983 int dstride = in_width * fb_pixel_size; | |
984 | |
985 switch (fb_real_bpp) { | |
986 case 24: | |
987 vo_draw_alpha_rgb24(w, h, src, srca, stride, dst, dstride); | |
988 break; | |
989 case 32: | |
990 vo_draw_alpha_rgb32(w, h, src, srca, stride, dst, dstride); | |
991 break; | |
992 case 15: | |
993 vo_draw_alpha_rgb15(w, h, src, srca, stride, dst, dstride); | |
994 break; | |
995 case 16: | |
996 vo_draw_alpha_rgb16(w, h, src, srca, stride, dst, dstride); | |
997 break; | |
998 } | |
225 | 999 } |
1000 | |
1001 static uint32_t draw_frame(uint8_t *src[]) | |
1002 { | |
1003 if (pixel_format == IMGFMT_YV12) { | |
1004 yuv2rgb(next_frame, src[0], src[1], src[2], in_width, | |
278 | 1005 in_height, in_width * fb_pixel_size, |
225 | 1006 in_width, in_width / 2); |
311 | 1007 } else { |
1008 int sbpp = ((pixel_format & 0xff) + 7) / 8; | |
1009 char *d = next_frame; | |
1010 char *s = src[0]; | |
1011 if (sbpp == fb_pixel_size) { | |
359 | 1012 if (fb_real_bpp == 16 && pixel_format == (IMGFMT_BGR|15)) { |
311 | 1013 #ifdef HAVE_MMX |
1014 rgb15to16_mmx(s, d, 2 * in_width * in_height); | |
1015 #else | |
1016 unsigned short *s1 = (unsigned short *) s; | |
1017 unsigned short *d1 = (unsigned short *) d; | |
1018 unsigned short *e = s1 + in_width * in_height; | |
1019 while (s1<e) { | |
1020 register x = *(s1++); | |
1021 *(d1++) = (x&0x001f)|((x&0x7fe0)<<1); | |
1022 } | |
1023 #endif | |
1024 } else | |
1025 memcpy(d, s, sbpp * in_width * in_height); | |
1026 } | |
1027 } | |
225 | 1028 return 0; |
1029 } | |
1030 | |
1031 static uint32_t draw_slice(uint8_t *src[], int stride[], int w, int h, int x, | |
1032 int y) | |
1033 { | |
1034 uint8_t *dest; | |
1035 | |
278 | 1036 dest = next_frame + (in_width * y + x) * fb_pixel_size; |
1037 yuv2rgb(dest, src[0], src[1], src[2], w, h, in_width * fb_pixel_size, | |
225 | 1038 stride[0], stride[1]); |
1039 return 0; | |
1040 } | |
1041 | |
1042 static void check_events(void) | |
1043 { | |
1044 } | |
1045 | |
418 | 1046 static void put_frame_without_bands(void) |
225 | 1047 { |
1048 int i, out_offset = 0, in_offset = 0; | |
1049 | |
1050 for (i = 0; i < in_height; i++) { | |
1051 memcpy(frame_buffer + out_offset, next_frame + in_offset, | |
423 | 1052 in_width * fb_pixel_size); |
359 | 1053 out_offset += fb_screen_width; |
278 | 1054 in_offset += in_width * fb_pixel_size; |
225 | 1055 } |
1056 } | |
1057 | |
418 | 1058 static void put_frame_with_bands(void) |
1059 { | |
1060 int i, out_offset = 0, in_offset = 0, w, bw, tmp; | |
1061 | |
1062 if (upper_band_height) { | |
1063 out_offset = upper_band_height * out_width * fb_pixel_size; | |
1064 memset(frame_buffer, 0x00, out_offset); | |
1065 } | |
1066 if (left_band_width) { | |
1067 tmp = left_band_width * fb_pixel_size; | |
1068 memset(frame_buffer + out_offset, 0x00, tmp); | |
1069 out_offset += tmp; | |
1070 } | |
1071 w = in_width * fb_pixel_size; | |
1072 bw = (left_band_width + right_band_width) * fb_pixel_size; | |
1073 for (i = 0; i < in_height - 1; i++) { | |
1074 memcpy(frame_buffer + out_offset, next_frame + in_offset, w); | |
1075 if (bw) | |
1076 memset(frame_buffer + out_offset + w, 0x00, bw); | |
1077 out_offset += fb_screen_width; | |
1078 in_offset += w; | |
1079 } | |
1080 memcpy(frame_buffer + out_offset, next_frame + in_offset, w); | |
1081 out_offset += w; | |
1082 if (right_band_width) { | |
1083 tmp = right_band_width * fb_pixel_size; | |
1084 memset(frame_buffer + out_offset, 0x00, tmp); | |
1085 out_offset += tmp; | |
1086 } | |
1087 if (lower_band_height) | |
1088 memset(frame_buffer + out_offset, 0x00, lower_band_height * | |
1089 out_width * fb_pixel_size); | |
1090 } | |
1091 | |
393 | 1092 extern void vo_draw_text(int dxs, int dys, void (*draw_alpha)(int x0, int y0, |
1093 int w, int h, unsigned char *src, unsigned char *srca, | |
1094 int stride)); | |
1095 | |
246 | 1096 static void flip_page(void) |
1097 { | |
1098 vo_draw_text(in_width, in_height, draw_alpha); | |
1099 check_events(); | |
418 | 1100 (*put_frame)(); |
246 | 1101 } |
1102 | |
225 | 1103 static void uninit(void) |
1104 { | |
379 | 1105 if (verbose > 0) |
393 | 1106 printf(FBDEV "uninit\n"); |
359 | 1107 if (fb_oldcmap) { |
1108 if (ioctl(fb_dev_fd, FBIOPUTCMAP, fb_oldcmap)) | |
393 | 1109 printf(FBDEV "Can't restore original cmap\n"); |
359 | 1110 fb_oldcmap = NULL; |
306 | 1111 } |
379 | 1112 if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo)) |
393 | 1113 printf(FBDEV "Can't set virtual screensize to original value: %s\n", strerror(errno)); |
359 | 1114 close(fb_dev_fd); |
278 | 1115 memset(next_frame, '\0', in_height * in_width * fb_pixel_size); |
246 | 1116 put_frame(); |
225 | 1117 free(next_frame); |
1118 munmap(frame_buffer, fb_size); | |
1119 } |