Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Improve/fix igsfb(4) support for 15BPP.
details: https://anonhg.NetBSD.org/src/rev/34a3fa6e63a4
branches: trunk
changeset: 350889:34a3fa6e63a4
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Wed Jan 25 17:31:55 2017 +0000
description:
Improve/fix igsfb(4) support for 15BPP.
Use howmany(depth, NBBY) instead of (depth >> 3), so that 15 bits maps
to 2 bytes instead of 1.
While here, in a nearly-identical change, don't hard-code 8BPP into the
CyberPro blitter.
diffstat:
sys/dev/ic/igsfb.c | 12 ++++++------
sys/dev/ic/igsfb_subr.c | 8 ++++----
2 files changed, 10 insertions(+), 10 deletions(-)
diffs (90 lines):
diff -r aec96e8409fc -r 34a3fa6e63a4 sys/dev/ic/igsfb.c
--- a/sys/dev/ic/igsfb.c Wed Jan 25 17:12:56 2017 +0000
+++ b/sys/dev/ic/igsfb.c Wed Jan 25 17:31:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: igsfb.c,v 1.55 2017/01/25 16:11:54 jakllsch Exp $ */
+/* $NetBSD: igsfb.c,v 1.56 2017/01/25 17:31:55 jakllsch Exp $ */
/*
* Copyright (c) 2002, 2003 Valeriy E. Ushakov
@@ -31,7 +31,7 @@
* Integraphics Systems IGA 168x and CyberPro series.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: igsfb.c,v 1.55 2017/01/25 16:11:54 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igsfb.c,v 1.56 2017/01/25 17:31:55 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -359,7 +359,6 @@
* Init graphic coprocessor for accelerated rasops.
*/
if (dc->dc_id >= 0x2000) { /* XXX */
- /* XXX: hardcoded 8bpp */
bus_space_write_2(dc->dc_iot, dc->dc_coph,
IGS_COP_SRC_MAP_WIDTH_REG,
dc->dc_width - 1);
@@ -369,7 +368,7 @@
bus_space_write_1(dc->dc_iot, dc->dc_coph,
IGS_COP_MAP_FMT_REG,
- IGS_COP_MAP_8BPP);
+ howmany(dc->dc_depth, NBBY) - 1);
}
/* make sure screen is not blanked */
@@ -635,7 +634,7 @@
return 0;
case WSDISPLAYIO_LINEBYTES:
- *(int *)data = dc->dc_width * (dc->dc_maxdepth >> 3);
+ *(int *)data = dc->dc_width * howmany(dc->dc_maxdepth, NBBY);
return 0;
case WSDISPLAYIO_SMODE:
@@ -1192,7 +1191,8 @@
int timo = 100000;
uint8_t reg;
- bus_space_write_1(t, h, IGS_COP_MAP_FMT_REG, (dc->dc_depth >> 3) - 1);
+ bus_space_write_1(t, h, IGS_COP_MAP_FMT_REG,
+ howmany(dc->dc_depth, NBBY) - 1);
while (timo--) {
reg = bus_space_read_1(t, h, IGS_COP_CTL_REG);
if ((reg & IGS_COP_CTL_BUSY) == 0)
diff -r aec96e8409fc -r 34a3fa6e63a4 sys/dev/ic/igsfb_subr.c
--- a/sys/dev/ic/igsfb_subr.c Wed Jan 25 17:12:56 2017 +0000
+++ b/sys/dev/ic/igsfb_subr.c Wed Jan 25 17:31:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: igsfb_subr.c,v 1.12 2009/11/18 21:59:38 macallan Exp $ */
+/* $NetBSD: igsfb_subr.c,v 1.13 2017/01/25 17:31:55 jakllsch Exp $ */
/*
* Copyright (c) 2002 Valeriy E. Ushakov
@@ -32,7 +32,7 @@
* Integraphics Systems IGA 168x and CyberPro series.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: igsfb_subr.c,v 1.12 2009/11/18 21:59:38 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igsfb_subr.c,v 1.13 2017/01/25 17:31:55 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -511,7 +511,7 @@
depth = 8;
seq_mode = IGS_EXT_SEQ_8BPP;
}
- bytes_per_pixel = depth >> 3;
+ bytes_per_pixel = howmany(depth, NBBY);
hoffset = (mode->hdisplay >> 3) * bytes_per_pixel;
memfetch = hoffset + 1;
@@ -660,7 +660,7 @@
dc->dc_width = mode->hdisplay;
dc->dc_height = mode->vdisplay;
dc->dc_depth = depth;
- dc->dc_stride = dc->dc_width * (depth >> 3);
+ dc->dc_stride = dc->dc_width * howmany(depth, NBBY);
igsfb_video_on(dc);
}
Home |
Main Index |
Thread Index |
Old Index