Scott to slouken
authorSam Lantinga <slouken@libsdl.org>
Tue, 17 Nov 2009 04:53:15 +0000
changeset 3438ca5663493497
parent 3437 dc2911c207e4
child 3439 0acec8c9f5c9
Scott to slouken

Heres the wiz patch and additional files. (I think I got everything)
Makefile.wiz
include/SDL_config_wiz.h
src/video/pandora/SDL_pandora.c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile.wiz	Tue Nov 17 04:53:15 2009 +0000
     1.3 @@ -0,0 +1,61 @@
     1.4 +# Makefile to build the pandora SDL library
     1.5 +WIZSDK = /mythtv/media/devel/toolchains/openwiz/arm-openwiz-linux-gnu
     1.6 +
     1.7 +AR	= $(WIZSDK)/bin/arm-openwiz-linux-gnu-ar
     1.8 +RANLIB	= $(WIZSDK)/bin/arm-openwiz-linux-gnu-ranlib
     1.9 +CC = $(WIZSDK)/bin/arm-openwiz-linux-gnu-gcc
    1.10 +CXX = $(WIZSDK)/bin/arm-openwiz-linux-gnu-g++
    1.11 +STRIP = $(WIZSDK)/bin/arm-openwiz-linux-gnu-strip
    1.12 +
    1.13 +CFLAGS  = -Wall -fPIC -I./include -I$(WIZSDK)/include -DWIZ_GLES_LITE
    1.14 +
    1.15 +TARGET_STATIC  = libSDL13.a
    1.16 +TARGET_SHARED  = libSDL13.so
    1.17 +
    1.18 +SOURCES = ./src/*.c ./src/audio/*.c ./src/cdrom/*.c ./src/cpuinfo/*.c ./src/events/*.c \
    1.19 +	./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \
    1.20 +	./src/joystick/*.c ./src/haptic/*.c ./src/video/dummy/*.c ./src/audio/disk/*.c \
    1.21 +	./src/audio/dummy/*.c ./src/loadso/dlopen/*.c ./src/audio/dsp/*.c ./src/audio/dma/*.c \
    1.22 +	./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c \
    1.23 +	./src/thread/pthread/SDL_sysmutex.c ./src/thread/pthread/SDL_syscond.c \
    1.24 +	./src/joystick/linux/*.c ./src/haptic/linux/*.c ./src/timer/unix/*.c ./src/cdrom/dummy/*.c \
    1.25 +	./src/video/pandora/SDL_pandora.o ./src/video/pandora/SDL_pandora_events.o
    1.26 +	
    1.27 +
    1.28 +OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')
    1.29 +
    1.30 +all: config_copy $(TARGET_STATIC) $(TARGET_SHARED)
    1.31 +
    1.32 +$(TARGET_STATIC): $(OBJECTS)
    1.33 +	$(AR) crv $@ $^
    1.34 +	$(RANLIB) $@
    1.35 +
    1.36 +$(TARGET_SHARED):
    1.37 +	$(CC) -shared -Wl,-soname,$(TARGET_SHARED).0 -o $(TARGET_SHARED).0.0.1  $(OBJECTS)
    1.38 +	ln -s $(TARGET_SHARED).0.0.1 $(TARGET_SHARED).0
    1.39 +	ln -s $(TARGET_SHARED).0 $(TARGET_SHARED)
    1.40 +
    1.41 +config_copy:
    1.42 +	cp include/SDL_config_wiz.h include/SDL_config.h
    1.43 +
    1.44 +clean:
    1.45 +	rm -f $(TARGET_STATIC) $(TARGET_SHARED)* $(OBJECTS)
    1.46 +
    1.47 +install:
    1.48 +	mkdir -p $(WIZSDK)/lib
    1.49 +	mkdir -p $(WIZSDK)/include/SDL13
    1.50 +	cp -f $(TARGET_STATIC) $(WIZSDK)/lib
    1.51 +	cp -f $(TARGET_SHARED).0.0.1 $(WIZSDK)/lib
    1.52 +	rm -f $(WIZSDK)/lib/$(TARGET_SHARED).0 $(WIZSDK)/lib/$(TARGET_SHARED)
    1.53 +	ln -s $(WIZSDK)/lib/$(TARGET_SHARED).0.0.1 $(WIZSDK)/lib/$(TARGET_SHARED).0
    1.54 +	ln -s $(WIZSDK)/lib/$(TARGET_SHARED).0 $(WIZSDK)/lib/$(TARGET_SHARED)
    1.55 +
    1.56 +	cp $(TARGET_STATIC) ../../toolchain/libs
    1.57 +	cp $(TARGET_SHARED).0.0.1 ../../toolchain/libs
    1.58 +	rm -f ../../toolchain/libs/$(TARGET_SHARED).0 ../../toolchain/libs/$(TARGET_SHARED)
    1.59 +	ln -s ../../toolchain/libs/$(TARGET_SHARED).0.0.1 ../../toolchain/libs/$(TARGET_SHARED).0
    1.60 +	ln -s ../../toolchain/libs/$(TARGET_SHARED).0 ../../toolchain/libs/$(TARGET_SHARED)
    1.61 +
    1.62 +	cp $(TARGET_SHARED).0.0.1 ../nehe_demos/build/$(TARGET_SHARED).0
    1.63 +	cp -f include/*.h $(WIZSDK)/include/SDL13/
    1.64 +	cp -f include/*.h ../../toolchain/include/SDL13/
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/include/SDL_config_wiz.h	Tue Nov 17 04:53:15 2009 +0000
     2.3 @@ -0,0 +1,125 @@
     2.4 +/*
     2.5 +    SDL - Simple DirectMedia Layer
     2.6 +    Copyright (C) 1997-2009 Sam Lantinga
     2.7 +
     2.8 +    This library is free software; you can redistribute it and/or
     2.9 +    modify it under the terms of the GNU Lesser General Public
    2.10 +    License as published by the Free Software Foundation; either
    2.11 +    version 2.1 of the License, or (at your option) any later version.
    2.12 +
    2.13 +    This library is distributed in the hope that it will be useful,
    2.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    2.16 +    Lesser General Public License for more details.
    2.17 +
    2.18 +    You should have received a copy of the GNU Lesser General Public
    2.19 +    License along with this library; if not, write to the Free Software
    2.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    2.21 +
    2.22 +    Sam Lantinga
    2.23 +    slouken@libsdl.org
    2.24 +*/
    2.25 +
    2.26 +#ifndef _SDL_config_h
    2.27 +#define _SDL_config_h
    2.28 +
    2.29 +/* This is a set of defines to configure the SDL features */
    2.30 +
    2.31 +/* General platform specific identifiers */
    2.32 +#include "SDL_platform.h"
    2.33 +
    2.34 +/* Make sure that this isn't included by Visual C++ */
    2.35 +#ifdef _MSC_VER
    2.36 +#error You should copy include/SDL_config.h.default to include/SDL_config.h
    2.37 +#endif
    2.38 +
    2.39 +#define SDL_HAS_64BIT_TYPE 1
    2.40 +#define SDL_BYTEORDER 1234
    2.41 +
    2.42 +#define HAVE_ALLOCA_H 1
    2.43 +#define HAVE_SYS_TYPES_H 1
    2.44 +#define HAVE_STDIO_H 1
    2.45 +#define STDC_HEADERS 1
    2.46 +#define HAVE_STDLIB_H 1
    2.47 +#define HAVE_STDARG_H 1
    2.48 +#define HAVE_MALLOC_H 1
    2.49 +#define HAVE_MEMORY_H 1
    2.50 +#define HAVE_STRING_H 1
    2.51 +#define HAVE_STRINGS_H 1
    2.52 +#define HAVE_INTTYPES_H 1
    2.53 +#define HAVE_STDINT_H 1
    2.54 +#define HAVE_CTYPE_H 1
    2.55 +#define HAVE_MATH_H 1
    2.56 +#define HAVE_ICONV_H 1
    2.57 +#define HAVE_SIGNAL_H 1
    2.58 +#define HAVE_MALLOC 1
    2.59 +#define HAVE_CALLOC 1
    2.60 +#define HAVE_REALLOC 1
    2.61 +#define HAVE_FREE 1
    2.62 +#define HAVE_ALLOCA 1
    2.63 +#define HAVE_GETENV 1
    2.64 +#define HAVE_PUTENV 1
    2.65 +#define HAVE_UNSETENV 1
    2.66 +#define HAVE_QSORT 1
    2.67 +#define HAVE_ABS 1
    2.68 +#define HAVE_BCOPY 1
    2.69 +#define HAVE_MEMSET 1
    2.70 +#define HAVE_MEMCPY 1
    2.71 +#define HAVE_MEMMOVE 1
    2.72 +#define HAVE_STRLEN 1
    2.73 +#define HAVE_STRDUP 1
    2.74 +#define HAVE_STRCHR 1
    2.75 +#define HAVE_STRRCHR 1
    2.76 +#define HAVE_STRSTR 1
    2.77 +#define HAVE_STRTOL 1
    2.78 +#define HAVE_STRTOUL 1
    2.79 +#define HAVE_STRTOLL 1
    2.80 +#define HAVE_STRTOULL 1
    2.81 +#define HAVE_ATOI 1
    2.82 +#define HAVE_ATOF 1
    2.83 +#define HAVE_STRCMP 1
    2.84 +#define HAVE_STRNCMP 1
    2.85 +#define HAVE_STRCASECMP 1
    2.86 +#define HAVE_STRNCASECMP 1
    2.87 +#define HAVE_SSCANF 1
    2.88 +#define HAVE_SNPRINTF 1
    2.89 +#define HAVE_VSNPRINTF 1
    2.90 +#define HAVE_M_PI 1
    2.91 +#define HAVE_CEIL 1
    2.92 +#define HAVE_COPYSIGN 1
    2.93 +#define HAVE_COS 1
    2.94 +#define HAVE_COSF 1
    2.95 +#define HAVE_FABS 1
    2.96 +#define HAVE_FLOOR 1
    2.97 +#define HAVE_LOG 1
    2.98 +#define HAVE_SCALBN 1
    2.99 +#define HAVE_SIN 1
   2.100 +#define HAVE_SINF 1
   2.101 +#define HAVE_SQRT 1
   2.102 +#define HAVE_SIGACTION 1
   2.103 +#define HAVE_SETJMP 1
   2.104 +#define HAVE_NANOSLEEP 1
   2.105 +#define HAVE_POW 1
   2.106 +
   2.107 +#define SDL_CDROM_DISABLED 1
   2.108 +#define SDL_AUDIO_DRIVER_DUMMY 1
   2.109 +#define SDL_AUDIO_DRIVER_OSS 1
   2.110 +
   2.111 +#define SDL_INPUT_LINUXEV 1
   2.112 +#define SDL_INPUT_TSLIB 1
   2.113 +#define SDL_JOYSTICK_LINUX 1
   2.114 +#define SDL_HAPTIC_LINUX 1
   2.115 +
   2.116 +#define SDL_LOADSO_DLOPEN 1
   2.117 +
   2.118 +#define SDL_THREAD_PTHREAD 1
   2.119 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
   2.120 +
   2.121 +#define SDL_TIMER_UNIX 1
   2.122 +
   2.123 +#define SDL_VIDEO_DRIVER_DUMMY 1
   2.124 +#define SDL_VIDEO_DRIVER_PANDORA 1
   2.125 +#define SDL_VIDEO_RENDER_OGL_ES 1
   2.126 +#define SDL_VIDEO_OPENGL_ES 1
   2.127 +
   2.128 +#endif /* _SDL_config_h */
     3.1 --- a/src/video/pandora/SDL_pandora.c	Mon Nov 16 09:47:34 2009 +0000
     3.2 +++ b/src/video/pandora/SDL_pandora.c	Tue Nov 17 04:53:15 2009 +0000
     3.3 @@ -38,6 +38,12 @@
     3.4  #include "SDL_pandora.h"
     3.5  #include "SDL_pandora_events.h"
     3.6  
     3.7 +/* WIZ declarations */
     3.8 +#include "GLES/gl.h"
     3.9 +#ifdef WIZ_GLES_LITE
    3.10 +static NativeWindowType hNativeWnd = 0; // A handle to the window we will create.
    3.11 +#endif
    3.12 +
    3.13  static SDL_bool PND_initialized = SDL_FALSE;
    3.14  
    3.15  static int
    3.16 @@ -136,8 +142,13 @@
    3.17  }
    3.18  
    3.19  VideoBootStrap PND_bootstrap = {
    3.20 +#ifdef WIZ_GLES_LITE
    3.21 +    "wiz",
    3.22 +    "SDL Wiz Video Driver",
    3.23 +#else
    3.24      "pandora",
    3.25      "SDL Pandora Video Driver",
    3.26 +#endif
    3.27      PND_available,
    3.28      PND_create
    3.29  };
    3.30 @@ -152,8 +163,13 @@
    3.31      SDL_DisplayMode current_mode;
    3.32  
    3.33      SDL_zero(current_mode);
    3.34 +#ifdef WIZ_GLES_LITE
    3.35 +    current_mode.w = 320;
    3.36 +    current_mode.h = 240;
    3.37 +#else
    3.38      current_mode.w = 800;
    3.39      current_mode.h = 480;
    3.40 +#endif
    3.41      current_mode.refresh_rate = 60;
    3.42      current_mode.format = SDL_PIXELFORMAT_RGB565;
    3.43      current_mode.driverdata = NULL;
    3.44 @@ -371,7 +387,11 @@
    3.45      if (path == NULL) {
    3.46          /* Already linked with GF library which provides egl* subset of  */
    3.47          /* functions, use Common profile of OpenGL ES library by default */
    3.48 +#ifdef WIZ_GLES_LITE
    3.49 +	path = "/lib/libopengles_lite.so";
    3.50 +#else
    3.51          path = "/usr/lib/libGLES_CM.so";
    3.52 +#endif
    3.53      }
    3.54  
    3.55      /* Load dynamic library */
    3.56 @@ -652,10 +672,31 @@
    3.57          return NULL;
    3.58      }
    3.59  
    3.60 +#ifdef WIZ_GLES_LITE
    3.61 +    if( !hNativeWnd ) {
    3.62 +	hNativeWnd = (NativeWindowType)malloc(16*1024);
    3.63 +
    3.64 +	if(!hNativeWnd)
    3.65 +	    printf( "Error : Wiz framebuffer allocatation failed\n" ); 
    3.66 +	else
    3.67 +	    printf( "SDL13: Wiz framebuffer allocated: %X\n", hNativeWnd );
    3.68 +    }
    3.69 +    else {
    3.70 +	printf( "SDL13: Wiz framebuffer already allocated: %X\n", hNativeWnd );
    3.71 +    }
    3.72 +
    3.73 +    wdata->gles_surface =
    3.74 +	eglCreateWindowSurface(phdata->egl_display, 
    3.75 +			       wdata->gles_configs[wdata->gles_config],
    3.76 +			       hNativeWnd, NULL );
    3.77 +#else
    3.78      wdata->gles_surface =
    3.79          eglCreateWindowSurface(phdata->egl_display,
    3.80                                 wdata->gles_configs[wdata->gles_config],
    3.81                                 (NativeWindowType) 0, NULL);
    3.82 +#endif
    3.83 +
    3.84 +
    3.85      if (wdata->gles_surface == 0) {
    3.86          SDL_SetError("Error : eglCreateWindowSurface failed;\n");
    3.87          return NULL;
    3.88 @@ -856,6 +897,15 @@
    3.89          }
    3.90      }
    3.91  
    3.92 +#ifdef WIZ_GLES_LITE
    3.93 +    if( hNativeWnd != 0 )
    3.94 +    {
    3.95 +	  free(hNativeWnd);
    3.96 +	  hNativeWnd = 0;
    3.97 +	  printf( "SDL13: Wiz framebuffer released\n" );
    3.98 +    }
    3.99 +#endif
   3.100 +
   3.101      return;
   3.102  }
   3.103