Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/luna68k/dev Remove global hwplanecount and use ri_d...
details: https://anonhg.NetBSD.org/src/rev/02e77497e6d1
branches: trunk
changeset: 371714:02e77497e6d1
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Mon Oct 03 17:42:35 2022 +0000
description:
Remove global hwplanecount and use ri_depth in struct rasops instead.
No functional change.
diffstat:
sys/arch/luna68k/dev/lunafb.c | 20 +++++------
sys/arch/luna68k/dev/omrasops.c | 61 ++++++++++++++++++++++---------------
sys/arch/luna68k/dev/omrasopsvar.h | 4 +-
3 files changed, 46 insertions(+), 39 deletions(-)
diffs (truncated from 346 to 300 lines):
diff -r 3591ac1a6ef3 -r 02e77497e6d1 sys/arch/luna68k/dev/lunafb.c
--- a/sys/arch/luna68k/dev/lunafb.c Mon Oct 03 16:04:19 2022 +0000
+++ b/sys/arch/luna68k/dev/lunafb.c Mon Oct 03 17:42:35 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.48 2022/10/01 14:02:08 tsutsui Exp $ */
+/* $NetBSD: lunafb.c,v 1.49 2022/10/03 17:42:35 tsutsui Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.48 2022/10/01 14:02:08 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.49 2022/10/03 17:42:35 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -175,8 +175,6 @@
extern int hwplanemask; /* hardware planemask; retrieved at boot */
-int hwplanecount; /* for omrasops */
-
static int omfb_console;
int omfb_cnattach(void);
@@ -460,7 +458,7 @@
static void
omfb_getdevconfig(paddr_t paddr, struct om_hwdevconfig *dc)
{
- int i;
+ int bpp, i;
struct rasops_info *ri;
union {
struct { short h, v; } p;
@@ -469,21 +467,21 @@
switch (hwplanemask) {
case 0xff:
- hwplanecount = 8; /* XXX check monochrome bit in DIPSW */
+ bpp = 8; /* XXX check monochrome bit in DIPSW */
break;
default:
case 0x0f:
- hwplanecount = 4; /* XXX check monochrome bit in DIPSW */
+ bpp = 4; /* XXX check monochrome bit in DIPSW */
break;
case 1:
- hwplanecount = 1;
+ bpp = 1;
break;
}
dc->dc_wid = 1280;
dc->dc_ht = 1024;
- dc->dc_depth = hwplanecount;
+ dc->dc_depth = bpp;
dc->dc_rowbytes = 2048 / 8;
- dc->dc_cmsize = (hwplanecount == 1) ? 0 : 1 << hwplanecount;
+ dc->dc_cmsize = (bpp == 1) ? 0 : 1 << bpp;
dc->dc_videobase = paddr;
omfb_resetcmap(dc);
@@ -513,7 +511,7 @@
ri->ri_flg |= RI_NO_AUTO;
ri->ri_hw = dc;
- if (hwplanecount == 4 || hwplanecount == 8)
+ if (bpp == 4 || bpp == 8)
omrasops4_init(ri, 34, 80);
else
omrasops1_init(ri, 34, 80);
diff -r 3591ac1a6ef3 -r 02e77497e6d1 sys/arch/luna68k/dev/omrasops.c
--- a/sys/arch/luna68k/dev/omrasops.c Mon Oct 03 16:04:19 2022 +0000
+++ b/sys/arch/luna68k/dev/omrasops.c Mon Oct 03 17:42:35 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: omrasops.c,v 1.24 2022/10/01 13:51:55 tsutsui Exp $ */
+/* $NetBSD: omrasops.c,v 1.25 2022/10/03 17:42:35 tsutsui Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.24 2022/10/01 13:51:55 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.25 2022/10/03 17:42:35 tsutsui Exp $");
/*
* Designed speficically for 'm68k bitorder';
@@ -100,8 +100,8 @@
static int om_allocattr(void *, int, int, int, long *);
static void om_fill(int, int, uint8_t *, int, int, uint32_t, int, int);
-static void om_fill_color(int, uint8_t *, int, int, int, int);
-static void om_rascopy_single(uint8_t *, uint8_t *, int16_t, int16_t,
+static void om_fill_color(int, int, uint8_t *, int, int, int, int);
+static void om_rascopy_single(int, uint8_t *, uint8_t *, int16_t, int16_t,
uint8_t[]);
static void om4_rascopy_multi(uint8_t *, uint8_t *, int16_t, int16_t);
static void om_unpack_attr(long, uint8_t *, uint8_t *, int *);
@@ -330,8 +330,8 @@
}
static void
-om_fill_color(int color, uint8_t *dstptr, int dstbitoffs, int dstspan,
- int width, int height)
+om_fill_color(int planecount, int color, uint8_t *dstptr, int dstbitoffs,
+ int dstspan, int width, int height)
{
uint32_t mask;
uint32_t prev_mask;
@@ -340,7 +340,7 @@
ASSUME(width > 0);
ASSUME(height > 0);
- ASSUME(omfb_planecount > 0);
+ ASSUME(planecount > 0);
/* select all planes */
om_set_planemask(hwplanemask);
@@ -364,7 +364,7 @@
}
if (prev_mask != mask) {
- for (plane = 0; plane < omfb_planecount; plane++) {
+ for (plane = 0; plane < planecount; plane++) {
if ((color & (1U << plane)) != 0)
rop = ROP_ONE;
else
@@ -446,6 +446,7 @@
uint32_t mask;
int width;
int height;
+ int planecount;
int x, y;
int fontstride;
int fontx;
@@ -462,6 +463,7 @@
width = ri->ri_font->fontwidth;
height = ri->ri_font->fontheight;
+ planecount = ri->ri_depth;
fontstride = ri->ri_font->stride;
y = height * row;
x = width * startcol;
@@ -475,7 +477,7 @@
last_fg = fg;
last_bg = bg;
/* calculate ROP */
- for (plane = 0; plane < omfb_planecount; plane++) {
+ for (plane = 0; plane < planecount; plane++) {
int t = om_fgbg2rop(fg, bg);
ropaddr[plane] = om_rop_addr(plane, t);
fg >>= 1;
@@ -497,9 +499,9 @@
mask = ALL1BITS >> xl;
dw = 32 - xl;
- ASSUME(omfb_planecount == 1 ||
- omfb_planecount == 4 ||
- omfb_planecount == 8);
+ ASSUME(planecount == 1 ||
+ planecount == 4 ||
+ planecount == 8);
do {
uint8_t *d;
@@ -513,7 +515,7 @@
width = 0;
}
- switch (omfb_planecount) {
+ switch (planecount) {
case 8:
*(ropaddr[7]) = mask;
*(ropaddr[6]) = mask;
@@ -558,6 +560,7 @@
int startx;
int width;
int height;
+ int planecount;
int sh, sl;
int y;
int scanspan;
@@ -569,6 +572,7 @@
startx = ri->ri_font->fontwidth * startcol;
width = ri->ri_font->fontwidth * ncols;
height = ri->ri_font->fontheight;
+ planecount = ri->ri_depth;
om_unpack_attr(attr, &fg, &bg, NULL);
sh = startx >> 5;
sl = startx & 0x1f;
@@ -582,7 +586,7 @@
om_fill(hwplanemask, ROP_ZERO,
p, sl, scanspan, 0, width, height);
} else {
- om_fill_color(bg, p, sl, scanspan, width, height);
+ om_fill_color(planecount, bg, p, sl, scanspan, width, height);
}
/* reset mask value */
@@ -596,6 +600,7 @@
int startx;
int width;
int height;
+ int planecount;
int sh, sl;
int y;
int scanspan;
@@ -608,6 +613,7 @@
startx = 0;
width = ri->ri_emuwidth;
height = ri->ri_font->fontheight * nrows;
+ planecount = ri->ri_depth;
om_unpack_attr(attr, &fg, &bg, NULL);
sh = startx >> 5;
sl = startx & 0x1f;
@@ -622,7 +628,7 @@
om_fill(hwplanemask, ROP_ZERO,
p, sl, scanspan, 0, width, height);
} else {
- om_fill_color(bg, p, sl, scanspan, width, height);
+ om_fill_color(planecount, bg, p, sl, scanspan, width, height);
}
/* reset mask value */
om_reset_planemask_and_rop();
@@ -636,13 +642,13 @@
* if y-backward, src < dst, point to left-bottom.
* width: pixel width (must > 0)
* height: pixel height (> 0 if forward, < 0 if backward)
- * rop: ROP array with omfb_planecount elements.
+ * rop: ROP array with planecount elements.
*
* This function modifies(breaks) the planemask and ROPs.
*/
static void
-om_rascopy_single(uint8_t *dst, uint8_t *src, int16_t width, int16_t height,
- uint8_t rop[])
+om_rascopy_single(int planecount, uint8_t *dst, uint8_t *src,
+ int16_t width, int16_t height, uint8_t rop[])
{
uint32_t mask;
int wh;
@@ -773,7 +779,7 @@
* The common ROP cannot be used here. Because the hardware doesn't
* allow you to set the mask while keeping the ROP states.
*/
- for (plane = 0; plane < omfb_planecount; plane++) {
+ for (plane = 0; plane < planecount; plane++) {
om_set_rop(plane, rop[plane], mask);
}
@@ -802,7 +808,7 @@
}
#endif
- for (plane = 0; plane < omfb_planecount; plane++) {
+ for (plane = 0; plane < planecount; plane++) {
om_set_rop(plane, rop[plane], ALL1BITS);
}
}
@@ -1140,6 +1146,7 @@
struct rasops_info *ri = cookie;
uint8_t *src, *dst;
int width, rowheight;
+ int planecount;
int ptrstep, rowstep;
int srcplane;
int i;
@@ -1148,6 +1155,7 @@
width = ri->ri_emuwidth;
rowheight = ri->ri_font->fontheight;
+ planecount = ri->ri_depth;
src = (uint8_t *)ri->ri_bits + srcrow * rowheight * ri->ri_stride;
dst = (uint8_t *)ri->ri_bits + dstrow * rowheight * ri->ri_stride;
@@ -1231,7 +1239,7 @@
bg = tmp;
}
- for (i = 0; i < omfb_planecount; i++) {
+ for (i = 0; i < planecount; i++) {
int t = om_fgbg2rop(fg, bg);
rop[i] = t;
om_set_rop(i, rop[i], ALL1BITS);
@@ -1248,7 +1256,8 @@
srcplane = (set != 0) ? (31 - __builtin_clz(set)) : 0;
srcp = src + OMFB_PLANEOFFS + srcplane * OMFB_PLANEOFFS;
- om_rascopy_single(dst, srcp, width, rowheight * r, rop);
+ om_rascopy_single(planecount, dst, srcp,
+ width, rowheight * r, rop);
}
skip:
@@ -1673,8 +1682,10 @@
*/
#endif
Home |
Main Index |
Thread Index |
Old Index