comparison libvo/vo_fbdev.c @ 481:6e8a887c99cd

cmap bug fixed (I think)
author szabii
date Mon, 16 Apr 2001 22:27:32 +0000
parents 1302e63cee73
children 4aa16f9ff929
comparison
equal deleted inserted replaced
480:787f2792beeb 481:6e8a887c99cd
539 static size_t fb_size; 539 static size_t fb_size;
540 static uint8_t *frame_buffer; 540 static uint8_t *frame_buffer;
541 static struct fb_fix_screeninfo fb_finfo; 541 static struct fb_fix_screeninfo fb_finfo;
542 static struct fb_var_screeninfo fb_orig_vinfo; 542 static struct fb_var_screeninfo fb_orig_vinfo;
543 static struct fb_var_screeninfo fb_vinfo; 543 static struct fb_var_screeninfo fb_vinfo;
544 static struct fb_cmap *fb_oldcmap = NULL; 544 static struct fb_cmap fb_oldcmap;
545 static int fb_cmap_changed = 0;
545 static int fb_pixel_size; // 32: 4 24: 3 16: 2 15: 2 546 static int fb_pixel_size; // 32: 4 24: 3 16: 2 15: 2
546 static int fb_real_bpp; // 32: 24 24: 24 16: 16 15: 15 547 static int fb_real_bpp; // 32: 24 24: 24 16: 16 15: 15
547 static int fb_bpp; // 32: 32 24: 24 16: 16 15: 15 548 static int fb_bpp; // 32: 32 24: 24 16: 16 15: 15
548 static int fb_bpp_we_want; // 32: 32 24: 24 16: 16 15: 15 549 static int fb_bpp_we_want; // 32: 32 24: 24 16: 16 15: 15
549 static int fb_screen_width; 550 static int fb_screen_width;
853 case FB_VISUAL_TRUECOLOR: 854 case FB_VISUAL_TRUECOLOR:
854 break; 855 break;
855 case FB_VISUAL_DIRECTCOLOR: 856 case FB_VISUAL_DIRECTCOLOR:
856 if (verbose > 0) 857 if (verbose > 0)
857 printf(FBDEV "creating cmap for directcolor\n"); 858 printf(FBDEV "creating cmap for directcolor\n");
858 if (ioctl(fb_dev_fd, FBIOGETCMAP, fb_oldcmap)) { 859 if (ioctl(fb_dev_fd, FBIOGETCMAP, &fb_oldcmap)) {
859 printf(FBDEV "can't get cmap: %s\n", 860 printf(FBDEV "can't get cmap: %s\n",
860 strerror(errno)); 861 strerror(errno));
861 return 1; 862 return 1;
862 } 863 }
863 if (!(cmap = make_directcolor_cmap(&fb_vinfo))) 864 if (!(cmap = make_directcolor_cmap(&fb_vinfo)))
865 if (ioctl(fb_dev_fd, FBIOPUTCMAP, cmap)) { 866 if (ioctl(fb_dev_fd, FBIOPUTCMAP, cmap)) {
866 printf(FBDEV "can't put cmap: %s\n", 867 printf(FBDEV "can't put cmap: %s\n",
867 strerror(errno)); 868 strerror(errno));
868 return 1; 869 return 1;
869 } 870 }
871 fb_cmap_changed = 1;
870 free(cmap->red); 872 free(cmap->red);
871 free(cmap->green); 873 free(cmap->green);
872 free(cmap->blue); 874 free(cmap->blue);
873 free(cmap); 875 free(cmap);
874 break; 876 break;
1103 1105
1104 static void uninit(void) 1106 static void uninit(void)
1105 { 1107 {
1106 if (verbose > 0) 1108 if (verbose > 0)
1107 printf(FBDEV "uninit\n"); 1109 printf(FBDEV "uninit\n");
1108 if (fb_oldcmap) { 1110 if (fb_cmap_changed) {
1109 if (ioctl(fb_dev_fd, FBIOPUTCMAP, fb_oldcmap)) 1111 if (ioctl(fb_dev_fd, FBIOPUTCMAP, &fb_oldcmap))
1110 printf(FBDEV "Can't restore original cmap\n"); 1112 printf(FBDEV "Can't restore original cmap\n");
1111 fb_oldcmap = NULL; 1113 fb_cmap_changed = 0;
1112 } 1114 }
1113 if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo)) 1115 if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo))
1114 printf(FBDEV "Can't set virtual screensize to original value: %s\n", strerror(errno)); 1116 printf(FBDEV "Can't set virtual screensize to original value: %s\n", strerror(errno));
1115 close(fb_dev_fd); 1117 close(fb_dev_fd);
1116 memset(next_frame, '\0', in_height * in_width * fb_pixel_size); 1118 memset(next_frame, '\0', in_height * in_width * fb_pixel_size);