- Fix cursor image handling bugs escaped in last commit.

This commit is contained in:
nisimura 1998-11-18 12:26:31 +00:00
parent dee948f2d9
commit 4184d87669
4 changed files with 50 additions and 74 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cfb.c,v 1.3 1998/11/09 03:58:05 nisimura Exp $ */
/* $NetBSD: cfb.c,v 1.4 1998/11/18 12:26:31 nisimura Exp $ */
/*
* Copyright (c) 1998 Tohru Nishimura. All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: cfb.c,v 1.3 1998/11/09 03:58:05 nisimura Exp $");
__KERNEL_RCSID(0, "$NetBSD: cfb.c,v 1.4 1998/11/18 12:26:31 nisimura Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -548,13 +548,13 @@ cfbintr(arg)
u_int8_t *cp = sc->sc_cursor.cc_color;
BT459_SELECT(vdac, BT459_REG_CCOLOR_2);
vdac->bt_cmap = cp[1]; tc_wmb();
vdac->bt_cmap = cp[3]; tc_wmb();
vdac->bt_cmap = cp[5]; tc_wmb();
vdac->bt_reg = cp[1]; tc_wmb();
vdac->bt_reg = cp[3]; tc_wmb();
vdac->bt_reg = cp[5]; tc_wmb();
vdac->bt_cmap = cp[0]; tc_wmb();
vdac->bt_cmap = cp[2]; tc_wmb();
vdac->bt_cmap = cp[4]; tc_wmb();
vdac->bt_reg = cp[0]; tc_wmb();
vdac->bt_reg = cp[2]; tc_wmb();
vdac->bt_reg = cp[4]; tc_wmb();
}
if (v & DATA_CURSHAPE_CHANGED) {
u_int8_t *ip, *mp, img, msk;
@ -597,9 +597,9 @@ cfbintr(arg)
BT459_SELECT(vdac, 0);
for (index = 0; index < CMAP_SIZE; index++) {
vdac->bt_cmap = cm->r[index];
vdac->bt_cmap = cm->g[index];
vdac->bt_cmap = cm->b[index];
vdac->bt_cmap = cm->r[index]; tc_wmb();
vdac->bt_cmap = cm->g[index]; tc_wmb();
vdac->bt_cmap = cm->b[index]; tc_wmb();
}
}
return (1);
@ -728,7 +728,7 @@ set_cursor(sc, p)
struct wsdisplay_cursor *p;
{
#define cc (&sc->sc_cursor)
int v, index, count;
int v, index, count, icount;
v = p->which;
if (v & WSDISPLAY_CURSOR_DOCMAP) {
@ -744,7 +744,7 @@ set_cursor(sc, p)
if (v & WSDISPLAY_CURSOR_DOSHAPE) {
if (p->size.x > CURSOR_MAX_SIZE || p->size.y > CURSOR_MAX_SIZE)
return (EINVAL);
count = (CURSOR_MAX_SIZE / NBBY) * p->size.y;
icount = ((p->size.x < 33) ? 4 : 8) * p->size.y;
if (!useracc(p->image, count, B_READ) ||
!useracc(p->mask, count, B_READ))
return (EFAULT);
@ -763,7 +763,6 @@ set_cursor(sc, p)
sc->sc_changed |= DATA_ENB_CHANGED;
}
if (v & WSDISPLAY_CURSOR_DOCMAP) {
count = p->cmap.count;
copyin(p->cmap.red, &cc->cc_color[index], count);
copyin(p->cmap.green, &cc->cc_color[index + 2], count);
copyin(p->cmap.blue, &cc->cc_color[index + 4], count);
@ -772,8 +771,8 @@ set_cursor(sc, p)
if (v & WSDISPLAY_CURSOR_DOSHAPE) {
cc->cc_size = p->size;
memset(cc->cc_image, 0, sizeof cc->cc_image);
copyin(p->image, cc->cc_image, count);
copyin(p->mask, cc->cc_image+CURSOR_MAX_SIZE, count);
copyin(p->image, cc->cc_image, icount);
copyin(p->mask, cc->cc_image+CURSOR_MAX_SIZE, icount);
sc->sc_changed |= DATA_CURSHAPE_CHANGED;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfb.c,v 1.3 1998/11/09 03:58:05 nisimura Exp $ */
/* $NetBSD: mfb.c,v 1.4 1998/11/18 12:26:32 nisimura Exp $ */
/*
* Copyright (c) 1998 Tohru Nishimura. All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.3 1998/11/09 03:58:05 nisimura Exp $");
__KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.4 1998/11/18 12:26:32 nisimura Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -77,7 +77,16 @@ struct bt455reg {
u_int8_t bt_ovly;
};
/* it's really painful to manipulate 'twined' registers... */
/*
* N.B. a paif of Bt431s are located adjascently.
* struct bt431twin {
* struct {
* u_int8_t u0; for sprite image
* u_int8_t u1; for sprite mask
* unsigned :16;
* } bt_lo;
* ...
*/
struct bt431reg {
u_int16_t bt_lo;
unsigned : 16;
@ -104,16 +113,6 @@ struct bt455reg {
u_int32_t bt_ovly;
};
/*
* N.B. a paif of Bt431s are located adjascently.
* struct bt431twin {
* struct {
* u_int8_t u0; for sprite image
* u_int8_t u1; for sprite mask
* unsigned :16;
* } bt_lo;
* ...
*/
struct bt431reg {
u_int32_t bt_lo;
u_int32_t bt_hi;
@ -567,23 +566,6 @@ mfbintr(arg)
curs->bt_ctl = (sc->sc_curenb) ? 0x4444 : 0x0404;
}
if (v & DATA_CURSHAPE_CHANGED) {
#if 0
u_int8_t *bp1, *bp2;
u_int16_t twin;
int index;
bp1 = (u_int8_t *)&sc->sc_cursor.cc_image;
bp2 = (u_int8_t *)(&sc->sc_cursor.cc_image + CURSOR_MAX_SIZE);
BT431_SELECT(curs, BT431_REG_CRAM_BASE+0);
for (index = 0;
index < sizeof(sc->sc_cursor.cc_image)/sizeof(u_int16_t);
index++) {
twin = *bp1++ | (*bp2++ << 8);
curs->bt_ram = twin;
tc_wmb();
}
#else
u_int8_t *ip, *mp, img, msk;
int bcnt;
@ -614,7 +596,6 @@ mfbintr(arg)
tc_wmb();
bcnt += 2;
}
#endif
}
return (1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sfb.c,v 1.4 1998/11/14 16:31:34 drochner Exp $ */
/* $NetBSD: sfb.c,v 1.5 1998/11/18 12:26:32 nisimura Exp $ */
/*
* Copyright (c) 1998 Tohru Nishimura. All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: sfb.c,v 1.4 1998/11/14 16:31:34 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: sfb.c,v 1.5 1998/11/18 12:26:32 nisimura Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -547,7 +547,7 @@ sfbintr(arg)
if (v & DATA_ENB_CHANGED) {
BT459_SELECT(vdac, BT459_REG_CCR);
vdac->bt_reg = (sc->sc_curenb) ? 0xc0 : 0x00; tc_wmb();
vdac->bt_reg = (sc->sc_curenb) ? 0xc0 : 0x00;
}
if (v & DATA_CURCMAP_CHANGED) {
u_int8_t *cp = sc->sc_cursor.cc_color;
@ -741,13 +741,12 @@ set_cursor(sc, p)
struct wsdisplay_cursor *p;
{
#define cc (&sc->sc_cursor)
int v, index, count;
int v, index, count, icount;
v = p->which;
if (v & WSDISPLAY_CURSOR_DOCMAP) {
index = p->cmap.index;
count = p->cmap.count;
if (index >= 2 || (index + count) > 2)
return (EINVAL);
if (!useracc(p->cmap.red, count, B_READ) ||
@ -758,7 +757,7 @@ set_cursor(sc, p)
if (v & WSDISPLAY_CURSOR_DOSHAPE) {
if (p->size.x > CURSOR_MAX_SIZE || p->size.y > CURSOR_MAX_SIZE)
return (EINVAL);
count = ((p->size.x < 33) ? 4 : 8) * p->size.y;
icount = ((p->size.x < 33) ? 4 : 8) * p->size.y;
if (!useracc(p->image, count, B_READ) ||
!useracc(p->mask, count, B_READ))
return (EFAULT);
@ -777,7 +776,6 @@ set_cursor(sc, p)
sc->sc_changed |= DATA_ENB_CHANGED;
}
if (v & WSDISPLAY_CURSOR_DOCMAP) {
count = p->cmap.count;
copyin(p->cmap.red, &cc->cc_color[index], count);
copyin(p->cmap.green, &cc->cc_color[index + 2], count);
copyin(p->cmap.blue, &cc->cc_color[index + 4], count);
@ -786,8 +784,8 @@ set_cursor(sc, p)
if (v & WSDISPLAY_CURSOR_DOSHAPE) {
cc->cc_size = p->size;
memset(cc->cc_image, 0, sizeof cc->cc_image);
copyin(p->image, cc->cc_image, count);
copyin(p->mask, cc->cc_image+CURSOR_MAX_SIZE, count);
copyin(p->image, cc->cc_image, icount);
copyin(p->mask, cc->cc_image+CURSOR_MAX_SIZE, icount);
sc->sc_changed |= DATA_CURSHAPE_CHANGED;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tfb.c,v 1.3 1998/11/09 03:58:06 nisimura Exp $ */
/* $NetBSD: tfb.c,v 1.4 1998/11/18 12:26:32 nisimura Exp $ */
/*
* Copyright (c) 1998 Tohru Nishimura. All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: tfb.c,v 1.3 1998/11/09 03:58:06 nisimura Exp $");
__KERNEL_RCSID(0, "$NetBSD: tfb.c,v 1.4 1998/11/18 12:26:32 nisimura Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -78,7 +78,16 @@ struct bt463reg {
u_int8_t bt_cmap;
};
/* it's really painful to manipulate 'twined' registers... */
/*
* N.B. a paif of Bt431s are located adjascently.
* struct bt431twin {
* struct {
* u_int8_t u0; for sprite image
* u_int8_t u1; for sprite mask
* unsigned :16;
* } bt_lo;
* ...
*/
struct bt431reg {
u_int16_t bt_lo;
unsigned : 16;
@ -101,16 +110,6 @@ struct bt463reg {
u_int32_t bt_cmap;
};
/*
* N.B. a paif of Bt431s are located adjascently.
* struct bt431twin {
* struct {
* u_int8_t u0; for sprite image
* u_int8_t u1; for sprite mask
* unsigned :16;
* } bt_lo;
* ...
*/
struct bt431reg {
u_int32_t bt_lo;
u_int32_t bt_hi;
@ -761,7 +760,7 @@ set_cursor(sc, p)
struct wsdisplay_cursor *p;
{
#define cc (&sc->sc_cursor)
int v, index, count;
int v, index, count, icount;
v = p->which;
if (v & WSDISPLAY_CURSOR_DOCMAP) {
@ -777,7 +776,7 @@ set_cursor(sc, p)
if (v & WSDISPLAY_CURSOR_DOSHAPE) {
if (p->size.x > CURSOR_MAX_SIZE || p->size.y > CURSOR_MAX_SIZE)
return (EINVAL);
count = ((p->size.x < 33) ? 4 : 8) * p->size.y;
icount = ((p->size.x < 33) ? 4 : 8) * p->size.y;
if (!useracc(p->image, count, B_READ) ||
!useracc(p->mask, count, B_READ))
return (EFAULT);
@ -796,7 +795,6 @@ set_cursor(sc, p)
sc->sc_changed |= DATA_ENB_CHANGED;
}
if (v & WSDISPLAY_CURSOR_DOCMAP) {
count = p->cmap.count;
copyin(p->cmap.red, &cc->cc_color[index], count);
copyin(p->cmap.green, &cc->cc_color[index + 2], count);
copyin(p->cmap.blue, &cc->cc_color[index + 4], count);
@ -805,8 +803,8 @@ set_cursor(sc, p)
if (v & WSDISPLAY_CURSOR_DOSHAPE) {
cc->cc_size = p->size;
memset(cc->cc_image, 0, sizeof cc->cc_image);
copyin(p->image, cc->cc_image, count);
copyin(p->mask, cc->cc_image+CURSOR_MAX_SIZE, count);
copyin(p->image, cc->cc_image, icount);
copyin(p->mask, cc->cc_image+CURSOR_MAX_SIZE, icount);
sc->sc_changed |= DATA_CURSHAPE_CHANGED;
}