From 2b4b30d15cd602ecc6e380d99771149bd289c1bb Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 11 May 2001 01:13:35 +0000 Subject: [PATCH] Added initial support for Nano-X (thanks Hsieh-Fu!) --- README.NanoX | 81 +++++ configure.in | 45 +++ docs.html | 1 + include/SDL_syswm.h | 17 +- src/video/Makefile.am | 2 +- src/video/SDL_sysvideo.h | 3 + src/video/SDL_video.c | 3 + src/video/nanox/Makefile.am | 20 ++ src/video/nanox/SDL_nxevents.c | 364 ++++++++++++++++++++ src/video/nanox/SDL_nxevents_c.h | 31 ++ src/video/nanox/SDL_nximage.c | 166 +++++++++ src/video/nanox/SDL_nximage_c.h | 34 ++ src/video/nanox/SDL_nxmodes.c | 84 +++++ src/video/nanox/SDL_nxmodes_c.h | 33 ++ src/video/nanox/SDL_nxmouse.c | 81 +++++ src/video/nanox/SDL_nxmouse_c.h | 6 + src/video/nanox/SDL_nxvideo.c | 557 +++++++++++++++++++++++++++++++ src/video/nanox/SDL_nxvideo.h | 89 +++++ src/video/nanox/SDL_nxwm.c | 63 ++++ src/video/nanox/SDL_nxwm_c.h | 31 ++ 20 files changed, 1709 insertions(+), 2 deletions(-) create mode 100644 README.NanoX create mode 100644 src/video/nanox/Makefile.am create mode 100644 src/video/nanox/SDL_nxevents.c create mode 100644 src/video/nanox/SDL_nxevents_c.h create mode 100644 src/video/nanox/SDL_nximage.c create mode 100644 src/video/nanox/SDL_nximage_c.h create mode 100644 src/video/nanox/SDL_nxmodes.c create mode 100644 src/video/nanox/SDL_nxmodes_c.h create mode 100644 src/video/nanox/SDL_nxmouse.c create mode 100644 src/video/nanox/SDL_nxmouse_c.h create mode 100644 src/video/nanox/SDL_nxvideo.c create mode 100644 src/video/nanox/SDL_nxvideo.h create mode 100644 src/video/nanox/SDL_nxwm.c create mode 100644 src/video/nanox/SDL_nxwm_c.h diff --git a/README.NanoX b/README.NanoX new file mode 100644 index 000000000..a9570a970 --- /dev/null +++ b/README.NanoX @@ -0,0 +1,81 @@ + ================================================================= + Patch version 0.8 of SDL(Simple DirectMedia Layer) for Nano-X API + ================================================================= + + Author: Hsieh-Fu Tsai, clare@setabox.com + + There are two patch files in this package. + + 1. The first patch file, nanox.patch, is to fix a bug in Nano-X. + This patch is proposed by Gary James (gjames@twcny.rr.com). + + It fixes the client side GrClose(). In the original version, + GrOpen() can only be called once. When the GrOpen() is called at + the second time, the program will terminate. In order to prevent + this situation, we need to insert "nxSocket = -1" after + "close(nxSocket)" in GrClose(). If you do not have this problem, + you may skip this step. + + ============= + Quick Install + ============= + + 1. ./configure --disable-video-x11 --disable-video-fbcon \ + --enable-video-nanox \ + --with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal] + 2. make clean + 3. make + 4. make install (as root) + + ============ + Nitty-gritty + ============ + + --with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal] + + If the wrong pixel type is used, the program will crash when the + sub-routine updates the screen. This option depends on SCREEN_PIXTYPE + which is defined in Microwin0.89pre7/src/config. SCREEN_PIXTYPE + is used to define the pixel type in Microwindows/Nano-X. + I only test the program when the pixel type is in "rgb" + (Microwin under X11) or "888" (framebuffer in 24-bit). + + --enable-nanox-debug Show debug messages + --enable-nanox-share-memory Use shared-memory to speed up + + ============================================= + Some programs can be used to test this patch. + ============================================= + + 1. http://www.cs.berkeley.edu/~weimer/atris (a tetris-like game) + 2. http://www.libsdl.org/projects/newvox/ + 3. http://www.libsdl.org/projects/xflame/ + 4. http://www.libsdl.org/projects/optimum/ + 5. http://www.gnugeneration.com/software/loop/ + + ========= + Todo List + ========= + + 1. Create hardware surface + 2. Create YUVOverlay on hardware + 3. Use OpenGL + 4. Gamma correction + 5. Hide/Change mouse pointer + + ===================== + Supporting Institutes + ===================== + + Many thanks to go to Setabox Co., Ltd. and CML (Communication and + Multimedia Laboratory, http://www.cmlab.csie.ntu.edu.tw/) in the + Department of Computer Science and Information Engineering of + National Taiwan University for supporting this porting project. + + =================== + Contact Information + =================== + + Welcome to give me any suggestion and to report bugs. + My e-mail address : clare@setabox.com or niky@cmlab.csie.ntu.edu.tw + diff --git a/configure.in b/configure.in index e37ca55cc..81bc8f95b 100644 --- a/configure.in +++ b/configure.in @@ -403,6 +403,49 @@ CheckNASM() fi } +dnl Find the nanox include and library directories +CheckNANOX() +{ + AC_ARG_ENABLE(video-nanox, + [ --enable-video-nanox use nanox video driver [default=no]], + , enable_video_nanox=no) + AC_ARG_ENABLE(nanox-debug, + [ --enable-nanox-debug print debug messages [default=no]], + , enable_nanox_debug=no) + AC_ARG_ENABLE(nanox-share-memory, + [ --enable-nanox-share-memory use share memory [default=no]], + , enable_nanox_share_memory=no) + + AC_ARG_WITH(nanox_pixel_type, + [ --with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal]]) + + if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then + if test x$enable_nanox_debug = xyes; then + CFLAGS="$CFLAGS -DENABLE_NANOX_DEBUG" + fi + + if test x$enable_nanox_share_memory = xyes; then + CFLAGS="$CFLAGS -DNANOX_SHARE_MEMORY" + fi + + case "$with_nanox_pixel_type" in + rgb) CFLAGS="$CFLAGS -DNANOX_PIXEL_RGB" ;; + 0888) CFLAGS="$CFLAGS -DNANOX_PIXEL_0888" ;; + 888) CFLAGS="$CFLAGS -DNANOX_PIXEL_888" ;; + 565) CFLAGS="$CFLAGS -DNANOX_PIXEL_565" ;; + 555) CFLAGS="$CFLAGS -DNANOX_PIXEL_555" ;; + 332) CFLAGS="$CFLAGS -DNANOX_PIXEL_332" ;; + pal) CFLAGS="$CFLAGS -DNANOX_PIXEL_PAL" ;; + *) AC_MSG_ERROR([Invalid nanox_pixel_type]);; + esac + + CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_NANOX" + SYSTEM_LIBS="$SYSTEM_LIBS -lnano-X" + VIDEO_SUBDIRS="$VIDEO_SUBDIRS nanox" + VIDEO_DRIVERS="$VIDEO_DRIVERS nanox/libvideo_nanox.la" + fi +} + dnl Find the X11 include and library directories CheckX11() { @@ -1042,6 +1085,7 @@ case "$target" in CheckESD CheckNAS CheckX11 + CheckNANOX CheckDGA CheckFBCON CheckGGI @@ -1921,6 +1965,7 @@ src/video/Makefile src/video/cybergfx/Makefile src/video/x11/Makefile src/video/dga/Makefile +src/video/nanox/Makefile src/video/fbcon/Makefile src/video/ggi/Makefile src/video/maccommon/Makefile diff --git a/docs.html b/docs.html index 9d3d14bac..c51be1903 100644 --- a/docs.html +++ b/docs.html @@ -16,6 +16,7 @@

Major changes since SDL 1.0.0: