Module Name: src Committed By: macallan Date: Fri Dec 6 11:46:11 UTC 2024
Modified Files: src/sys/dev/wscons: wsdisplay_glyphcache.c wsdisplay_glyphcachevar.h Log Message: allow placement of the glyph cache anywhere in VRAM mostly for weird HP graphics hardware that has usable off-screen memory to the right of the visible screen instead of below it To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/wscons/wsdisplay_glyphcache.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/wscons/wsdisplay_glyphcachevar.h 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/wscons/wsdisplay_glyphcache.c diff -u src/sys/dev/wscons/wsdisplay_glyphcache.c:1.13 src/sys/dev/wscons/wsdisplay_glyphcache.c:1.14 --- src/sys/dev/wscons/wsdisplay_glyphcache.c:1.13 Tue Feb 20 09:53:16 2024 +++ src/sys/dev/wscons/wsdisplay_glyphcache.c Fri Dec 6 11:46:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_glyphcache.c,v 1.13 2024/02/20 09:53:16 macallan Exp $ */ +/* $NetBSD: wsdisplay_glyphcache.c,v 1.14 2024/12/06 11:46:11 macallan Exp $ */ /* * Copyright (c) 2012 Michael Lorenz @@ -75,6 +75,7 @@ glyphcache_init_align(glyphcache *gc, in gc->gc_cellwidth = -1; gc->gc_cellheight = -1; gc->gc_firstline = first; + gc->gc_firstcol = 0; gc->gc_lines = lines; gc->gc_cellalign = alignment; gc->gc_buckets = NULL; @@ -88,6 +89,30 @@ glyphcache_init_align(glyphcache *gc, in } int +glyphcache_init_x(glyphcache *gc, int x, int y, int lines, int width, + int cellwidth, int cellheight, long attr) +{ + + /* first the geometry stuff */ + if (lines < 0) lines = 0; + gc->gc_width = width; + gc->gc_cellwidth = -1; + gc->gc_cellheight = -1; + gc->gc_firstline = y; + gc->gc_firstcol = x; + gc->gc_lines = lines; + gc->gc_cellalign = 0; + gc->gc_buckets = NULL; + gc->gc_numbuckets = 0; + // XXX: Never free? + gc->gc_buckets = kmem_alloc(sizeof(*gc->gc_buckets) * NBUCKETS, + KM_SLEEP); + gc->gc_nbuckets = NBUCKETS; + return glyphcache_reconfig(gc, cellwidth, cellheight, attr); + +} + +int glyphcache_reconfig(glyphcache *gc, int cellwidth, int cellheight, long attr) { int cache_lines, buckets, i, usedcells = 0, idx; @@ -223,7 +248,8 @@ glyphcache_add(glyphcache *gc, int c, in cell += b->gb_firstcell; cy = gc->gc_firstline + (cell / gc->gc_cellsperline) * gc->gc_cellheight; - cx = (cell % gc->gc_cellsperline) * gc->gc_cellstride; + cx = gc->gc_firstcol + + (cell % gc->gc_cellsperline) * gc->gc_cellstride; b->gb_map[c - 33] = (cx << 16) | cy; gc->gc_bitblt(gc->gc_blitcookie, x, y, cx, cy, gc->gc_cellwidth, gc->gc_cellheight, gc->gc_rop); Index: src/sys/dev/wscons/wsdisplay_glyphcachevar.h diff -u src/sys/dev/wscons/wsdisplay_glyphcachevar.h:1.6 src/sys/dev/wscons/wsdisplay_glyphcachevar.h:1.7 --- src/sys/dev/wscons/wsdisplay_glyphcachevar.h:1.6 Thu Jun 8 05:48:41 2023 +++ src/sys/dev/wscons/wsdisplay_glyphcachevar.h Fri Dec 6 11:46:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_glyphcachevar.h,v 1.6 2023/06/08 05:48:41 macallan Exp $ */ +/* $NetBSD: wsdisplay_glyphcachevar.h,v 1.7 2024/12/06 11:46:11 macallan Exp $ */ /* * Copyright (c) 2012 Michael Lorenz @@ -50,6 +50,7 @@ typedef struct _glyphcache { int gc_cellheight; int gc_cellsperline; int gc_firstline; /* first line in vram to use for glyphs */ + int gc_firstcol; /* first column */ int gc_lines; int gc_width; int gc_fontcookie; @@ -73,6 +74,9 @@ typedef struct _glyphcache { /* first line, lines, width, cellwidth, cellheight, attr */ int glyphcache_init(glyphcache *, int, int, int, int, int, long); +/* first x, y, lines, width, cellwidth, cellheight, attr */ +int glyphcache_init_x(glyphcache *, int, int, int, int, int, int, long); + /* first line, lines, width, cellwidth, cellheight, attr, alignment */ int glyphcache_init_align(glyphcache *, int, int, int, int, int, long, int);