Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/rasops Innumerable fixes and improvements. README co...
details: https://anonhg.NetBSD.org/src/rev/6ef72f3d68cb
branches: trunk
changeset: 472251:6ef72f3d68cb
user: ad <ad%NetBSD.org@localhost>
date: Mon Apr 26 04:27:47 1999 +0000
description:
Innumerable fixes and improvements. README contains list of remaining bugs
that need to be squashed.
diffstat:
sys/dev/rasops/README | 24 +-
sys/dev/rasops/files.rasops | 29 +-
sys/dev/rasops/rasops.c | 404 ++++++++++++++++-
sys/dev/rasops/rasops.h | 25 +-
sys/dev/rasops/rasops1.c | 495 ++++++----------------
sys/dev/rasops/rasops15.c | 319 +++-----------
sys/dev/rasops/rasops2.c | 473 +++++++++++++++++++++
sys/dev/rasops/rasops24.c | 886 +++++++++++++++++++++++++++-------------
sys/dev/rasops/rasops32.c | 213 +---------
sys/dev/rasops/rasops8.c | 222 +---------
sys/dev/rasops/rasops_bitops.h | 304 ++++++++++++++
sys/dev/rasops/rasops_masks.c | 358 ++++++++++++++++
sys/dev/rasops/rasops_masks.h | 97 ++++
13 files changed, 2489 insertions(+), 1360 deletions(-)
diffs (truncated from 4490 to 300 lines):
diff -r 65fa63f40dbd -r 6ef72f3d68cb sys/dev/rasops/README
--- a/sys/dev/rasops/README Mon Apr 26 04:25:38 1999 +0000
+++ b/sys/dev/rasops/README Mon Apr 26 04:27:47 1999 +0000
@@ -1,21 +1,13 @@
-$NetBSD: README,v 1.1 1999/04/13 00:17:57 ad Exp $
+$NetBSD: README,v 1.2 1999/04/26 04:27:47 ad Exp $
This directory contains 'rasops', a set of raster operations intended to
replace the dev/rcons/raster stuff for both wscons and rcons. It yields
significantly improved performance, supports multiple depths and color.
-The stamp_mutex used by some of the colordepths is not fully atomic. It's
-designed to stop stamp corruption in the event that text is printed at
-interrupt time. Even if it fails, >99% of the time text will be white on
-black, so it doesn't really matter. Going to splhigh for each character is
-a Bad Thing.
-
-Status of the various depths. Feel free to complete/test:
-
- 8 tested, complete
- 15/16 untested, complete (endainness issues exist?)
- 32 untested, complete (endainness issues exist?)
- 1 untested, incomplete for non 8,16 pel fonts
- 24 untested, incomplete, assumes RGB order
-
-- Andy Doran <ad%NetBSD.org@localhost>, April 1999
+TODO o There is no generic `putchar' function for 2bpp.
+ o Color handling for 2bpp is broken.
+ o copycols() from rasops_bitops.h is broken in right->left case.
+ o The stamp mutex is not particularly safe.
+ o rasops_pmask[][] is too big (4kB).
+ o 64-bit types are not used on machines that are 64-bit.
+ o We should never be doing reads/writes of less than 32-bits.
diff -r 65fa63f40dbd -r 6ef72f3d68cb sys/dev/rasops/files.rasops
--- a/sys/dev/rasops/files.rasops Mon Apr 26 04:25:38 1999 +0000
+++ b/sys/dev/rasops/files.rasops Mon Apr 26 04:27:47 1999 +0000
@@ -1,11 +1,22 @@
-# $NetBSD: files.rasops,v 1.1 1999/04/13 00:17:58 ad Exp $
+# $NetBSD: files.rasops,v 1.2 1999/04/26 04:27:47 ad Exp $
+
+define rasops1
+define rasops2
+define rasops8
+define rasops15
+define rasops16
+define rasops24
+define rasops32
-file dev/rasops/rasops.c rasterconsole
-file dev/rasops/rasops1.c rasterconsole
-file dev/rasops/rasops8.c rasterconsole
-file dev/rasops/rasops15.c rasterconsole
-file dev/rasops/rasops24.c rasterconsole
-file dev/rasops/rasops32.c rasterconsole
+file dev/rasops/rasops.c rasops_glue | rasops1 | rasops2 | rasops8 |
+ rasops15 | rasops16 | rasops24 | rasops32 needs-flag
-defopt opt_rasops.h RASOPS1 RASOPS8 RASOPS15 RASOPS16 RASOPS24 RASOPS32
- RASOPS_CLIPPING
+file dev/rasops/rasops_masks.c rasops1 | rasops2
+file dev/rasops/rasops1.c rasops1
+file dev/rasops/rasops2.c rasops2
+file dev/rasops/rasops8.c rasops8
+file dev/rasops/rasops15.c rasops15 | rasops16
+file dev/rasops/rasops24.c rasops24
+file dev/rasops/rasops32.c rasops32
+
+defopt opt_rasops.h RASOPS_CLIPPING
diff -r 65fa63f40dbd -r 6ef72f3d68cb sys/dev/rasops/rasops.c
--- a/sys/dev/rasops/rasops.c Mon Apr 26 04:25:38 1999 +0000
+++ b/sys/dev/rasops/rasops.c Mon Apr 26 04:27:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops.c,v 1.3 1999/04/13 03:02:40 ad Exp $ */
+/* $NetBSD: rasops.c,v 1.4 1999/04/26 04:27:47 ad Exp $ */
/*
* Copyright (c) 1999 Andy Doran <ad%NetBSD.org@localhost>
@@ -28,9 +28,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.3 1999/04/13 03:02:40 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.4 1999/04/26 04:27:47 ad Exp $");
-#include "opt_rasops.h"
+#include "rasops_glue.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -38,6 +38,7 @@
#include <sys/time.h>
#include <machine/bswap.h>
+#include <machine/endian.h>
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsconsio.h>
@@ -73,16 +74,18 @@
0, 0, 0, 1
};
-/* Common functions */
-static void rasops_copycols __P((void *, int, int, int, int));
+/* Generic functions */
static void rasops_copyrows __P((void *, int, int, int));
static int rasops_mapchar __P((void *, int, u_int *));
static void rasops_cursor __P((void *, int, int, int));
static int rasops_alloc_cattr __P((void *, int, int, int, long *));
static int rasops_alloc_mattr __P((void *, int, int, int, long *));
+static void rasops_do_cursor __P((struct rasops_info *));
+static void rasops_init_devcmap __P((struct rasops_info *));
/* Per-depth initalization functions */
void rasops1_init __P((struct rasops_info *));
+void rasops2_init __P((struct rasops_info *));
void rasops8_init __P((struct rasops_info *));
void rasops15_init __P((struct rasops_info *));
void rasops24_init __P((struct rasops_info *));
@@ -96,7 +99,7 @@
struct rasops_info *ri;
int wantrows, wantcols, clear, center;
{
-
+#ifdef _KERNEL
/* Select a font if the caller doesn't care */
if (ri->ri_font == NULL) {
int cookie;
@@ -113,11 +116,12 @@
}
if (wsfont_lock(cookie, &ri->ri_font,
- WSFONT_LITTLE, WSFONT_LITTLE) < 0) {
+ WSFONT_L2R, WSFONT_L2R) < 0) {
printf("rasops_init: couldn't lock font\n");
return (-1);
}
}
+#endif
/* This should never happen in reality... */
#ifdef DEBUG
@@ -130,18 +134,42 @@
printf("rasops_init: stride not aligned on 32-bit boundary\n");
return (-1);
}
-
- if (ri->ri_font->fontwidth > 32) {
- printf("rasops_init: fontwidth > 32\n");
- return (-1);
- }
#endif
-
+
/* Fix color palette. We need this for the cursor to work. */
rasops_cmap[255*3+0] = 0xff;
rasops_cmap[255*3+1] = 0xff;
rasops_cmap[255*3+2] = 0xff;
+ /* setfont does most of the work */
+ if (rasops_setfont(ri, wantrows, wantcols, clear, center))
+ return (-1);
+
+ rasops_init_devcmap(ri);
+ ri->ri_flg = RASOPS_INITTED;
+ return (0);
+}
+
+
+/*
+ * Choose a different font. The new font will already be set in ri_font.
+ */
+int
+rasops_setfont(ri, wantrows, wantcols, clear, center)
+ struct rasops_info *ri;
+ int wantrows, wantcols, clear, center;
+{
+ int bpp;
+
+ if (ri->ri_font->fontwidth > 32 || ri->ri_font->fontwidth < 4)
+ panic("rasops_init: fontwidth assumptions botched!\n");
+
+ /* Need this to frob the setup below */
+ bpp = (ri->ri_depth == 15 ? 16 : ri->ri_depth);
+
+ if (ri->ri_flg & RASOPS_INITTED)
+ ri->ri_bits = ri->ri_origbits;
+
/* Don't care if the caller wants a hideously small console */
if (wantrows < 10)
wantrows = 5000;
@@ -160,18 +188,18 @@
ri->ri_emuheight = ri->ri_height;
/* Reduce width until aligned on a 32-bit boundary */
- while ((ri->ri_emuwidth*ri->ri_depth & 31) != 0)
+ while ((ri->ri_emuwidth*bpp & 31) != 0)
ri->ri_emuwidth--;
ri->ri_cols = ri->ri_emuwidth / ri->ri_font->fontwidth;
ri->ri_rows = ri->ri_emuheight / ri->ri_font->fontheight;
- ri->ri_emustride = ri->ri_emuwidth * ri->ri_depth >> 3;
+ ri->ri_emustride = ri->ri_emuwidth * bpp >> 3;
ri->ri_delta = ri->ri_stride - ri->ri_emustride;
ri->ri_ccol = 0;
ri->ri_crow = 0;
- ri->ri_pelbytes = ri->ri_depth >> 3;
+ ri->ri_pelbytes = bpp >> 3;
- ri->ri_xscale = (ri->ri_font->fontwidth * ri->ri_depth) >> 3;
+ ri->ri_xscale = (ri->ri_font->fontwidth * bpp) >> 3;
ri->ri_yscale = ri->ri_font->fontheight * ri->ri_stride;
ri->ri_fontscale = ri->ri_font->fontheight * ri->ri_font->stride;
@@ -191,45 +219,61 @@
ri->ri_bits += ((ri->ri_height - ri->ri_emuheight) >> 1) *
ri->ri_stride;
}
-
- /* Fill in defaults for operations set */
+
+ /*
+ * Fill in defaults for operations set. XXX this nukes private
+ * routines used by accelerated fb drivers.
+ */
ri->ri_ops.mapchar = rasops_mapchar;
ri->ri_ops.copyrows = rasops_copyrows;
ri->ri_ops.copycols = rasops_copycols;
+ ri->ri_ops.erasecols = rasops_erasecols;
+ ri->ri_ops.eraserows = rasops_eraserows;
ri->ri_ops.cursor = rasops_cursor;
+ ri->ri_do_cursor = rasops_do_cursor;
- if (ri->ri_depth == 1 || ri->ri_forcemono)
+ if (ri->ri_depth < 8 || ri->ri_forcemono) {
ri->ri_ops.alloc_attr = rasops_alloc_mattr;
- else
+ ri->ri_caps = WSATTR_UNDERLINE;
+ } else {
ri->ri_ops.alloc_attr = rasops_alloc_cattr;
-
+ ri->ri_caps = WSATTR_UNDERLINE | WSATTR_HILIT |
+ WSATTR_WSCOLORS;
+ }
+
switch (ri->ri_depth) {
-#ifdef RASOPS1
+#if NRASOPS1
case 1:
rasops1_init(ri);
break;
#endif
-#ifdef RASOPS8
+#if NRASOPS2
+ case 2:
+ rasops2_init(ri);
+ break;
+#endif
+
+#if NRASOPS8
case 8:
rasops8_init(ri);
break;
#endif
-#if defined(RASOPS15) || defined(RASOPS16)
+#if NRASOPS15 || NRASOPS16
case 15:
case 16:
rasops15_init(ri);
break;
#endif
-#ifdef RASOPS24
+#if NRASOPS24
case 24:
rasops24_init(ri);
break;
#endif
-#ifdef RASOPS24
+#if NRASOPS32
case 32:
rasops32_init(ri);
break;
@@ -239,7 +283,6 @@
return (-1);
}
- ri->ri_flg = RASOPS_INITTED;
return (0);
}
@@ -449,7 +492,7 @@
* We simply cop-out here and use bcopy(), since it handles all of
* these cases anyway.
*/
-static void
+void
rasops_copycols(cookie, row, src, dst, num)
Home |
Main Index |
Thread Index |
Old Index