Fix cursor sprite for X11 startup/exit:
* add cursor on/off functions. * Default cursor state is off (for framebuffer console). * Turn off cursor in each driver's xxxCursorInit() entrypoint. * Turn on cursor at the end of each driver's xxxLoadCursor() entrypoint. works with X11R5 servers shipped with NetBSD 1.3.
This commit is contained in:
parent
980ab5b3b1
commit
45ad7fb3e5
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bt459.c,v 1.8 1997/07/20 03:57:19 jonathan Exp $ */
|
||||
/* $NetBSD: bt459.c,v 1.9 1997/11/16 10:17:53 jonathan Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -80,6 +80,9 @@
|
||||
* rights to redistribute these changes.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: bt459.c,v 1.9 1997/11/16 10:17:53 jonathan Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -97,7 +100,6 @@
|
||||
#include <pmax/dev/bt459.h> /* chipset definitions */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Forward references.
|
||||
*/
|
||||
@ -106,6 +108,8 @@ static void bt459_set_cursor_ram (struct fbinfo *, int, u_char);
|
||||
static void bt459_select_reg (bt459_regmap_t *, int);
|
||||
static void bt459_write_reg (bt459_regmap_t *, int, int);
|
||||
static u_char bt459_read_reg (bt459_regmap_t *, int);
|
||||
static __inline void bt459_cursor_on(bt459_regmap_t *);
|
||||
static __inline void bt459_cursor_off(bt459_regmap_t *);
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
@ -171,7 +175,7 @@ bt459init(fi)
|
||||
* no crosshair on either plane 0 or 1,
|
||||
* regular cursor on both planes.
|
||||
*/
|
||||
bt459_write_reg(regs, BT459_REG_CCR, 0xc0);
|
||||
bt459_cursor_on(regs);
|
||||
|
||||
/* home cursor */
|
||||
bt459_write_reg(regs, BT459_REG_CXLO, 0x00);
|
||||
@ -204,6 +208,33 @@ bt459init(fi)
|
||||
|
||||
static u_char cursor_RGB[6]; /* cursor color 2 & 3 */
|
||||
|
||||
/*
|
||||
* Enable the hardware cursor sprite.
|
||||
*/
|
||||
static __inline void
|
||||
bt459_cursor_on(btregs)
|
||||
register bt459_regmap_t *btregs;
|
||||
{
|
||||
/*
|
||||
* no blinking, 1bit cross hair, XOR reg&crosshair,
|
||||
* no crosshair on either plane 0 or 1,
|
||||
* regular cursor on both planes.
|
||||
*/
|
||||
bt459_write_reg(btregs, BT459_REG_CCR, 0xc0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Disable the hardware cursor sprite.
|
||||
*/
|
||||
static __inline void
|
||||
bt459_cursor_off(btregs)
|
||||
register bt459_regmap_t *btregs;
|
||||
{
|
||||
bt459_write_reg(btregs, BT459_REG_CCR, 0x00);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* XXX This assumes 2bits/cursor pixel so that the 1Kbyte cursor RAM
|
||||
* defines a 64x64 cursor. If the bt459 does not map the cursor RAM
|
||||
@ -257,6 +288,9 @@ bt459LoadCursor(fi, cursor)
|
||||
bt459_set_cursor_ram(fi, pos, 0);
|
||||
pos++;
|
||||
}
|
||||
|
||||
/* The cursor pattern is loaded, so turn on the hardware sprite. */
|
||||
bt459_cursor_on((bt459_regmap_t *) fi->fi_vdac);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -372,7 +406,8 @@ bt459PosCursor(fi, x, y)
|
||||
}
|
||||
|
||||
/* Initialize the colormap to the default state, which is that entry
|
||||
zero is black and all other entries are full white. */
|
||||
zero is black and all other entries are full white.
|
||||
The hardware cursor is turned off. */
|
||||
|
||||
void
|
||||
bt459InitColorMap(fi)
|
||||
@ -407,6 +442,7 @@ bt459InitColorMap(fi)
|
||||
cursor_RGB[i + 3] = 0xff;
|
||||
}
|
||||
bt459RestoreCursorColor(fi);
|
||||
bt459_cursor_off(regs);
|
||||
}
|
||||
|
||||
/* Load count entries of the colormap starting at index with the values
|
||||
@ -494,7 +530,7 @@ bt459_video_on(fi)
|
||||
|
||||
/* enable normal display */
|
||||
bt459_write_reg(regs, BT459_REG_PRM, 0xff);
|
||||
bt459_write_reg(regs, BT459_REG_CCR, 0xc0);
|
||||
bt459_cursor_off(regs);
|
||||
|
||||
fi -> fi_blanked = 0;
|
||||
return 0;
|
||||
@ -523,7 +559,7 @@ bt459_video_off(fi)
|
||||
|
||||
/* disable display */
|
||||
bt459_write_reg(regs, BT459_REG_PRM, 0);
|
||||
bt459_write_reg(regs, BT459_REG_CCR, 0);
|
||||
bt459_cursor_off(regs);
|
||||
|
||||
fi -> fi_blanked = 1;
|
||||
return 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ims332.c,v 1.7 1997/07/19 12:03:51 jonathan Exp $ */
|
||||
/* $NetBSD: ims332.c,v 1.8 1997/11/16 10:17:57 jonathan Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1995
|
||||
@ -39,6 +39,9 @@
|
||||
* Author: Alessandro Forin, Carnegie Mellon University
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: ims332.c,v 1.8 1997/11/16 10:17:57 jonathan Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
@ -50,12 +53,20 @@
|
||||
|
||||
#include <pmax/dev/ims332.h>
|
||||
|
||||
static u_int ims332_read_register (struct fbinfo *, int);
|
||||
static void ims332_write_register (struct fbinfo *, int, unsigned int);
|
||||
|
||||
#define assert_ims332_reset_bit(r) *r &= ~0x40
|
||||
#define deassert_ims332_reset_bit(r) *r |= 0x40
|
||||
|
||||
|
||||
/*
|
||||
* local prototypes
|
||||
*/
|
||||
static u_int ims332_read_register (struct fbinfo *, int);
|
||||
static void ims332_write_register (struct fbinfo *, int, unsigned int);
|
||||
static __inline void ims332_cursor_off(struct fbinfo *fi);
|
||||
static __inline void ims332_cursor_on(struct fbinfo *fi);
|
||||
|
||||
|
||||
int
|
||||
ims332init(fi)
|
||||
struct fbinfo *fi;
|
||||
@ -115,6 +126,7 @@ ims332init(fi)
|
||||
IMS332_BPP_8
|
||||
| IMS332_CSR_A_DMA_DISABLE
|
||||
| IMS332_CSR_A_VTG_ENABLE);
|
||||
ims332_cursor_off(fi);
|
||||
|
||||
return (1);
|
||||
}
|
||||
@ -153,6 +165,42 @@ ims332_write_register(fi, regno, val)
|
||||
*((volatile u_short *)(wptr)) = val;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Turn off hardware cursor sprite.
|
||||
*/
|
||||
static __inline void
|
||||
ims332_cursor_off(fi)
|
||||
register struct fbinfo *fi;
|
||||
{
|
||||
register u_int csr;
|
||||
|
||||
csr = ims332_read_register (fi, IMS332_REG_CSR_A);
|
||||
csr |= IMS332_CSR_A_DISABLE_CURSOR;
|
||||
ims332_write_register (fi, IMS332_REG_CSR_A, csr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Turn on hardware cursor.
|
||||
*/
|
||||
static __inline void
|
||||
ims332_cursor_on(fi)
|
||||
register struct fbinfo *fi;
|
||||
{
|
||||
register u_int csr;
|
||||
|
||||
csr = ims332_read_register (fi, IMS332_REG_CSR_A);
|
||||
csr &= ~IMS332_CSR_A_DISABLE_CURSOR;
|
||||
ims332_write_register (fi, IMS332_REG_CSR_A, csr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set screen colourmap to default state.
|
||||
* For X11's benefit, the default sate entry is that
|
||||
* zero is black and all other entries are full white.
|
||||
* The hardwaer cursor is turned off.
|
||||
*/
|
||||
void
|
||||
ims332InitColorMap(fi)
|
||||
struct fbinfo *fi;
|
||||
@ -175,6 +223,7 @@ ims332InitColorMap(fi)
|
||||
cursor_RGB[i + 3] = 0xff;
|
||||
}
|
||||
ims332RestoreCursorColor (fi);
|
||||
ims332_cursor_off(fi);
|
||||
}
|
||||
|
||||
/* Load color map entry(s). */
|
||||
@ -241,7 +290,6 @@ int
|
||||
ims332_video_off(fi)
|
||||
struct fbinfo *fi;
|
||||
{
|
||||
u_int csr;
|
||||
u_char *cmap_bits;
|
||||
|
||||
if (fi -> fi_blanked)
|
||||
@ -254,9 +302,7 @@ ims332_video_off(fi)
|
||||
ims332_write_register (fi, IMS332_REG_COLOR_MASK, 0);
|
||||
|
||||
/* cursor now */
|
||||
csr = ims332_read_register (fi, IMS332_REG_CSR_A);
|
||||
csr |= IMS332_CSR_A_DISABLE_CURSOR;
|
||||
ims332_write_register (fi, IMS332_REG_CSR_A, csr);
|
||||
ims332_cursor_off(fi);
|
||||
|
||||
fi -> fi_blanked = 1;
|
||||
return 0;
|
||||
@ -267,7 +313,6 @@ ims332_video_on (fi)
|
||||
struct fbinfo *fi;
|
||||
{
|
||||
u_char *cmap;
|
||||
u_int csr;
|
||||
|
||||
if (!fi -> fi_blanked)
|
||||
return 0;
|
||||
@ -282,9 +327,7 @@ ims332_video_on (fi)
|
||||
ims332_write_register (fi, IMS332_REG_COLOR_MASK, 0xffffffff);
|
||||
|
||||
/* cursor now */
|
||||
csr = ims332_read_register (fi, IMS332_REG_CSR_A);
|
||||
csr &= ~IMS332_CSR_A_DISABLE_CURSOR;
|
||||
ims332_write_register (fi, IMS332_REG_CSR_A, csr);
|
||||
ims332_cursor_on(fi);
|
||||
|
||||
fi -> fi_blanked = 0;
|
||||
return 0;
|
||||
@ -391,5 +434,8 @@ ims332LoadCursor(fi, cursor)
|
||||
ims332_write_register (fi, IMS332_REG_CURSOR_RAM + pos, 0);
|
||||
pos++;
|
||||
}
|
||||
|
||||
/* The cursor pattern is loaded, so turn on the hardware sprite. */
|
||||
ims332_cursor_on(fi);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pm.c,v 1.23 1997/11/14 02:01:22 jonathan Exp $ */
|
||||
/* $NetBSD: pm.c,v 1.24 1997/11/16 10:17:55 jonathan Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -56,7 +56,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: pm.c,v 1.23 1997/11/14 02:01:22 jonathan Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pm.c,v 1.24 1997/11/16 10:17:55 jonathan Exp $");
|
||||
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -109,6 +109,9 @@ void pmPosCursor __P((struct fbinfo *fi, int x, int y));
|
||||
void bt478CursorColor __P((struct fbinfo *fi, u_int *color));
|
||||
void bt478InitColorMap __P((struct fbinfo *fi));
|
||||
|
||||
void pccCursorOn __P((struct fbinfo *fi));
|
||||
void pccCursorOff __P((struct fbinfo *fi));
|
||||
void pmInitColorMap __P((struct fbinfo *fi));
|
||||
|
||||
int pminit __P((struct fbinfo *fi, int unit, int cold_console_flag));
|
||||
int pmattach __P((struct fbinfo *fi, int unit, int cold_console_flag));
|
||||
@ -143,7 +146,7 @@ struct cfdriver pm_cd = {
|
||||
struct fbdriver pm_driver = {
|
||||
pm_video_on,
|
||||
pm_video_off,
|
||||
bt478InitColorMap,
|
||||
pmInitColorMap, /* pcc cursor wrapper for bt478InitColorMap */
|
||||
bt478GetColorMap,
|
||||
bt478LoadColorMap,
|
||||
pmPosCursor,
|
||||
@ -261,10 +264,10 @@ pmattach(fi, unit, cold_console_flag)
|
||||
*/
|
||||
pcc->cmdr = PCC_FOPB | PCC_VBHI;
|
||||
|
||||
/*
|
||||
* Initialize the cursor register.
|
||||
*/
|
||||
pcc->cmdr = curReg = 0;
|
||||
/* Initialize the cursor register on . */
|
||||
/* Turn off the hardware cursor sprite for rcons text mode. */
|
||||
curReg = 0; /* XXX */
|
||||
pccCursorOff(fi);
|
||||
|
||||
/*
|
||||
* Initialize the color map, the screen, and the mouse.
|
||||
@ -315,6 +318,8 @@ pmattach(fi, unit, cold_console_flag)
|
||||
*
|
||||
* Side effects:
|
||||
* The cursor is loaded into the hardware cursor.
|
||||
* Also, turn on the cursor in case it was disabled before.
|
||||
* If someone sets a cursor pattern, it should probably be displayed.
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
@ -333,7 +338,9 @@ pmLoadCursor(fi, cur)
|
||||
wbflush();
|
||||
}
|
||||
curReg &= ~PCC_LODSA;
|
||||
curReg |= PCC_ENPA | PCC_ENPB;
|
||||
|
||||
/* turn on the cursor plane overlays in the PCC chip. */
|
||||
curReg |= (PCC_ENPA | PCC_ENPB);
|
||||
pcc->cmdr = curReg;
|
||||
}
|
||||
|
||||
@ -351,6 +358,9 @@ pmLoadCursor(fi, cur)
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
* NB: should not turn on the hardwar cursor, since the
|
||||
* Xserver positions the cursor to upper left corner as the last
|
||||
* cursor operation before it exits.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
@ -374,6 +384,46 @@ pmPosCursor(fi, x, y)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Turn hardware cursor on by turning on the enable for A and B
|
||||
* overlay planes. video output under the cursor sprite is then
|
||||
* determined by the A and B plane contents.
|
||||
*/
|
||||
void pccCursorOn(fi)
|
||||
struct fbinfo *fi;
|
||||
{
|
||||
register PCCRegs *pcc = (PCCRegs *)fi -> fi_base;
|
||||
pcc -> cmdr = curReg | (PCC_ENPA | PCC_ENPB);
|
||||
wbflush();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Turn hardware cursor off by turning off the enable for A and B
|
||||
* overlay planes. video output under the cursor sprite is then
|
||||
* determined by the framebuffer contents.
|
||||
*/
|
||||
void pccCursorOff(fi)
|
||||
struct fbinfo *fi;
|
||||
{
|
||||
register PCCRegs *pcc = (PCCRegs *)fi -> fi_base;
|
||||
pcc -> cmdr = curReg & ~(PCC_ENPA | PCC_ENPB);
|
||||
wbflush();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize colourmap to default values.
|
||||
* The default cursor hardware state is off.
|
||||
*/
|
||||
void pmInitColorMap(fi)
|
||||
struct fbinfo *fi;
|
||||
{
|
||||
bt478InitColorMap(fi);
|
||||
pccCursorOff(fi);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Enable the video display.
|
||||
*/
|
||||
@ -392,8 +442,13 @@ pm_video_on (fi)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* disable the video display. */
|
||||
|
||||
/*
|
||||
* Disable the video display.
|
||||
* Sets the FOPA and FOPB bits in the PCC chip to force the contents
|
||||
* of the A and B overlay planes to 1. Video output is then
|
||||
* determined by colourmap entry 12 (0x0c), which we set here to
|
||||
* black.
|
||||
*/
|
||||
static int pm_video_off (fi)
|
||||
struct fbinfo *fi;
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user