Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jan 2010 14:16:49 -0500
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        Alexey Dokuchaev <danfe@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, Dag-Erling Sm??rgrav <des@des.no>, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r198858 - in head/sys: dev/fb dev/syscons sys
Message-ID:  <201001261417.06116.jkim@FreeBSD.org>
In-Reply-To: <20100126153027.GA65470@FreeBSD.org>
References:  <200911032022.nA3KM96H003434@svn.freebsd.org> <86aaw0kjko.fsf@ds4.des.no> <20100126153027.GA65470@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Boundary-00=_y+zXLB2u5Sm4pdb
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Tuesday 26 January 2010 10:30 am, Alexey Dokuchaev wrote:
> On Tue, Jan 26, 2010 at 03:49:11PM +0100, Dag-Erling Sm??rgrav 
wrote:
> > Alexey Dokuchaev <danfe@FreeBSD.org> writes:
> > > Considering number of recent vesa/saver breaks, I am thinking
> > > about some regression test suit that could at least check for
> > > "8-bit vs. 6-bit" type of things.  Is it feasible?
> >
> > Not unless you can figure our a way to programmatically look at
> > the screen and check that the colors aren't too dark...  IIUC,
> > this is a BIOS issue, not a driver issue.
>
> I understand; I was thinking if maybe there are some "hackish" or
> indirect way to tell that BIOS is lying.

Probably you mean something like the attached patch?   Basically, with 
this patch, we ignore the VGA compatibility flag if the DAC mode is 
higher than 6-bit.  Let me know if it works for you.

Jung-uk Kim

--Boundary-00=_y+zXLB2u5Sm4pdb
Content-Type: text/plain;
  charset="iso-8859-1";
  name="vesa.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="vesa.diff"

--- sys/dev/fb/vesa.c
+++ sys/dev/fb/vesa.c
@@ -1367,10 +1367,11 @@ vesa_save_palette(video_adapter_t *adp, u_char *pa
 {
 	int bits;
 
-	if ((adp == vesa_adp) &&
-	    (adp->va_info.vi_flags & V_INFO_NONVGA) != 0 &&
-	    (bits = vesa_bios_get_dac()) >= 6)
-		return (vesa_bios_save_palette(0, 256, palette, bits));
+	if (adp == vesa_adp && VESA_MODE(adp->va_mode)) {
+		bits = vesa_bios_get_dac();
+		if ((adp->va_info.vi_flags & V_INFO_NONVGA) != 0 || bits > 6)
+			return (vesa_bios_save_palette(0, 256, palette, bits));
+	}
 
 	return ((*prevvidsw->save_palette)(adp, palette));
 }
@@ -1380,10 +1381,11 @@ vesa_load_palette(video_adapter_t *adp, u_char *pa
 {
 	int bits;
 
-	if ((adp == vesa_adp) &&
-	    (adp->va_info.vi_flags & V_INFO_NONVGA) != 0 &&
-	    (bits = vesa_bios_get_dac()) >= 6)
-		return (vesa_bios_load_palette(0, 256, palette, bits));
+	if (adp == vesa_adp && VESA_MODE(adp->va_mode)) {
+		bits = vesa_bios_get_dac();
+		if ((adp->va_info.vi_flags & V_INFO_NONVGA) != 0 || bits > 6)
+			return (vesa_bios_load_palette(0, 256, palette, bits));
+	}
 
 	return ((*prevvidsw->load_palette)(adp, palette));
 }
@@ -1581,13 +1583,15 @@ get_palette(video_adapter_t *adp, int base, int co
 	int bits;
 	int error;
 
-	if ((base < 0) || (base >= 256) || (count < 0) || (count > 256))
+	if (base < 0 || base >= 256 || count < 0 || count > 256)
 		return (1);
 	if ((base + count) > 256)
 		return (1);
-	if ((adp->va_info.vi_flags & V_INFO_NONVGA) == 0 ||
-	    (bits = vesa_bios_get_dac()) < 6)
+	if (!VESA_MODE(adp->va_mode))
 		return (1);
+	bits = vesa_bios_get_dac();
+	if ((adp->va_info.vi_flags & V_INFO_NONVGA) == 0 && bits <= 6)
+		return (1);
 
 	r = malloc(count * 3, M_DEVBUF, M_WAITOK);
 	g = r + count;
@@ -1617,11 +1621,15 @@ set_palette(video_adapter_t *adp, int base, int co
 	int bits;
 	int error;
 
-	if ((base < 0) || (base >= 256) || (base + count > 256))
+	if (base < 0 || base >= 256 || count < 0 || count > 256)
 		return (1);
-	if ((adp->va_info.vi_flags & V_INFO_NONVGA) == 0 ||
-	    (bits = vesa_bios_get_dac()) < 6)
+	if ((base + count) > 256)
 		return (1);
+	if (!VESA_MODE(adp->va_mode))
+		return (1);
+	bits = vesa_bios_get_dac();
+	if ((adp->va_info.vi_flags & V_INFO_NONVGA) == 0 && bits <= 6)
+		return (1);
 
 	r = malloc(count * 3, M_DEVBUF, M_WAITOK);
 	g = r + count;

--Boundary-00=_y+zXLB2u5Sm4pdb--



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