Xorg for amiga via wsfb. Currently available on CV64 and CV64/3D. More
graphics cards will follow, when adding wscons support to them. I didn't manage to make the "wskbd" protocol the default in the X server, so you have to provide a small xorg.conf with Option "Protocol" "wskbd". The standard protocol will not work as the Amiga wskbd cannot be switched into raw mode and has no AT-scancode translation in the kernel. On the positive side, wskbd also works with national keymaps under X. The graphics modes can still be defined via grfconfig(8). Xorg's wsfb driver uses the current grf video mode, which is usually mode #1. All resolutions and depths seem to work (tested on CV64).
This commit is contained in:
parent
fa45966e6d
commit
656c43404f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bus.c,v 1.1 2011/08/04 17:48:50 rkujawa Exp $ */
|
||||
/* $NetBSD: bus.c,v 1.2 2015/11/12 12:01:53 phx Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2011 The NetBSD Foundation, Inc.
|
||||
|
@ -48,11 +48,7 @@ paddr_t
|
|||
bus_space_mmap(bus_space_tag_t t, bus_addr_t addr, off_t off, int prot,
|
||||
int flags)
|
||||
{
|
||||
#if defined(__m68k__)
|
||||
return m68k_btop(addr + off);
|
||||
#else
|
||||
return -1; /* FIXME */
|
||||
#endif
|
||||
return MD_BTOP(addr + off);
|
||||
}
|
||||
|
||||
void *
|
||||
|
@ -63,4 +59,3 @@ bus_space_vaddr(bus_space_tag_t space, bus_space_handle_t handle)
|
|||
|
||||
return va;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: grf.c,v 1.63 2015/11/07 14:29:10 phx Exp $ */
|
||||
/* $NetBSD: grf.c,v 1.64 2015/11/12 12:01:53 phx Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.63 2015/11/07 14:29:10 phx Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.64 2015/11/12 12:01:53 phx Exp $");
|
||||
|
||||
/*
|
||||
* Graphics display driver for the Amiga
|
||||
|
@ -140,7 +140,6 @@ static struct vcons_screen console_vcons;
|
|||
static void grf_init_screen(void *, struct vcons_screen *, int, long *);
|
||||
static struct rasops_info *grf_setup_rasops(struct grf_softc *,
|
||||
struct vcons_screen *);
|
||||
static paddr_t grf_wsmmap_md(off_t off);
|
||||
|
||||
cons_decl(grf);
|
||||
#endif
|
||||
|
@ -369,14 +368,14 @@ grfmmap(dev_t dev, off_t off, int prot)
|
|||
* control registers
|
||||
*/
|
||||
if (off >= 0 && off < gi->gd_regsize)
|
||||
return(((paddr_t)gi->gd_regaddr + off) >> PGSHIFT);
|
||||
return MD_BTOP((paddr_t)gi->gd_regaddr + off);
|
||||
|
||||
/*
|
||||
* frame buffer
|
||||
*/
|
||||
if (off >= gi->gd_regsize && off < gi->gd_regsize+gi->gd_fbsize) {
|
||||
off -= gi->gd_regsize;
|
||||
return(((paddr_t)gi->gd_fbaddr + off) >> PGSHIFT);
|
||||
return MD_BTOP((paddr_t)gi->gd_fbaddr + off);
|
||||
}
|
||||
/* bogus */
|
||||
return(-1);
|
||||
|
@ -613,8 +612,12 @@ grf_wsmmap(void *v, void *vs, off_t off, int prot)
|
|||
|
||||
/* Normal fb mapping */
|
||||
if (off < gi->gd_fbsize)
|
||||
return grf_wsmmap_md(((bus_addr_t)gp->g_fbkva) + off);
|
||||
return MD_BTOP(((paddr_t)gi->gd_fbaddr) + off);
|
||||
|
||||
/*
|
||||
* restrict all other mappings to processes with superuser privileges
|
||||
* or the kernel itself
|
||||
*/
|
||||
if (kauth_authorize_machdep(kauth_cred_get(), KAUTH_MACHDEP_UNMANAGEDMEM,
|
||||
NULL, NULL, NULL, NULL) != 0) {
|
||||
aprint_normal("%s: permission to mmap denied.\n",
|
||||
|
@ -622,28 +625,18 @@ grf_wsmmap(void *v, void *vs, off_t off, int prot)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if ((off >= (bus_addr_t)gp->g_fbkva ) &&
|
||||
(off < ( (bus_addr_t)gp->g_fbkva + (size_t)gi->gd_fbsize)))
|
||||
return grf_wsmmap_md(off);
|
||||
|
||||
/* Handle register mapping */
|
||||
if ((off >= (bus_addr_t)gi->gd_regaddr) &&
|
||||
(off < ((bus_addr_t)gi->gd_regaddr + (size_t)gi->gd_regsize)))
|
||||
return grf_wsmmap_md(off);
|
||||
if ((off >= (paddr_t)gi->gd_regaddr) &&
|
||||
(off < ((paddr_t)gi->gd_regaddr + (size_t)gi->gd_regsize)))
|
||||
return MD_BTOP(off);
|
||||
|
||||
if ((off >= (paddr_t)gi->gd_fbaddr) &&
|
||||
(off < ((paddr_t)gi->gd_fbaddr + (size_t)gi->gd_fbsize)))
|
||||
return MD_BTOP(off);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static paddr_t
|
||||
grf_wsmmap_md(off_t off)
|
||||
{
|
||||
#if defined(__m68k__)
|
||||
return (paddr_t) m68k_btop(off);
|
||||
#else
|
||||
return -1; /* FIXME */
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* NWSDISPLAY > 0 */
|
||||
|
||||
#endif /* NGRF > 0 */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: grf_cv.c,v 1.57 2015/11/07 14:29:10 phx Exp $ */
|
||||
/* $NetBSD: grf_cv.c,v 1.58 2015/11/12 12:01:53 phx Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Michael Teske
|
||||
|
@ -33,7 +33,7 @@
|
|||
#include "opt_amigacons.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_cv.c,v 1.57 2015/11/07 14:29:10 phx Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_cv.c,v 1.58 2015/11/12 12:01:53 phx Exp $");
|
||||
|
||||
#include "grfcv.h"
|
||||
#include "ite.h"
|
||||
|
@ -271,6 +271,7 @@ long cv_memclk = 50000000;
|
|||
#if NWSDISPLAY > 0
|
||||
/* wsdisplay acessops, emulops */
|
||||
static int cv_wsioctl(void *, void *, u_long, void *, int, struct lwp *);
|
||||
static int cv_get_fbinfo(struct grf_softc *, struct wsdisplayio_fbinfo *);
|
||||
|
||||
static void cv_wscursor(void *, int, int, int);
|
||||
static void cv_wsputchar(void *, int, int, u_int, long);
|
||||
|
@ -440,7 +441,7 @@ cv_has_4mb(volatile void *fb)
|
|||
}
|
||||
|
||||
int
|
||||
grfcvmatch(device_t paren, cfdata_t cf, void *aux)
|
||||
grfcvmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
#ifdef CV64CONSOLE
|
||||
static int cvcons_unit = -1;
|
||||
|
@ -2485,12 +2486,94 @@ cv_wsioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
|
|||
|
||||
case WSDISPLAYIO_SVIDEO:
|
||||
return cv_blank(gp, *(u_int *)data == WSDISPLAYIO_VIDEO_OFF);
|
||||
|
||||
case WSDISPLAYIO_SMODE:
|
||||
if ((*(int *)data) != gp->g_wsmode) {
|
||||
if (*(int *)data == WSDISPLAYIO_MODE_EMUL) {
|
||||
/* load console text mode, redraw screen */
|
||||
(void)cv_load_mon(gp, &cvconsole_mode);
|
||||
if (vd->active != NULL)
|
||||
vcons_redraw_screen(vd->active);
|
||||
} else {
|
||||
/* switch to current graphics mode */
|
||||
if (!cv_load_mon(gp,
|
||||
(struct grfcvtext_mode *)monitor_current))
|
||||
return EINVAL;
|
||||
}
|
||||
gp->g_wsmode = *(int *)data;
|
||||
}
|
||||
return 0;
|
||||
|
||||
case WSDISPLAYIO_GET_FBINFO:
|
||||
return cv_get_fbinfo(gp, data);
|
||||
}
|
||||
|
||||
/* handle this command hw-independant in grf(4) */
|
||||
return grf_wsioctl(v, vs, cmd, data, flag, l);
|
||||
}
|
||||
|
||||
#endif /* NWSDISPLAY > 0 */
|
||||
/*
|
||||
* Fill the wsdisplayio_fbinfo structure with information from the current
|
||||
* graphics mode. Even when text mode is active.
|
||||
*/
|
||||
static int
|
||||
cv_get_fbinfo(struct grf_softc *gp, struct wsdisplayio_fbinfo *fbi)
|
||||
{
|
||||
struct grfvideo_mode *md;
|
||||
uint32_t rbits, gbits, bbits, abits;
|
||||
|
||||
#endif /* NGRFCV */
|
||||
md = monitor_current;
|
||||
abits = 0;
|
||||
|
||||
fbi->fbi_width = md->disp_width;
|
||||
fbi->fbi_height = md->disp_height;
|
||||
fbi->fbi_bitsperpixel = md->depth;
|
||||
|
||||
switch (md->depth) {
|
||||
case 8:
|
||||
fbi->fbi_stride = md->disp_width;
|
||||
rbits = gbits = bbits = 6; /* keep gcc happy */
|
||||
break;
|
||||
case 15:
|
||||
fbi->fbi_stride = md->disp_width * 2;
|
||||
rbits = gbits = bbits = 5;
|
||||
break;
|
||||
case 16:
|
||||
fbi->fbi_stride = md->disp_width * 2;
|
||||
rbits = bbits = 5;
|
||||
gbits = 6;
|
||||
break;
|
||||
case 32:
|
||||
abits = 8;
|
||||
case 24:
|
||||
fbi->fbi_stride = md->disp_width * 4;
|
||||
rbits = gbits = bbits = 8;
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (md->depth > 8) {
|
||||
fbi->fbi_pixeltype = WSFB_RGB;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.red_offset = bbits + gbits;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.red_size = rbits;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.green_offset = bbits;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.green_size = gbits;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.blue_offset = 0;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.blue_size = bbits;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.alpha_offset =
|
||||
bbits + gbits + rbits;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.alpha_size = abits;
|
||||
} else {
|
||||
fbi->fbi_pixeltype = WSFB_CI;
|
||||
fbi->fbi_subtype.fbi_cmapinfo.cmap_entries = 1 << md->depth;
|
||||
}
|
||||
|
||||
fbi->fbi_flags = 0;
|
||||
fbi->fbi_fbsize = fbi->fbi_stride * fbi->fbi_height;
|
||||
fbi->fbi_fboffset = 0;
|
||||
return 0;
|
||||
}
|
||||
#endif /* NWSDISPLAY > 0 */
|
||||
|
||||
#endif /* NGRFCV */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: grf_cv3d.c,v 1.31 2015/11/07 14:29:10 phx Exp $ */
|
||||
/* $NetBSD: grf_cv3d.c,v 1.32 2015/11/12 12:01:53 phx Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Michael Teske
|
||||
|
@ -33,7 +33,7 @@
|
|||
#include "opt_amigacons.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_cv3d.c,v 1.31 2015/11/07 14:29:10 phx Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_cv3d.c,v 1.32 2015/11/12 12:01:53 phx Exp $");
|
||||
|
||||
#include "ite.h"
|
||||
#include "wsdisplay.h"
|
||||
|
@ -46,7 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: grf_cv3d.c,v 1.31 2015/11/07 14:29:10 phx Exp $");
|
|||
* Modified for CV64/3D from Michael Teske's CV driver by Tobias Abt 10/97.
|
||||
* Bugfixes by Bernd Ernesti 10/97.
|
||||
* Many thanks to Richard Hartmann who gave us his board so we could make
|
||||
* driver.
|
||||
* the driver.
|
||||
*
|
||||
* TODO:
|
||||
* - ZorroII support
|
||||
|
@ -73,7 +73,7 @@ BOARDBASE
|
|||
+0xc0e0000 PCI Cfg Base start
|
||||
+0xc0e0fff PCI Cfg Base end
|
||||
|
||||
Note: IO Regbase is needed fo wakeup of the board otherwise use
|
||||
Note: IO Regbase is needed for wakeup of the board otherwise use
|
||||
MMIO Regbase
|
||||
*/
|
||||
|
||||
|
@ -291,6 +291,7 @@ long cv3d_memclk = 55000000;
|
|||
#if NWSDISPLAY > 0
|
||||
/* wsdisplay accessops, emulops */
|
||||
static int cv3d_wsioctl(void *, void *, u_long, void *, int, struct lwp *);
|
||||
static int cv3d_get_fbinfo(struct grf_softc *, struct wsdisplayio_fbinfo *);
|
||||
|
||||
static void cv3d_wscursor(void *, int, int, int);
|
||||
static void cv3d_wsputchar(void *, int, int, u_int, long);
|
||||
|
@ -2340,12 +2341,94 @@ cv3d_wsioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
|
|||
|
||||
case WSDISPLAYIO_SVIDEO:
|
||||
return cv3d_blank(gp, *(u_int *)data == WSDISPLAYIO_VIDEO_OFF);
|
||||
|
||||
case WSDISPLAYIO_SMODE:
|
||||
if ((*(int *)data) != gp->g_wsmode) {
|
||||
if (*(int *)data == WSDISPLAYIO_MODE_EMUL) {
|
||||
/* load console text mode, redraw screen */
|
||||
(void)cv3d_load_mon(gp, &cv3dconsole_mode);
|
||||
if (vd->active != NULL)
|
||||
vcons_redraw_screen(vd->active);
|
||||
} else {
|
||||
/* switch to current graphics mode */
|
||||
if (!cv3d_load_mon(gp,
|
||||
(struct grfcv3dtext_mode *)monitor_current))
|
||||
return EINVAL;
|
||||
}
|
||||
gp->g_wsmode = *(int *)data;
|
||||
}
|
||||
return 0;
|
||||
|
||||
case WSDISPLAYIO_GET_FBINFO:
|
||||
return cv3d_get_fbinfo(gp, data);
|
||||
}
|
||||
|
||||
/* handle this command hw-independant in grf(4) */
|
||||
return grf_wsioctl(v, vs, cmd, data, flag, l);
|
||||
}
|
||||
|
||||
#endif /* NWSDISPLAY > 0 */
|
||||
/*
|
||||
* Fill the wsdisplayio_fbinfo structure with information from the current
|
||||
* graphics mode. Even when text mode is active.
|
||||
*/
|
||||
static int
|
||||
cv3d_get_fbinfo(struct grf_softc *gp, struct wsdisplayio_fbinfo *fbi)
|
||||
{
|
||||
struct grfvideo_mode *md;
|
||||
uint32_t rbits, gbits, bbits, abits;
|
||||
|
||||
#endif /* NGRFCV3D */
|
||||
md = monitor_current;
|
||||
abits = 0;
|
||||
|
||||
fbi->fbi_width = md->disp_width;
|
||||
fbi->fbi_height = md->disp_height;
|
||||
fbi->fbi_bitsperpixel = md->depth;
|
||||
|
||||
switch (md->depth) {
|
||||
case 8:
|
||||
fbi->fbi_stride = md->disp_width;
|
||||
rbits = gbits = bbits = 6; /* keep gcc happy */
|
||||
break;
|
||||
case 15:
|
||||
fbi->fbi_stride = md->disp_width * 2;
|
||||
rbits = gbits = bbits = 5;
|
||||
break;
|
||||
case 16:
|
||||
fbi->fbi_stride = md->disp_width * 2;
|
||||
rbits = bbits = 5;
|
||||
gbits = 6;
|
||||
break;
|
||||
case 32:
|
||||
abits = 8;
|
||||
case 24:
|
||||
fbi->fbi_stride = md->disp_width * 4;
|
||||
rbits = gbits = bbits = 8;
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (md->depth > 8) {
|
||||
fbi->fbi_pixeltype = WSFB_RGB;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.red_offset = bbits + gbits;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.red_size = rbits;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.green_offset = bbits;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.green_size = gbits;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.blue_offset = 0;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.blue_size = bbits;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.alpha_offset =
|
||||
bbits + gbits + rbits;
|
||||
fbi->fbi_subtype.fbi_rgbmasks.alpha_size = abits;
|
||||
} else {
|
||||
fbi->fbi_pixeltype = WSFB_CI;
|
||||
fbi->fbi_subtype.fbi_cmapinfo.cmap_entries = 1 << md->depth;
|
||||
}
|
||||
|
||||
fbi->fbi_flags = 0;
|
||||
fbi->fbi_fbsize = fbi->fbi_stride * fbi->fbi_height;
|
||||
fbi->fbi_fboffset = 0;
|
||||
return 0;
|
||||
}
|
||||
#endif /* NWSDISPLAY > 0 */
|
||||
|
||||
#endif /* NGRFCV3D */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: param.h,v 1.49 2012/02/10 17:35:49 para Exp $ */
|
||||
/* $NetBSD: param.h,v 1.50 2015/11/12 12:01:53 phx Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -56,6 +56,9 @@
|
|||
|
||||
#define NPTEPG (NBPG/(sizeof (pt_entry_t)))
|
||||
|
||||
/* We need the same btop macro in device drivers for m68k and powerpc */
|
||||
#define MD_BTOP(pa) m68k_btop(pa)
|
||||
|
||||
/*
|
||||
* Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
|
||||
* logical pages.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: param.h,v 1.13 2011/06/20 06:29:53 matt Exp $ */
|
||||
/* $NetBSD: param.h,v 1.14 2015/11/12 12:01:53 phx Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -43,3 +43,6 @@
|
|||
#endif /* _KERNEL && !_MODULE */
|
||||
|
||||
#include <powerpc/param.h>
|
||||
|
||||
/* We need the same btop macro in device drivers for m68k and powerpc */
|
||||
#define MD_BTOP(pa) (pa)
|
||||
|
|
Loading…
Reference in New Issue