Module Name:    src
Committed By:   macallan
Date:           Fri May 21 20:22:15 UTC 2021

Modified Files:
        src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
use probed VRAM size to determine where to put the cursor instead of blindly
assuming 16MB
also make sure the glyph cache can't overlap with the cursor


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/voyager/voyagerfb.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/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.30 src/sys/dev/pci/voyager/voyagerfb.c:1.31
--- src/sys/dev/pci/voyager/voyagerfb.c:1.30	Sat Apr 24 23:36:58 2021
+++ src/sys/dev/pci/voyager/voyagerfb.c	Fri May 21 20:22:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.30 2021/04/24 23:36:58 thorpej Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.31 2021/05/21 20:22:15 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.30 2021/04/24 23:36:58 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.31 2021/05/21 20:22:15 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -328,7 +328,8 @@ voyagerfb_attach(device_t parent, device
 			(*ri->ri_ops.allocattr)(ri, 0, 0, 0, &defattr);
 	}
 	glyphcache_init(&sc->sc_gc, sc->sc_height,
-			(sc->sc_fbsize / sc->sc_stride) - sc->sc_height,
+			((sc->sc_fbsize - 16 * 64) / sc->sc_stride) - 
+			    sc->sc_height,
 			sc->sc_width,
 			ri->ri_font->fontwidth,
 			ri->ri_font->fontheight,
@@ -780,7 +781,7 @@ voyagerfb_init(struct voyagerfb_softc *s
 	    reg);
 
 	/* put the cursor at the end of video memory */
-	sc->sc_cursor_addr = 16 * 1024 * 1024 - 16 * 64;	/* XXX */
+	sc->sc_cursor_addr = sc->sc_fbsize - 16 * 64;	/* XXX */
 	DPRINTF("%s: %08x\n", __func__, sc->sc_cursor_addr); 
 	sc->sc_cursor = (uint32_t *)((uint8_t *)bus_space_vaddr(sc->sc_memt,
 			 sc->sc_fbh) + sc->sc_cursor_addr);

Reply via email to