Module Name: src Committed By: macallan Date: Tue Oct 12 16:00:22 UTC 2010
Modified Files: src/sys/dev/pci: voodoofb.c Log Message: make higher resolutions than 1024x768 work To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/voodoofb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/voodoofb.c diff -u src/sys/dev/pci/voodoofb.c:1.22 src/sys/dev/pci/voodoofb.c:1.23 --- src/sys/dev/pci/voodoofb.c:1.22 Tue May 4 05:00:33 2010 +++ src/sys/dev/pci/voodoofb.c Tue Oct 12 16:00:21 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: voodoofb.c,v 1.22 2010/05/04 05:00:33 macallan Exp $ */ +/* $NetBSD: voodoofb.c,v 1.23 2010/10/12 16:00:21 macallan Exp $ */ /* * Copyright (c) 2005, 2006 Michael Lorenz @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.22 2010/05/04 05:00:33 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.23 2010/10/12 16:00:21 macallan Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -48,9 +48,6 @@ #define HAVE_OPENFIRMWARE #endif -/* XXX should be configurable */ -#define VOODOOFB_VIDEOMODE 15 - #ifdef HAVE_OPENFIRMWARE #include <dev/ofw/openfirm.h> #include <dev/ofw/ofw_pci.h> @@ -98,6 +95,7 @@ int bits_per_pixel; int width, height, linebytes; + const struct videomode *sc_videomode; int sc_mode; uint32_t sc_bg; @@ -386,7 +384,8 @@ #endif /* XXX this should at least be configurable via kernel config */ - voodoofb_set_videomode(sc, &videomode_list[VOODOOFB_VIDEOMODE]); + if ((sc->sc_videomode = pick_mode_by_ref(1024, 768, 60)) != NULL) + voodoofb_set_videomode(sc, sc->sc_videomode); vcons_init(&sc->vd, sc, &voodoofb_defaultscreen, &voodoofb_accessops); sc->vd.init_screen = voodoofb_init_screen; @@ -409,7 +408,7 @@ * since we're not the console we can postpone the rest * until someone actually allocates a screen for us */ - voodoofb_set_videomode(sc, &videomode_list[0]); + voodoofb_set_videomode(sc, sc->sc_videomode); } printf("%s: %d MB aperture at 0x%08x, %d MB registers at 0x%08x\n", @@ -508,7 +507,7 @@ voodoofb_init(sc); /* XXX this should at least be configurable via kernel config */ - voodoofb_set_videomode(sc, &videomode_list[VOODOOFB_VIDEOMODE]); + voodoofb_set_videomode(sc, sc->sc_videomode); return 0; } @@ -1245,6 +1244,21 @@ mode->vr_crtc[22] = vertical_blanking_end + 1; mode->vr_crtc[23] = 128; mode->vr_crtc[24] = 255; + + /* overflow registers */ + mode->vr_crtc[CRTC_HDISP_EXT] = + (horizontal_total&0x100) >> 8 | + (horizontal_display_end & 0x100) >> 6 | + (horizontal_blanking_start & 0x100) >> 4 | + (horizontal_blanking_end & 0x40) >> 1 | + (horizontal_sync_start & 0x100) >> 2 | + (horizontal_sync_end & 0x20) << 2; + + mode->vr_crtc[CRTC_VDISP_EXT] = + (vertical_total & 0x400) >> 10 | + (vertical_display_enable_end & 0x400) >> 8 | + (vertical_blanking_start & 0x400) >> 6 | + (vertical_blanking_end & 0x400) >> 4; /* attr regs start */ mode->vr_attr[0] = 0; @@ -1284,7 +1298,7 @@ for(i = 0; i < 5; i++) voodoo3_write_seq(sc, i, mode->vr_seq[i]); - for (i = 0; i < 0x19; i ++) + for (i = 0; i < CRTC_PCI_READBACK; i ++) voodoo3_write_crtc(sc, i, mode->vr_crtc[i]); for (i = 0; i < 0x14; i ++) voodoo3_write_attr(sc, i, mode->vr_attr[i]); @@ -1361,7 +1375,7 @@ voodoo3_make_room(sc, 5); voodoo3_write32(sc, VIDSCREENSIZE, sc->width | (sc->height << 12)); - voodoo3_write32(sc, VIDDESKSTART, 1024); + voodoo3_write32(sc, VIDDESKSTART, 0); vidproc &= ~VIDCFG_HWCURSOR_ENABLE; voodoo3_write32(sc, VIDPROCCFG, vidproc);