Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Mar 1999 20:53:21 +0900
From:      Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
To:        Charles Quarri <randy@hackerz.org>
Cc:        freebsd stable <freebsd-stable@freebsd.org>, yokota@zodiac.mech.utsunomiya-u.ac.jp
Subject:   Re: Color messed up for splash screen 
Message-ID:  <199903091153.UAA13236@zodiac.mech.utsunomiya-u.ac.jp>
In-Reply-To: Your message of "Tue, 09 Mar 1999 01:01:00 EST." <Pine.BSF.4.02A.9903090057320.13165-100000@hackerz.org> 
References:  <Pine.BSF.4.02A.9903090057320.13165-100000@hackerz.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
>I have been trying to put together a splash screen for my box using
>gimp to generate the image.  I am using the vesa module to get a
>800x600 image, but all the colors are messed up, though the image
>displays fine.  Any ideas of what I am doing wrong?

The vesa module is suffering from incorrect palette colors lately :-<
And I am debugging it.

Would you apply the following patch to /sys/i386/isa/vesa.c, rebuild
and install the vesa module?

The patch will comment out problematic code.

Kazu

Index: vesa.c
===================================================================
RCS file: /src/CVS/src/sys/i386/isa/vesa.c,v
retrieving revision 1.18
diff -u -r1.18 vesa.c
--- vesa.c	1999/02/20 03:05:37	1.18
+++ vesa.c	1999/03/09 10:35:26
@@ -151,6 +151,7 @@
 static int int10_set_mode(int mode);
 static int vesa_bios_get_mode(int mode, struct vesa_mode *vmode);
 static int vesa_bios_set_mode(int mode);
+static int vesa_bios_get_dac(void);
 static int vesa_bios_set_dac(int bits);
 static int vesa_bios_save_palette(int start, int colors, u_char *palette,
 				  int bits);
@@ -233,6 +234,21 @@
 }
 
 static int
+vesa_bios_get_dac(void)
+{
+	struct vm86frame vmf;
+	int err;
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f08;
+	vmf.vmf_ebx = 1;	/* get DAC width */
+	err = vm86_intcall(0x10, &vmf);
+	if ((err != 0) || (vmf.vmf_eax != 0x4f))
+		return 6;	/* XXX */
+	return ((vmf.vmf_ebx >> 8) & 0x00ff);
+}
+
+static int
 vesa_bios_set_dac(int bits)
 {
 	struct vm86frame vmf;
@@ -832,16 +848,20 @@
 static int
 vesa_save_palette(video_adapter_t *adp, u_char *palette)
 {
+#if notyet
 	int bits;
 	int error;
 
-	if ((adp == vesa_adp) && (vesa_adp_info->v_flags & V_DAC8) 
-	    && ((bits = vesa_bios_set_dac(8)) > 6)) {
+	bits = 6;
+	if ((adp == vesa_adp) && (vesa_adp_info->v_flags & V_DAC8)
+	    && VESA_MODE(adp->va_mode)) {
+		bits = vesa_bios_get_dac();
 		error = vesa_bios_save_palette(0, 256, palette, bits);
-		vesa_bios_set_dac(6);
 		if (error == 0)
 			return 0;
+		bits = vesa_bios_set_dac(6);
 	}
+#endif /* notyet */
 
 	return (*prevvidsw->save_palette)(adp, palette);
 }
@@ -849,16 +869,19 @@
 static int
 vesa_load_palette(video_adapter_t *adp, u_char *palette)
 {
+#if notyet
 	int bits;
 	int error;
 
+	bits = 6;
 	if ((adp == vesa_adp) && (vesa_adp_info->v_flags & V_DAC8) 
-	    && ((bits = vesa_bios_set_dac(8)) > 6)) {
+	    && VESA_MODE(adp->va_mode) && ((bits = vesa_bios_set_dac(8)) > 6)) {
 		error = vesa_bios_load_palette(0, 256, palette, bits);
-		vesa_bios_set_dac(6);
 		if (error == 0)
 			return 0;
+		bits = vesa_bios_set_dac(6);
 	}
+#endif /* notyet */
 
 	return (*prevvidsw->load_palette)(adp, palette);
 }
@@ -1069,7 +1092,9 @@
 static int
 vesa_unload(void)
 {
+	u_char palette[256*3];
 	int error;
+	int bits;
 	int s;
 
 	/* if the adapter is currently in a VESA mode, don't unload */
@@ -1083,8 +1108,16 @@
 	s = spltty();
 	if ((error = vesa_unload_ioctl()) == 0) {
 		if (vesa_adp != NULL) {
-			if (vesa_adp_info->v_flags & V_DAC8) 
-				vesa_bios_set_dac(6);
+			if (vesa_adp_info->v_flags & V_DAC8)  {
+				bits = vesa_bios_get_dac();
+				if (bits > 6) {
+					vesa_bios_save_palette(0, 256,
+							       palette, bits);
+					vesa_bios_set_dac(6);
+					vesa_bios_load_palette(0, 256,
+							       palette, 6);
+				}
+			}
 			vesa_adp->va_flags &= ~V_ADP_VESA;
 			vidsw[vesa_adp->va_index] = prevvidsw;
 		}


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903091153.UAA13236>