Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/rasops Switch to per-device stamp, and retire stamp_...
details: https://anonhg.NetBSD.org/src/rev/da10c8acb660
branches: trunk
changeset: 462904:da10c8acb660
user: rin <rin%NetBSD.org@localhost>
date: Wed Jul 31 02:04:14 2019 +0000
description:
Switch to per-device stamp, and retire stamp_mutex.
XXX
Bump kernel version after other changes for struct rasops_info.
diffstat:
sys/dev/rasops/rasops.c | 24 +++++++++-
sys/dev/rasops/rasops.h | 9 +++-
sys/dev/rasops/rasops15.c | 20 ++++-----
sys/dev/rasops/rasops2.c | 30 ++++++-------
sys/dev/rasops/rasops24.c | 74 +++++++++++++++-------------------
sys/dev/rasops/rasops32.c | 20 ++++-----
sys/dev/rasops/rasops4.c | 20 ++++-----
sys/dev/rasops/rasops8.c | 20 ++++-----
sys/dev/rasops/rasops_putchar_width.h | 16 +-----
9 files changed, 115 insertions(+), 118 deletions(-)
diffs (truncated from 643 to 300 lines):
diff -r d4bc1b96c14b -r da10c8acb660 sys/dev/rasops/rasops.c
--- a/sys/dev/rasops/rasops.c Wed Jul 31 00:14:25 2019 +0000
+++ b/sys/dev/rasops/rasops.c Wed Jul 31 02:04:14 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops.c,v 1.102 2019/07/31 00:14:25 rin Exp $ */
+/* $NetBSD: rasops.c,v 1.103 2019/07/31 02:04:14 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.102 2019/07/31 00:14:25 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.103 2019/07/31 02:04:14 rin Exp $");
#include "opt_rasops.h"
#include "rasops_glue.h"
@@ -489,6 +489,13 @@
WSSCREEN_WSCOLORS | WSSCREEN_REVERSE;
}
+#ifndef RASOPS_SMALL
+ if (ri->ri_stamp != NULL) {
+ kmem_free(ri->ri_stamp, ri->ri_stamp_len);
+ ri->ri_stamp = NULL;
+ }
+#endif
+
switch (ri->ri_depth) {
#if NRASOPS1 > 0
case 1:
@@ -1670,7 +1677,6 @@
* For now this is either a copy of rasops_cmap[] or an R3G3B2 map, it should
* probably be a linear ( or gamma corrected? ) ramp for higher depths.
*/
-
int
rasops_get_cmap(struct rasops_info *ri, uint8_t *palette, size_t bytes)
{
@@ -1707,3 +1713,15 @@
memcpy(palette, rasops_cmap, uimin(bytes, sizeof(rasops_cmap)));
return 0;
}
+
+#ifndef RASOPS_SMALL
+void
+rasops_allocstamp(struct rasops_info *ri, size_t len)
+{
+
+ KASSERT(ri->ri_stamp == NULL);
+ ri->ri_stamp_len = len;
+ ri->ri_stamp = kmem_zalloc(len, KM_SLEEP);
+ ri->ri_stamp_attr = 0;
+}
+#endif
diff -r d4bc1b96c14b -r da10c8acb660 sys/dev/rasops/rasops.h
--- a/sys/dev/rasops/rasops.h Wed Jul 31 00:14:25 2019 +0000
+++ b/sys/dev/rasops/rasops.h Wed Jul 31 02:04:14 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops.h,v 1.39 2019/07/31 00:14:25 rin Exp $ */
+/* $NetBSD: rasops.h,v 1.40 2019/07/31 02:04:14 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -132,6 +132,11 @@
/* Callbacks so we can share some code */
void (*ri_do_cursor)(struct rasops_info *);
+ /* 4x1 stamp for optimized character blitting */
+ void *ri_stamp;
+ long ri_stamp_attr;
+ size_t ri_stamp_len;
+
#if NRASOPS_ROTATION > 0
/* Used to intercept putchar to permit display rotation */
struct wsdisplay_emulops ri_real_ops;
@@ -182,6 +187,8 @@
void rasops24_init(struct rasops_info *);
void rasops32_init(struct rasops_info *);
+void rasops_allocstamp(struct rasops_info *, size_t);
+
#define DELTA(p, d, cast) ((p) = (cast)((uint8_t *)(p) + (d)))
#define FONT_GLYPH(uc, font, ri) \
diff -r d4bc1b96c14b -r da10c8acb660 sys/dev/rasops/rasops15.c
--- a/sys/dev/rasops/rasops15.c Wed Jul 31 00:14:25 2019 +0000
+++ b/sys/dev/rasops/rasops15.c Wed Jul 31 02:04:14 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops15.c,v 1.32 2019/07/31 00:14:25 rin Exp $ */
+/* $NetBSD: rasops15.c,v 1.33 2019/07/31 02:04:14 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.32 2019/07/31 00:14:25 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.33 2019/07/31 02:04:14 rin Exp $");
#include "opt_rasops.h"
@@ -55,13 +55,6 @@
#ifndef RASOPS_SMALL
/*
- * 4x1 stamp for optimized character blitting
- */
-static uint32_t stamp[32];
-static long stamp_attr;
-static int stamp_mutex; /* XXX see note in readme */
-
-/*
* offset = STAMP_SHIFT(fontbits, nibble #) & STAMP_MASK
* destination uint32_t[0] = STAMP_READ(offset)
* destination uint32_t[1] = STAMP_READ(offset + 4)
@@ -106,8 +99,12 @@
#endif /* !RASOPS_SMALL */
default:
ri->ri_ops.putchar = rasops15_putchar;
- break;
+ return;
}
+
+#ifndef RASOPS_SMALL
+ rasops_allocstamp(ri, sizeof(uint32_t) * 32);
+#endif
}
#define RASOPS_DEPTH 15
@@ -121,12 +118,13 @@
static void
rasops15_makestamp(struct rasops_info *ri, long attr)
{
+ uint32_t *stamp = (uint32_t *)ri->ri_stamp;
uint32_t fg, bg;
int i;
fg = ri->ri_devcmap[((uint32_t)attr >> 24) & 0xf] & 0xffff;
bg = ri->ri_devcmap[((uint32_t)attr >> 16) & 0xf] & 0xffff;
- stamp_attr = attr;
+ ri->ri_stamp_attr = attr;
for (i = 0; i < 32; i += 2) {
#if BYTE_ORDER == LITTLE_ENDIAN
diff -r d4bc1b96c14b -r da10c8acb660 sys/dev/rasops/rasops2.c
--- a/sys/dev/rasops/rasops2.c Wed Jul 31 00:14:25 2019 +0000
+++ b/sys/dev/rasops/rasops2.c Wed Jul 31 02:04:14 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops2.c,v 1.27 2019/07/31 00:14:25 rin Exp $ */
+/* $NetBSD: rasops2.c,v 1.28 2019/07/31 02:04:14 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.27 2019/07/31 00:14:25 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.28 2019/07/31 02:04:14 rin Exp $");
#include "opt_rasops.h"
@@ -55,13 +55,6 @@
static void rasops2_putchar12(void *, int, int col, u_int, long);
static void rasops2_putchar16(void *, int, int col, u_int, long);
static void rasops2_makestamp(struct rasops_info *, long);
-
-/*
- * 4x1 stamp for optimized character blitting
- */
-static uint8_t stamp[16];
-static long stamp_attr;
-static int stamp_mutex; /* XXX see note in README */
#endif
/*
@@ -79,6 +72,12 @@
rasops2_init(struct rasops_info *ri)
{
+ if ((ri->ri_font->fontwidth & 3) != 0) {
+ ri->ri_ops.erasecols = rasops2_erasecols;
+ ri->ri_ops.copycols = rasops2_copycols;
+ ri->ri_do_cursor = rasops2_do_cursor;
+ }
+
switch (ri->ri_font->fontwidth) {
#ifndef RASOPS_SMALL
case 8:
@@ -94,14 +93,12 @@
default:
panic("fontwidth not 8/12/16 or RASOPS_SMALL - fixme!");
ri->ri_ops.putchar = rasops2_putchar;
- break;
+ return;
}
- if ((ri->ri_font->fontwidth & 3) != 0) {
- ri->ri_ops.erasecols = rasops2_erasecols;
- ri->ri_ops.copycols = rasops2_copycols;
- ri->ri_do_cursor = rasops2_do_cursor;
- }
+#ifndef RASOPS_SMALL
+ rasops_allocstamp(ri, sizeof(uint8_t) * 16);
+#endif
}
/*
@@ -121,11 +118,12 @@
static void
rasops2_makestamp(struct rasops_info *ri, long attr)
{
+ uint8_t *stamp = (uint8_t *)ri->ri_stamp;
int i, fg, bg;
fg = ri->ri_devcmap[((uint32_t)attr >> 24) & 0xf] & 3;
bg = ri->ri_devcmap[((uint32_t)attr >> 16) & 0xf] & 3;
- stamp_attr = attr;
+ ri->ri_stamp_attr = attr;
for (i = 0; i < 16; i++) {
#if BYTE_ORDER == BIG_ENDIAN
diff -r d4bc1b96c14b -r da10c8acb660 sys/dev/rasops/rasops24.c
--- a/sys/dev/rasops/rasops24.c Wed Jul 31 00:14:25 2019 +0000
+++ b/sys/dev/rasops/rasops24.c Wed Jul 31 02:04:14 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops24.c,v 1.40 2019/07/31 00:14:25 rin Exp $ */
+/* $NetBSD: rasops24.c,v 1.41 2019/07/31 02:04:14 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.40 2019/07/31 00:14:25 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.41 2019/07/31 02:04:14 rin Exp $");
#include "opt_rasops.h"
@@ -56,13 +56,6 @@
static void rasops24_putchar12(void *, int, int, u_int, long);
static void rasops24_putchar16(void *, int, int, u_int, long);
static void rasops24_makestamp(struct rasops_info *, long);
-
-/*
- * 4x1 stamp for optimized character blitting
- */
-static uint32_t stamp[64];
-static long stamp_attr;
-static int stamp_mutex; /* XXX see note in readme */
#endif
/*
@@ -82,14 +75,6 @@
rasops24_init(struct rasops_info *ri)
{
-#ifndef RASOPS_SMALL
- /*
- * Different devcmap's are used depending on font widths,
- * therefore we need reset stamp here.
- */
- stamp_attr = 0;
-#endif
-
if (ri->ri_rnum == 0) {
ri->ri_rnum = ri->ri_gnum = ri->ri_bnum = 8;
@@ -120,8 +105,12 @@
#endif
default:
ri->ri_ops.putchar = rasops24_putchar;
- break;
+ return;
}
+
+#ifndef RASOPS_SMALL
+ rasops_allocstamp(ri, sizeof(uint32_t) * 64);
+#endif
}
#define RASOPS_DEPTH 24
@@ -135,12 +124,13 @@
static void
rasops24_makestamp(struct rasops_info *ri, long attr)
{
+ uint32_t *stamp = (uint32_t *)ri->ri_stamp;
uint32_t fg, bg, c1, c2, c3, c4;
int i;
fg = ri->ri_devcmap[((uint32_t)attr >> 24) & 0xf] & 0xffffff;
bg = ri->ri_devcmap[((uint32_t)attr >> 16) & 0xf] & 0xffffff;
- stamp_attr = attr;
+ ri->ri_stamp_attr = attr;
for (i = 0; i < 64; i += 4) {
Home |
Main Index |
Thread Index |
Old Index