From b60e71a4816514e7cb8d9f9521ce66711bf11828 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 7 Jan 2018 23:10:16 +0000 Subject: [PATCH] v65c816: add the graphics mode ioctls remove a debug output to uart for vt We still hack the input side while I debug the SDL input logic on the emulator. --- Kernel/platform-v65c816/devices.c | 2 +- Kernel/platform-v65c816/devtty.c | 43 ++++++++++++++++++++++++++++++- Kernel/platform-v65c816/devtty.h | 1 + 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/Kernel/platform-v65c816/devices.c b/Kernel/platform-v65c816/devices.c index c6a101f5..f6387ce2 100644 --- a/Kernel/platform-v65c816/devices.c +++ b/Kernel/platform-v65c816/devices.c @@ -16,7 +16,7 @@ struct devsw dev_tab[] = /* The device driver switch table */ /* 1: /dev/hd Hard disc block devices (absent) */ { nxio_open, no_close, no_rdwr, no_rdwr, no_ioctl }, /* 2: /dev/tty TTY devices */ - { tty_open, tty_close, tty_read, tty_write, vt_ioctl }, + { tty_open, tty_close, tty_read, tty_write, gfx_ioctl }, /* 3: /dev/lpr Printer devices */ { no_open, no_close, no_rdwr, no_rdwr, no_ioctl }, /* 4: /dev/mem etc System devices (one offs) */ diff --git a/Kernel/platform-v65c816/devtty.c b/Kernel/platform-v65c816/devtty.c index 6acaeb16..ee6df797 100644 --- a/Kernel/platform-v65c816/devtty.c +++ b/Kernel/platform-v65c816/devtty.c @@ -6,6 +6,7 @@ #include #include #include +#include extern void charprint(uint8_t ch); extern void do_clear_bytes(void); @@ -58,7 +59,6 @@ void plot_char(int8_t y, int8_t x, uint16_t c) { fb_off = y * 640 + x; charprint(c); - uart[0] = c; } void cursor_on(int8_t y, int8_t x) @@ -126,3 +126,44 @@ void platform_interrupt(void) timer_interrupt(); } } + +/* Declare a single 640x200 mappable display that doesn't bother supporting + kernel mode graphics helpers (because it's mappable */ +static struct display display[1] = { + { + 0, + 640, 200, + 640, 200, + FMT_MONO_BW, + HW_UNACCEL, + GFX_TEXT|GFX_MAPPABLE, + 0, + 0, + } +}; + +static struct videomap displaymap = { + 0, + 0, + 0, /* Base is 0 in bank */ + 16384, + 0, + 0xFE, /* Bank $FE is framebuffer */ + 0, + MAP_FBMEM|MAP_FBMEM_SEG +}; + +int gfx_ioctl(uint8_t minor, uarg_t arg, char *ptr) +{ + if (minor > 1 || arg >> 8 != 0x03) + return vt_ioctl(minor, arg, ptr); + switch(arg) { + case GFXIOC_GETINFO: + return uput(&display[0], ptr, sizeof(struct display)); + case GFXIOC_MAP: + return uput(&displaymap, ptr, sizeof(displaymap)); + case GFXIOC_UNMAP: + return 0; + } + return -1; +} diff --git a/Kernel/platform-v65c816/devtty.h b/Kernel/platform-v65c816/devtty.h index da0afba5..360715f3 100644 --- a/Kernel/platform-v65c816/devtty.h +++ b/Kernel/platform-v65c816/devtty.h @@ -2,5 +2,6 @@ #define __DEVTTY_DOT_H__ extern void tty_poll(void); +extern int gfx_ioctl(uint8_t minor, uarg_t arg, char *ptr); #endif -- 2.34.1