From ec2542bd97008da13cfaec0011f64f0976cfb594 Mon Sep 17 00:00:00 2001 From: yokota Date: Mon, 10 Aug 1998 08:39:19 +0000 Subject: [PATCH] A workaround for screen flicker; eliminate some I/O access to the VGA chip. It has been observed that the problem is most apparent: a) in notebook computers, b) and/or in the systems with C&T video chips. Define the new configuration option SC_BAD_FLICKER in the kernel configuration file to remove outb()/outw() calls in question. --- sys/dev/syscons/syscons.c | 18 +++++++++++++++++- sys/i386/isa/syscons.c | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index bb68f7f7aa22..da3b3bfd5077 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.271 1998/08/03 09:18:58 yokota Exp $ + * $Id: syscons.c,v 1.272 1998/08/03 11:30:45 yokota Exp $ */ #include "sc.h" @@ -4734,18 +4734,26 @@ set_font_mode(u_char *buf) outb(ATC, 0x20); /* enable palette */ #if SLOW_VGA +#ifndef SC_BAD_FLICKER outb(TSIDX, 0x00); outb(TSREG, 0x01); +#endif outb(TSIDX, 0x02); outb(TSREG, 0x04); outb(TSIDX, 0x04); outb(TSREG, 0x07); +#ifndef SC_BAD_FLICKER outb(TSIDX, 0x00); outb(TSREG, 0x03); +#endif outb(GDCIDX, 0x04); outb(GDCREG, 0x02); outb(GDCIDX, 0x05); outb(GDCREG, 0x00); outb(GDCIDX, 0x06); outb(GDCREG, 0x04); #else +#ifndef SC_BAD_FLICKER outw(TSIDX, 0x0100); +#endif outw(TSIDX, 0x0402); outw(TSIDX, 0x0704); +#ifndef SC_BAD_FLICKER outw(TSIDX, 0x0300); +#endif outw(GDCIDX, 0x0204); outw(GDCIDX, 0x0005); outw(GDCIDX, 0x0406); /* addr = a0000, 64kb */ @@ -4766,10 +4774,14 @@ set_normal_mode(u_char *buf) outb(ATC, 0x20); /* enable palette */ #if SLOW_VGA +#ifndef SC_BAD_FLICKER outb(TSIDX, 0x00); outb(TSREG, 0x01); +#endif outb(TSIDX, 0x02); outb(TSREG, buf[0]); outb(TSIDX, 0x04); outb(TSREG, buf[1]); +#ifndef SC_BAD_FLICKER outb(TSIDX, 0x00); outb(TSREG, 0x03); +#endif outb(GDCIDX, 0x04); outb(GDCREG, buf[2]); outb(GDCIDX, 0x05); outb(GDCREG, buf[3]); if (crtc_addr == MONO_BASE) { @@ -4778,10 +4790,14 @@ set_normal_mode(u_char *buf) outb(GDCIDX, 0x06); outb(GDCREG,(buf[4] & 0x03) | 0x0c); } #else +#ifndef SC_BAD_FLICKER outw(TSIDX, 0x0100); +#endif outw(TSIDX, 0x0002 | (buf[0] << 8)); outw(TSIDX, 0x0004 | (buf[1] << 8)); +#ifndef SC_BAD_FLICKER outw(TSIDX, 0x0300); +#endif outw(GDCIDX, 0x0004 | (buf[2] << 8)); outw(GDCIDX, 0x0005 | (buf[3] << 8)); if (crtc_addr == MONO_BASE) diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c index bb68f7f7aa22..da3b3bfd5077 100644 --- a/sys/i386/isa/syscons.c +++ b/sys/i386/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.271 1998/08/03 09:18:58 yokota Exp $ + * $Id: syscons.c,v 1.272 1998/08/03 11:30:45 yokota Exp $ */ #include "sc.h" @@ -4734,18 +4734,26 @@ set_font_mode(u_char *buf) outb(ATC, 0x20); /* enable palette */ #if SLOW_VGA +#ifndef SC_BAD_FLICKER outb(TSIDX, 0x00); outb(TSREG, 0x01); +#endif outb(TSIDX, 0x02); outb(TSREG, 0x04); outb(TSIDX, 0x04); outb(TSREG, 0x07); +#ifndef SC_BAD_FLICKER outb(TSIDX, 0x00); outb(TSREG, 0x03); +#endif outb(GDCIDX, 0x04); outb(GDCREG, 0x02); outb(GDCIDX, 0x05); outb(GDCREG, 0x00); outb(GDCIDX, 0x06); outb(GDCREG, 0x04); #else +#ifndef SC_BAD_FLICKER outw(TSIDX, 0x0100); +#endif outw(TSIDX, 0x0402); outw(TSIDX, 0x0704); +#ifndef SC_BAD_FLICKER outw(TSIDX, 0x0300); +#endif outw(GDCIDX, 0x0204); outw(GDCIDX, 0x0005); outw(GDCIDX, 0x0406); /* addr = a0000, 64kb */ @@ -4766,10 +4774,14 @@ set_normal_mode(u_char *buf) outb(ATC, 0x20); /* enable palette */ #if SLOW_VGA +#ifndef SC_BAD_FLICKER outb(TSIDX, 0x00); outb(TSREG, 0x01); +#endif outb(TSIDX, 0x02); outb(TSREG, buf[0]); outb(TSIDX, 0x04); outb(TSREG, buf[1]); +#ifndef SC_BAD_FLICKER outb(TSIDX, 0x00); outb(TSREG, 0x03); +#endif outb(GDCIDX, 0x04); outb(GDCREG, buf[2]); outb(GDCIDX, 0x05); outb(GDCREG, buf[3]); if (crtc_addr == MONO_BASE) { @@ -4778,10 +4790,14 @@ set_normal_mode(u_char *buf) outb(GDCIDX, 0x06); outb(GDCREG,(buf[4] & 0x03) | 0x0c); } #else +#ifndef SC_BAD_FLICKER outw(TSIDX, 0x0100); +#endif outw(TSIDX, 0x0002 | (buf[0] << 8)); outw(TSIDX, 0x0004 | (buf[1] << 8)); +#ifndef SC_BAD_FLICKER outw(TSIDX, 0x0300); +#endif outw(GDCIDX, 0x0004 | (buf[2] << 8)); outw(GDCIDX, 0x0005 | (buf[3] << 8)); if (crtc_addr == MONO_BASE)