Removed outdated wscons support
authorSam Lantinga <slouken@libsdl.org>
Sat, 19 Sep 2009 07:28:59 +0000
changeset 3275a4a34a511ba0
parent 3274 08574b033f37
child 3276 720d176be107
Removed outdated wscons support
README.wscons
configure.in
include/SDL_config.h.in
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/wscons/SDL_wsconsevents.c
src/video/wscons/SDL_wsconsevents_c.h
src/video/wscons/SDL_wsconsmouse.c
src/video/wscons/SDL_wsconsmouse_c.h
src/video/wscons/SDL_wsconsvideo.c
src/video/wscons/SDL_wsconsvideo.h
     1.1 --- a/README.wscons	Sat Sep 19 07:26:51 2009 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,107 +0,0 @@
     1.4 -==============================================================================
     1.5 -Using the Simple DirectMedia Layer with OpenBSD/wscons
     1.6 -==============================================================================
     1.7 -
     1.8 -The wscons SDL driver can be used to run SDL programs on OpenBSD
     1.9 -without running X.  So far, the driver only runs on the Sharp Zaurus,
    1.10 -but the driver is written to be easily extended for other machines.
    1.11 -The main missing pieces are blitting routines for anything but 16 bit
    1.12 -displays, and keycode maps for other keyboards.  Also, there is no
    1.13 -support for hardware palettes.
    1.14 -
    1.15 -There is currently no mouse support.
    1.16 -
    1.17 -To compile SDL with support for wscons, use the
    1.18 -"--enable-video-wscons" option when running configure.  I used the
    1.19 -following command line:
    1.20 -
    1.21 -./configure --disable-oss --disable-ltdl --enable-pthread-sem \
    1.22 -	    --disable-esd --disable-arts --disable-video-aalib  \
    1.23 -	    --enable-openbsdaudio --enable-video-wscons \
    1.24 -	    --prefix=/usr/local --sysconfdir=/etc
    1.25 -
    1.26 -
    1.27 -Setting the console device to use
    1.28 -=================================
    1.29 -
    1.30 -When starting an SDL program on a wscons console, the driver uses the
    1.31 -current virtual terminal (usually /dev/ttyC0).  To force the driver to
    1.32 -use a specific terminal device, set the environment variable
    1.33 -SDL_WSCONSDEV:
    1.34 -
    1.35 -bash$ SDL_WSCONSDEV=/dev/ttyC1 ./some-sdl-program
    1.36 -
    1.37 -This is especially useful when starting an SDL program from a remote
    1.38 -login prompt (which is great for development).  If you do this, and
    1.39 -want to use keyboard input, you should avoid having some other program
    1.40 -reading from the used virtual console (i.e., do not have a getty
    1.41 -running).
    1.42 -
    1.43 -
    1.44 -Rotating the display
    1.45 -====================
    1.46 -
    1.47 -The display can be rotated by the wscons SDL driver.  This is useful
    1.48 -for the Sharp Zaurus, since the display hardware is wired so that it
    1.49 -is correctly rotated only when the display is folded into "PDA mode."
    1.50 -When using the Zaurus in "normal," or "keyboard" mode, the hardware
    1.51 -screen is rotated 90 degrees anti-clockwise.
    1.52 -
    1.53 -To let the wscons SDL driver rotate the screen, set the environment
    1.54 -variable SDL_VIDEO_WSCONS_ROTATION to "CW", "CCW", or "UD", for
    1.55 -clockwise, counter clockwise, and upside-down rotation respectively.
    1.56 -"CW" makes the screen appear correct on a Sharp Zaurus SL-C3100.
    1.57 -
    1.58 -When using rotation in the driver, a "shadow" frame buffer is used to
    1.59 -hold the intermediary display, before blitting it to the actual
    1.60 -hardware frame buffer.  This slows down performance a bit.
    1.61 -
    1.62 -For completeness, the rotation "NONE" can be specified to use a shadow
    1.63 -frame buffer without actually rotating.  Unsetting
    1.64 -SDL_VIDEO_WSCONS_ROTATION, or setting it to '' turns off the shadow
    1.65 -frame buffer for maximum performance.
    1.66 -
    1.67 -
    1.68 -Running MAME
    1.69 -============
    1.70 -
    1.71 -Since my main motivation for writing the driver was playing MAME on
    1.72 -the Zaurus, I'll give a few hints:
    1.73 -
    1.74 -XMame compiles just fine under OpenBSD.
    1.75 -
    1.76 -I'm not sure this is strictly necessary, but set
    1.77 -
    1.78 -MY_CPU = arm
    1.79 -
    1.80 -in makefile.unix, and
    1.81 -
    1.82 -CFLAGS.arm = -DLSB_FIRST -DALIGN_INTS -DALIGN_SHORTS
    1.83 -
    1.84 -in src/unix/unix.max
    1.85 -
    1.86 -to be sure.
    1.87 -
    1.88 -The latest XMame (0.101 at this writing) is a very large program.
    1.89 -Either tinker with the make files to compile a version without support
    1.90 -for all drivers, or, get an older version of XMame.  My recommendation
    1.91 -would be 0.37b16.
    1.92 -
    1.93 -When running MAME, DO NOT SET SDL_VIDEO_WSCONS_ROTATION!  Performace
    1.94 -is MUCH better without this, and it is COMPLETELY UNNECESSARY, since
    1.95 -MAME can rotate the picture itself while drawing, and does so MUCH
    1.96 -FASTER.
    1.97 -
    1.98 -Use the Xmame command line option "-ror" to rotate the picture to the
    1.99 -right.
   1.100 -
   1.101 -
   1.102 -Acknowledgments
   1.103 -===============
   1.104 -
   1.105 -I studied the wsfb driver for XFree86/Xorg quite a bit before writing
   1.106 -this, so there ought to be some similarities.
   1.107 -
   1.108 -
   1.109 ---
   1.110 -Staffan Ulfberg <staffan@ulfberg.se>
     2.1 --- a/configure.in	Sat Sep 19 07:26:51 2009 +0000
     2.2 +++ b/configure.in	Sat Sep 19 07:28:59 2009 +0000
     2.3 @@ -1561,33 +1561,6 @@
     2.4      fi
     2.5  }
     2.6  
     2.7 -dnl Set up the wscons video driver if enabled
     2.8 -CheckWscons()
     2.9 -{
    2.10 -    AC_ARG_ENABLE(video-wscons,
    2.11 -AC_HELP_STRING([--enable-video-wscons], [use wscons video driver [[default=no]]]),
    2.12 -                  , enable_video_wscons=no)
    2.13 -    if test x$enable_video = xyes -a x$enable_video_wscons = xyes; then
    2.14 -        AC_MSG_CHECKING(for wscons support)
    2.15 -        video_wscons=no
    2.16 -        AC_TRY_COMPILE([
    2.17 -         #include <sys/time.h>
    2.18 -         #include <dev/wscons/wsconsio.h>
    2.19 -         #include <dev/wscons/wsdisplay_usl_io.h>
    2.20 -        ],[
    2.21 -         int wsmode = WSDISPLAYIO_MODE_DUMBFB;
    2.22 -        ],[
    2.23 -        video_wscons=yes
    2.24 -        ])
    2.25 -        AC_MSG_RESULT($video_wscons)
    2.26 -        if test x$video_wscons = xyes; then
    2.27 -            AC_DEFINE(SDL_VIDEO_DRIVER_WSCONS)
    2.28 -            SOURCES="$SOURCES $srcdir/src/video/wscons/*.c"
    2.29 -            have_video=yes
    2.30 -        fi
    2.31 -    fi
    2.32 -}
    2.33 -
    2.34  dnl Set up the Atari Bios keyboard driver
    2.35  CheckAtariBiosEvent()
    2.36  {
     3.1 --- a/include/SDL_config.h.in	Sat Sep 19 07:26:51 2009 +0000
     3.2 +++ b/include/SDL_config.h.in	Sat Sep 19 07:28:59 2009 +0000
     3.3 @@ -265,7 +265,6 @@
     3.4  #undef SDL_VIDEO_DRIVER_SVGALIB
     3.5  #undef SDL_VIDEO_DRIVER_VGL
     3.6  #undef SDL_VIDEO_DRIVER_WIN32
     3.7 -#undef SDL_VIDEO_DRIVER_WSCONS
     3.8  #undef SDL_VIDEO_DRIVER_X11
     3.9  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC
    3.10  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
     4.1 --- a/src/video/SDL_sysvideo.h	Sat Sep 19 07:26:51 2009 +0000
     4.2 +++ b/src/video/SDL_sysvideo.h	Sat Sep 19 07:28:59 2009 +0000
     4.3 @@ -341,9 +341,6 @@
     4.4  #if SDL_VIDEO_DRIVER_X11
     4.5  extern VideoBootStrap X11_bootstrap;
     4.6  #endif
     4.7 -#if SDL_VIDEO_DRIVER_WSCONS
     4.8 -extern VideoBootStrap WSCONS_bootstrap;
     4.9 -#endif
    4.10  #if SDL_VIDEO_DRIVER_FBCON
    4.11  extern VideoBootStrap FBCON_bootstrap;
    4.12  #endif
     5.1 --- a/src/video/SDL_video.c	Sat Sep 19 07:26:51 2009 +0000
     5.2 +++ b/src/video/SDL_video.c	Sat Sep 19 07:28:59 2009 +0000
     5.3 @@ -55,9 +55,6 @@
     5.4  #if SDL_VIDEO_DRIVER_X11
     5.5      &X11_bootstrap,
     5.6  #endif
     5.7 -#if SDL_VIDEO_DRIVER_WSCONS
     5.8 -    &WSCONS_bootstrap,
     5.9 -#endif
    5.10  #if SDL_VIDEO_DRIVER_FBCON
    5.11      &FBCON_bootstrap,
    5.12  #endif
     6.1 --- a/src/video/wscons/SDL_wsconsevents.c	Sat Sep 19 07:26:51 2009 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,245 +0,0 @@
     6.4 -/*
     6.5 -    SDL - Simple DirectMedia Layer
     6.6 -    Copyright (C) 1997-2009 Sam Lantinga
     6.7 -
     6.8 -    This library is free software; you can redistribute it and/or
     6.9 -    modify it under the terms of the GNU Lesser General Public
    6.10 -    License as published by the Free Software Foundation; either
    6.11 -    version 2.1 of the License, or (at your option) any later version.
    6.12 -
    6.13 -    This library is distributed in the hope that it will be useful,
    6.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    6.16 -    Lesser General Public License for more details.
    6.17 -
    6.18 -    You should have received a copy of the GNU Lesser General Public
    6.19 -    License along with this library; if not, write to the Free Software
    6.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    6.21 -
    6.22 -    Sam Lantinga
    6.23 -    slouken@libsdl.org
    6.24 -*/
    6.25 -#include "SDL_config.h"
    6.26 -
    6.27 -#include <sys/types.h>
    6.28 -#include <dev/wscons/wsdisplay_usl_io.h>
    6.29 -#include <sys/ioctl.h>
    6.30 -#include <fcntl.h>
    6.31 -#include <unistd.h>
    6.32 -#include <termios.h>
    6.33 -#include <errno.h>
    6.34 -#include <string.h>
    6.35 -
    6.36 -#include "../../events/SDL_sysevents.h"
    6.37 -#include "../../events/SDL_events_c.h"
    6.38 -#include "SDL_wsconsvideo.h"
    6.39 -#include "SDL_wsconsevents_c.h"
    6.40 -
    6.41 -static int posted = 0;
    6.42 -
    6.43 -int
    6.44 -WSCONS_InitKeyboard(_THIS)
    6.45 -{
    6.46 -    struct termios tty;
    6.47 -
    6.48 -    if (ioctl(private->fd, WSKBDIO_GTYPE, &private->kbdType) == -1) {
    6.49 -        WSCONS_ReportError("cannot get keyboard type: %s", strerror(errno));
    6.50 -        return -1;
    6.51 -    }
    6.52 -
    6.53 -    if (tcgetattr(private->fd, &private->saved_tty) == -1) {
    6.54 -        WSCONS_ReportError("cannot get terminal attributes: %s",
    6.55 -                           strerror(errno));
    6.56 -        return -1;
    6.57 -    }
    6.58 -    private->did_save_tty = 1;
    6.59 -    tty = private->saved_tty;
    6.60 -    tty.c_iflag = IGNPAR | IGNBRK;
    6.61 -    tty.c_oflag = 0;
    6.62 -    tty.c_cflag = CREAD | CS8;
    6.63 -    tty.c_lflag = 0;
    6.64 -    tty.c_cc[VTIME] = 0;
    6.65 -    tty.c_cc[VMIN] = 1;
    6.66 -    cfsetispeed(&tty, 9600);
    6.67 -    cfsetospeed(&tty, 9600);
    6.68 -    if (tcsetattr(private->fd, TCSANOW, &tty) < 0) {
    6.69 -        WSCONS_ReportError("cannot set terminal attributes: %s",
    6.70 -                           strerror(errno));
    6.71 -        return -1;
    6.72 -    }
    6.73 -    if (ioctl(private->fd, KDSKBMODE, K_RAW) == -1) {
    6.74 -        WSCONS_ReportError("cannot set raw keyboard mode: %s",
    6.75 -                           strerror(errno));
    6.76 -        return -1;
    6.77 -    }
    6.78 -
    6.79 -    return 0;
    6.80 -}
    6.81 -
    6.82 -void
    6.83 -WSCONS_ReleaseKeyboard(_THIS)
    6.84 -{
    6.85 -    if (private->fd != -1) {
    6.86 -        if (ioctl(private->fd, KDSKBMODE, K_XLATE) == -1) {
    6.87 -            WSCONS_ReportError
    6.88 -                ("cannot restore keyboard to translated mode: %s",
    6.89 -                 strerror(errno));
    6.90 -        }
    6.91 -        if (private->did_save_tty) {
    6.92 -            if (tcsetattr(private->fd, TCSANOW, &private->saved_tty) < 0) {
    6.93 -                WSCONS_ReportError
    6.94 -                    ("cannot restore keynoard attributes: %s",
    6.95 -                     strerror(errno));
    6.96 -            }
    6.97 -        }
    6.98 -    }
    6.99 -}
   6.100 -
   6.101 -static void
   6.102 -updateMouse()
   6.103 -{
   6.104 -}
   6.105 -
   6.106 -static SDLKey keymap[128];
   6.107 -
   6.108 -static SDL_keysym *
   6.109 -TranslateKey(int scancode, SDL_keysym * keysym)
   6.110 -{
   6.111 -    keysym->scancode = scancode;
   6.112 -    keysym->sym = SDLK_UNKNOWN;
   6.113 -    keysym->mod = KMOD_NONE;
   6.114 -
   6.115 -    if (scancode < SDL_arraysize(keymap))
   6.116 -        keysym->sym = keymap[scancode];
   6.117 -
   6.118 -    if (keysym->sym == SDLK_UNKNOWN)
   6.119 -        printf("Unknown mapping for scancode %d\n", scancode);
   6.120 -
   6.121 -    return keysym;
   6.122 -}
   6.123 -
   6.124 -static void
   6.125 -updateKeyboard(_THIS)
   6.126 -{
   6.127 -    unsigned char buf[100];
   6.128 -    SDL_keysym keysym;
   6.129 -    int n, i;
   6.130 -
   6.131 -    if ((n = read(private->fd, buf, sizeof(buf))) > 0) {
   6.132 -        for (i = 0; i < n; i++) {
   6.133 -            unsigned char c = buf[i] & 0x7f;
   6.134 -            if (c == 224)       // special key prefix -- what should we do with it?
   6.135 -                continue;
   6.136 -            posted +=
   6.137 -                SDL_PrivateKeyboard((buf[i] & 0x80) ? SDL_RELEASED :
   6.138 -                                    SDL_PRESSED, TranslateKey(c, &keysym));
   6.139 -        }
   6.140 -    }
   6.141 -}
   6.142 -
   6.143 -void
   6.144 -WSCONS_PumpEvents(_THIS)
   6.145 -{
   6.146 -    do {
   6.147 -        posted = 0;
   6.148 -        updateMouse();
   6.149 -        updateKeyboard(this);
   6.150 -    } while (posted);
   6.151 -}
   6.152 -
   6.153 -void
   6.154 -WSCONS_InitOSKeymap(_THIS)
   6.155 -{
   6.156 -    int i;
   6.157 -
   6.158 -    /* Make sure unknown keys are mapped correctly */
   6.159 -    for (i = 0; i < SDL_arraysize(keymap); i++) {
   6.160 -        keymap[i] = SDLK_UNKNOWN;
   6.161 -    }
   6.162 -
   6.163 -    switch (private->kbdType) {
   6.164 -#ifdef WSKBD_TYPE_ZAURUS
   6.165 -    case WSKBD_TYPE_ZAURUS:
   6.166 -        /* top row */
   6.167 -        keymap[2] = SDLK_1;
   6.168 -        keymap[3] = SDLK_2;
   6.169 -        keymap[4] = SDLK_3;
   6.170 -        keymap[5] = SDLK_4;
   6.171 -        keymap[6] = SDLK_5;
   6.172 -        keymap[7] = SDLK_6;
   6.173 -        keymap[8] = SDLK_7;
   6.174 -        keymap[9] = SDLK_8;
   6.175 -        keymap[10] = SDLK_9;
   6.176 -        keymap[11] = SDLK_0;
   6.177 -        keymap[14] = SDLK_BACKSPACE;
   6.178 -
   6.179 -        /* second row */
   6.180 -        keymap[16] = SDLK_q;
   6.181 -        keymap[17] = SDLK_w;
   6.182 -        keymap[18] = SDLK_e;
   6.183 -        keymap[19] = SDLK_r;
   6.184 -        keymap[20] = SDLK_t;
   6.185 -        keymap[21] = SDLK_y;
   6.186 -        keymap[22] = SDLK_u;
   6.187 -        keymap[23] = SDLK_i;
   6.188 -        keymap[24] = SDLK_o;
   6.189 -        keymap[25] = SDLK_p;
   6.190 -
   6.191 -        /* third row */
   6.192 -        keymap[15] = SDLK_TAB;
   6.193 -        keymap[30] = SDLK_a;
   6.194 -        keymap[31] = SDLK_s;
   6.195 -        keymap[32] = SDLK_d;
   6.196 -        keymap[33] = SDLK_f;
   6.197 -        keymap[34] = SDLK_g;
   6.198 -        keymap[35] = SDLK_h;
   6.199 -        keymap[36] = SDLK_j;
   6.200 -        keymap[37] = SDLK_k;
   6.201 -        keymap[38] = SDLK_l;
   6.202 -
   6.203 -        /* fourth row */
   6.204 -        keymap[42] = SDLK_LSHIFT;
   6.205 -        keymap[44] = SDLK_z;
   6.206 -        keymap[45] = SDLK_x;
   6.207 -        keymap[46] = SDLK_c;
   6.208 -        keymap[47] = SDLK_v;
   6.209 -        keymap[48] = SDLK_b;
   6.210 -        keymap[49] = SDLK_n;
   6.211 -        keymap[50] = SDLK_m;
   6.212 -        keymap[54] = SDLK_RSHIFT;
   6.213 -        keymap[28] = SDLK_RETURN;
   6.214 -
   6.215 -        /* fifth row */
   6.216 -        keymap[56] = SDLK_LALT;
   6.217 -        keymap[29] = SDLK_LCTRL;
   6.218 -        /* keymap[56] = ; */
   6.219 -        keymap[0] = SDLK_LSUPER;
   6.220 -        keymap[12] = SDLK_MINUS;
   6.221 -        keymap[57] = SDLK_SPACE;
   6.222 -        keymap[51] = SDLK_COMMA;
   6.223 -        keymap[52] = SDLK_PERIOD;
   6.224 -
   6.225 -        /* misc */
   6.226 -        keymap[59] = SDLK_F1;
   6.227 -        keymap[60] = SDLK_F2;
   6.228 -        keymap[61] = SDLK_F3;
   6.229 -        keymap[62] = SDLK_F4;
   6.230 -        keymap[63] = SDLK_F5;
   6.231 -        keymap[1] = SDLK_ESCAPE;
   6.232 -        /* keymap[28] = SDLK_KP_ENTER; */
   6.233 -        keymap[72] = SDLK_UP;
   6.234 -        keymap[75] = SDLK_LEFT;
   6.235 -        keymap[77] = SDLK_RIGHT;
   6.236 -        keymap[80] = SDLK_DOWN;
   6.237 -        break;
   6.238 -#endif /* WSKBD_TYPE_ZAURUS */
   6.239 -
   6.240 -    default:
   6.241 -        WSCONS_ReportError("Unable to map keys for keyboard type %u",
   6.242 -                           private->kbdType);
   6.243 -        break;
   6.244 -    }
   6.245 -}
   6.246 -
   6.247 -/* end of SDL_wsconsevents.c ... */
   6.248 -/* vi: set ts=4 sw=4 expandtab: */
     7.1 --- a/src/video/wscons/SDL_wsconsevents_c.h	Sat Sep 19 07:26:51 2009 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,36 +0,0 @@
     7.4 -/*
     7.5 -    SDL - Simple DirectMedia Layer
     7.6 -    Copyright (C) 1997-2009 Sam Lantinga
     7.7 -
     7.8 -    This library is free software; you can redistribute it and/or
     7.9 -    modify it under the terms of the GNU Lesser General Public
    7.10 -    License as published by the Free Software Foundation; either
    7.11 -    version 2.1 of the License, or (at your option) any later version.
    7.12 -
    7.13 -    This library is distributed in the hope that it will be useful,
    7.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    7.16 -    Lesser General Public License for more details.
    7.17 -
    7.18 -    You should have received a copy of the GNU Lesser General Public
    7.19 -    License along with this library; if not, write to the Free Software
    7.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    7.21 -
    7.22 -    Sam Lantinga
    7.23 -    slouken@libsdl.org
    7.24 -*/
    7.25 -#include "SDL_config.h"
    7.26 -
    7.27 -#include "SDL_wsconsvideo.h"
    7.28 -
    7.29 -int WSCONS_InitKeyboard(_THIS);
    7.30 -void WSCONS_ReleaseKeyboard(_THIS);
    7.31 -
    7.32 -/* Variables and functions exported by SDL_sysevents.c to other parts 
    7.33 -   of the native video subsystem (SDL_sysvideo.c)
    7.34 -*/
    7.35 -extern void WSCONS_InitOSKeymap(_THIS);
    7.36 -extern void WSCONS_PumpEvents(_THIS);
    7.37 -
    7.38 -/* end of SDL_wsconsevents_c.h ... */
    7.39 -/* vi: set ts=4 sw=4 expandtab: */
     8.1 --- a/src/video/wscons/SDL_wsconsmouse.c	Sat Sep 19 07:26:51 2009 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,35 +0,0 @@
     8.4 -/*
     8.5 -    SDL - Simple DirectMedia Layer
     8.6 -    Copyright (C) 1997-2009 Sam Lantinga
     8.7 -
     8.8 -    This library is free software; you can redistribute it and/or
     8.9 -    modify it under the terms of the GNU Lesser General Public
    8.10 -    License as published by the Free Software Foundation; either
    8.11 -    version 2.1 of the License, or (at your option) any later version.
    8.12 -
    8.13 -    This library is distributed in the hope that it will be useful,
    8.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    8.16 -    Lesser General Public License for more details.
    8.17 -
    8.18 -    You should have received a copy of the GNU Lesser General Public
    8.19 -    License along with this library; if not, write to the Free Software
    8.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    8.21 -
    8.22 -    Sam Lantinga
    8.23 -    slouken@libsdl.org
    8.24 -*/
    8.25 -#include "SDL_config.h"
    8.26 -
    8.27 -#include "SDL_mouse.h"
    8.28 -#include "../../events/SDL_events_c.h"
    8.29 -
    8.30 -#include "SDL_wsconsmouse_c.h"
    8.31 -
    8.32 -
    8.33 -/* The implementation dependent data for the window manager cursor */
    8.34 -struct WMcursor
    8.35 -{
    8.36 -    int unused;
    8.37 -};
    8.38 -/* vi: set ts=4 sw=4 expandtab: */
     9.1 --- a/src/video/wscons/SDL_wsconsmouse_c.h	Sat Sep 19 07:26:51 2009 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,27 +0,0 @@
     9.4 -/*
     9.5 -    SDL - Simple DirectMedia Layer
     9.6 -    Copyright (C) 1997-2009 Sam Lantinga
     9.7 -
     9.8 -    This library is free software; you can redistribute it and/or
     9.9 -    modify it under the terms of the GNU Lesser General Public
    9.10 -    License as published by the Free Software Foundation; either
    9.11 -    version 2.1 of the License, or (at your option) any later version.
    9.12 -
    9.13 -    This library is distributed in the hope that it will be useful,
    9.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    9.16 -    Lesser General Public License for more details.
    9.17 -
    9.18 -    You should have received a copy of the GNU Lesser General Public
    9.19 -    License along with this library; if not, write to the Free Software
    9.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    9.21 -
    9.22 -    Sam Lantinga
    9.23 -    slouken@libsdl.org
    9.24 -*/
    9.25 -#include "SDL_config.h"
    9.26 -
    9.27 -#include "SDL_wsconsvideo.h"
    9.28 -
    9.29 -/* Functions to be exported */
    9.30 -/* vi: set ts=4 sw=4 expandtab: */
    10.1 --- a/src/video/wscons/SDL_wsconsvideo.c	Sat Sep 19 07:26:51 2009 +0000
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,632 +0,0 @@
    10.4 -/*
    10.5 -    SDL - Simple DirectMedia Layer
    10.6 -    Copyright (C) 1997-2009 Sam Lantinga
    10.7 -
    10.8 -    This library is free software; you can redistribute it and/or
    10.9 -    modify it under the terms of the GNU Lesser General Public
   10.10 -    License as published by the Free Software Foundation; either
   10.11 -    version 2.1 of the License, or (at your option) any later version.
   10.12 -
   10.13 -    This library is distributed in the hope that it will be useful,
   10.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   10.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   10.16 -    Lesser General Public License for more details.
   10.17 -
   10.18 -    You should have received a copy of the GNU Lesser General Public
   10.19 -    License along with this library; if not, write to the Free Software
   10.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   10.21 -
   10.22 -    Sam Lantinga
   10.23 -    slouken@libsdl.org
   10.24 -*/
   10.25 -#include "SDL_config.h"
   10.26 -
   10.27 -#include <sys/time.h>
   10.28 -#include <sys/mman.h>
   10.29 -#include <sys/ioctl.h>
   10.30 -#include <dev/wscons/wsdisplay_usl_io.h>
   10.31 -#include <fcntl.h>
   10.32 -#include <unistd.h>
   10.33 -#include <errno.h>
   10.34 -
   10.35 -#include "SDL_video.h"
   10.36 -#include "SDL_mouse.h"
   10.37 -#include "../SDL_sysvideo.h"
   10.38 -#include "../SDL_pixels_c.h"
   10.39 -#include "../../events/SDL_events_c.h"
   10.40 -
   10.41 -#include "SDL_wsconsvideo.h"
   10.42 -#include "SDL_wsconsevents_c.h"
   10.43 -#include "SDL_wsconsmouse_c.h"
   10.44 -
   10.45 -#define WSCONSVID_DRIVER_NAME "wscons"
   10.46 -enum
   10.47 -{
   10.48 -    WSCONS_ROTATE_NONE = 0,
   10.49 -    WSCONS_ROTATE_CCW = 90,
   10.50 -    WSCONS_ROTATE_UD = 180,
   10.51 -    WSCONS_ROTATE_CW = 270
   10.52 -};
   10.53 -
   10.54 -#define min(a,b) ((a)<(b)?(a):(b))
   10.55 -
   10.56 -/* Initialization/Query functions */
   10.57 -static int WSCONS_VideoInit(_THIS, SDL_PixelFormat * vformat);
   10.58 -static SDL_Rect **WSCONS_ListModes(_THIS, SDL_PixelFormat * format,
   10.59 -                                   Uint32 flags);
   10.60 -static SDL_Surface *WSCONS_SetVideoMode(_THIS, SDL_Surface * current,
   10.61 -                                        int width, int height, int bpp,
   10.62 -                                        Uint32 flags);
   10.63 -static int WSCONS_SetColors(_THIS, int firstcolor, int ncolors,
   10.64 -                            SDL_Color * colors);
   10.65 -static void WSCONS_VideoQuit(_THIS);
   10.66 -
   10.67 -/* Hardware surface functions */
   10.68 -static int WSCONS_AllocHWSurface(_THIS, SDL_Surface * surface);
   10.69 -static int WSCONS_LockHWSurface(_THIS, SDL_Surface * surface);
   10.70 -static void WSCONS_UnlockHWSurface(_THIS, SDL_Surface * surface);
   10.71 -static void WSCONS_FreeHWSurface(_THIS, SDL_Surface * surface);
   10.72 -
   10.73 -/* etc. */
   10.74 -static WSCONS_bitBlit WSCONS_blit16;
   10.75 -static WSCONS_bitBlit WSCONS_blit16blocked;
   10.76 -static void WSCONS_UpdateRects(_THIS, int numrects, SDL_Rect * rects);
   10.77 -
   10.78 -void
   10.79 -WSCONS_ReportError(char *fmt, ...)
   10.80 -{
   10.81 -    char message[200];
   10.82 -    va_list vaArgs;
   10.83 -
   10.84 -    message[199] = '\0';
   10.85 -
   10.86 -    va_start(vaArgs, fmt);
   10.87 -    vsnprintf(message, 199, fmt, vaArgs);
   10.88 -    va_end(vaArgs);
   10.89 -
   10.90 -    SDL_SetError(message);
   10.91 -    fprintf(stderr, "WSCONS error: %s\n", message);
   10.92 -}
   10.93 -
   10.94 -/* WSCONS driver bootstrap functions */
   10.95 -
   10.96 -static int
   10.97 -WSCONS_Available(void)
   10.98 -{
   10.99 -    return 1;
  10.100 -}
  10.101 -
  10.102 -static void
  10.103 -WSCONS_DeleteDevice(SDL_VideoDevice * device)
  10.104 -{
  10.105 -    SDL_free(device->hidden);
  10.106 -    SDL_free(device);
  10.107 -}
  10.108 -
  10.109 -static SDL_VideoDevice *
  10.110 -WSCONS_CreateDevice(int devindex)
  10.111 -{
  10.112 -    SDL_VideoDevice *device;
  10.113 -
  10.114 -    /* Initialize all variables that we clean on shutdown */
  10.115 -    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
  10.116 -    if (device == NULL) {
  10.117 -        SDL_OutOfMemory();
  10.118 -        return 0;
  10.119 -    }
  10.120 -    SDL_memset(device, 0, (sizeof *device));
  10.121 -    device->hidden =
  10.122 -        (struct SDL_PrivateVideoData *) SDL_malloc((sizeof *device->hidden));
  10.123 -    if (device->hidden == NULL) {
  10.124 -        SDL_OutOfMemory();
  10.125 -        SDL_free(device);
  10.126 -        return (0);
  10.127 -    }
  10.128 -    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
  10.129 -    device->hidden->fd = -1;
  10.130 -
  10.131 -    /* Set the function pointers */
  10.132 -    device->VideoInit = WSCONS_VideoInit;
  10.133 -    device->ListModes = WSCONS_ListModes;
  10.134 -    device->SetVideoMode = WSCONS_SetVideoMode;
  10.135 -    device->SetColors = WSCONS_SetColors;
  10.136 -    device->UpdateRects = WSCONS_UpdateRects;
  10.137 -    device->VideoQuit = WSCONS_VideoQuit;
  10.138 -    device->AllocHWSurface = WSCONS_AllocHWSurface;
  10.139 -    device->LockHWSurface = WSCONS_LockHWSurface;
  10.140 -    device->UnlockHWSurface = WSCONS_UnlockHWSurface;
  10.141 -    device->FreeHWSurface = WSCONS_FreeHWSurface;
  10.142 -    device->InitOSKeymap = WSCONS_InitOSKeymap;
  10.143 -    device->PumpEvents = WSCONS_PumpEvents;
  10.144 -    device->free = WSCONS_DeleteDevice;
  10.145 -
  10.146 -    return device;
  10.147 -}
  10.148 -
  10.149 -VideoBootStrap WSCONS_bootstrap = {
  10.150 -    WSCONSVID_DRIVER_NAME,
  10.151 -    "SDL wscons video driver",
  10.152 -    WSCONS_Available,
  10.153 -    WSCONS_CreateDevice
  10.154 -};
  10.155 -
  10.156 -#define WSCONSDEV_FORMAT "/dev/ttyC%01x"
  10.157 -
  10.158 -int
  10.159 -WSCONS_VideoInit(_THIS, SDL_PixelFormat * vformat)
  10.160 -{
  10.161 -    char devnamebuf[30];
  10.162 -    char *devname;
  10.163 -    char *rotation;
  10.164 -    int wstype;
  10.165 -    int wsmode = WSDISPLAYIO_MODE_DUMBFB;
  10.166 -    size_t len, mapsize;
  10.167 -    int pagemask;
  10.168 -    int width, height;
  10.169 -
  10.170 -    devname = SDL_getenv("SDL_WSCONSDEV");
  10.171 -    if (devname == NULL) {
  10.172 -        int activeVT;
  10.173 -        if (ioctl(STDIN_FILENO, VT_GETACTIVE, &activeVT) == -1) {
  10.174 -            WSCONS_ReportError("Unable to determine active terminal: %s",
  10.175 -                               strerror(errno));
  10.176 -            return -1;
  10.177 -        }
  10.178 -        SDL_snprintf(devnamebuf, sizeof(devnamebuf), WSCONSDEV_FORMAT,
  10.179 -                     activeVT - 1);
  10.180 -        devname = devnamebuf;
  10.181 -    }
  10.182 -
  10.183 -    private->fd = open(devname, O_RDWR | O_NONBLOCK, 0);
  10.184 -    if (private->fd == -1) {
  10.185 -        WSCONS_ReportError("open %s: %s", devname, strerror(errno));
  10.186 -        return -1;
  10.187 -    }
  10.188 -    if (ioctl(private->fd, WSDISPLAYIO_GINFO, &private->info) == -1) {
  10.189 -        WSCONS_ReportError("ioctl WSDISPLAY_GINFO: %s", strerror(errno));
  10.190 -        return -1;
  10.191 -    }
  10.192 -    if (ioctl(private->fd, WSDISPLAYIO_GTYPE, &wstype) == -1) {
  10.193 -        WSCONS_ReportError("ioctl WSDISPLAY_GTYPE: %s", strerror(errno));
  10.194 -        return -1;
  10.195 -    }
  10.196 -    if (ioctl(private->fd, WSDISPLAYIO_LINEBYTES, &private->physlinebytes) ==
  10.197 -        -1) {
  10.198 -        WSCONS_ReportError("ioctl WSDISPLAYIO_LINEBYTES: %s",
  10.199 -                           strerror(errno));
  10.200 -        return -1;
  10.201 -    }
  10.202 -    if (private->info.depth > 8) {
  10.203 -        if (wstype == WSDISPLAY_TYPE_SUN24 ||
  10.204 -            wstype == WSDISPLAY_TYPE_SUNCG12 ||
  10.205 -            wstype == WSDISPLAY_TYPE_SUNCG14 ||
  10.206 -            wstype == WSDISPLAY_TYPE_SUNTCX ||
  10.207 -            wstype == WSDISPLAY_TYPE_SUNFFB) {
  10.208 -            private->redMask = 0x0000ff;
  10.209 -            private->greenMask = 0x00ff00;
  10.210 -            private->blueMask = 0xff0000;
  10.211 -#ifdef WSDISPLAY_TYPE_PXALCD
  10.212 -        } else if (wstype == WSDISPLAY_TYPE_PXALCD) {
  10.213 -            private->redMask = 0x1f << 11;
  10.214 -            private->greenMask = 0x3f << 5;
  10.215 -            private->blueMask = 0x1f;
  10.216 -#endif
  10.217 -        } else {
  10.218 -            WSCONS_ReportError("Unknown video hardware");
  10.219 -            return -1;
  10.220 -        }
  10.221 -    } else {
  10.222 -        WSCONS_ReportError("Displays with 8 bpp or less are not supported");
  10.223 -        return -1;
  10.224 -    }
  10.225 -
  10.226 -    private->rotate = WSCONS_ROTATE_NONE;
  10.227 -    rotation = SDL_getenv("SDL_VIDEO_WSCONS_ROTATION");
  10.228 -    if (rotation != NULL) {
  10.229 -        if (SDL_strlen(rotation) == 0) {
  10.230 -            private->shadowFB = 0;
  10.231 -            private->rotate = WSCONS_ROTATE_NONE;
  10.232 -            printf("Not rotating, no shadow\n");
  10.233 -        } else if (!SDL_strcmp(rotation, "NONE")) {
  10.234 -            private->shadowFB = 1;
  10.235 -            private->rotate = WSCONS_ROTATE_NONE;
  10.236 -            printf("Not rotating, but still using shadow\n");
  10.237 -        } else if (!SDL_strcmp(rotation, "CW")) {
  10.238 -            private->shadowFB = 1;
  10.239 -            private->rotate = WSCONS_ROTATE_CW;
  10.240 -            printf("Rotating screen clockwise\n");
  10.241 -        } else if (!SDL_strcmp(rotation, "CCW")) {
  10.242 -            private->shadowFB = 1;
  10.243 -            private->rotate = WSCONS_ROTATE_CCW;
  10.244 -            printf("Rotating screen counter clockwise\n");
  10.245 -        } else if (!SDL_strcmp(rotation, "UD")) {
  10.246 -            private->shadowFB = 1;
  10.247 -            private->rotate = WSCONS_ROTATE_UD;
  10.248 -            printf("Rotating screen upside down\n");
  10.249 -        } else {
  10.250 -            WSCONS_ReportError("\"%s\" is not a valid value for "
  10.251 -                               "SDL_VIDEO_WSCONS_ROTATION", rotation);
  10.252 -            return -1;
  10.253 -        }
  10.254 -    }
  10.255 -
  10.256 -    switch (private->info.depth) {
  10.257 -    case 1:
  10.258 -    case 4:
  10.259 -    case 8:
  10.260 -        len = private->physlinebytes * private->info.height;
  10.261 -        break;
  10.262 -    case 16:
  10.263 -        if (private->physlinebytes == private->info.width) {
  10.264 -            len = private->info.width * private->info.height * sizeof(short);
  10.265 -        } else {
  10.266 -            len = private->physlinebytes * private->info.height;
  10.267 -        }
  10.268 -        if (private->rotate == WSCONS_ROTATE_NONE ||
  10.269 -            private->rotate == WSCONS_ROTATE_UD) {
  10.270 -            private->blitFunc = WSCONS_blit16;
  10.271 -        } else {
  10.272 -            private->blitFunc = WSCONS_blit16blocked;
  10.273 -        }
  10.274 -        break;
  10.275 -    case 32:
  10.276 -        if (private->physlinebytes == private->info.width) {
  10.277 -            len = private->info.width * private->info.height * sizeof(int);
  10.278 -        } else {
  10.279 -            len = private->physlinebytes * private->info.height;
  10.280 -        }
  10.281 -        break;
  10.282 -    default:
  10.283 -        WSCONS_ReportError("unsupported depth %d", private->info.depth);
  10.284 -        return -1;
  10.285 -    }
  10.286 -
  10.287 -    if (private->shadowFB && private->blitFunc == NULL) {
  10.288 -        WSCONS_ReportError
  10.289 -            ("Using software buffer, but no blitter function is "
  10.290 -             "available for this %d bpp.", private->info.depth);
  10.291 -        return -1;
  10.292 -    }
  10.293 -
  10.294 -    if (ioctl(private->fd, WSDISPLAYIO_SMODE, &wsmode) == -1) {
  10.295 -        WSCONS_ReportError("ioctl SMODE");
  10.296 -        return -1;
  10.297 -    }
  10.298 -
  10.299 -    pagemask = getpagesize() - 1;
  10.300 -    mapsize = ((int) len + pagemask) & ~pagemask;
  10.301 -    private->physmem = (Uint8 *) mmap(NULL, mapsize,
  10.302 -                                      PROT_READ | PROT_WRITE, MAP_SHARED,
  10.303 -                                      private->fd, (off_t) 0);
  10.304 -    if (private->physmem == (Uint8 *) MAP_FAILED) {
  10.305 -        private->physmem = NULL;
  10.306 -        WSCONS_ReportError("mmap: %s", strerror(errno));
  10.307 -        return -1;
  10.308 -    }
  10.309 -    private->fbmem_len = len;
  10.310 -
  10.311 -    if (private->rotate == WSCONS_ROTATE_CW ||
  10.312 -        private->rotate == WSCONS_ROTATE_CCW) {
  10.313 -        width = private->info.height;
  10.314 -        height = private->info.width;
  10.315 -    } else {
  10.316 -        width = private->info.width;
  10.317 -        height = private->info.height;
  10.318 -    }
  10.319 -
  10.320 -    this->info.current_w = width;
  10.321 -    this->info.current_h = height;
  10.322 -
  10.323 -    if (private->shadowFB) {
  10.324 -        private->shadowmem = (Uint8 *) SDL_malloc(len);
  10.325 -        if (private->shadowmem == NULL) {
  10.326 -            WSCONS_ReportError("No memory for shadow");
  10.327 -            return -1;
  10.328 -        }
  10.329 -        private->fbstart = private->shadowmem;
  10.330 -        private->fblinebytes = width * ((private->info.depth + 7) / 8);
  10.331 -    } else {
  10.332 -        private->fbstart = private->physmem;
  10.333 -        private->fblinebytes = private->physlinebytes;
  10.334 -    }
  10.335 -
  10.336 -    private->SDL_modelist[0] = (SDL_Rect *) SDL_malloc(sizeof(SDL_Rect));
  10.337 -    private->SDL_modelist[0]->w = width;
  10.338 -    private->SDL_modelist[0]->h = height;
  10.339 -
  10.340 -    vformat->BitsPerPixel = private->info.depth;
  10.341 -    vformat->BytesPerPixel = private->info.depth / 8;
  10.342 -
  10.343 -    if (WSCONS_InitKeyboard(this) == -1) {
  10.344 -        return -1;
  10.345 -    }
  10.346 -
  10.347 -    return 0;
  10.348 -}
  10.349 -
  10.350 -SDL_Rect **
  10.351 -WSCONS_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
  10.352 -{
  10.353 -    if (format->BitsPerPixel == private->info.depth) {
  10.354 -        return private->SDL_modelist;
  10.355 -    } else {
  10.356 -        return NULL;
  10.357 -    }
  10.358 -}
  10.359 -
  10.360 -SDL_Surface *
  10.361 -WSCONS_SetVideoMode(_THIS, SDL_Surface * current,
  10.362 -                    int width, int height, int bpp, Uint32 flags)
  10.363 -{
  10.364 -    if (width != private->SDL_modelist[0]->w ||
  10.365 -        height != private->SDL_modelist[0]->h) {
  10.366 -        WSCONS_ReportError("Requested video mode %dx%d not supported.",
  10.367 -                           width, height);
  10.368 -        return NULL;
  10.369 -    }
  10.370 -    if (bpp != private->info.depth) {
  10.371 -        WSCONS_ReportError("Requested video depth %d bpp not supported.",
  10.372 -                           bpp);
  10.373 -        return NULL;
  10.374 -    }
  10.375 -
  10.376 -    if (!SDL_ReallocFormat(current,
  10.377 -                           bpp,
  10.378 -                           private->redMask,
  10.379 -                           private->greenMask, private->blueMask, 0)) {
  10.380 -        WSCONS_ReportError("Couldn't allocate new pixel format");
  10.381 -        return NULL;
  10.382 -    }
  10.383 -
  10.384 -    current->flags &= SDL_FULLSCREEN;
  10.385 -    if (private->shadowFB) {
  10.386 -        current->flags |= SDL_SWSURFACE;
  10.387 -    } else {
  10.388 -        current->flags |= SDL_HWSURFACE;
  10.389 -    }
  10.390 -    current->w = width;
  10.391 -    current->h = height;
  10.392 -    current->pitch = private->fblinebytes;
  10.393 -    current->pixels = private->fbstart;
  10.394 -
  10.395 -    SDL_memset(private->fbstart, 0, private->fbmem_len);
  10.396 -
  10.397 -    return current;
  10.398 -}
  10.399 -
  10.400 -static int
  10.401 -WSCONS_AllocHWSurface(_THIS, SDL_Surface * surface)
  10.402 -{
  10.403 -    return -1;
  10.404 -}
  10.405 -
  10.406 -static void
  10.407 -WSCONS_FreeHWSurface(_THIS, SDL_Surface * surface)
  10.408 -{
  10.409 -}
  10.410 -
  10.411 -static int
  10.412 -WSCONS_LockHWSurface(_THIS, SDL_Surface * surface)
  10.413 -{
  10.414 -    return 0;
  10.415 -}
  10.416 -
  10.417 -static void
  10.418 -WSCONS_UnlockHWSurface(_THIS, SDL_Surface * surface)
  10.419 -{
  10.420 -}
  10.421 -
  10.422 -static void
  10.423 -WSCONS_blit16(Uint8 * byte_src_pos,
  10.424 -              int srcRightDelta,
  10.425 -              int srcDownDelta,
  10.426 -              Uint8 * byte_dst_pos, int dst_linebytes, int width, int height)
  10.427 -{
  10.428 -    int w;
  10.429 -    Uint16 *src_pos = (Uint16 *) byte_src_pos;
  10.430 -    Uint16 *dst_pos = (Uint16 *) byte_dst_pos;
  10.431 -
  10.432 -    while (height) {
  10.433 -        Uint16 *src = src_pos;
  10.434 -        Uint16 *dst = dst_pos;
  10.435 -        for (w = width; w != 0; w--) {
  10.436 -            *dst = *src;
  10.437 -            src += srcRightDelta;
  10.438 -            dst++;
  10.439 -        }
  10.440 -        dst_pos = (Uint16 *) ((Uint8 *) dst_pos + dst_linebytes);
  10.441 -        src_pos += srcDownDelta;
  10.442 -        height--;
  10.443 -    }
  10.444 -}
  10.445 -
  10.446 -#define BLOCKSIZE_W 32
  10.447 -#define BLOCKSIZE_H 32
  10.448 -
  10.449 -static void
  10.450 -WSCONS_blit16blocked(Uint8 * byte_src_pos,
  10.451 -                     int srcRightDelta,
  10.452 -                     int srcDownDelta,
  10.453 -                     Uint8 * byte_dst_pos,
  10.454 -                     int dst_linebytes, int width, int height)
  10.455 -{
  10.456 -    int w;
  10.457 -    Uint16 *src_pos = (Uint16 *) byte_src_pos;
  10.458 -    Uint16 *dst_pos = (Uint16 *) byte_dst_pos;
  10.459 -
  10.460 -    while (height > 0) {
  10.461 -        Uint16 *src = src_pos;
  10.462 -        Uint16 *dst = dst_pos;
  10.463 -        for (w = width; w > 0; w -= BLOCKSIZE_W) {
  10.464 -            WSCONS_blit16((Uint8 *) src,
  10.465 -                          srcRightDelta,
  10.466 -                          srcDownDelta,
  10.467 -                          (Uint8 *) dst,
  10.468 -                          dst_linebytes,
  10.469 -                          min(w, BLOCKSIZE_W), min(height, BLOCKSIZE_H));
  10.470 -            src += srcRightDelta * BLOCKSIZE_W;
  10.471 -            dst += BLOCKSIZE_W;
  10.472 -        }
  10.473 -        dst_pos =
  10.474 -            (Uint16 *) ((Uint8 *) dst_pos + dst_linebytes * BLOCKSIZE_H);
  10.475 -        src_pos += srcDownDelta * BLOCKSIZE_H;
  10.476 -        height -= BLOCKSIZE_H;
  10.477 -    }
  10.478 -}
  10.479 -
  10.480 -static void
  10.481 -WSCONS_UpdateRects(_THIS, int numrects, SDL_Rect * rects)
  10.482 -{
  10.483 -    int width = private->SDL_modelist[0]->w;
  10.484 -    int height = private->SDL_modelist[0]->h;
  10.485 -    int bytesPerPixel = (private->info.depth + 7) / 8;
  10.486 -    int i;
  10.487 -
  10.488 -    if (!private->shadowFB) {
  10.489 -        return;
  10.490 -    }
  10.491 -
  10.492 -    if (private->info.depth != 16) {
  10.493 -        WSCONS_ReportError("Shadow copy only implemented for 16 bpp");
  10.494 -        return;
  10.495 -    }
  10.496 -
  10.497 -    for (i = 0; i < numrects; i++) {
  10.498 -        int x1, y1, x2, y2;
  10.499 -        int scr_x1, scr_y1, scr_x2, scr_y2;
  10.500 -        int sha_x1, sha_y1;
  10.501 -        int shadowRightDelta;   /* Address change when moving right in dest */
  10.502 -        int shadowDownDelta;    /* Address change when moving down in dest */
  10.503 -        Uint8 *src_start;
  10.504 -        Uint8 *dst_start;
  10.505 -
  10.506 -        x1 = rects[i].x;
  10.507 -        y1 = rects[i].y;
  10.508 -        x2 = x1 + rects[i].w;
  10.509 -        y2 = y1 + rects[i].h;
  10.510 -
  10.511 -        if (x1 < 0) {
  10.512 -            x1 = 0;
  10.513 -        } else if (x1 > width) {
  10.514 -            x1 = width;
  10.515 -        }
  10.516 -        if (x2 < 0) {
  10.517 -            x2 = 0;
  10.518 -        } else if (x2 > width) {
  10.519 -            x2 = width;
  10.520 -        }
  10.521 -        if (y1 < 0) {
  10.522 -            y1 = 0;
  10.523 -        } else if (y1 > height) {
  10.524 -            y1 = height;
  10.525 -        }
  10.526 -        if (y2 < 0) {
  10.527 -            y2 = 0;
  10.528 -        } else if (y2 > height) {
  10.529 -            y2 = height;
  10.530 -        }
  10.531 -        if (x2 <= x1 || y2 <= y1) {
  10.532 -            continue;
  10.533 -        }
  10.534 -
  10.535 -        switch (private->rotate) {
  10.536 -        case WSCONS_ROTATE_NONE:
  10.537 -            sha_x1 = scr_x1 = x1;
  10.538 -            sha_y1 = scr_y1 = y1;
  10.539 -            scr_x2 = x2;
  10.540 -            scr_y2 = y2;
  10.541 -            shadowRightDelta = 1;
  10.542 -            shadowDownDelta = width;
  10.543 -            break;
  10.544 -        case WSCONS_ROTATE_CCW:
  10.545 -            scr_x1 = y1;
  10.546 -            scr_y1 = width - x2;
  10.547 -            scr_x2 = y2;
  10.548 -            scr_y2 = width - x1;
  10.549 -            sha_x1 = x2 - 1;
  10.550 -            sha_y1 = y1;
  10.551 -            shadowRightDelta = width;
  10.552 -            shadowDownDelta = -1;
  10.553 -            break;
  10.554 -        case WSCONS_ROTATE_UD:
  10.555 -            scr_x1 = width - x2;
  10.556 -            scr_y1 = height - y2;
  10.557 -            scr_x2 = width - x1;
  10.558 -            scr_y2 = height - y1;
  10.559 -            sha_x1 = x2 - 1;
  10.560 -            sha_y1 = y2 - 1;
  10.561 -            shadowRightDelta = -1;
  10.562 -            shadowDownDelta = -width;
  10.563 -            break;
  10.564 -        case WSCONS_ROTATE_CW:
  10.565 -            scr_x1 = height - y2;
  10.566 -            scr_y1 = x1;
  10.567 -            scr_x2 = height - y1;
  10.568 -            scr_y2 = x2;
  10.569 -            sha_x1 = x1;
  10.570 -            sha_y1 = y2 - 1;
  10.571 -            shadowRightDelta = -width;
  10.572 -            shadowDownDelta = 1;
  10.573 -            break;
  10.574 -        default:
  10.575 -            WSCONS_ReportError("Unknown rotation");
  10.576 -            return;
  10.577 -        }
  10.578 -
  10.579 -        src_start =
  10.580 -            private->shadowmem + (sha_y1 * width + sha_x1) * bytesPerPixel;
  10.581 -        dst_start =
  10.582 -            private->physmem + scr_y1 * private->physlinebytes +
  10.583 -            scr_x1 * bytesPerPixel;
  10.584 -
  10.585 -        private->blitFunc(src_start,
  10.586 -                          shadowRightDelta,
  10.587 -                          shadowDownDelta,
  10.588 -                          dst_start,
  10.589 -                          private->physlinebytes,
  10.590 -                          scr_x2 - scr_x1, scr_y2 - scr_y1);
  10.591 -    }
  10.592 -}
  10.593 -
  10.594 -int
  10.595 -WSCONS_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
  10.596 -{
  10.597 -    return 0;
  10.598 -}
  10.599 -
  10.600 -/*
  10.601 - * Note: If we are terminated, this could be called in the middle of
  10.602 - * another SDL video routine -- notably UpdateRects.
  10.603 - */
  10.604 -void
  10.605 -WSCONS_VideoQuit(_THIS)
  10.606 -{
  10.607 -    int mode = WSDISPLAYIO_MODE_EMUL;
  10.608 -
  10.609 -    if (private->shadowmem != NULL) {
  10.610 -        SDL_free(private->shadowmem);
  10.611 -        private->shadowmem = NULL;
  10.612 -    }
  10.613 -    private->fbstart = NULL;
  10.614 -    if (this->screen != NULL) {
  10.615 -        this->screen->pixels = NULL;
  10.616 -    }
  10.617 -
  10.618 -    if (private->SDL_modelist[0] != NULL) {
  10.619 -        SDL_free(private->SDL_modelist[0]);
  10.620 -        private->SDL_modelist[0] = NULL;
  10.621 -    }
  10.622 -
  10.623 -    if (ioctl(private->fd, WSDISPLAYIO_SMODE, &mode) == -1) {
  10.624 -        WSCONS_ReportError("ioctl SMODE");
  10.625 -    }
  10.626 -
  10.627 -    WSCONS_ReleaseKeyboard(this);
  10.628 -
  10.629 -    if (private->fd != -1) {
  10.630 -        close(private->fd);
  10.631 -        private->fd = -1;
  10.632 -    }
  10.633 -}
  10.634 -
  10.635 -/* vi: set ts=4 sw=4 expandtab: */
    11.1 --- a/src/video/wscons/SDL_wsconsvideo.h	Sat Sep 19 07:26:51 2009 +0000
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,75 +0,0 @@
    11.4 -/*
    11.5 -    SDL - Simple DirectMedia Layer
    11.6 -    Copyright (C) 1997-2009 Sam Lantinga
    11.7 -
    11.8 -    This library is free software; you can redistribute it and/or
    11.9 -    modify it under the terms of the GNU Lesser General Public
   11.10 -    License as published by the Free Software Foundation; either
   11.11 -    version 2.1 of the License, or (at your option) any later version.
   11.12 -
   11.13 -    This library is distributed in the hope that it will be useful,
   11.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   11.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   11.16 -    Lesser General Public License for more details.
   11.17 -
   11.18 -    You should have received a copy of the GNU Lesser General Public
   11.19 -    License along with this library; if not, write to the Free Software
   11.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   11.21 -
   11.22 -    Sam Lantinga
   11.23 -    slouken@libsdl.org
   11.24 -*/
   11.25 -#include "SDL_config.h"
   11.26 -
   11.27 -#ifndef _SDL_wsconsvideo_h
   11.28 -#define _SDL_wsconsvideo_h
   11.29 -
   11.30 -#include <sys/time.h>
   11.31 -#include <termios.h>
   11.32 -#include <dev/wscons/wsconsio.h>
   11.33 -
   11.34 -#include "SDL_mouse.h"
   11.35 -#include "SDL_mutex.h"
   11.36 -#include "../SDL_sysvideo.h"
   11.37 -
   11.38 -void WSCONS_ReportError(char *fmt, ...);
   11.39 -
   11.40 -/* Hidden "this" pointer for the video functions */
   11.41 -#define _THIS	SDL_VideoDevice *this
   11.42 -#define private	(this->hidden)
   11.43 -
   11.44 -/* Private display data */
   11.45 -
   11.46 -typedef void WSCONS_bitBlit(Uint8 * src_pos, int srcRightDelta, // pixels, not bytes
   11.47 -                            int srcDownDelta,   // pixels, not bytes
   11.48 -                            Uint8 * dst_pos,
   11.49 -                            int dst_linebytes, int width, int height);
   11.50 -
   11.51 -struct SDL_PrivateVideoData
   11.52 -{
   11.53 -    int fd;                     /* file descriptor of open device */
   11.54 -    struct wsdisplay_fbinfo info;       /* frame buffer characteristics */
   11.55 -    int physlinebytes;          /* number of bytes per row */
   11.56 -    int redMask, greenMask, blueMask;
   11.57 -
   11.58 -    Uint8 *fbstart;             /* These refer to the surface used, */
   11.59 -    int fblinebytes;            /* physical frame buffer or shadow. */
   11.60 -
   11.61 -    size_t fbmem_len;
   11.62 -    Uint8 *physmem;
   11.63 -    Uint8 *shadowmem;
   11.64 -    int rotate;
   11.65 -    int shadowFB;               /* Tells whether a shadow is being used. */
   11.66 -
   11.67 -    WSCONS_bitBlit *blitFunc;
   11.68 -
   11.69 -    SDL_Rect *SDL_modelist[2];
   11.70 -
   11.71 -    unsigned int kbdType;
   11.72 -    int did_save_tty;
   11.73 -    struct termios saved_tty;
   11.74 -};
   11.75 -
   11.76 -
   11.77 -#endif /* _SDL_wsconsvideo_h */
   11.78 -/* vi: set ts=4 sw=4 expandtab: */