changeset 481:6e8a887c99cd

cmap bug fixed (I think)
author szabii
date Mon, 16 Apr 2001 22:27:32 +0000
parents 787f2792beeb
children 1a2c4f3e7a10
files libvo/vo_fbdev.c
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_fbdev.c	Mon Apr 16 22:13:12 2001 +0000
+++ b/libvo/vo_fbdev.c	Mon Apr 16 22:27:32 2001 +0000
@@ -541,7 +541,8 @@
 static struct fb_fix_screeninfo fb_finfo;
 static struct fb_var_screeninfo fb_orig_vinfo;
 static struct fb_var_screeninfo fb_vinfo;
-static struct fb_cmap *fb_oldcmap = NULL;
+static struct fb_cmap fb_oldcmap;
+static int fb_cmap_changed = 0;
 static int fb_pixel_size;	// 32:  4  24:  3  16:  2  15:  2
 static int fb_real_bpp;		// 32: 24  24: 24  16: 16  15: 15
 static int fb_bpp;		// 32: 32  24: 24  16: 16  15: 15
@@ -855,7 +856,7 @@
 		case FB_VISUAL_DIRECTCOLOR:
 			if (verbose > 0)
 				printf(FBDEV "creating cmap for directcolor\n");
-			if (ioctl(fb_dev_fd, FBIOGETCMAP, fb_oldcmap)) {
+			if (ioctl(fb_dev_fd, FBIOGETCMAP, &fb_oldcmap)) {
 				printf(FBDEV "can't get cmap: %s\n",
 						strerror(errno));
 				return 1;
@@ -867,6 +868,7 @@
 						strerror(errno));
 				return 1;
 			}
+			fb_cmap_changed = 1;
 			free(cmap->red);
 			free(cmap->green);
 			free(cmap->blue);
@@ -1105,10 +1107,10 @@
 {
 	if (verbose > 0)
 		printf(FBDEV "uninit\n");
-	if (fb_oldcmap) {
-		if (ioctl(fb_dev_fd, FBIOPUTCMAP, fb_oldcmap))
+	if (fb_cmap_changed) {
+		if (ioctl(fb_dev_fd, FBIOPUTCMAP, &fb_oldcmap))
 			printf(FBDEV "Can't restore original cmap\n");
-		fb_oldcmap = NULL;
+		fb_cmap_changed = 0;
 	}
 	if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo))
 		printf(FBDEV "Can't set virtual screensize to original value: %s\n", strerror(errno));