2010-02-02 19:54:40 +03:00
|
|
|
/* $NetBSD: wsdisplayvar.h,v 1.48 2010/02/02 16:54:40 drochner Exp $ */
|
1998-03-22 17:24:02 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Christopher G. Demetriou
|
|
|
|
* for the NetBSD Project.
|
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2006-02-19 18:09:58 +03:00
|
|
|
#ifndef _DEV_WSCONS_WSDISPLAYVAR_H
|
|
|
|
#define _DEV_WSCONS_WSDISPLAYVAR_H
|
|
|
|
|
2007-10-19 12:57:50 +04:00
|
|
|
#include <sys/device.h>
|
1998-03-22 17:24:02 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* WSDISPLAY interfaces
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Emulation functions, for displays that can support glass-tty terminal
|
|
|
|
* emulations. These are character oriented, with row and column
|
|
|
|
* numbers starting at zero in the upper left hand corner of the
|
|
|
|
* screen.
|
|
|
|
*
|
|
|
|
* These are used only when emulating a terminal. Therefore, displays
|
|
|
|
* drivers which cannot emulate terminals do not have to provide them.
|
|
|
|
*
|
|
|
|
* There is a "void *" cookie provided by the display driver associated
|
|
|
|
* with these functions, which is passed to them when they are invoked.
|
|
|
|
*/
|
|
|
|
struct wsdisplay_emulops {
|
2006-10-09 15:03:43 +04:00
|
|
|
void (*cursor)(void *, int, int, int);
|
2001-10-13 19:56:15 +04:00
|
|
|
int (*mapchar)(void *, int, unsigned int *);
|
2006-10-09 15:03:43 +04:00
|
|
|
void (*putchar)(void *, int, int, u_int, long);
|
|
|
|
void (*copycols)(void *, int, int, int, int);
|
|
|
|
void (*erasecols)(void *, int, int, int, long);
|
|
|
|
void (*copyrows)(void *, int, int, int);
|
|
|
|
void (*eraserows)(void *, int, int, long);
|
|
|
|
int (*allocattr)(void *, int, int, int, long *);
|
1998-05-15 00:49:55 +04:00
|
|
|
/* fg / bg values. Made identical to ANSI terminal color codes. */
|
|
|
|
#define WSCOL_BLACK 0
|
|
|
|
#define WSCOL_RED 1
|
|
|
|
#define WSCOL_GREEN 2
|
|
|
|
#define WSCOL_BROWN 3
|
|
|
|
#define WSCOL_BLUE 4
|
|
|
|
#define WSCOL_MAGENTA 5
|
|
|
|
#define WSCOL_CYAN 6
|
|
|
|
#define WSCOL_WHITE 7
|
2005-05-23 13:44:57 +04:00
|
|
|
#define WSCOL_LIGHT_GREY (WSCOL_BLACK+8)
|
|
|
|
#define WSCOL_LIGHT_RED (WSCOL_RED+8)
|
|
|
|
#define WSCOL_LIGHT_GREEN (WSCOL_GREEN+8)
|
|
|
|
#define WSCOL_LIGHT_BROWN (WSCOL_BROWN+8)
|
|
|
|
#define WSCOL_LIGHT_BLUE (WSCOL_BLUE+8)
|
|
|
|
#define WSCOL_LIGHT_MAGENTA (WSCOL_MAGENTA+8)
|
|
|
|
#define WSCOL_LIGHT_CYAN (WSCOL_CYAN+8)
|
|
|
|
#define WSCOL_LIGHT_WHITE (WSCOL_WHITE+8)
|
1998-05-15 00:49:55 +04:00
|
|
|
/* flag values: */
|
|
|
|
#define WSATTR_REVERSE 1
|
|
|
|
#define WSATTR_HILIT 2
|
|
|
|
#define WSATTR_BLINK 4
|
|
|
|
#define WSATTR_UNDERLINE 8
|
|
|
|
#define WSATTR_WSCOLORS 16
|
|
|
|
/* XXX need a free_attr() ??? */
|
2006-10-09 15:03:43 +04:00
|
|
|
void (*replaceattr)(void *, long, long);
|
1998-03-22 17:24:02 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct wsscreen_descr {
|
2005-05-30 01:56:35 +04:00
|
|
|
const char *name;
|
1998-03-22 17:24:02 +03:00
|
|
|
int ncols, nrows;
|
|
|
|
const struct wsdisplay_emulops *textops;
|
|
|
|
int fontwidth, fontheight;
|
1998-05-15 00:49:55 +04:00
|
|
|
int capabilities;
|
|
|
|
#define WSSCREEN_WSCOLORS 1 /* minimal color capability */
|
|
|
|
#define WSSCREEN_REVERSE 2 /* can display reversed */
|
|
|
|
#define WSSCREEN_HILIT 4 /* can highlight (however) */
|
|
|
|
#define WSSCREEN_BLINK 8 /* can blink */
|
|
|
|
#define WSSCREEN_UNDERLINE 16 /* can underline */
|
2002-10-15 21:38:08 +04:00
|
|
|
void *modecookie;
|
1998-03-22 17:24:02 +03:00
|
|
|
};
|
|
|
|
|
1999-01-13 19:21:02 +03:00
|
|
|
struct wsdisplay_font;
|
2002-06-27 03:05:33 +04:00
|
|
|
struct wsdisplay_char;
|
1998-03-22 17:24:02 +03:00
|
|
|
/*
|
|
|
|
* Display access functions, invoked by user-land programs which require
|
|
|
|
* direct device access, such as X11.
|
|
|
|
*
|
|
|
|
* There is a "void *" cookie provided by the display driver associated
|
|
|
|
* with these functions, which is passed to them when they are invoked.
|
|
|
|
*/
|
|
|
|
struct wsdisplay_accessops {
|
2007-03-04 08:59:00 +03:00
|
|
|
int (*ioctl)(void *, void *, u_long, void *, int, struct lwp *);
|
2006-10-09 15:03:43 +04:00
|
|
|
paddr_t (*mmap)(void *, void *, off_t, int);
|
2001-10-13 19:56:15 +04:00
|
|
|
int (*alloc_screen)(void *, const struct wsscreen_descr *,
|
2006-10-09 15:03:43 +04:00
|
|
|
void **, int *, int *, long *);
|
2001-10-13 19:56:15 +04:00
|
|
|
void (*free_screen)(void *, void *);
|
|
|
|
int (*show_screen)(void *, void *, int,
|
2006-10-09 15:03:43 +04:00
|
|
|
void (*)(void *, int, int), void *);
|
2001-10-13 19:56:15 +04:00
|
|
|
int (*load_font)(void *, void *, struct wsdisplay_font *);
|
|
|
|
void (*pollc)(void *, int);
|
2005-02-04 05:10:35 +03:00
|
|
|
void (*scroll)(void *, void *, int);
|
1998-03-22 17:24:02 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Attachment information provided by wsdisplaydev devices when attaching
|
|
|
|
* wsdisplay units.
|
|
|
|
*/
|
|
|
|
struct wsdisplaydev_attach_args {
|
|
|
|
const struct wsdisplay_accessops *accessops; /* access ops */
|
|
|
|
void *accesscookie; /* access cookie */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* passed to wscons by the video driver to tell about its capabilities */
|
|
|
|
struct wsscreen_list {
|
|
|
|
int nscreens;
|
|
|
|
const struct wsscreen_descr **screens;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Attachment information provided by wsemuldisplaydev devices when attaching
|
|
|
|
* wsdisplay units.
|
|
|
|
*/
|
|
|
|
struct wsemuldisplaydev_attach_args {
|
|
|
|
int console; /* is it console? */
|
1998-05-15 00:49:55 +04:00
|
|
|
const struct wsscreen_list *scrdata; /* screen cfg info */
|
1998-03-22 17:24:02 +03:00
|
|
|
const struct wsdisplay_accessops *accessops; /* access ops */
|
|
|
|
void *accesscookie; /* access cookie */
|
|
|
|
};
|
|
|
|
|
1998-06-12 02:00:04 +04:00
|
|
|
struct wscons_syncops {
|
2001-10-13 19:56:15 +04:00
|
|
|
int (*detach)(void *, int, void (*)(void *, int, int), void *);
|
|
|
|
int (*attach)(void *, int, void (*)(void *, int, int), void *);
|
|
|
|
int (*check)(void *);
|
|
|
|
void (*destroy)(void *);
|
1998-06-12 02:00:04 +04:00
|
|
|
};
|
|
|
|
|
1998-03-22 17:24:02 +03:00
|
|
|
/*
|
|
|
|
* Autoconfiguration helper functions.
|
|
|
|
*/
|
2006-11-06 22:51:12 +03:00
|
|
|
void wsdisplay_cnattach(const struct wsscreen_descr *, void *, int, int,
|
|
|
|
long);
|
|
|
|
void wsdisplay_preattach(const struct wsscreen_descr *, void *, int, int,
|
|
|
|
long);
|
|
|
|
|
2001-10-13 19:56:15 +04:00
|
|
|
int wsdisplaydevprint(void *, const char *);
|
|
|
|
int wsemuldisplaydevprint(void *, const char *);
|
1998-03-22 17:24:02 +03:00
|
|
|
|
2008-02-21 01:33:18 +03:00
|
|
|
int wsdisplay_handlex(int);
|
|
|
|
|
1998-03-22 17:24:02 +03:00
|
|
|
/*
|
|
|
|
* Console interface.
|
|
|
|
*/
|
2006-10-09 15:03:43 +04:00
|
|
|
void wsdisplay_cnputc(dev_t, int);
|
1998-06-12 02:00:04 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* for use by compatibility code
|
|
|
|
*/
|
|
|
|
struct wsdisplay_softc;
|
|
|
|
struct wsscreen;
|
2001-10-13 19:56:15 +04:00
|
|
|
int wsscreen_attach_sync(struct wsscreen *,
|
|
|
|
const struct wscons_syncops *, void *);
|
|
|
|
int wsscreen_detach_sync(struct wsscreen *);
|
|
|
|
int wsscreen_lookup_sync(struct wsscreen *,
|
|
|
|
const struct wscons_syncops *, void **);
|
1998-06-12 02:00:04 +04:00
|
|
|
|
2001-10-13 19:56:15 +04:00
|
|
|
int wsdisplay_maxscreenidx(struct wsdisplay_softc *);
|
|
|
|
int wsdisplay_screenstate(struct wsdisplay_softc *, int);
|
|
|
|
int wsdisplay_getactivescreen(struct wsdisplay_softc *);
|
|
|
|
int wsscreen_switchwait(struct wsdisplay_softc *, int);
|
1998-06-12 02:00:04 +04:00
|
|
|
|
2006-10-09 15:03:43 +04:00
|
|
|
int wsdisplay_internal_ioctl(struct wsdisplay_softc *, struct wsscreen *,
|
2007-03-04 08:59:00 +03:00
|
|
|
u_long, void *, int, struct lwp *);
|
1998-06-12 02:00:04 +04:00
|
|
|
|
2007-10-18 22:09:52 +04:00
|
|
|
int wsdisplay_usl_ioctl1(device_t, u_long, void *, int, struct lwp *);
|
1999-10-19 04:03:18 +04:00
|
|
|
|
2001-10-13 19:56:15 +04:00
|
|
|
int wsdisplay_usl_ioctl2(struct wsdisplay_softc *, struct wsscreen *,
|
2007-03-04 08:59:00 +03:00
|
|
|
u_long, void *, int, struct lwp *);
|
1999-01-09 18:44:45 +03:00
|
|
|
|
2007-03-04 08:59:00 +03:00
|
|
|
int wsdisplay_stat_ioctl(struct wsdisplay_softc *, u_long, void *,
|
2006-10-09 15:03:43 +04:00
|
|
|
int, struct lwp *);
|
2002-06-27 03:05:33 +04:00
|
|
|
|
2007-03-04 08:59:00 +03:00
|
|
|
int wsdisplay_cfg_ioctl(struct wsdisplay_softc *, u_long, void *,
|
2006-10-09 15:03:43 +04:00
|
|
|
int, struct lwp *);
|
1999-10-12 20:47:41 +04:00
|
|
|
|
2004-05-29 01:42:29 +04:00
|
|
|
#ifdef WSDISPLAY_SCROLLSUPPORT
|
2006-10-09 15:03:43 +04:00
|
|
|
void wsdisplay_scroll(void *, int);
|
2004-05-29 01:42:29 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define WSDISPLAY_SCROLL_BACKWARD 1
|
|
|
|
#define WSDISPLAY_SCROLL_FORWARD (1 << 1)
|
|
|
|
#define WSDISPLAY_SCROLL_RESET (1 << 2)
|
|
|
|
#define WSDISPLAY_SCROLL_LOW (1 << 3)
|
|
|
|
|
2008-03-25 03:49:19 +03:00
|
|
|
int wsdisplay_stat_inject(device_t, u_int, int);
|
2002-06-27 03:05:33 +04:00
|
|
|
|
1999-10-12 20:47:41 +04:00
|
|
|
/*
|
|
|
|
* for general use
|
|
|
|
*/
|
2000-09-10 13:39:57 +04:00
|
|
|
#define WSDISPLAY_NULLSCREEN -1
|
2006-10-09 15:03:43 +04:00
|
|
|
const struct wsscreen_descr *wsdisplay_screentype_pick(
|
|
|
|
const struct wsscreen_list *, const char *);
|
Implement support to dynamically change wscons console and kernel colors.
Two new ioctls are added to the wsdisplay device, named WSDISPLAY_GMSGATTRS
and WSDISPLAY_SMSGATTRS, used to retrieve the actual values and set them,
respectively (the name, if you are wondering, comes from "message attributes").
A new emulop is added to the underlying display driver (only vga, for now)
which sets the new attribute for the whole screen, without having to clear
it. This is optional, which means that this also works with other drivers
that don't have this new operation.
Five new kernel options have been added, although only documented in
i386 kernels (for now):
- WSDISPLAY_CUSTOM_OUTPUT, which enables the ioctls described above to
change the colors dynamically from userland. This is enabled by default
in the GENERIC kernel (as well as others) but disabled on all INSTALL*
kernels (as this feature is useless there).
- WS_DEFAULT_COLATTR, WS_DEFAULT_MONOATTR, WS_DEFAULT_BG and WS_DEFAULT_FG,
which specify the default colors for the console at boot time. These have
the same meaning as the (already existing) WS_KERNEL_* variables.
wsconsctl is modified to add msg.default.{attrs,bg,fg} and
msg.kernel.{attrs,bg,fg} to the display part, so that colors can be changed
after boot.
Tested on NetBSD/i386 with vga (and vga in mono mode), and on NetBSD/mac68k.
No objections in tech-kern@.
2004-07-28 16:34:02 +04:00
|
|
|
|
|
|
|
#if defined(_KERNEL)
|
|
|
|
# if defined(_KERNEL_OPT)
|
|
|
|
# include "opt_wsmsgattrs.h"
|
|
|
|
# endif
|
|
|
|
# if !defined(WS_DEFAULT_FG)
|
|
|
|
# define WS_DEFAULT_FG WSCOL_WHITE
|
|
|
|
# endif
|
|
|
|
# if !defined(WS_DEFAULT_BG)
|
|
|
|
# define WS_DEFAULT_BG WSCOL_BLACK
|
|
|
|
# endif
|
|
|
|
# if !defined(WS_DEFAULT_COLATTR)
|
|
|
|
# define WS_DEFAULT_COLATTR 0
|
|
|
|
# endif
|
|
|
|
# if !defined(WS_DEFAULT_MONOATTR)
|
|
|
|
# define WS_DEFAULT_MONOATTR 0
|
|
|
|
# endif
|
|
|
|
# if defined(WS_KERNEL_FG) || defined(WS_KERNEL_BG) || \
|
|
|
|
defined(WS_KERNEL_COLATTR) || defined(WS_KERNEL_MONOATTR)
|
|
|
|
# define WS_KERNEL_CUSTOMIZED
|
|
|
|
# else
|
|
|
|
# undef WS_KERNEL_CUSTOMIZED
|
|
|
|
# endif
|
|
|
|
# if !defined(WS_KERNEL_FG)
|
|
|
|
# define WS_KERNEL_FG WS_DEFAULT_FG
|
|
|
|
# endif
|
|
|
|
# if !defined(WS_KERNEL_BG)
|
|
|
|
# define WS_KERNEL_BG WS_DEFAULT_BG
|
|
|
|
# endif
|
|
|
|
# if !defined(WS_KERNEL_COLATTR)
|
|
|
|
# define WS_KERNEL_COLATTR WS_DEFAULT_COLATTR
|
|
|
|
# endif
|
|
|
|
# if !defined(WS_KERNEL_MONOATTR)
|
|
|
|
# define WS_KERNEL_MONOATTR WS_DEFAULT_MONOATTR
|
|
|
|
# endif
|
Implement border color customization in wscons(4), only available for vga(4)
at the moment.
This includes the addition of two new wsdisplay ioctls, WSDISPLAY_{G,S}BORDER,
one to get the actual color and one to set it, respectively. Possible colors
match those defined by ANSI (and listed in wsdisplayvar.h).
It also adds two accessops to the underlying graphics device, getborder and
setborder, which mach their ioctl counterparts.
Two kernel options are added: WSDISPLAY_CUSTOM_BORDER, which enables the
ioctls described above (to customize the border color from userland after
boot), and WSDISPLAY_BORDER_COLOR, which sets the color at boot time.
The former is enabled by default on the GENERIC kernel, but not on INSTALL
(among others). The later is always commented out, leaving the usual black
border as a default.
wsconsctl is modified to allow accessing this value easily. For example,
'wsconsctl -d -w border=blue'.
2004-07-30 02:29:35 +04:00
|
|
|
# if !defined(WSDISPLAY_BORDER_COLOR)
|
|
|
|
# define WSDISPLAY_BORDER_COLOR WSCOL_BLACK
|
|
|
|
# endif
|
Implement support to dynamically change wscons console and kernel colors.
Two new ioctls are added to the wsdisplay device, named WSDISPLAY_GMSGATTRS
and WSDISPLAY_SMSGATTRS, used to retrieve the actual values and set them,
respectively (the name, if you are wondering, comes from "message attributes").
A new emulop is added to the underlying display driver (only vga, for now)
which sets the new attribute for the whole screen, without having to clear
it. This is optional, which means that this also works with other drivers
that don't have this new operation.
Five new kernel options have been added, although only documented in
i386 kernels (for now):
- WSDISPLAY_CUSTOM_OUTPUT, which enables the ioctls described above to
change the colors dynamically from userland. This is enabled by default
in the GENERIC kernel (as well as others) but disabled on all INSTALL*
kernels (as this feature is useless there).
- WS_DEFAULT_COLATTR, WS_DEFAULT_MONOATTR, WS_DEFAULT_BG and WS_DEFAULT_FG,
which specify the default colors for the console at boot time. These have
the same meaning as the (already existing) WS_KERNEL_* variables.
wsconsctl is modified to add msg.default.{attrs,bg,fg} and
msg.kernel.{attrs,bg,fg} to the display part, so that colors can be changed
after boot.
Tested on NetBSD/i386 with vga (and vga in mono mode), and on NetBSD/mac68k.
No objections in tech-kern@.
2004-07-28 16:34:02 +04:00
|
|
|
#endif /* _KERNEL */
|
2006-02-19 18:09:58 +03:00
|
|
|
|
|
|
|
#endif /* !_DEV_WSCONS_WSDISPLAYVAR_H */
|