Add WSDISPLAYIO_[GS]MODE type _DUMBFB - mapped fb (no registers)

Add WSDISPLAYIO_LINEBYTES ioctl - # bytes/row

Used by ffb driver and XFree wsfb driver module - From OpenBSD
This commit is contained in:
heas 2004-07-20 20:28:20 +00:00
parent aeec9b8f23
commit a3f3869414
3 changed files with 27 additions and 11 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: wsdisplay.4,v 1.20 2004/01/20 18:31:18 heas Exp $
.\" $NetBSD: wsdisplay.4,v 1.21 2004/07/20 20:28:20 heas Exp $
.\"
.\" Copyright (c) 1999 Matthias Drochner.
.\" Copyright (c) 2002 Ben Harris.
@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd June 22, 2002
.Dd July 20, 2004
.Os
.Dt WSDISPLAY 4
.Sh NAME
@ -390,12 +390,17 @@ Possible results include:
The display is in emulating (text) mode.
.It Dv WSDISPLAYIO_MODE_MAPPED
The display is in mapped (graphics) mode.
.It Dv WSDISPLAYIO_MODE_DUMBFB
The display is in mapped (frame buffer) mode.
.El
.Pp
.It Dv WSDISPLAYIO_SMODE Pq Li u_int
Set the current mode of the display.
For possible arguments, see
.Dv WSDISPLAYIO_GMODE .
.Pp
.It Dv WSDISPLAYIO_LINEBYTES Pq Li u_int
Get the number of bytes per row, which may be the same the number of pixels.
.El
.Sh FILES
.Bl -item

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsconsio.h,v 1.66 2004/07/07 00:10:30 sekiya Exp $ */
/* $NetBSD: wsconsio.h,v 1.67 2004/07/20 20:28:20 heas Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -348,6 +348,7 @@ struct wsdisplay_cursor {
#define WSDISPLAYIO_SMODE _IOW('W', 76, u_int)
#define WSDISPLAYIO_MODE_EMUL 0 /* emulation (text) mode */
#define WSDISPLAYIO_MODE_MAPPED 1 /* mapped (graphics) mode */
#define WSDISPLAYIO_MODE_DUMBFB 2 /* mapped (graphics) fb mode */
/*
@ -445,6 +446,8 @@ struct wsdisplay_scroll_data {
/* XXX NOT YET DEFINED */
/* Mapping information retrieval. */
/* Display information: number of bytes per row, may be same as pixels */
#define WSDISPLAYIO_LINEBYTES _IOR('W', 95, u_int)
/*
* Mux ioctls (96 - 127)

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsdisplay.c,v 1.78 2004/06/03 19:04:58 christos Exp $ */
/* $NetBSD: wsdisplay.c,v 1.79 2004/07/20 20:28:20 heas Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.78 2004/06/03 19:04:58 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.79 2004/07/20 20:28:20 heas Exp $");
#include "opt_wsdisplay_compat.h"
#include "opt_compat_netbsd.h"
@ -84,6 +84,7 @@ struct wsscreen {
#define SCR_OPEN 1 /* is it open? */
#define SCR_WAITACTIVE 2 /* someone waiting on activation */
#define SCR_GRAPHICS 4 /* graphics mode, no text (emulation) output */
#define SCR_DUMBFB 8 /* in use as a dumb fb (iff SCR_GRAPHICS) */
const struct wscons_syncops *scr_syncops;
void *scr_synccookie;
@ -1047,21 +1048,28 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
switch (cmd) {
case WSDISPLAYIO_GMODE:
*(u_int *)data = (scr->scr_flags & SCR_GRAPHICS ?
WSDISPLAYIO_MODE_MAPPED :
WSDISPLAYIO_MODE_EMUL);
if (scr->scr_flags & SCR_GRAPHICS) {
if (scr->scr_flags & SCR_DUMBFB)
*(u_int *)data = WSDISPLAYIO_MODE_DUMBFB;
else
*(u_int *)data = WSDISPLAYIO_MODE_MAPPED;
} else
*(u_int *)data = WSDISPLAYIO_MODE_EMUL;
return (0);
case WSDISPLAYIO_SMODE:
#define d (*(int *)data)
if (d != WSDISPLAYIO_MODE_EMUL &&
d != WSDISPLAYIO_MODE_MAPPED)
d != WSDISPLAYIO_MODE_MAPPED &&
d != WSDISPLAYIO_MODE_DUMBFB)
return (EINVAL);
if (WSSCREEN_HAS_EMULATOR(scr)) {
scr->scr_flags &= ~SCR_GRAPHICS;
if (d == WSDISPLAYIO_MODE_MAPPED)
scr->scr_flags |= SCR_GRAPHICS;
if (d == WSDISPLAYIO_MODE_MAPPED ||
d == WSDISPLAYIO_MODE_DUMBFB)
scr->scr_flags |= SCR_GRAPHICS |
((d == WSDISPLAYIO_MODE_DUMBFB) ? SCR_DUMBFB : 0);
} else if (d == WSDISPLAYIO_MODE_EMUL)
return (EINVAL);