- Work around a hardware bug that loaded fonts don't work, which is
found on many (all?) of PCI-based ATI graphics cards. It is fully optional and can be enabled by adding `options VGA_CONSOLE_ATI_BROKEN_FONTSEL' to config file. - Temporarily remove `quirk' mechanism. Similar code already exists in pci_quirks.c.
This commit is contained in:
parent
4fdfe6f24c
commit
754342aeb8
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files,v 1.536 2002/06/24 08:06:20 itojun Exp $
|
||||
# $NetBSD: files,v 1.537 2002/06/27 06:26:51 junyoung Exp $
|
||||
|
||||
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
|
||||
|
||||
@ -764,6 +764,7 @@ file dev/ic/pcdisplay_subr.c pcdisplayops
|
||||
file dev/ic/pcdisplay_chars.c pcdisplayops
|
||||
# VGA graphics
|
||||
#
|
||||
defflag opt_vga.h VGA_CONSOLE_ATI_BROKEN_FONTSEL
|
||||
device vga: wsemuldisplaydev, pcdisplayops
|
||||
file dev/ic/vga.c vga needs-flag
|
||||
file dev/ic/vga_subr.c vga
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vga.c,v 1.53 2002/06/26 23:05:33 christos Exp $ */
|
||||
/* $NetBSD: vga.c,v 1.54 2002/06/27 06:26:53 junyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.53 2002/06/26 23:05:33 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.54 2002/06/27 06:26:53 junyoung Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -597,8 +597,7 @@ vga_init(struct vga_config *vc, bus_space_tag_t iot, bus_space_tag_t memt)
|
||||
|
||||
void
|
||||
vga_common_attach(struct vga_softc *sc, bus_space_tag_t iot,
|
||||
bus_space_tag_t memt, int type, int quirks,
|
||||
const struct vga_funcs *vf)
|
||||
bus_space_tag_t memt, int type, const struct vga_funcs *vf)
|
||||
{
|
||||
int console;
|
||||
struct vga_config *vc;
|
||||
@ -615,7 +614,7 @@ vga_common_attach(struct vga_softc *sc, bus_space_tag_t iot,
|
||||
}
|
||||
|
||||
vc->vc_type = type;
|
||||
vc->vc_nfontslots = (quirks & VGA_QUIRK_ONEFONT) ? 1 : 8;
|
||||
vc->vc_nfontslots = 8;
|
||||
vc->vc_funcs = vf;
|
||||
|
||||
sc->sc_vc = vc;
|
||||
@ -648,7 +647,6 @@ vga_cnattach(bus_space_tag_t iot, bus_space_tag_t memt, int type, int check)
|
||||
#else
|
||||
scr = vga_console_vc.currenttype;
|
||||
#endif
|
||||
vga_console_vc.vc_nfontslots = 1; /* for now assume buggy adapter */
|
||||
vga_init_screen(&vga_console_vc, &vga_console_screen, scr, 1, &defattr);
|
||||
|
||||
wsdisplay_cnattach(scr, &vga_console_screen,
|
||||
@ -846,17 +844,18 @@ vga_usefont(struct vga_config *vc, struct egavga_font *f)
|
||||
goto loadit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This should only happen if there is only 1 font slot
|
||||
* which is occupied by the builtin font.
|
||||
* Last resort: kick out the builtin font.
|
||||
*/
|
||||
KASSERT(vc->vc_fonts[0] == &vga_builtinfont);
|
||||
TAILQ_REMOVE(&vc->vc_fontlist, &vga_builtinfont, next);
|
||||
slot = 0;
|
||||
panic("vga_usefont");
|
||||
|
||||
loadit:
|
||||
#ifdef VGA_CONSOLE_ATI_BROKEN_FONTSEL
|
||||
if (slot == 1) {
|
||||
/* Load the builtin font to slot 1. */
|
||||
vga_loadchars(&vc->hdl, slot, 0, 256, f->wsfont->fontheight,
|
||||
NULL);
|
||||
vc->vc_fonts[slot] = &vga_builtinfont;
|
||||
slot++;
|
||||
}
|
||||
#endif
|
||||
vga_loadchars(&vc->hdl, slot, f->wsfont->firstchar,
|
||||
f->wsfont->numchars, f->wsfont->fontheight,
|
||||
f->wsfont->data);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vga_subr.c,v 1.8 2001/12/13 08:34:55 junyoung Exp $ */
|
||||
/* $NetBSD: vga_subr.c,v 1.9 2002/06/27 06:26:54 junyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vga_subr.c,v 1.8 2001/12/13 08:34:55 junyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vga_subr.c,v 1.9 2002/06/27 06:26:54 junyoung Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -98,11 +98,17 @@ vga_loadchars(struct vga_handle *vh, int fontset, int first, int num, int lpc,
|
||||
s = splhigh();
|
||||
fontram(vh);
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
for (j = 0; j < lpc; j++)
|
||||
bus_space_write_1(vh->vh_memt, vh->vh_allmemh,
|
||||
offset + (i << 5) + j,
|
||||
data[i * lpc + j]);
|
||||
#ifdef VGA_CONSOLE_ATI_BROKEN_FONTSEL
|
||||
if (fontset == 1)
|
||||
bus_space_copy_region_1(vh->vh_memt, vh->vh_allmemh, 0,
|
||||
vh->vh_allmemh, offset, 8192);
|
||||
else
|
||||
#endif
|
||||
for (i = 0; i < num; i++)
|
||||
for (j = 0; j < lpc; j++)
|
||||
bus_space_write_1(vh->vh_memt, vh->vh_allmemh,
|
||||
offset + (i << 5) + j,
|
||||
data[i * lpc + j]);
|
||||
|
||||
textram(vh);
|
||||
splx(s);
|
||||
@ -111,6 +117,22 @@ vga_loadchars(struct vga_handle *vh, int fontset, int first, int num, int lpc,
|
||||
void
|
||||
vga_setfontset(struct vga_handle *vh, int fontset1, int fontset2)
|
||||
{
|
||||
#ifdef VGA_CONSOLE_ATI_BROKEN_FONTSEL
|
||||
/* XXXBJY: 512 character mode is still broken. */
|
||||
|
||||
int s;
|
||||
|
||||
s = splhigh();
|
||||
fontram(vh);
|
||||
|
||||
if (fontset1 == 0)
|
||||
fontset1++;
|
||||
bus_space_copy_region_1(vh->vh_memt, vh->vh_allmemh, fontset1 << 13,
|
||||
vh->vh_allmemh, 0, 8192);
|
||||
|
||||
textram(vh);
|
||||
splx(s);
|
||||
#else
|
||||
u_int8_t cmap;
|
||||
static u_int8_t cmaptaba[] = {
|
||||
0x00, 0x10, 0x01, 0x11,
|
||||
@ -125,6 +147,7 @@ vga_setfontset(struct vga_handle *vh, int fontset1, int fontset2)
|
||||
cmap = cmaptaba[fontset1] | cmaptabb[fontset2];
|
||||
|
||||
vga_ts_write(vh, fontsel, cmap);
|
||||
#endif /* VGA_CONSOLE_ATI_BROKEN_FONTSEL */
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vgavar.h,v 1.11 2002/06/25 21:07:42 drochner Exp $ */
|
||||
/* $NetBSD: vgavar.h,v 1.12 2002/06/27 06:26:54 junyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
@ -29,6 +29,8 @@
|
||||
|
||||
#include <sys/callout.h>
|
||||
|
||||
#include "opt_vga.h"
|
||||
|
||||
struct vga_handle {
|
||||
struct pcdisplay_handle vh_ph;
|
||||
bus_space_handle_t vh_ioh_vga, vh_allmemh;
|
||||
@ -184,10 +186,7 @@ _vga_crtc_write(struct vga_handle *vh, int reg, u_int8_t val)
|
||||
|
||||
int vga_common_probe(bus_space_tag_t, bus_space_tag_t);
|
||||
void vga_common_attach(struct vga_softc *, bus_space_tag_t,
|
||||
bus_space_tag_t, int, int,
|
||||
const struct vga_funcs *);
|
||||
#define VGA_QUIRK_ONEFONT 0x01
|
||||
#define VGA_QUIRK_NOFASTSCROLL 0x02
|
||||
bus_space_tag_t, int, const struct vga_funcs *);
|
||||
int vga_is_console(bus_space_tag_t, int);
|
||||
|
||||
int vga_cnattach(bus_space_tag_t, bus_space_tag_t, int, int);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vga_isa.c,v 1.9 2002/06/26 09:38:37 simonb Exp $ */
|
||||
/* $NetBSD: vga_isa.c,v 1.10 2002/06/27 06:26:54 junyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vga_isa.c,v 1.9 2002/06/26 09:38:37 simonb Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vga_isa.c,v 1.10 2002/06/27 06:26:54 junyoung Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -116,7 +116,7 @@ vga_isa_attach(parent, self, aux)
|
||||
printf("\n");
|
||||
|
||||
vga_common_attach(sc, ia->ia_iot, ia->ia_memt, WSDISPLAY_TYPE_ISAVGA,
|
||||
0, NULL);
|
||||
NULL);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vga_pci.c,v 1.12 2002/06/25 21:07:43 drochner Exp $ */
|
||||
/* $NetBSD: vga_pci.c,v 1.13 2002/06/27 06:26:55 junyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vga_pci.c,v 1.12 2002/06/25 21:07:43 drochner Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vga_pci.c,v 1.13 2002/06/27 06:26:55 junyoung Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -73,7 +73,6 @@ struct vga_pci_softc {
|
||||
|
||||
int vga_pci_match(struct device *, struct cfdata *, void *);
|
||||
void vga_pci_attach(struct device *, struct device *, void *);
|
||||
static int vga_pci_lookup_quirks(struct pci_attach_args *);
|
||||
|
||||
struct cfattach vga_pci_ca = {
|
||||
sizeof(struct vga_pci_softc),
|
||||
@ -89,28 +88,6 @@ const struct vga_funcs vga_pci_funcs = {
|
||||
vga_pci_mmap,
|
||||
};
|
||||
|
||||
static const struct {
|
||||
int id;
|
||||
int quirks;
|
||||
} vga_pci_quirks[] = {
|
||||
{PCI_ID_CODE(PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_XL_AGP),
|
||||
VGA_QUIRK_ONEFONT},
|
||||
};
|
||||
|
||||
static int
|
||||
vga_pci_lookup_quirks(pa)
|
||||
struct pci_attach_args *pa;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(vga_pci_quirks) / sizeof (vga_pci_quirks[0]);
|
||||
i++) {
|
||||
if (vga_pci_quirks[i].id == pa->pa_id)
|
||||
return (vga_pci_quirks[i].quirks);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
vga_pci_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
@ -204,7 +181,7 @@ vga_pci_attach(struct device *parent, struct device *self, void *aux)
|
||||
/* XXX Expansion ROM? */
|
||||
|
||||
vga_common_attach(sc, pa->pa_iot, pa->pa_memt, WSDISPLAY_TYPE_PCIVGA,
|
||||
vga_pci_lookup_quirks(pa), &vga_pci_funcs);
|
||||
&vga_pci_funcs);
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user