Module Name: src Committed By: tsutsui Date: Fri Feb 2 15:59:30 UTC 2024
Modified Files: src/sys/arch/next68k/dev: nextdisplay.c nextdisplayvar.h Log Message: Add WSDISPLAY_GINFO, LINEBYTES, and SMODE ioctl(2)s and mmap(2) support. mlterm-wscons partially works (no 2 bpp support) with these APIs. XXX: Xorg server needs wsmouse support. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/next68k/dev/nextdisplay.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/next68k/dev/nextdisplayvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/next68k/dev/nextdisplay.c diff -u src/sys/arch/next68k/dev/nextdisplay.c:1.30 src/sys/arch/next68k/dev/nextdisplay.c:1.31 --- src/sys/arch/next68k/dev/nextdisplay.c:1.30 Sat Feb 11 02:34:15 2023 +++ src/sys/arch/next68k/dev/nextdisplay.c Fri Feb 2 15:59:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nextdisplay.c,v 1.30 2023/02/11 02:34:15 tsutsui Exp $ */ +/* $NetBSD: nextdisplay.c,v 1.31 2024/02/02 15:59:30 tsutsui Exp $ */ /* * Copyright (c) 1998 Matt DeBergalis @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.30 2023/02/11 02:34:15 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.31 2024/02/02 15:59:30 tsutsui Exp $"); #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ @@ -170,6 +170,7 @@ nextdisplay_init(struct nextdisplay_conf dc->dc_wid = 1120; dc->dc_ht = 832; dc->dc_depth = color ? 16 : 2; + dc->dc_cmsize = color ? 256 : 4; dc->dc_rowbytes = (turbo ? 1120 : 1152) * dc->dc_depth / 8; dc->dc_videobase = dc->dc_vaddr; @@ -259,6 +260,8 @@ nextdisplay_attach(device_t parent, devi INTR_ENABLE(NEXT_I_C16_VIDEO); } + sc->sc_mode = WSDISPLAYIO_MODE_EMUL; + /* initialize the raster */ waa.console = isconsole; waa.scrdata = iscolor ? @@ -294,6 +297,7 @@ nextdisplay_ioctl(void *v, void *vs, u_l { struct nextdisplay_softc *sc = v; struct nextdisplay_config *dc = sc->sc_dc; + int new_mode; switch (cmd) { case WSDISPLAYIO_GTYPE: @@ -309,6 +313,25 @@ nextdisplay_ioctl(void *v, void *vs, u_l return EPASSTHROUGH; case WSDISPLAYIO_GINFO: +#define wsd_fbip ((struct wsdisplay_fbinfo *)data) + wsd_fbip->height = dc->dc_ht; + wsd_fbip->width = dc->dc_wid; + wsd_fbip->depth = dc->dc_depth; + wsd_fbip->cmsize = dc->dc_cmsize; +#undef wsd_fbip + return 0; + + case WSDISPLAYIO_LINEBYTES: + *(u_int *)data = dc->dc_rowbytes; + return 0; + + case WSDISPLAYIO_SMODE: + new_mode = *(int *)data; + if (new_mode != sc->sc_mode) { + sc->sc_mode = new_mode; + } + return 0; + case WSDISPLAYIO_GETCMAP: case WSDISPLAYIO_PUTCMAP: case WSDISPLAYIO_GVIDEO: @@ -326,10 +349,18 @@ nextdisplay_ioctl(void *v, void *vs, u_l static paddr_t nextdisplay_mmap(void *v, void *vs, off_t offset, int prot) { + struct nextdisplay_softc *sc = v; + struct nextdisplay_config *dc = sc->sc_dc; + paddr_t cookie = -1; + + switch (sc->sc_mode) { + case WSDISPLAYIO_MODE_DUMBFB: + if (offset >= 0 && offset < dc->dc_size) + cookie = m68k_btop(dc->dc_paddr + offset); + break; + } - /* XXX */ - printf("nextdisplay_mmap: failed\n"); - return -1; + return cookie; } int Index: src/sys/arch/next68k/dev/nextdisplayvar.h diff -u src/sys/arch/next68k/dev/nextdisplayvar.h:1.6 src/sys/arch/next68k/dev/nextdisplayvar.h:1.7 --- src/sys/arch/next68k/dev/nextdisplayvar.h:1.6 Fri Feb 3 23:13:00 2023 +++ src/sys/arch/next68k/dev/nextdisplayvar.h Fri Feb 2 15:59:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nextdisplayvar.h,v 1.6 2023/02/03 23:13:00 tsutsui Exp $ */ +/* $NetBSD: nextdisplayvar.h,v 1.7 2024/02/02 15:59:30 tsutsui Exp $ */ /* * Copyright (c) 1998 Matt DeBergalis * All rights reserved. @@ -54,6 +54,7 @@ struct nextdisplay_config { int dc_ht; /* height of frame buffer */ int dc_depth; /* depth of frame buffer */ int dc_rowbytes; /* bytes in fb scan line */ + int dc_cmsize; struct raster dc_raster; /* raster description */ struct rcons dc_rcons; /* raster blitter control info */ @@ -67,6 +68,7 @@ struct nextdisplay_softc { device_t sc_dev; struct nextdisplay_config *sc_dc; + int sc_mode; int nscreens; };