comparison libvo/vo_fbdev.c @ 519:5e8d5422854d

changed query_format return; lots of fixes/changes
author szabii
date Thu, 19 Apr 2001 01:18:05 +0000
parents 4aa16f9ff929
children 4df60675000a
comparison
equal deleted inserted replaced
518:e1e2131411c3 519:5e8d5422854d
349 return NULL; 349 return NULL;
350 } 350 }
351 351
352 static float dcf(fb_mode_t *m) //driving clock frequency 352 static float dcf(fb_mode_t *m) //driving clock frequency
353 { 353 {
354 return 1000000.0f / m->pixclock; 354 return 1e12f / m->pixclock;
355 } 355 }
356 356
357 static float hsf(fb_mode_t *m) //horizontal scan frequency 357 static float hsf(fb_mode_t *m) //horizontal scan frequency
358 { 358 {
359 int htotal = m->left + m->xres + m->right + m->hslen; 359 int htotal = m->left + m->xres + m->right + m->hslen;
383 static fb_mode_t *find_best_mode(int xres, int yres, range_t *hfreq, 383 static fb_mode_t *find_best_mode(int xres, int yres, range_t *hfreq,
384 range_t *vfreq, range_t *dotclock) 384 range_t *vfreq, range_t *dotclock)
385 { 385 {
386 int i; 386 int i;
387 fb_mode_t *best = fb_modes; 387 fb_mode_t *best = fb_modes;
388 fb_mode_t *curr = fb_modes + 1; 388 fb_mode_t *curr;
389 389
390 for (i = nr_modes - 1; i; i--, curr++) { 390 /* find first working mode */
391 if (curr->xres >= xres && curr->yres >= yres) { 391 for (i = nr_modes - 1; i; i--, best++) {
392 if (in_range(hfreq, hsf(best)) && in_range(vfreq, vsf(best)) &&
393 in_range(dotclock, dcf(best)))
394 break;
395 if (verbose > 1)
396 printf(FBDEV "can't set %dx%d\n", best->xres, best->yres);
397 }
398
399 if (!i)
400 return NULL;
401 if (i == 1)
402 return best;
403
404 for (curr = best + 1; i; i--, curr++) {
405 if (!in_range(hfreq, hsf(curr)))
406 continue;
407 if (!in_range(vfreq, vsf(curr)))
408 continue;
409 if (!in_range(dotclock, dcf(curr)))
410 continue;
411 if (verbose > 1)
412 printf(FBDEV "%dx%d ", curr->xres, curr->yres);
413 if ((best->xres < xres || best->yres < yres) &&
414 (curr->xres > best->xres ||
415 curr->yres > best->yres)) {
416 if (verbose > 1)
417 printf("better than %dx%d\n", best->xres,
418 best->yres);
419 best = curr;
420 } else if (curr->xres >= xres && curr->yres >= yres) {
392 if (curr->xres < best->xres && curr->yres < best->yres) { 421 if (curr->xres < best->xres && curr->yres < best->yres) {
393 if (!in_range(hfreq, hsf(curr))) 422 if (verbose > 1)
394 continue; 423 printf("smaller than %dx%d\n",
395 if (!in_range(vfreq, vsf(curr))) 424 best->xres, best->yres);
396 continue;
397 if (!in_range(dotclock, dcf(curr)))
398 continue;
399 best = curr; 425 best = curr;
400 } 426 } else if (curr->xres == best->xres &&
401 } 427 curr->yres == best->yres &&
402 } 428 (vsf(curr) > vsf(best))) {
403 if ((best->xres < xres || best->yres < yres) || 429 if (verbose > 1)
404 !in_range(hfreq, hsf(best)) || 430 printf("faster screen refresh\n");
405 !in_range(vfreq, vsf(best)) || 431 best = curr;
406 !in_range(dotclock, dcf(curr))) 432 } else if (verbose > 1)
407 return NULL; 433 printf("\n");
434 } else if (verbose > 1)
435 printf("is too small\n");
436 }
408 return best; 437 return best;
409 } 438 }
410 439
411 static void set_bpp(struct fb_var_screeninfo *p, int bpp) 440 static void set_bpp(struct fb_var_screeninfo *p, int bpp)
412 { 441 {
536 static int fb_preinit_done = 0; 565 static int fb_preinit_done = 0;
537 static int fb_works = 0; 566 static int fb_works = 0;
538 static int fb_dev_fd; 567 static int fb_dev_fd;
539 static size_t fb_size; 568 static size_t fb_size;
540 static uint8_t *frame_buffer; 569 static uint8_t *frame_buffer;
570 static uint8_t *L123123875; /* thx to .so */
541 static struct fb_fix_screeninfo fb_finfo; 571 static struct fb_fix_screeninfo fb_finfo;
542 static struct fb_var_screeninfo fb_orig_vinfo; 572 static struct fb_var_screeninfo fb_orig_vinfo;
543 static struct fb_var_screeninfo fb_vinfo; 573 static struct fb_var_screeninfo fb_vinfo;
544 static struct fb_cmap fb_oldcmap; 574 static struct fb_cmap fb_oldcmap;
545 static int fb_cmap_changed = 0; 575 static int fb_cmap_changed = 0;
548 static int fb_bpp; // 32: 32 24: 24 16: 16 15: 15 578 static int fb_bpp; // 32: 32 24: 24 16: 16 15: 15
549 static int fb_bpp_we_want; // 32: 32 24: 24 16: 16 15: 15 579 static int fb_bpp_we_want; // 32: 32 24: 24 16: 16 15: 15
550 static int fb_screen_width; 580 static int fb_screen_width;
551 static fb_mode_t *fb_mode = NULL; 581 static fb_mode_t *fb_mode = NULL;
552 582
553 static void (*put_frame)(void);
554 static int left_band_width; 583 static int left_band_width;
555 static int right_band_width; 584 static int right_band_width;
556 static int upper_band_height; 585 static int upper_band_height;
557 static int lower_band_height; 586 static int lower_band_height;
558 static uint8_t *next_frame; 587 static uint8_t *next_frame;
671 err_out: 700 err_out:
672 fb_preinit_done = 1; 701 fb_preinit_done = 1;
673 return 1; 702 return 1;
674 } 703 }
675 704
676 static void put_frame_without_bands(void); 705 static void clear_bg(void)
677 static void put_frame_with_bands(void); 706 {
707 int i, offset = 0;
708
709 for (i = 0; i < out_height; i++, offset += fb_screen_width)
710 memset(frame_buffer + offset, 0x0, out_width * fb_pixel_size);
711 }
678 712
679 static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, 713 static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width,
680 uint32_t d_height, uint32_t fullscreen, char *title, 714 uint32_t d_height, uint32_t fullscreen, char *title,
681 uint32_t format) 715 uint32_t format)
682 { 716 {
738 monitor_hfreq, monitor_vfreq, 772 monitor_hfreq, monitor_vfreq,
739 monitor_dotclock))) { 773 monitor_dotclock))) {
740 printf(FBDEV "can't find best video mode\n"); 774 printf(FBDEV "can't find best video mode\n");
741 return 1; 775 return 1;
742 } 776 }
777 printf(FBDEV "using mode %dx%d @ %.1fHz\n", fb_mode->xres,
778 fb_mode->yres, vsf(fb_mode));
743 fb_mode2fb_vinfo(fb_mode, &fb_vinfo); 779 fb_mode2fb_vinfo(fb_mode, &fb_vinfo);
744 } 780 }
745 fb_bpp_we_want = fb_bpp; 781 fb_bpp_we_want = fb_bpp;
746 set_bpp(&fb_vinfo, fb_bpp); 782 set_bpp(&fb_vinfo, fb_bpp);
747 fb_vinfo.xres_virtual = fb_vinfo.xres; 783 fb_vinfo.xres_virtual = fb_vinfo.xres;
756 return 1; 792 return 1;
757 } 793 }
758 794
759 if (verbose > 0) { 795 if (verbose > 0) {
760 printf(FBDEV "var info:\n"); 796 printf(FBDEV "var info:\n");
761 printf(FBDEV "xres: %ul\n", fb_vinfo.xres); 797 printf(FBDEV "xres: %u\n", fb_vinfo.xres);
762 printf(FBDEV "yres: %ul\n", fb_vinfo.yres); 798 printf(FBDEV "yres: %u\n", fb_vinfo.yres);
763 printf(FBDEV "xres_virtual: %ul\n", fb_vinfo.xres_virtual); 799 printf(FBDEV "xres_virtual: %u\n", fb_vinfo.xres_virtual);
764 printf(FBDEV "yres_virtual: %ul\n", fb_vinfo.yres_virtual); 800 printf(FBDEV "yres_virtual: %u\n", fb_vinfo.yres_virtual);
765 printf(FBDEV "xoffset: %ul\n", fb_vinfo.xoffset); 801 printf(FBDEV "xoffset: %u\n", fb_vinfo.xoffset);
766 printf(FBDEV "yoffset: %ul\n", fb_vinfo.yoffset); 802 printf(FBDEV "yoffset: %u\n", fb_vinfo.yoffset);
767 printf(FBDEV "bits_per_pixel: %ul\n", fb_vinfo.bits_per_pixel); 803 printf(FBDEV "bits_per_pixel: %u\n", fb_vinfo.bits_per_pixel);
768 printf(FBDEV "grayscale: %ul\n", fb_vinfo.grayscale); 804 printf(FBDEV "grayscale: %u\n", fb_vinfo.grayscale);
769 printf(FBDEV "red: %lu %lu %lu\n", 805 printf(FBDEV "red: %lu %lu %lu\n",
770 (unsigned long) fb_vinfo.red.offset, 806 (unsigned long) fb_vinfo.red.offset,
771 (unsigned long) fb_vinfo.red.length, 807 (unsigned long) fb_vinfo.red.length,
772 (unsigned long) fb_vinfo.red.msb_right); 808 (unsigned long) fb_vinfo.red.msb_right);
773 printf(FBDEV "green: %lu %lu %lu\n", 809 printf(FBDEV "green: %lu %lu %lu\n",
780 (unsigned long) fb_vinfo.blue.msb_right); 816 (unsigned long) fb_vinfo.blue.msb_right);
781 printf(FBDEV "transp: %lu %lu %lu\n", 817 printf(FBDEV "transp: %lu %lu %lu\n",
782 (unsigned long) fb_vinfo.transp.offset, 818 (unsigned long) fb_vinfo.transp.offset,
783 (unsigned long) fb_vinfo.transp.length, 819 (unsigned long) fb_vinfo.transp.length,
784 (unsigned long) fb_vinfo.transp.msb_right); 820 (unsigned long) fb_vinfo.transp.msb_right);
785 printf(FBDEV "nonstd: %ul\n", fb_vinfo.nonstd); 821 printf(FBDEV "nonstd: %u\n", fb_vinfo.nonstd);
786 if (verbose > 1) { 822 if (verbose > 1) {
787 printf(FBDEV "activate: %ul\n", fb_vinfo.activate); 823 printf(FBDEV "activate: %u\n", fb_vinfo.activate);
788 printf(FBDEV "height: %ul\n", fb_vinfo.height); 824 printf(FBDEV "height: %u\n", fb_vinfo.height);
789 printf(FBDEV "width: %ul\n", fb_vinfo.width); 825 printf(FBDEV "width: %u\n", fb_vinfo.width);
790 printf(FBDEV "accel_flags: %ul\n", fb_vinfo.accel_flags); 826 printf(FBDEV "accel_flags: %u\n", fb_vinfo.accel_flags);
791 printf(FBDEV "timing:\n"); 827 printf(FBDEV "timing:\n");
792 printf(FBDEV "pixclock: %ul\n", fb_vinfo.pixclock); 828 printf(FBDEV "pixclock: %u\n", fb_vinfo.pixclock);
793 printf(FBDEV "left_margin: %ul\n", fb_vinfo.left_margin); 829 printf(FBDEV "left_margin: %u\n", fb_vinfo.left_margin);
794 printf(FBDEV "right_margin: %ul\n", fb_vinfo.right_margin); 830 printf(FBDEV "right_margin: %u\n", fb_vinfo.right_margin);
795 printf(FBDEV "upper_margin: %ul\n", fb_vinfo.upper_margin); 831 printf(FBDEV "upper_margin: %u\n", fb_vinfo.upper_margin);
796 printf(FBDEV "lower_margin: %ul\n", fb_vinfo.lower_margin); 832 printf(FBDEV "lower_margin: %u\n", fb_vinfo.lower_margin);
797 printf(FBDEV "hsync_len: %ul\n", fb_vinfo.hsync_len); 833 printf(FBDEV "hsync_len: %u\n", fb_vinfo.hsync_len);
798 printf(FBDEV "vsync_len: %ul\n", fb_vinfo.vsync_len); 834 printf(FBDEV "vsync_len: %u\n", fb_vinfo.vsync_len);
799 printf(FBDEV "sync: %ul\n", fb_vinfo.sync); 835 printf(FBDEV "sync: %u\n", fb_vinfo.sync);
800 printf(FBDEV "vmode: %ul\n", fb_vinfo.vmode); 836 printf(FBDEV "vmode: %u\n", fb_vinfo.vmode);
801 } 837 }
802 } 838 }
803 if (ioctl(fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo)) { 839 if (ioctl(fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo)) {
804 printf(FBDEV "Can't get FSCREENINFO: %s\n", strerror(errno)); 840 printf(FBDEV "Can't get FSCREENINFO: %s\n", strerror(errno));
805 return 1; 841 return 1;
808 printf(FBDEV "fix info:\n"); 844 printf(FBDEV "fix info:\n");
809 if (verbose > 1) { 845 if (verbose > 1) {
810 printf(FBDEV "id: %.16s\n", fb_finfo.id); 846 printf(FBDEV "id: %.16s\n", fb_finfo.id);
811 printf(FBDEV "smem_start: %p\n", (void *) fb_finfo.smem_start); 847 printf(FBDEV "smem_start: %p\n", (void *) fb_finfo.smem_start);
812 } 848 }
813 printf(FBDEV "framebuffer size: %d bytes\n", fb_size); 849 printf(FBDEV "framebuffer size: %d bytes\n", fb_finfo.smem_len);
814 printf(FBDEV "type: %lu\n", (unsigned long) fb_finfo.type); 850 printf(FBDEV "type: %lu\n", (unsigned long) fb_finfo.type);
815 printf(FBDEV "type_aux: %lu\n", (unsigned long) fb_finfo.type_aux); 851 printf(FBDEV "type_aux: %lu\n", (unsigned long) fb_finfo.type_aux);
816 printf(FBDEV "visual: %lu\n", (unsigned long) fb_finfo.visual); 852 printf(FBDEV "visual: %lu\n", (unsigned long) fb_finfo.visual);
817 if (verbose > 1) { 853 if (verbose > 1) {
818 printf(FBDEV "xpanstep: %u\n", fb_finfo.xpanstep); 854 printf(FBDEV "xpanstep: %u\n", fb_finfo.xpanstep);
820 printf(FBDEV "ywrapstep: %u\n", fb_finfo.ywrapstep); 856 printf(FBDEV "ywrapstep: %u\n", fb_finfo.ywrapstep);
821 } 857 }
822 printf(FBDEV "line_length: %lu bytes\n", (unsigned long) fb_finfo.line_length); 858 printf(FBDEV "line_length: %lu bytes\n", (unsigned long) fb_finfo.line_length);
823 if (verbose > 1) { 859 if (verbose > 1) {
824 printf(FBDEV "mmio_start: %p\n", (void *) fb_finfo.mmio_start); 860 printf(FBDEV "mmio_start: %p\n", (void *) fb_finfo.mmio_start);
825 printf(FBDEV "mmio_len: %ul bytes\n", fb_finfo.mmio_len); 861 printf(FBDEV "mmio_len: %u bytes\n", fb_finfo.mmio_len);
826 printf(FBDEV "accel: %ul\n", fb_finfo.accel); 862 printf(FBDEV "accel: %u\n", fb_finfo.accel);
827 } 863 }
828 } 864 }
829 switch (fb_finfo.type) { 865 switch (fb_finfo.type) {
830 case FB_TYPE_VGA_PLANES: 866 case FB_TYPE_VGA_PLANES:
831 printf(FBDEV "FB_TYPE_VGA_PLANES not supported.\n"); 867 printf(FBDEV "FB_TYPE_VGA_PLANES not supported.\n");
889 } 925 }
890 if (out_width < in_width || out_height < in_height) { 926 if (out_width < in_width || out_height < in_height) {
891 printf(FBDEV "screensize is smaller than video size\n"); 927 printf(FBDEV "screensize is smaller than video size\n");
892 return 1; 928 return 1;
893 } 929 }
894 left_band_width = (out_width - in_width) / 2;
895 right_band_width = (out_width - in_width + 1) / 2;
896 upper_band_height = (out_height - in_height) / 2;
897 lower_band_height = (out_height - in_height + 1) / 2;
898 if (left_band_width || right_band_width || upper_band_height ||
899 lower_band_height)
900 put_frame = put_frame_with_bands;
901 else
902 put_frame = put_frame_without_bands;
903 930
904 fb_pixel_size = fb_vinfo.bits_per_pixel / 8; 931 fb_pixel_size = fb_vinfo.bits_per_pixel / 8;
905 fb_real_bpp = fb_vinfo.red.length + fb_vinfo.green.length + 932 fb_real_bpp = fb_vinfo.red.length + fb_vinfo.green.length +
906 fb_vinfo.blue.length; 933 fb_vinfo.blue.length;
907 fb_bpp = (fb_pixel_size == 4) ? 32 : fb_real_bpp; 934 fb_bpp = (fb_pixel_size == 4) ? 32 : fb_real_bpp;
913 if ((frame_buffer = (uint8_t *) mmap(0, fb_size, PROT_READ | PROT_WRITE, 940 if ((frame_buffer = (uint8_t *) mmap(0, fb_size, PROT_READ | PROT_WRITE,
914 MAP_SHARED, fb_dev_fd, 0)) == (uint8_t *) -1) { 941 MAP_SHARED, fb_dev_fd, 0)) == (uint8_t *) -1) {
915 printf(FBDEV "Can't mmap %s: %s\n", fb_dev_name, strerror(errno)); 942 printf(FBDEV "Can't mmap %s: %s\n", fb_dev_name, strerror(errno));
916 return 1; 943 return 1;
917 } 944 }
945 L123123875 = frame_buffer + (out_width - in_width) * fb_pixel_size /
946 2 + (out_height - in_height) * fb_screen_width / 2;
918 947
919 if (verbose > 0) { 948 if (verbose > 0) {
920 printf(FBDEV "other:\n"); 949 printf(FBDEV "other:\n");
921 if (verbose > 1) 950 if (verbose > 1) {
922 printf(FBDEV "frame_buffer @ %p\n", frame_buffer); 951 printf(FBDEV "frame_buffer @ %p\n", frame_buffer);
952 printf(FBDEV "L123123875 @ %p\n", L123123875);
953 }
923 printf(FBDEV "fb_bpp: %d\n", fb_bpp); 954 printf(FBDEV "fb_bpp: %d\n", fb_bpp);
924 printf(FBDEV "fb_real_bpp: %d\n", fb_real_bpp); 955 printf(FBDEV "fb_real_bpp: %d\n", fb_real_bpp);
925 printf(FBDEV "fb_pixel_size: %d bytes\n", fb_pixel_size); 956 printf(FBDEV "fb_pixel_size: %d bytes\n", fb_pixel_size);
926 printf(FBDEV "pixel per line: %d\n", fb_screen_width / fb_pixel_size); 957 printf(FBDEV "pixel per line: %d\n", fb_screen_width / fb_pixel_size);
927 } 958 }
931 return 1; 962 return 1;
932 } 963 }
933 964
934 if (format == IMGFMT_YV12) 965 if (format == IMGFMT_YV12)
935 yuv2rgb_init(fb_bpp, MODE_RGB); 966 yuv2rgb_init(fb_bpp, MODE_RGB);
967 clear_bg();
936 return 0; 968 return 0;
937 } 969 }
938 970
939 static uint32_t query_format(uint32_t format) 971 static uint32_t query_format(uint32_t format)
940 { 972 {
973 int ret = 0x4; /* osd/sub supported on all bpp */
974
941 if (!fb_preinit_done) 975 if (!fb_preinit_done)
942 if (fb_preinit()) 976 if (fb_preinit())
943 return 0; 977 return 0;
944 if (!fb_works) 978 if (!fb_works)
945 return 0; 979 return 0;
946 980
947 if (verbose > 0)
948 printf(FBDEV "query_format(%#lx(%.4s))\n",(unsigned long) format,
949 (char *) &format);
950 if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR) { 981 if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR) {
951 int bpp = format & 0xff; 982 int bpp = format & 0xff;
983
952 if (bpp == fb_bpp) 984 if (bpp == fb_bpp)
953 return 1; 985 return ret|0x2;
954 else if (bpp == 15 && fb_bpp == 16) 986 else if (bpp == 15 && fb_bpp == 16)
955 return 1; 987 return ret|0x1;
956 else if (bpp == 24 && fb_bpp == 32) 988 else if (bpp == 24 && fb_bpp == 32)
957 return 1; 989 return ret|0x1;
958 } 990 }
959 if (format == IMGFMT_YV12) 991 if (format == IMGFMT_YV12)
960 return 1; 992 return ret|0x2;
961 return 0; 993 return 0;
962 } 994 }
963 995
964 static const vo_info_t *get_info(void) 996 static const vo_info_t *get_info(void)
965 { 997 {
983 unsigned char *srca, int stride) 1015 unsigned char *srca, int stride)
984 { 1016 {
985 uint8_t *dst = next_frame + (in_width * y0 + x0) * fb_pixel_size; 1017 uint8_t *dst = next_frame + (in_width * y0 + x0) * fb_pixel_size;
986 int dstride = in_width * fb_pixel_size; 1018 int dstride = in_width * fb_pixel_size;
987 1019
988 switch (fb_real_bpp) { 1020 switch (fb_bpp) {
989 case 24: 1021 case 24:
990 vo_draw_alpha_rgb24(w, h, src, srca, stride, dst, dstride); 1022 vo_draw_alpha_rgb24(w, h, src, srca, stride, dst, dstride);
991 break; 1023 break;
992 case 32: 1024 case 32:
993 vo_draw_alpha_rgb32(w, h, src, srca, stride, dst, dstride); 1025 vo_draw_alpha_rgb32(w, h, src, srca, stride, dst, dstride);
1044 1076
1045 static void check_events(void) 1077 static void check_events(void)
1046 { 1078 {
1047 } 1079 }
1048 1080
1049 static void put_frame_without_bands(void) 1081 static void put_frame(void)
1050 { 1082 {
1051 int i, out_offset = 0, in_offset = 0; 1083 int i, out_offset = 0, in_offset = 0;
1052 1084
1053 for (i = 0; i < in_height; i++) { 1085 for (i = 0; i < in_height; i++) {
1054 memcpy(frame_buffer + out_offset, next_frame + in_offset, 1086 memcpy(L123123875 + out_offset, next_frame + in_offset,
1055 in_width * fb_pixel_size); 1087 in_width * fb_pixel_size);
1056 out_offset += fb_screen_width; 1088 out_offset += fb_screen_width;
1057 in_offset += in_width * fb_pixel_size; 1089 in_offset += in_width * fb_pixel_size;
1058 } 1090 }
1059 } 1091 }
1060 1092
1061 static void put_frame_with_bands(void)
1062 {
1063 int i, out_offset = 0, in_offset = 0, w, bw, tmp;
1064
1065 if (upper_band_height) {
1066 out_offset = upper_band_height * out_width * fb_pixel_size;
1067 memset(frame_buffer, 0x00, out_offset);
1068 }
1069 if (left_band_width) {
1070 tmp = left_band_width * fb_pixel_size;
1071 memset(frame_buffer + out_offset, 0x00, tmp);
1072 out_offset += tmp;
1073 }
1074 w = in_width * fb_pixel_size;
1075 bw = (left_band_width + right_band_width) * fb_pixel_size;
1076 for (i = 0; i < in_height - 1; i++) {
1077 memcpy(frame_buffer + out_offset, next_frame + in_offset, w);
1078 if (bw)
1079 memset(frame_buffer + out_offset + w, 0x00, bw);
1080 out_offset += fb_screen_width;
1081 in_offset += w;
1082 }
1083 memcpy(frame_buffer + out_offset, next_frame + in_offset, w);
1084 out_offset += w;
1085 if (right_band_width) {
1086 tmp = right_band_width * fb_pixel_size;
1087 memset(frame_buffer + out_offset, 0x00, tmp);
1088 out_offset += tmp;
1089 }
1090 if (lower_band_height)
1091 memset(frame_buffer + out_offset, 0x00, lower_band_height *
1092 out_width * fb_pixel_size);
1093 }
1094
1095 extern void vo_draw_text(int dxs, int dys, void (*draw_alpha)(int x0, int y0, 1093 extern void vo_draw_text(int dxs, int dys, void (*draw_alpha)(int x0, int y0,
1096 int w, int h, unsigned char *src, unsigned char *srca, 1094 int w, int h, unsigned char *src, unsigned char *srca,
1097 int stride)); 1095 int stride));
1098 1096
1099 static void flip_page(void) 1097 static void flip_page(void)
1100 { 1098 {
1101 vo_draw_text(in_width, in_height, draw_alpha); 1099 vo_draw_text(in_width, in_height, draw_alpha);
1102 check_events(); 1100 check_events();
1103 (*put_frame)(); 1101 put_frame();
1104 } 1102 }
1105 1103
1106 static void uninit(void) 1104 static void uninit(void)
1107 { 1105 {
1108 if (verbose > 0) 1106 if (verbose > 0)
1110 if (fb_cmap_changed) { 1108 if (fb_cmap_changed) {
1111 if (ioctl(fb_dev_fd, FBIOPUTCMAP, &fb_oldcmap)) 1109 if (ioctl(fb_dev_fd, FBIOPUTCMAP, &fb_oldcmap))
1112 printf(FBDEV "Can't restore original cmap\n"); 1110 printf(FBDEV "Can't restore original cmap\n");
1113 fb_cmap_changed = 0; 1111 fb_cmap_changed = 0;
1114 } 1112 }
1115 // memset(next_frame, '\0', in_height * in_width * fb_pixel_size);
1116 // put_frame();
1117 free(next_frame); 1113 free(next_frame);
1118 if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo)) 1114 if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo))
1119 printf(FBDEV "ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno)); 1115 printf(FBDEV "ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno));
1120 fb_orig_vinfo.xoffset = fb_vinfo.xoffset; 1116 fb_orig_vinfo.xoffset = fb_vinfo.xoffset;
1121 fb_orig_vinfo.yoffset = fb_vinfo.yoffset; 1117 fb_orig_vinfo.yoffset = fb_vinfo.yoffset;