aboutsummaryrefslogtreecommitdiff
path: root/devel/sdl12
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2001-01-27 19:22:03 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2001-01-27 19:22:03 +0000
commite219727201eb734fce9ece955a8556c4a4002b48 (patch)
treeb5efb253f87847545d17155b8fa07c4a7d57a85f /devel/sdl12
parent7e2cf32be971d30567907db7210f71489b200eda (diff)
downloadports-e219727201eb734fce9ece955a8556c4a4002b48.tar.gz
ports-e219727201eb734fce9ece955a8556c4a4002b48.zip
Notes
Diffstat (limited to 'devel/sdl12')
-rw-r--r--devel/sdl12/Makefile9
-rw-r--r--devel/sdl12/files/patch-ac4
-rw-r--r--devel/sdl12/files/patch-configure.in4
-rw-r--r--devel/sdl12/files/patch-src_video_svga_SDL__svgaevents.c13
-rw-r--r--devel/sdl12/files/patch-src_video_vgl_SDL__vglevents.c4
-rw-r--r--devel/sdl12/files/patch-src_video_vgl_SDL__vglevents__c.h4
-rw-r--r--devel/sdl12/files/patch-src_video_vgl_SDL__vglmouse.c4
-rw-r--r--devel/sdl12/files/patch-src_video_vgl_SDL__vglmouse__c.h4
-rw-r--r--devel/sdl12/files/patch-src_video_vgl_SDL__vglvideo.c210
-rw-r--r--devel/sdl12/files/patch-src_video_vgl_SDL__vglvideo.h31
-rw-r--r--devel/sdl12/files/patch-src_video_x11_SDL__x11events.c15
11 files changed, 263 insertions, 39 deletions
diff --git a/devel/sdl12/Makefile b/devel/sdl12/Makefile
index 01bb92a40e49..79d778cc292c 100644
--- a/devel/sdl12/Makefile
+++ b/devel/sdl12/Makefile
@@ -25,11 +25,16 @@ INSTALLS_SHLIB= yes
USE_LIBTOOL= yes
CONFIGURE_ENV= NASM="${LOCALBASE}/bin/nasm"
CONFIGURE_ARGS= --enable-video-aalib \
- --enable-video-svga \
- --enable-video-vgl
+ --enable-video-svga
CFLAGS+= -D_THREAD_SAFE
+.if exists(/usr/lib/libvgl.so.3)
+CONFIGURE_ARGS+=--enable-video-vgl
+.else
+CONFIGURE_ARGS+=--disable-video-vgl
+.endif
+
.if defined(WITHOUT_GL)
CONFIGURE_ARGS+=--disable-video-opengl
.else
diff --git a/devel/sdl12/files/patch-ac b/devel/sdl12/files/patch-ac
index 7f44eb536d91..c29d74064651 100644
--- a/devel/sdl12/files/patch-ac
+++ b/devel/sdl12/files/patch-ac
@@ -62,8 +62,8 @@ $FreeBSD$
+
+int main() {
+
-+ VGLMode mode;
-+ exit(0);
++ VGLBitmap bitmap;
++ exit(bitmap.PixelBytes);
+
+; return 0; }
+EOF
diff --git a/devel/sdl12/files/patch-configure.in b/devel/sdl12/files/patch-configure.in
index 96e94473bd8f..83a0f76ac4ec 100644
--- a/devel/sdl12/files/patch-configure.in
+++ b/devel/sdl12/files/patch-configure.in
@@ -22,8 +22,8 @@ $FreeBSD$
+ #include <sys/kbio.h>
+ #include <vgl.h>
+ ],[
-+ VGLMode mode;
-+ exit(0);
++ VGLBitmap bitmap;
++ exit(bitmap.PyxelBytes);
+ ],[
+ video_vgl=yes
+ ])
diff --git a/devel/sdl12/files/patch-src_video_svga_SDL__svgaevents.c b/devel/sdl12/files/patch-src_video_svga_SDL__svgaevents.c
new file mode 100644
index 000000000000..113384935c43
--- /dev/null
+++ b/devel/sdl12/files/patch-src_video_svga_SDL__svgaevents.c
@@ -0,0 +1,13 @@
+
+$FreeBSD$
+
+--- src/video/svga/SDL_svgaevents.c 2001/01/27 17:53:11 1.1
++++ src/video/svga/SDL_svgaevents.c 2001/01/27 17:53:58
+@@ -28,6 +28,7 @@
+ /* Handle the event stream, converting X11 events into SDL events */
+
+ #include <stdio.h>
++#include <stdlib.h>
+
+ #include <vga.h>
+ #include <vgamouse.h>
diff --git a/devel/sdl12/files/patch-src_video_vgl_SDL__vglevents.c b/devel/sdl12/files/patch-src_video_vgl_SDL__vglevents.c
index 589a210b63ce..9caaeae82822 100644
--- a/devel/sdl12/files/patch-src_video_vgl_SDL__vglevents.c
+++ b/devel/sdl12/files/patch-src_video_vgl_SDL__vglevents.c
@@ -1,8 +1,8 @@
$FreeBSD$
---- /dev/null Mon Jan 22 20:53:09 2001
-+++ src/video/vgl/SDL_vglevents.c Mon Jan 22 20:02:48 2001
+--- src/video/vgl/SDL_vglevents.c.orig Wed Jan 24 00:51:13 2001
++++ src/video/vgl/SDL_vglevents.c Wed Jan 24 00:51:13 2001
@@ -0,0 +1,305 @@
+/*
+ SDL - Simple DirectMedia Layer
diff --git a/devel/sdl12/files/patch-src_video_vgl_SDL__vglevents__c.h b/devel/sdl12/files/patch-src_video_vgl_SDL__vglevents__c.h
index 3a0c60cca619..ed719a784f6d 100644
--- a/devel/sdl12/files/patch-src_video_vgl_SDL__vglevents__c.h
+++ b/devel/sdl12/files/patch-src_video_vgl_SDL__vglevents__c.h
@@ -1,8 +1,8 @@
$FreeBSD$
---- /dev/null Mon Jan 22 20:53:09 2001
-+++ src/video/vgl/SDL_vglevents_c.h Mon Jan 22 19:57:14 2001
+--- src/video/vgl/SDL_vglevents_c.h.orig Wed Jan 24 00:51:13 2001
++++ src/video/vgl/SDL_vglevents_c.h Wed Jan 24 00:51:13 2001
@@ -0,0 +1,159 @@
+/*
+ SDL - Simple DirectMedia Layer
diff --git a/devel/sdl12/files/patch-src_video_vgl_SDL__vglmouse.c b/devel/sdl12/files/patch-src_video_vgl_SDL__vglmouse.c
index 2fc9f5e24f3f..33247ab1e59d 100644
--- a/devel/sdl12/files/patch-src_video_vgl_SDL__vglmouse.c
+++ b/devel/sdl12/files/patch-src_video_vgl_SDL__vglmouse.c
@@ -1,8 +1,8 @@
$FreeBSD$
---- /dev/null Mon Jan 22 20:53:09 2001
-+++ src/video/vgl/SDL_vglmouse.c Mon Jan 22 16:31:43 2001
+--- src/video/vgl/SDL_vglmouse.c.orig Wed Jan 24 00:51:13 2001
++++ src/video/vgl/SDL_vglmouse.c Wed Jan 24 00:51:13 2001
@@ -0,0 +1,66 @@
+/*
+ SDL - Simple DirectMedia Layer
diff --git a/devel/sdl12/files/patch-src_video_vgl_SDL__vglmouse__c.h b/devel/sdl12/files/patch-src_video_vgl_SDL__vglmouse__c.h
index 119b81177f3d..9e750085ab0e 100644
--- a/devel/sdl12/files/patch-src_video_vgl_SDL__vglmouse__c.h
+++ b/devel/sdl12/files/patch-src_video_vgl_SDL__vglmouse__c.h
@@ -1,8 +1,8 @@
$FreeBSD$
---- /dev/null Mon Jan 22 20:53:10 2001
-+++ src/video/vgl/SDL_vglmouse_c.h Mon Jan 22 16:31:43 2001
+--- src/video/vgl/SDL_vglmouse_c.h.orig Wed Jan 24 00:51:13 2001
++++ src/video/vgl/SDL_vglmouse_c.h Wed Jan 24 00:51:13 2001
@@ -0,0 +1,36 @@
+/*
+ SDL - Simple DirectMedia Layer
diff --git a/devel/sdl12/files/patch-src_video_vgl_SDL__vglvideo.c b/devel/sdl12/files/patch-src_video_vgl_SDL__vglvideo.c
index 9ab45e62dae8..7a8f38ca46b4 100644
--- a/devel/sdl12/files/patch-src_video_vgl_SDL__vglvideo.c
+++ b/devel/sdl12/files/patch-src_video_vgl_SDL__vglvideo.c
@@ -1,9 +1,9 @@
$FreeBSD$
---- /dev/null Mon Jan 22 20:53:09 2001
-+++ src/video/vgl/SDL_vglvideo.c Mon Jan 22 20:04:39 2001
-@@ -0,0 +1,444 @@
+--- src/video/vgl/SDL_vglvideo.c.orig Sat Jan 27 17:45:48 2001
++++ src/video/vgl/SDL_vglvideo.c Sat Jan 27 18:13:31 2001
+@@ -0,0 +1,616 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997, 1998, 1999, 2000 Sam Lantinga
@@ -56,8 +56,6 @@ $FreeBSD$
+#include "SDL_vglmouse_c.h"
+
+
-+static VGLMode *VGLCurMode = NULL;
-+
+/* Initialization/Query functions */
+static int VGL_VideoInit(_THIS, SDL_PixelFormat *vformat);
+static SDL_Rect **VGL_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
@@ -73,6 +71,10 @@ $FreeBSD$
+static void VGL_UnlockHWSurface(_THIS, SDL_Surface *surface);
+static void VGL_FreeHWSurface(_THIS, SDL_Surface *surface);
+
++/* Misc function */
++static VGLMode ** VGLListModes(int depth, int mem_model);
++static void VGLWaitRetrace(void);
++
+/* VGL driver bootstrap functions */
+
+static int VGL_Available(void)
@@ -133,7 +135,7 @@ $FreeBSD$
+ device->SetHWAlpha = NULL;
+ device->LockHWSurface = VGL_LockHWSurface;
+ device->UnlockHWSurface = VGL_UnlockHWSurface;
-+ device->FlipHWSurface = NULL;
++ device->FlipHWSurface = VGL_FlipHWSurface;
+ device->FreeHWSurface = VGL_FreeHWSurface;
+ device->SetIcon = NULL;
+ device->SetCaption = NULL;
@@ -242,10 +244,6 @@ $FreeBSD$
+ SDL_SetError("Unable to initialize mouse");
+ return -1;
+ }
-+// if (VGLMouseInit(VGL_MOUSEHIDE) != 0) {
-+// SDL_SetError("Unable to initialize mouse");
-+// return -1;
-+// }
+
+ /* Determine the screen depth */
+ if (VGLCurMode != NULL)
@@ -294,7 +292,7 @@ $FreeBSD$
+static void VGL_BankedUpdate(_THIS, int numrects, SDL_Rect *rects);
+
+SDL_Surface *VGL_SetVideoMode(_THIS, SDL_Surface *current,
-+ int width, int height, int bpp, Uint32 flags)
++ int width, int height, int bpp, Uint32 flags)
+{
+ int mode_found;
+ int i;
@@ -326,25 +324,45 @@ $FreeBSD$
+ SDL_SetError("Unable to switch to requested mode");
+ return NULL;
+ }
++
+ VGLCurMode = realloc(VGLCurMode, sizeof(VGLMode));
+ VGLCurMode->ModeInfo = *VGLDisplay;
+ VGLCurMode->Depth = modes[i]->Depth;
+ VGLCurMode->ModeId = modes[i]->ModeId;
++ VGLCurMode->Rmask = modes[i]->Rmask;
++ VGLCurMode->Gmask = modes[i]->Gmask;
++ VGLCurMode->Bmask = modes[i]->Bmask;
+
+ /* Workaround a bug in libvgl */
+ if (VGLCurMode->ModeInfo.PixelBytes == 0)
+ (VGLCurMode->ModeInfo.PixelBytes = 1);
+
-+ current->flags = (SDL_FULLSCREEN | SDL_HWSURFACE);
-+ if (VGLCurMode->ModeInfo.Type == VIDBUF8)
-+ current->flags |= SDL_HWPALETTE;
+ current->w = VGLCurMode->ModeInfo.Xsize;
+ current->h = VGLCurMode->ModeInfo.Ysize;
+ current->pixels = VGLCurMode->ModeInfo.Bitmap;
-+ current->pitch = VGLCurMode->ModeInfo.Xsize * VGLCurMode->ModeInfo.PixelBytes;
++ current->pitch = VGLCurMode->ModeInfo.Xsize *
++ VGLCurMode->ModeInfo.PixelBytes;
++ current->flags = (SDL_FULLSCREEN | SDL_HWSURFACE);
+
-+ /* FIXME - should set colormasks for bpp > 8*/
-+ if (! SDL_ReallocFormat(current, modes[i]->Depth, 0, 0, 0, 0)) {
++ /* Check if we are in a pseudo-color mode */
++ if (VGLCurMode->ModeInfo.Type == VIDBUF8)
++ current->flags |= SDL_HWPALETTE;
++
++ /* Check if we can do doublebuffering */
++ if (flags & SDL_DOUBLEBUF) {
++ if (VGLCurMode->ModeInfo.Xsize * 2 <=
++ VGLCurMode->ModeInfo.VYsize) {
++ current->flags |= SDL_DOUBLEBUF;
++ flip_page = 0;
++ flip_address[0] = (byte *)current->pixels;
++ flip_address[1] = (byte *)current->pixels +
++ current->h * current->pitch;
++ VGL_FlipHWSurface(this, current);
++ }
++ }
++
++ if (! SDL_ReallocFormat(current, modes[i]->Depth, VGLCurMode->Rmask,
++ VGLCurMode->Gmask, VGLCurMode->Bmask, 0)) {
+ return NULL;
+ }
+
@@ -385,6 +403,15 @@ $FreeBSD$
+
+static int VGL_FlipHWSurface(_THIS, SDL_Surface *surface)
+{
++// VGLWaitRetrace();
++ if (VGLPanScreen(VGLDisplay, 0, flip_page * surface->h) < 0) {
++ SDL_SetError("VGLPanSreen() failed");
++ return -1;
++ }
++
++ flip_page = !flip_page;
++ surface->pixels = flip_address[flip_page];
++
+ return 0;
+}
+
@@ -418,10 +445,12 @@ $FreeBSD$
+{
+ int i, j;
+
-+ /* Reset the console video mode */
++ /* Return the keyboard to the normal state */
+ VGLKeyboardEnd();
-+ VGLEnd();
++
++ /* Reset the console video mode if we actually initialised one */
+ if (VGLCurMode != NULL) {
++ VGLEnd();
+ free(VGLCurMode);
+ VGLCurMode = NULL;
+ }
@@ -448,3 +477,146 @@ $FreeBSD$
+ this->screen->pixels = NULL;
+ }
+}
++
++#define VGL_RED_INDEX 0
++#define VGL_GREEN_INDEX 1
++#define VGL_BLUE_INDEX 2
++
++static VGLMode **
++VGLListModes(int depth, int mem_model)
++{
++ static VGLMode **modes = NULL;
++
++ VGLBitmap *vminfop;
++ VGLMode **modesp, *modescp;
++ video_info_t minfo;
++ int adptype, i, modenum;
++
++ if (modes == NULL) {
++ modes = malloc(sizeof(VGLMode *) * M_VESA_MODE_MAX);
++ bzero(modes, sizeof(VGLMode *) * M_VESA_MODE_MAX);
++ }
++ modesp = modes;
++
++ for (modenum = 0; modenum < M_VESA_MODE_MAX; modenum++) {
++ minfo.vi_mode = modenum;
++ if (ioctl(0, CONS_MODEINFO, &minfo) || ioctl(0, CONS_CURRENT, &adptype))
++ continue;
++ if (minfo.vi_mode != modenum)
++ continue;
++ if ((minfo.vi_flags & V_INFO_GRAPHICS) == 0)
++ continue;
++ if ((mem_model != -1) && ((minfo.vi_mem_model & mem_model) == 0))
++ continue;
++ if ((depth > 1) && (minfo.vi_depth != depth))
++ continue;
++
++ /* reallocf can fail */
++ if ((*modesp = reallocf(*modesp, sizeof(VGLMode))) == NULL)
++ return NULL;
++ modescp = *modesp;
++
++ vminfop = &(modescp->ModeInfo);
++ bzero(vminfop, sizeof(VGLBitmap));
++
++ vminfop->Type = NOBUF;
++
++ vminfop->PixelBytes = 1; /* Good default value */
++ switch (minfo.vi_mem_model) {
++ case V_INFO_MM_PLANAR:
++ /* we can handle EGA/VGA planar modes only */
++ if (!(minfo.vi_depth != 4 || minfo.vi_planes != 4
++ || (adptype != KD_EGA && adptype != KD_VGA)))
++ vminfop->Type = VIDBUF4;
++ break;
++ case V_INFO_MM_PACKED:
++ /* we can do only 256 color packed modes */
++ if (minfo.vi_depth == 8)
++ vminfop->Type = VIDBUF8;
++ break;
++ case V_INFO_MM_VGAX:
++ vminfop->Type = VIDBUF8X;
++ break;
++#if __FreeBSD_version >= 500000
++ case V_INFO_MM_DIRECT:
++ vminfop->PixelBytes = minfo.vi_pixel_size;
++ switch (vminfop->PixelBytes) {
++ case 2:
++ vminfop->Type = VIDBUF16;
++ break;
++#if notyet
++ case 3:
++ vminfop->Type = VIDBUF24;
++ break;
++#endif
++ case 4:
++ vminfop->Type = VIDBUF32;
++ break;
++ default:
++ break;
++ }
++#endif
++ default:
++ break;
++ }
++ if (vminfop->Type == NOBUF)
++ continue;
++
++ switch (vminfop->Type) {
++ case VIDBUF16:
++ case VIDBUF32:
++ modescp->Rmask = ((1 << minfo.vi_pixel_fsizes[VGL_RED_INDEX]) - 1) <<
++ minfo.vi_pixel_fields[VGL_RED_INDEX];
++ modescp->Gmask = ((1 << minfo.vi_pixel_fsizes[VGL_GREEN_INDEX]) - 1) <<
++ minfo.vi_pixel_fields[VGL_GREEN_INDEX];
++ modescp->Bmask = ((1 << minfo.vi_pixel_fsizes[VGL_BLUE_INDEX]) - 1) <<
++ minfo.vi_pixel_fields[VGL_BLUE_INDEX];
++ break;
++
++ default:
++ break;
++ }
++
++ vminfop->Xsize = minfo.vi_width;
++ vminfop->Ysize = minfo.vi_height;
++ modescp->Depth = minfo.vi_depth;
++
++ /* XXX */
++ if (minfo.vi_mode >= M_VESA_BASE)
++ modescp->ModeId = _IO('V', minfo.vi_mode - M_VESA_BASE);
++ else
++ modescp->ModeId = _IO('S', minfo.vi_mode);
++
++ /* Sort list */
++ for (i = 0; modes + i < modesp ; i++) {
++ if (modes[i]->ModeInfo.Xsize * modes[i]->ModeInfo.Ysize >
++ vminfop->Xsize * modes[i]->ModeInfo.Ysize)
++ continue;
++ if ((modes[i]->ModeInfo.Xsize * modes[i]->ModeInfo.Ysize ==
++ vminfop->Xsize * vminfop->Ysize) &&
++ (modes[i]->Depth >= modescp->Depth))
++ continue;
++ *modesp = modes[i];
++ modes[i] = modescp;
++ modescp = *modesp;
++ vminfop = &(modescp->ModeInfo);
++ }
++
++ modesp++;
++ }
++
++ if (*modesp != NULL) {
++ free(*modesp);
++ *modesp = NULL;
++ }
++
++ return modes;
++}
++
++static void
++VGLWaitRetrace(void)
++{
++ while (!(inb(0x3DA) & 8));
++ while (inb(0x3DA) & 8);
++}
++
diff --git a/devel/sdl12/files/patch-src_video_vgl_SDL__vglvideo.h b/devel/sdl12/files/patch-src_video_vgl_SDL__vglvideo.h
index 640ae17dc942..c6b440f85188 100644
--- a/devel/sdl12/files/patch-src_video_vgl_SDL__vglvideo.h
+++ b/devel/sdl12/files/patch-src_video_vgl_SDL__vglvideo.h
@@ -1,9 +1,9 @@
$FreeBSD$
---- /dev/null Mon Jan 22 20:53:10 2001
-+++ src/video/vgl/SDL_vglvideo.h Mon Jan 22 18:16:51 2001
-@@ -0,0 +1,50 @@
+--- src/video/vgl/SDL_vglvideo.h.orig Sat Jan 27 17:25:12 2001
++++ src/video/vgl/SDL_vglvideo.h Sat Jan 27 17:30:56 2001
+@@ -0,0 +1,69 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997, 1998, 1999, 2000 Sam Lantinga
@@ -34,6 +34,10 @@ $FreeBSD$
+#ifndef _SDL_vglvideo_h
+#define _SDL_vglvideo_h
+
++#include <sys/fbio.h>
++#include <sys/consio.h>
++#include <vgl.h>
++
+#include "SDL_mouse.h"
+#include "SDL_mutex.h"
+#include "SDL_sysvideo.h"
@@ -41,16 +45,31 @@ $FreeBSD$
+/* Hidden "this" pointer for the video functions */
+#define _THIS SDL_VideoDevice *this
+
++typedef struct {
++ int ModeId;
++ int Depth;
++ int Rmask;
++ int Gmask;
++ int Bmask;
++ VGLBitmap ModeInfo;
++} VGLMode;
++
+/* Private display data */
+struct SDL_PrivateVideoData {
+#define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */
+ int SDL_nummodes[NUM_MODELISTS];
+ SDL_Rect **SDL_modelist[NUM_MODELISTS];
+ SDL_mutex *hw_lock;
++ VGLMode *VGLCurMode;
++ int flip_page;
++ byte *flip_address[2];
+};
+/* Old variable names */
-+#define SDL_nummodes (this->hidden->SDL_nummodes)
-+#define SDL_modelist (this->hidden->SDL_modelist)
-+#define hw_lock (this->hidden->hw_lock)
++#define SDL_nummodes (this->hidden->SDL_nummodes)
++#define SDL_modelist (this->hidden->SDL_modelist)
++#define hw_lock (this->hidden->hw_lock)
++#define VGLCurMode (this->hidden->VGLCurMode)
++#define flip_page (this->hidden->flip_page)
++#define flip_address (this->hidden->flip_address)
+
+#endif /* _SDL_vglvideo_h */
diff --git a/devel/sdl12/files/patch-src_video_x11_SDL__x11events.c b/devel/sdl12/files/patch-src_video_x11_SDL__x11events.c
new file mode 100644
index 000000000000..0951242378f6
--- /dev/null
+++ b/devel/sdl12/files/patch-src_video_x11_SDL__x11events.c
@@ -0,0 +1,15 @@
+
+$FreeBSD$
+
+--- src/video/x11/SDL_x11events.c 2001/01/27 17:49:30 1.1
++++ src/video/x11/SDL_x11events.c 2001/01/27 17:49:54
+@@ -35,7 +35,9 @@
+ #ifdef __SVR4
+ #include <X11/Sunkeysym.h>
+ #endif
++#include <sys/types.h>
+ #include <sys/time.h>
++#include <unistd.h>
+
+ #include "SDL.h"
+ #include "SDL_syswm.h"