Commit 3ef9fa99 authored by Sam Lantinga's avatar Sam Lantinga

OpenPandora support added by David Carré

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403616
parent 1decfd1a
...@@ -44,10 +44,12 @@ Thanks to everyone who made this possible, including: ...@@ -44,10 +44,12 @@ Thanks to everyone who made this possible, including:
* Eric Wing, Max Horn, and Darrell Walisser for unflagging work on the Mac OS X port * Eric Wing, Max Horn, and Darrell Walisser for unflagging work on the Mac OS X port
* Couriersud for the DirectFB driver * David Carré, for the Pandora port
* Patrice Mandin, for the Atari port * Patrice Mandin, for the Atari port
* Couriersud for the DirectFB driver
* Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation * Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation
* Arne Claus, for the 2004 winning SDL logo, * Arne Claus, for the 2004 winning SDL logo,
......
# Makefile to build the pandora SDL library
AR = arm-none-linux-gnueabi-ar
RANLIB = arm-none-linux-gnueabi-ranlib
CC = arm-none-linux-gnueabi-gcc
CXX = arm-none-linux-gnueabi-g++
STRIP = arm-none-linux-gnueabi-strip
CFLAGS = -O3 -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp \
-mfpu=neon -ftree-vectorize -ffast-math -fomit-frame-pointer -fno-strict-aliasing -fsingle-precision-constant \
-I./include -I$(PNDSDK)/usr/include
TARGET = libSDL.a
SOURCES = ./src/*.c ./src/audio/*.c ./src/cdrom/*.c ./src/cpuinfo/*.c ./src/events/*.c \
./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \
./src/joystick/*.c ./src/haptic/*.c ./src/video/dummy/*.c ./src/audio/disk/*.c \
./src/audio/dummy/*.c ./src/loadso/dlopen/*.c ./src/audio/dsp/*.c ./src/audio/dma/*.c \
./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c \
./src/thread/pthread/SDL_sysmutex.c ./src/thread/pthread/SDL_syscond.c \
./src/joystick/linux/*.c ./src/haptic/linux/*.c ./src/timer/unix/*.c ./src/cdrom/dummy/*.c \
./src/video/pandora/SDL_pandora.o ./src/video/pandora/SDL_pandora_events.o ./src/video/x11/*.c
OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')
all: $(TARGET)
$(TARGET): $(CONFIG_H) $(OBJECTS)
$(AR) crv $@ $^
$(RANLIB) $@
$(CONFIG_H):
cp include/SDL_config_pandora.h include/SDL_config.h
clean:
rm -f $(TARGET) $(OBJECTS)
SDL 1.3 with open pandora console support ( http://openpandora.org/ )
=====================================================================
- A pandora specific video driver was writed to allow SDL 1.3 with OpenGL ES
support to work on the pandora under the framebuffer. This driver do not have
input support for now, so if you use it you will have to add your own control code.
The video driver name is "pandora" so if you have problem running it from
the framebuffer, try to set the following variable before starting your application :
"export SDL_VIDEODRIVER=pandora"
- OpenGL ES support was added to the x11 driver, so it's working like the normal
x11 driver one with OpenGLX support, with SDL input event's etc..
David Carré (Cpasjuste)
cpasjuste@gmail.com
...@@ -42,6 +42,14 @@ glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height) ...@@ -42,6 +42,14 @@ glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
#endif /* __QNXNTO__ */ #endif /* __QNXNTO__ */
#if SDL_VIDEO_DRIVER_PANDORA
GL_API void GL_APIENTRY
glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
{
return;
}
#endif /* SDL_VIDEO_DRIVER_PANDORA */
/* OpenGL ES 1.1 renderer implementation, based on the OpenGL renderer */ /* OpenGL ES 1.1 renderer implementation, based on the OpenGL renderer */
static const float inv255f = 1.0f / 255.0f; static const float inv255f = 1.0f / 255.0f;
...@@ -284,7 +292,10 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -284,7 +292,10 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER; renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER;
} }
} }
#if SDL_VIDEO_DRIVER_PANDORA
data->GL_OES_draw_texture_supported = SDL_FALSE;
data->useDrawTexture = SDL_FALSE;
#else
if (SDL_GL_ExtensionSupported("GL_OES_draw_texture")) { if (SDL_GL_ExtensionSupported("GL_OES_draw_texture")) {
data->GL_OES_draw_texture_supported = SDL_TRUE; data->GL_OES_draw_texture_supported = SDL_TRUE;
data->useDrawTexture = SDL_TRUE; data->useDrawTexture = SDL_TRUE;
...@@ -292,6 +303,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -292,6 +303,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
data->GL_OES_draw_texture_supported = SDL_FALSE; data->GL_OES_draw_texture_supported = SDL_FALSE;
data->useDrawTexture = SDL_FALSE; data->useDrawTexture = SDL_FALSE;
} }
#endif
data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value); data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
renderer->info.max_texture_width = value; renderer->info.max_texture_width = value;
......
...@@ -318,6 +318,10 @@ struct SDL_VideoDevice ...@@ -318,6 +318,10 @@ struct SDL_VideoDevice
void *driverdata; void *driverdata;
struct SDL_GLDriverData *gl_data; struct SDL_GLDriverData *gl_data;
#if SDL_VIDEO_DRIVER_PANDORA
struct SDL_PrivateGLESData *gles_data;
#endif
/* * * */ /* * * */
/* The function used to dispose of this structure */ /* The function used to dispose of this structure */
void (*free) (_THIS); void (*free) (_THIS);
...@@ -403,6 +407,9 @@ extern VideoBootStrap DUMMY_bootstrap; ...@@ -403,6 +407,9 @@ extern VideoBootStrap DUMMY_bootstrap;
#if SDL_VIDEO_DRIVER_NDS #if SDL_VIDEO_DRIVER_NDS
extern VideoBootStrap NDS_bootstrap; extern VideoBootStrap NDS_bootstrap;
#endif #endif
#if SDL_VIDEO_DRIVER_PANDORA
extern VideoBootStrap PND_bootstrap;
#endif
#define SDL_CurrentDisplay (_this->displays[_this->current_display]) #define SDL_CurrentDisplay (_this->displays[_this->current_display])
......
...@@ -120,6 +120,9 @@ static VideoBootStrap *bootstrap[] = { ...@@ -120,6 +120,9 @@ static VideoBootStrap *bootstrap[] = {
#endif #endif
#if SDL_VIDEO_DRIVER_DUMMY #if SDL_VIDEO_DRIVER_DUMMY
&DUMMY_bootstrap, &DUMMY_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_PANDORA
&PND_bootstrap,
#endif #endif
NULL NULL
}; };
......
This diff is collapsed.
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
Open Pandora SDL driver
Copyright (C) 2009 David Carré
(cpasjuste@gmail.com)
*/
#ifndef __SDL_PANDORA_H__
#define __SDL_PANDORA_H__
#include <GLES/egl.h>
#include "SDL_config.h"
#include "../SDL_sysvideo.h"
typedef struct SDL_VideoData
{
SDL_bool egl_initialized; /* OpenGL ES device initialization status */
EGLDisplay egl_display; /* OpenGL ES display connection */
uint32_t egl_refcount; /* OpenGL ES reference count */
uint32_t swapinterval; /* OpenGL ES default swap interval */
} SDL_VideoData;
typedef struct SDL_DisplayData
{
} SDL_DisplayData;
typedef struct SDL_WindowData
{
SDL_bool uses_gles; /* if true window must support OpenGL ES */
EGLConfig gles_configs[32];
EGLint gles_config; /* OpenGL ES configuration index */
EGLContext gles_context; /* OpenGL ES context */
EGLint gles_attributes[256]; /* OpenGL ES attributes for context */
EGLSurface gles_surface; /* OpenGL ES target rendering surface */
} SDL_WindowData;
/****************************************************************************/
/* SDL_VideoDevice functions declaration */
/****************************************************************************/
/* Display and window functions */
int PND_videoinit(_THIS);
void PND_videoquit(_THIS);
void PND_getdisplaymodes(_THIS);
int PND_setdisplaymode(_THIS, SDL_DisplayMode * mode);
int PND_setdisplaypalette(_THIS, SDL_Palette * palette);
int PND_getdisplaypalette(_THIS, SDL_Palette * palette);
int PND_setdisplaygammaramp(_THIS, Uint16 * ramp);
int PND_getdisplaygammaramp(_THIS, Uint16 * ramp);
int PND_createwindow(_THIS, SDL_Window * window);
int PND_createwindowfrom(_THIS, SDL_Window * window, const void *data);
void PND_setwindowtitle(_THIS, SDL_Window * window);
void PND_setwindowicon(_THIS, SDL_Window * window, SDL_Surface * icon);
void PND_setwindowposition(_THIS, SDL_Window * window);
void PND_setwindowsize(_THIS, SDL_Window * window);
void PND_showwindow(_THIS, SDL_Window * window);
void PND_hidewindow(_THIS, SDL_Window * window);
void PND_raisewindow(_THIS, SDL_Window * window);
void PND_maximizewindow(_THIS, SDL_Window * window);
void PND_minimizewindow(_THIS, SDL_Window * window);
void PND_restorewindow(_THIS, SDL_Window * window);
void PND_setwindowgrab(_THIS, SDL_Window * window);
void PND_destroywindow(_THIS, SDL_Window * window);
/* Window manager function */
SDL_bool PND_getwindowwminfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo *info);
/* OpenGL/OpenGL ES functions */
int PND_gl_loadlibrary(_THIS, const char *path);
void *PND_gl_getprocaddres(_THIS, const char *proc);
void PND_gl_unloadlibrary(_THIS);
SDL_GLContext PND_gl_createcontext(_THIS, SDL_Window * window);
int PND_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context);
int PND_gl_setswapinterval(_THIS, int interval);
int PND_gl_getswapinterval(_THIS);
void PND_gl_swapwindow(_THIS, SDL_Window * window);
void PND_gl_deletecontext(_THIS, SDL_GLContext context);
#endif /* __SDL_PANDORA_H__ */
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
/* Being a null driver, there's no event stream. We just define stubs for
most of the API. */
#include "../../events/SDL_sysevents.h"
#include "../../events/SDL_events_c.h"
void
PND_PumpEvents(_THIS)
{
/* Not implemented. */
}
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
extern void PND_PumpEvents(_THIS);
/* vi: set ts=4 sw=4 expandtab: */
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
#include "SDL_x11gamma.h" #include "SDL_x11gamma.h"
#include "../Xext/extensions/StdCmap.h" #include "../Xext/extensions/StdCmap.h"
#ifdef SDL_VIDEO_DRIVER_PANDORA
#include "SDL_x11opengles.h"
#endif
#define _NET_WM_STATE_REMOVE 0l #define _NET_WM_STATE_REMOVE 0l
#define _NET_WM_STATE_ADD 1l #define _NET_WM_STATE_ADD 1l
#define _NET_WM_STATE_TOGGLE 2l #define _NET_WM_STATE_TOGGLE 2l
...@@ -240,6 +244,19 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -240,6 +244,19 @@ X11_CreateWindow(_THIS, SDL_Window * window)
depth = vinfo->depth; depth = vinfo->depth;
XFree(vinfo); XFree(vinfo);
} else } else
#endif
#ifdef SDL_VIDEO_DRIVER_PANDORA
if (window->flags & SDL_WINDOW_OPENGL) {
XVisualInfo *vinfo;
vinfo = X11_GLES_GetVisual(_this, data->display, displaydata->screen);
if (!vinfo) {
return -1;
}
visual = vinfo->visual;
depth = vinfo->depth;
XFree(vinfo);
} else
#endif #endif
{ {
visual = displaydata->visual; visual = displaydata->visual;
...@@ -505,6 +522,19 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -505,6 +522,19 @@ X11_CreateWindow(_THIS, SDL_Window * window)
SDL_SetError("Couldn't create window"); SDL_SetError("Couldn't create window");
return -1; return -1;
} }
#if SDL_VIDEO_DRIVER_PANDORA
/* Create the GLES window surface */
_this->gles_data->egl_surface =
_this->gles_data->eglCreateWindowSurface(_this->gles_data->
egl_display,
_this->gles_data->egl_config,
(NativeWindowType) w, NULL);
if (_this->gles_data->egl_surface == EGL_NO_SURFACE) {
SDL_SetError("Could not create GLES window surface");
return -1;
}
#endif
sizehints = XAllocSizeHints(); sizehints = XAllocSizeHints();
if (sizehints) { if (sizehints) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment