comparison libvo/vo_fbdev.c @ 804:c3fad5e1698e

flip support if (screen depth == frame depth)
author szabii
date Mon, 14 May 2001 22:40:08 +0000
parents 121cb2047c08
children 83919c1b9924
comparison
equal deleted inserted replaced
803:b25a887b6054 804:c3fad5e1698e
586 static int in_width; 586 static int in_width;
587 static int in_height; 587 static int in_height;
588 static int out_width; 588 static int out_width;
589 static int out_height; 589 static int out_height;
590 static uint32_t pixel_format; 590 static uint32_t pixel_format;
591 static int fs;
592 static int flip;
591 593
592 /* 594 /*
593 * Note: this function is completely cut'n'pasted from 595 * Note: this function is completely cut'n'pasted from
594 * Chris Lawrence's code. 596 * Chris Lawrence's code.
595 * (modified a bit to fit in my code...) 597 * (modified a bit to fit in my code...)
702 err_out: 704 err_out:
703 fb_preinit_done = 1; 705 fb_preinit_done = 1;
704 return 1; 706 return 1;
705 } 707 }
706 708
707 static void clear_bg(void)
708 {
709 int i, offset = 0;
710
711 for (i = 0; i < out_height; i++, offset += fb_screen_width)
712 memset(frame_buffer + offset, 0x0, out_width * fb_pixel_size);
713 }
714
715 static void lots_of_printf(void) 709 static void lots_of_printf(void)
716 { 710 {
717 if (verbose > 0) { 711 if (verbose > 0) {
718 printf(FBDEV "var info:\n"); 712 printf(FBDEV "var info:\n");
719 printf(FBDEV "xres: %u\n", fb_vinfo.xres); 713 printf(FBDEV "xres: %u\n", fb_vinfo.xres);
781 uint32_t format) 775 uint32_t format)
782 { 776 {
783 #define FS (fullscreen & 0x01) 777 #define FS (fullscreen & 0x01)
784 #define VM (fullscreen & 0x02) 778 #define VM (fullscreen & 0x02)
785 #define ZOOM (fullscreen & 0x04) 779 #define ZOOM (fullscreen & 0x04)
780 #define FLIP (fullscreen & 0x08)
786 781
787 struct fb_cmap *cmap; 782 struct fb_cmap *cmap;
788 783
784 fs = FS;
789 if (!fb_preinit_done) 785 if (!fb_preinit_done)
790 if (fb_preinit()) 786 if (fb_preinit())
791 return 1; 787 return 1;
792 if (!fb_works) 788 if (!fb_works)
793 return 1; 789 return 1;
794 790
791 flip = FLIP;
792
795 if (ZOOM) { 793 if (ZOOM) {
796 printf(FBDEV "-zoom is not supported\n"); 794 printf(FBDEV "-zoom is not supported\n");
797 return 1; 795 return 1;
798 } 796 }
799 if (fb_mode_name && !VM) { 797 if (fb_mode_name && !VM) {
802 return 1; 800 return 1;
803 } 801 }
804 if (VM) 802 if (VM)
805 if (parse_fbmode_cfg(fb_mode_cfgfile) < 0) 803 if (parse_fbmode_cfg(fb_mode_cfgfile) < 0)
806 return 1; 804 return 1;
807 #if 0 805 if (d_width && (fs || VM)) {
808 if ((!d_width + !d_height) == 1) {
809 printf(FBDEV "use both -x and -y, or none of them\n");
810 return 1;
811 }
812 #endif
813 if (d_width) {
814 out_width = d_width; 806 out_width = d_width;
815 out_height = d_height; 807 out_height = d_height;
816 } else { 808 } else {
817 out_width = width; 809 out_width = width;
818 out_height = height; 810 out_height = height;
889 free(cmap->red); 881 free(cmap->red);
890 free(cmap->green); 882 free(cmap->green);
891 free(cmap->blue); 883 free(cmap->blue);
892 free(cmap); 884 free(cmap);
893 break; 885 break;
894 // case FB_VISUAL_PSEUDOCOLOR:
895 // printf(FBDEV "visual is FB_VISUAL_PSEUDOCOLOR."
896 // "it's not tested!\n");
897 // break;
898 default: 886 default:
899 printf(FBDEV "visual: %d not yet supported\n", 887 printf(FBDEV "visual: %d not yet supported\n",
900 fb_finfo.visual); 888 fb_finfo.visual);
901 return 1; 889 return 1;
902 } 890 }
903 891
904 if (FS || (d_width && VM)) { 892 if (VM || fs) {
905 out_width = fb_vinfo.xres; 893 out_width = fb_vinfo.xres;
906 out_height = fb_vinfo.yres; 894 out_height = fb_vinfo.yres;
907 } 895 }
908 if (out_width < in_width || out_height < in_height) { 896 if (out_width < in_width || out_height < in_height) {
909 printf(FBDEV "screensize is smaller than video size\n"); 897 printf(FBDEV "screensize is smaller than video size\n");
959 if (!(next_frame = (uint8_t *) malloc(in_width * in_height * fb_pixel_size))) { 947 if (!(next_frame = (uint8_t *) malloc(in_width * in_height * fb_pixel_size))) {
960 printf(FBDEV "Can't malloc next_frame: %s\n", strerror(errno)); 948 printf(FBDEV "Can't malloc next_frame: %s\n", strerror(errno));
961 return 1; 949 return 1;
962 } 950 }
963 951
952 if (flip & (((pixel_format & 0xff) + 7) / 8) != fb_pixel_size) {
953 printf(FBDEV "Flipped output with depth conversion is not "
954 "supported\n");
955 return 1;
956 }
964 if (format == IMGFMT_YV12) 957 if (format == IMGFMT_YV12)
965 yuv2rgb_init(fb_bpp, MODE_RGB); 958 yuv2rgb_init(fb_bpp, MODE_RGB);
966 clear_bg();
967 return 0; 959 return 0;
968 } 960 }
969 961
970 static uint32_t query_format(uint32_t format) 962 static uint32_t query_format(uint32_t format)
971 { 963 {
1010 { 1002 {
1011 if (pixel_format == IMGFMT_YV12) { 1003 if (pixel_format == IMGFMT_YV12) {
1012 yuv2rgb(next_frame, src[0], src[1], src[2], in_width, 1004 yuv2rgb(next_frame, src[0], src[1], src[2], in_width,
1013 in_height, in_width * fb_pixel_size, 1005 in_height, in_width * fb_pixel_size,
1014 in_width, in_width / 2); 1006 in_width, in_width / 2);
1007 } else if (flip) {
1008 int h = in_height;
1009 int len = in_width * fb_pixel_size;
1010 char *d = next_frame + (in_height - 1) * len;
1011 char *s = src[0];
1012 while (h--) {
1013 memcpy(d, s, len);
1014 s += len;
1015 d -= len;
1016 }
1015 } else { 1017 } else {
1016 int sbpp = ((pixel_format & 0xff) + 7) / 8; 1018 int sbpp = ((pixel_format & 0xff) + 7) / 8;
1017 char *d = next_frame; 1019 char *d = next_frame;
1018 char *s = src[0]; 1020 char *s = src[0];
1019 if (sbpp == fb_pixel_size) { 1021 if (sbpp == fb_pixel_size) {