From 08420f85c8ddf54d1c74e696326c2c1d78185a55 Mon Sep 17 00:00:00 2001 From: aoyama Date: Mon, 15 Jul 2013 13:23:17 +0000 Subject: [PATCH] Add monochrome X server support for luna88k. Some luna88k specific quirks are needed in driver/xf86-video-wsfb/src/wsfb_driver.c for now. ok matthieu@ --- driver/Makefile | 7 +- driver/xf86-video-wsfb/src/wsfb_driver.c | 23 ++- xserver/Makefile.bsd-wrapper | 4 +- xserver/configure.ac | 5 + xserver/hw/xfree86/os-support/bsd/Makefile.am | 5 + .../hw/xfree86/os-support/bsd/luna88k_video.c | 170 ++++++++++++++++++ 6 files changed, 204 insertions(+), 10 deletions(-) create mode 100644 xserver/hw/xfree86/os-support/bsd/luna88k_video.c diff --git a/driver/Makefile b/driver/Makefile index 6b70be272..a8dab04a1 100644 --- a/driver/Makefile +++ b/driver/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.54 2013/03/16 01:24:43 aoyama Exp $ +# $OpenBSD: Makefile,v 1.55 2013/07/15 13:23:17 aoyama Exp $ INPUT_DRV_DEFAULT= \ xf86-input-keyboard \ @@ -26,7 +26,7 @@ INPUT_DRV_landisk= INPUT_DRV_loongson= ${INPUT_DRV_DEFAULT} -INPUT_DRV_luna88k= +INPUT_DRV_luna88k= ${INPUT_DRV_DEFAULT} INPUT_DRV_macppc= ${INPUT_DRV_COMMON} @@ -82,7 +82,8 @@ VIDEO_DRV_landisk= VIDEO_DRV_loongson= \ xf86-video-wsfb -VIDEO_DRV_luna88k= +VIDEO_DRV_luna88k= \ + xf86-video-wsfb VIDEO_DRV_macppc= \ xf86-video-ati xf86-video-mach64 xf86-video-nv xf86-video-r128 \ diff --git a/driver/xf86-video-wsfb/src/wsfb_driver.c b/driver/xf86-video-wsfb/src/wsfb_driver.c index 752b1c14c..d0d556ee8 100644 --- a/driver/xf86-video-wsfb/src/wsfb_driver.c +++ b/driver/xf86-video-wsfb/src/wsfb_driver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsfb_driver.c,v 1.29 2013/05/12 13:06:25 matthieu Exp $ */ +/* $OpenBSD: wsfb_driver.c,v 1.30 2013/07/15 13:23:17 aoyama Exp $ */ /* * Copyright © 2001-2012 Matthieu Herrb * All rights reserved. @@ -235,6 +235,7 @@ typedef struct { int fd; /* File descriptor of open device. */ struct wsdisplay_fbinfo info; /* Frame buffer characteristics. */ int linebytes; /* Number of bytes per row. */ + int wstype; /* wsdisplay type. */ unsigned char* fbstart; unsigned char* fbmem; size_t fbmem_len; @@ -397,7 +398,7 @@ static Bool WsfbPreInit(ScrnInfoPtr pScrn, int flags) { WsfbPtr fPtr; - int defaultDepth, depths, flags24, wstype; + int defaultDepth, depths, flags24; const char *dev; char *mod = NULL, *s; const char *reqSym = NULL; @@ -427,7 +428,7 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags) if (fPtr->fd == -1) { return FALSE; } - if (ioctl(fPtr->fd, WSDISPLAYIO_GTYPE, &wstype) == -1) { + if (ioctl(fPtr->fd, WSDISPLAYIO_GTYPE, &(fPtr->wstype)) == -1) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ioctl WSDISPLAY_GTYPE: %s\n", strerror(errno)); @@ -495,7 +496,7 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags) fPtr->info.depth, flags24)) return FALSE; - if (wstype == WSDISPLAY_TYPE_PCIVGA) { + if (fPtr->wstype == WSDISPLAY_TYPE_PCIVGA) { /* Set specified mode. */ if (pScrn->display->modes != NULL && pScrn->display->modes[0] != NULL) { @@ -579,7 +580,7 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags) if (pScrn->depth > 8) { rgb zeros = { 0, 0, 0 }, masks; - switch (wstype) { + switch (fPtr->wstype) { case WSDISPLAY_TYPE_SUN24: case WSDISPLAY_TYPE_SUNCG12: case WSDISPLAY_TYPE_SUNCG14: @@ -736,6 +737,10 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags) pScrn->virtualY = fPtr->info.height; pScrn->displayWidth = pScrn->virtualX; + /* Quirk for LUNA's framebuffer */ + if (fPtr->wstype == WSDISPLAY_TYPE_LUNA) + pScrn->displayWidth = fPtr->linebytes * 8; + /* Set the display resolution. */ xf86SetDpi(pScrn, 0, 0); @@ -915,6 +920,14 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL) fPtr->fbstart = fPtr->fbmem; + /* + * LUNA's framebuffer seems to have 64 dot (8 byte) offset. + * This might be able to be changed in kernel lunafb driver, + * but current setting was pulled from 4.4BSD-Lite2/luna68k. + */ + if (fPtr->wstype == WSDISPLAY_TYPE_LUNA) + fPtr->fbstart += 8; + if (fPtr->shadowFB) { fPtr->shadow = calloc(1, pScrn->virtualX * pScrn->virtualY * pScrn->bitsPerPixel/8); diff --git a/xserver/Makefile.bsd-wrapper b/xserver/Makefile.bsd-wrapper index 3fdc52310..a27874806 100644 --- a/xserver/Makefile.bsd-wrapper +++ b/xserver/Makefile.bsd-wrapper @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.46 2013/06/07 17:28:45 matthieu Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.47 2013/07/15 13:23:17 aoyama Exp $ .include @@ -8,7 +8,7 @@ DIST= ${.CURDIR} NO_XORG_MACHINES= alpha aviion hp300 hppa64 landisk mac68k \ mvme68k mvme88k mvmeppc solbourne vax -NO_XF86UTIL_MACHINES= hp300 landisk mac68k sgi sparc vax +NO_XF86UTIL_MACHINES= hp300 landisk luna88k mac68k sgi sparc vax .for M in ${NO_XORG_MACHINES} NO_XORG_${M} = --disable-xorg diff --git a/xserver/configure.ac b/xserver/configure.ac index f75b4bb96..ac214682b 100644 --- a/xserver/configure.ac +++ b/xserver/configure.ac @@ -352,6 +352,10 @@ case $host_cpu in HP300_VIDEO=yes BSD_ARCH_SOURCES="hp300_video.c ioperm_noop.c" ;; + m88k) + LUNA88K_VIDEO=yes + BSD_ARCH_SOURCES="luna88k_video.c ioperm_noop.c" + ;; mips*) SGI_VIDEO=yes BSD_ARCH_SOURCES="sgi_video.c ioperm_noop.c" @@ -396,6 +400,7 @@ AM_CONDITIONAL(ARM_VIDEO, [test "x$ARM_VIDEO" = xyes]) AM_CONDITIONAL(HP300_VIDEO, [test "x$HP300_VIDEO" = xyes]) AM_CONDITIONAL(HPPA_VIDEO, [test "x$HPPA_VIDEO" = xyes]) AM_CONDITIONAL(I386_VIDEO, [test "x$I386_VIDEO" = xyes]) +AM_CONDITIONAL(LUNA88K_VIDEO, [test "x$LUNA88K_VIDEO" = xyes]) AM_CONDITIONAL(PPC_VIDEO, [test "x$PPC_VIDEO" = xyes]) AM_CONDITIONAL(SGI_VIDEO, [test "x$SGI_VIDEO" = xyes]) AM_CONDITIONAL(SPARC64_VIDEO, [test "x$SPARC64_VIDEO" = xyes]) diff --git a/xserver/hw/xfree86/os-support/bsd/Makefile.am b/xserver/hw/xfree86/os-support/bsd/Makefile.am index a0dc9c734..bd0ac8e65 100644 --- a/xserver/hw/xfree86/os-support/bsd/Makefile.am +++ b/xserver/hw/xfree86/os-support/bsd/Makefile.am @@ -51,6 +51,11 @@ if I386_VIDEO ARCH_SOURCES = i386_video.c endif +if LUNA88K_VIDEO +ARCH_SOURCES = luna88k_video.c \ + $(srcdir)/../shared/ioperm_noop.c +endif + if PPC_VIDEO ARCH_SOURCES = ppc_video.c \ $(srcdir)/../shared/ioperm_noop.c diff --git a/xserver/hw/xfree86/os-support/bsd/luna88k_video.c b/xserver/hw/xfree86/os-support/bsd/luna88k_video.c new file mode 100644 index 000000000..bfe05d34c --- /dev/null +++ b/xserver/hw/xfree86/os-support/bsd/luna88k_video.c @@ -0,0 +1,170 @@ +/* $OpenBSD: luna88k_video.c,v 1.1 2013/07/15 13:23:17 aoyama Exp $ */ +/* + * Copyright 1992 by Rich Murphey + * Copyright 1993 by David Wexelblat + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Rich Murphey and David Wexelblat + * not be used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. Rich Murphey and + * David Wexelblat make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + +#include +#include "xf86.h" +#include "xf86Priv.h" + +#include "xf86_OSlib.h" +#include "xf86OSpriv.h" + +/***************************************************************************/ +/* Video Memory Mapping section */ +/***************************************************************************/ + +void +xf86OSInitVidMem(VidMemInfoPtr pVidMem) +{ + pVidMem->linearSupported = TRUE; + pVidMem->mapMem = NULL; /* luna88kMapVidMem; */ + pVidMem->unmapMem = NULL; /* luna88kUnmapVidMem; */ + pVidMem->initialised = TRUE; +} + +_X_EXPORT int +xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, + int Len) +{ + return 0; +} + +/***************************************************************************/ +/* Interrupt Handling section */ +/***************************************************************************/ + +_X_EXPORT Bool +xf86DisableInterrupts() +{ + + return TRUE; +} + +_X_EXPORT void +xf86EnableInterrupts() +{ + + return; +} + +#ifdef X_PRIVSEP +/* + * Do all initialisation that need root privileges + */ +_X_EXPORT void +xf86PrivilegedInit(void) +{ + xf86OpenConsole(); +} +#endif +/* $OpenBSD: luna88k_video.c,v 1.1 2013/07/15 13:23:17 aoyama Exp $ */ +/* + * Copyright 1992 by Rich Murphey + * Copyright 1993 by David Wexelblat + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Rich Murphey and David Wexelblat + * not be used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. Rich Murphey and + * David Wexelblat make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + +#include +#include "xf86.h" +#include "xf86Priv.h" + +#include "xf86_OSlib.h" +#include "xf86OSpriv.h" + +/***************************************************************************/ +/* Video Memory Mapping section */ +/***************************************************************************/ + +void +xf86OSInitVidMem(VidMemInfoPtr pVidMem) +{ + pVidMem->linearSupported = TRUE; + pVidMem->mapMem = NULL; + pVidMem->unmapMem = NULL; + pVidMem->initialised = TRUE; +} + +_X_EXPORT int +xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, + int Len) +{ + return 0; +} + +/***************************************************************************/ +/* Interrupt Handling section */ +/***************************************************************************/ + +_X_EXPORT Bool +xf86DisableInterrupts() +{ + + return TRUE; +} + +_X_EXPORT void +xf86EnableInterrupts() +{ + + return; +} + +#ifdef X_PRIVSEP +/* + * Do all initialisation that need root privileges + */ +_X_EXPORT void +xf86PrivilegedInit(void) +{ + xf86OpenConsole(); +} +#endif