From owner-freebsd-stable Tue Mar 9 3:50:57 1999 Delivered-To: freebsd-stable@freebsd.org Received: from outmail.utsunomiya-u.ac.jp (outmail.utsunomiya-u.ac.jp [160.12.196.3]) by hub.freebsd.org (Postfix) with ESMTP id 3122414E70 for ; Tue, 9 Mar 1999 03:50:42 -0800 (PST) (envelope-from yokota@zodiac.mech.utsunomiya-u.ac.jp) Received: from zodiac.mech.utsunomiya-u.ac.jp (IDENT:6dxIufw4SRmHQQXHBEAW7vn/EcIN9fyc@zodiac.mech.utsunomiya-u.ac.jp [160.12.42.1]) by outmail.utsunomiya-u.ac.jp (8.9.1/8.9.1) with ESMTP id UAA26327; Tue, 9 Mar 1999 20:50:10 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp (zodiac.mech.utsunomiya-u.ac.jp [160.12.42.1]) by zodiac.mech.utsunomiya-u.ac.jp (8.7.6+2.6Wbeta7/3.4W/zodiac-May96) with ESMTP id UAA13236; Tue, 9 Mar 1999 20:53:22 +0900 (JST) Message-Id: <199903091153.UAA13236@zodiac.mech.utsunomiya-u.ac.jp> To: Charles Quarri Cc: freebsd stable , yokota@zodiac.mech.utsunomiya-u.ac.jp Subject: Re: Color messed up for splash screen In-reply-to: Your message of "Tue, 09 Mar 1999 01:01:00 EST." References: Date: Tue, 09 Mar 1999 20:53:21 +0900 From: Kazutaka YOKOTA Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >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