Date: Sat, 16 Jan 1999 01:40:02 -0800 (PST) From: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> To: freebsd-bugs@FreeBSD.ORG Subject: Re: kern/9521: console become yellow after running X Message-ID: <199901160940.BAA23708@freefall.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR kern/9521; it has been noted by GNATS.
From: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
To: ijliao@terry.dorm10.nctu.edu.tw
Cc: FreeBSD-gnats-submit@freebsd.org, yokota@zodiac.mech.utsunomiya-u.ac.jp
Subject: Re: kern/9521: console become yellow after running X
Date: Sat, 16 Jan 1999 18:32:09 +0900
>>Number: 9521
>>Category: kern
>>Synopsis: console become yellow after running X
[...]
>>Originator: Ying-Chieh Liao
>>Release: FreeBSD 3.0-CURRENT i386
>>Organization:
>NCTU CSIE
>>Environment:
>
>FreeBSD Terry.Dorm10.NCTU.edu.tw 3.0-CURRENT FreeBSD 3.0-CURRENT #1: Sat Jan 1
>6
>01:53:53 CST 1999 root@Terry.Dorm10.NCTU.edu.tw:/usr/src/sys/compile/TERRY
>i386
[...]
>>Description:
>
>it's ok while booting up
>but after i use X and press Ctrl-Alt-F1 to switch to ttyv0, it becomes
>yellow...and i can't see any blue words
Apply the following patch to /sys/i386/isa/vesa.c and rebuild the kernel
and /sys/modules/vesa.
Please report if it works for you.
Kazu
yokota@FreeBSD.ORG
Index: vesa.c
===================================================================
RCS file: /src/CVS/src/sys/i386/isa/vesa.c,v
retrieving revision 1.13
diff -u -r1.13 vesa.c
--- vesa.c 1999/01/13 01:16:39 1.13
+++ vesa.c 1999/01/15 07:42:34
@@ -152,8 +152,10 @@
static int vesa_bios_get_mode(int mode, struct vesa_mode *vmode);
static int vesa_bios_set_mode(int mode);
static int vesa_bios_set_dac(int bits);
-static int vesa_bios_save_palette(int start, int colors, u_char *palette);
-static int vesa_bios_load_palette(int start, int colors, u_char *palette);
+static int vesa_bios_save_palette(int start, int colors, u_char *palette,
+ int bits);
+static int vesa_bios_load_palette(int start, int colors, u_char *palette,
+ int bits);
#define STATE_SIZE 0
#define STATE_SAVE 1
#define STATE_LOAD 2
@@ -239,11 +241,13 @@
vmf.vmf_eax = 0x4f08;
vmf.vmf_ebx = (bits << 8);
err = vm86_intcall(0x10, &vmf);
- return ((err != 0) || (vmf.vmf_eax != 0x4f));
+ if ((err != 0) || (vmf.vmf_eax != 0x4f))
+ return 6; /* XXX */
+ return ((vmf.vmf_ebx >> 8) & 0x00ff);
}
static int
-vesa_bios_save_palette(int start, int colors, u_char *palette)
+vesa_bios_save_palette(int start, int colors, u_char *palette, int bits)
{
struct vm86frame vmf;
u_char *p;
@@ -263,17 +267,18 @@
return 1;
}
+ bits = 8 - bits;
for (i = 0; i < colors; ++i) {
- palette[i*3] = p[i*4 + 1];
- palette[i*3 + 1] = p[i*4 + 2];
- palette[i*3 + 2] = p[i*4 + 3];
+ palette[i*3] = p[i*4 + 2] << bits;
+ palette[i*3 + 1] = p[i*4 + 1] << bits;
+ palette[i*3 + 2] = p[i*4] << bits;
}
free(p, M_DEVBUF);
return 0;
}
static int
-vesa_bios_load_palette(int start, int colors, u_char *palette)
+vesa_bios_load_palette(int start, int colors, u_char *palette, int bits)
{
struct vm86frame vmf;
u_char *p;
@@ -281,11 +286,12 @@
int i;
p = malloc(colors*4, M_DEVBUF, M_WAITOK);
+ bits = 8 - bits;
for (i = 0; i < colors; ++i) {
- p[i*4] = 0;
- p[i*4 + 1] = palette[i*3];
- p[i*4 + 2] = palette[i*3 + 1];
- p[i*4 + 3] = palette[i*3 + 2];
+ p[i*4] = palette[i*3 + 2] >> bits;
+ p[i*4 + 1] = palette[i*3 + 1] >> bits;
+ p[i*4 + 2] = palette[i*3] >> bits;
+ p[i*4 + 3] = 0;
}
bzero(&vmf, sizeof(vmf));
@@ -779,21 +785,35 @@
static int
vesa_save_palette(video_adapter_t *adp, u_char *palette)
{
- if ((adp != vesa_adp) || !(vesa_adp_info->v_flags & V_DAC8)
- || vesa_bios_set_dac(8))
- return (*prevvidsw->save_palette)(adp, palette);
+ int bits;
+ int error;
+
+ if ((adp == vesa_adp) && (vesa_adp_info->v_flags & V_DAC8)
+ && ((bits = vesa_bios_set_dac(8)) > 6)) {
+ error = vesa_bios_save_palette(0, 256, palette, bits);
+ if (error == 0)
+ return 0
+ vesa_bios_set_dac(6);
+ }
- return vesa_bios_save_palette(0, 256, palette);
+ return (*prevvidsw->save_palette)(adp, palette);
}
static int
vesa_load_palette(video_adapter_t *adp, u_char *palette)
{
- if ((adp != vesa_adp) || !(vesa_adp_info->v_flags & V_DAC8)
- || vesa_bios_set_dac(8))
- return (*prevvidsw->load_palette)(adp, palette);
+ int bits;
+ int error;
+
+ if ((adp == vesa_adp) && (vesa_adp_info->v_flags & V_DAC8)
+ && ((bits = vesa_bios_set_dac(8)) > 6)) {
+ error = vesa_bios_load_palette(0, 256, palette, bits);
+ if (error == 0)
+ return 0
+ vesa_bios_set_dac(6);
+ }
- return vesa_bios_load_palette(0, 256, palette);
+ return (*prevvidsw->load_palette)(adp, palette);
}
static int
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901160940.BAA23708>
