Commit 8a68fef7 authored by Sam Lantinga's avatar Sam Lantinga

Patch from David Carre:

I fixed a bug in the "SDL_DestroyRenderer()" function in the pandora x11 renderer (in fact the bug was in the "X11_GLES_MakeCurrent()" function) that was causing a crash when exiting SDL.

There was a problem while terminating the x11 egl window, that was preventing to quit/close SDL/SDL-window then reload SDL/SDL-window inside the same application.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403715
parent 01700524
...@@ -8,7 +8,7 @@ STRIP = arm-none-linux-gnueabi-strip ...@@ -8,7 +8,7 @@ STRIP = arm-none-linux-gnueabi-strip
CFLAGS = -O3 -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp \ 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 \ -mfpu=neon -ftree-vectorize -ffast-math -fomit-frame-pointer -fno-strict-aliasing -fsingle-precision-constant \
-I./include -I$(PNDSDK)/usr/include -I./include -I$(PNDSDK)/usr/include -DSDL_REVISION=0
TARGET = libSDL.a TARGET = libSDL.a
...@@ -24,14 +24,13 @@ SOURCES = ./src/*.c ./src/audio/*.c ./src/cdrom/*.c ./src/cpuinfo/*.c ./src/even ...@@ -24,14 +24,13 @@ SOURCES = ./src/*.c ./src/audio/*.c ./src/cdrom/*.c ./src/cpuinfo/*.c ./src/even
OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')
CONFIG_H = $(shell cp include/SDL_config_pandora.h include/SDL_config.h && touch include/SDL_revision.h)
all: $(TARGET) all: $(TARGET)
$(TARGET): $(CONFIG_H) $(OBJECTS) $(TARGET): $(CONFIG_H) $(OBJECTS)
$(AR) crv $@ $^ $(AR) crv $@ $^
$(RANLIB) $@ $(RANLIB) $@
$(CONFIG_H):
cp include/SDL_config_pandora.h include/SDL_config.h
clean: clean:
rm -f $(TARGET) $(OBJECTS) rm -f $(TARGET) $(OBJECTS)
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <limits.h> /* INT_MAX */ #include <limits.h> /* INT_MAX */
#include <errno.h> /* errno, strerror */ #include <errno.h> /* errno, strerror */
#include <math.h> /* atan2 */ #include <math.h> /* atan2 */
#include <sys/stat.h> /* stat */
/* Just in case. */ /* Just in case. */
#ifndef M_PI #ifndef M_PI
......
...@@ -298,8 +298,8 @@ X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) ...@@ -298,8 +298,8 @@ X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
{ {
int retval; int retval;
SDL_WindowData *data = (SDL_WindowData *) window->driverdata; // SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
Display *display = data->videodata->display; // Display *display = data->videodata->display;
retval = 1; retval = 1;
if (!_this->gles_data->eglMakeCurrent(_this->gles_data->egl_display, if (!_this->gles_data->eglMakeCurrent(_this->gles_data->egl_display,
...@@ -309,7 +309,7 @@ X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) ...@@ -309,7 +309,7 @@ X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
SDL_SetError("Unable to make EGL context current"); SDL_SetError("Unable to make EGL context current");
retval = -1; retval = -1;
} }
XSync(display, False); // XSync(display, False);
return (retval); return (retval);
} }
...@@ -359,6 +359,10 @@ X11_GLES_DeleteContext(_THIS, SDL_GLContext context) ...@@ -359,6 +359,10 @@ X11_GLES_DeleteContext(_THIS, SDL_GLContext context)
} }
} }
_this->gles_data->egl_active = 0; _this->gles_data->egl_active = 0;
/* crappy fix */
X11_GLES_UnloadLibrary(_this);
} }
#endif /* SDL_VIDEO_OPENGL_ES */ #endif /* SDL_VIDEO_OPENGL_ES */
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#include "SDL_x11video.h" #include "SDL_x11video.h"
#if SDL_VIDEO_DRIVER_PANDORA
#include "SDL_x11opengles.h"
#endif
/* Initialization/Query functions */ /* Initialization/Query functions */
static int X11_VideoInit(_THIS); static int X11_VideoInit(_THIS);
...@@ -101,6 +104,9 @@ X11_DeleteDevice(SDL_VideoDevice * device) ...@@ -101,6 +104,9 @@ X11_DeleteDevice(SDL_VideoDevice * device)
} }
SDL_free(data->windowlist); SDL_free(data->windowlist);
SDL_free(device->driverdata); SDL_free(device->driverdata);
#if SDL_VIDEO_DRIVER_PANDORA
SDL_free(device->gles_data);
#endif
SDL_free(device); SDL_free(device);
SDL_X11_UnloadSymbols(); SDL_X11_UnloadSymbols();
...@@ -131,6 +137,14 @@ X11_CreateDevice(int devindex) ...@@ -131,6 +137,14 @@ X11_CreateDevice(int devindex)
} }
device->driverdata = data; device->driverdata = data;
#if SDL_VIDEO_DRIVER_PANDORA
device->gles_data = (struct SDL_PrivateGLESData *) SDL_calloc(1, sizeof(SDL_PrivateGLESData));
if (!device->gles_data) {
SDL_OutOfMemory();
return NULL;
}
#endif
/* FIXME: Do we need this? /* FIXME: Do we need this?
if ( (SDL_strncmp(XDisplayName(display), ":", 1) == 0) || if ( (SDL_strncmp(XDisplayName(display), ":", 1) == 0) ||
(SDL_strncmp(XDisplayName(display), "unix:", 5) == 0) ) { (SDL_strncmp(XDisplayName(display), "unix:", 5) == 0) ) {
...@@ -198,6 +212,17 @@ X11_CreateDevice(int devindex) ...@@ -198,6 +212,17 @@ X11_CreateDevice(int devindex)
device->GL_SwapWindow = X11_GL_SwapWindow; device->GL_SwapWindow = X11_GL_SwapWindow;
device->GL_DeleteContext = X11_GL_DeleteContext; device->GL_DeleteContext = X11_GL_DeleteContext;
#endif #endif
#if SDL_VIDEO_DRIVER_PANDORA
device->GL_LoadLibrary = X11_GLES_LoadLibrary;
device->GL_GetProcAddress = X11_GLES_GetProcAddress;
device->GL_UnloadLibrary = X11_GLES_UnloadLibrary;
device->GL_CreateContext = X11_GLES_CreateContext;
device->GL_MakeCurrent = X11_GLES_MakeCurrent;
device->GL_SetSwapInterval = X11_GLES_SetSwapInterval;
device->GL_GetSwapInterval = X11_GLES_GetSwapInterval;
device->GL_SwapWindow = X11_GLES_SwapWindow;
device->GL_DeleteContext = X11_GLES_DeleteContext;
#endif
device->free = X11_DeleteDevice; device->free = X11_DeleteDevice;
......
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