svn commit: r198858 - in head/sys: dev/fb dev/syscons sys
Jung-uk Kim
jkim at FreeBSD.org
Tue Jan 26 19:17:14 UTC 2010
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 at 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
-------------- next part --------------
--- 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;
More information about the svn-src-all
mailing list