diff -Nru libsdl1.2-1.2.15+dfsg1/configure.in libsdl1.2-1.2.15+dfsg1/configure.in --- libsdl1.2-1.2.15+dfsg1/configure.in 2012-01-18 22:30:05.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/configure.in 2016-09-19 13:42:59.000000000 -0700 @@ -1131,6 +1131,44 @@ fi } +dnl Check for the Mir video driver +CheckMir() +{ + AC_ARG_ENABLE(video-mir, + AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]), + , enable_video_mir=yes) + + if test x$enable_video = xyes -a x$enable_video_mir = xyes; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + + if test x$PKG_CONFIG != xno; then + AC_MSG_CHECKING(for Mir support) + video_mir=no + tmp_CFLAGS="$CFLAGS" + CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`" + + AC_TRY_COMPILE([ + #include + #include + #include + ],[ + ],[ + video_mir=yes + ]) + CFLAGS="$tmp_CFLAGS" + AC_MSG_RESULT($video_mir) + + if test x$video_mir = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_MIR) + SOURCES="$SOURCES $srcdir/src/video/mir/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs egl mirclient xkbcommon`" + have_video=yes + fi + fi + fi +} + dnl Check for QNX photon video driver CheckPHOTON() { @@ -2361,6 +2399,7 @@ CheckPulseAudio CheckNAS CheckX11 + CheckMir CheckNANOX CheckFBCON CheckDirectFB diff -Nru libsdl1.2-1.2.15+dfsg1/debian/control libsdl1.2-1.2.15+dfsg1/debian/control --- libsdl1.2-1.2.15+dfsg1/debian/control 2016-03-17 04:52:56.000000000 -0700 +++ libsdl1.2-1.2.15+dfsg1/debian/control 2016-03-17 05:15:31.000000000 -0700 @@ -20,7 +20,10 @@ libasound2-dev [linux-any], libcaca-dev, libusbhid-dev [kfreebsd-any], - libglu1-mesa-dev + libglu1-mesa-dev, + libxkbcommon-dev, + libegl1-mesa-dev, + libmirclient-dev Vcs-Git: https://anonscm.debian.org/git/pkg-sdl/packages/libsdl1.2.git Vcs-Browser: https://anonscm.debian.org/cgit/pkg-sdl/packages/libsdl1.2.git Homepage: http://www.libsdl.org/ diff -Nru libsdl1.2-1.2.15+dfsg1/include/SDL_config.h.in libsdl1.2-1.2.15+dfsg1/include/SDL_config.h.in --- libsdl1.2-1.2.15+dfsg1/include/SDL_config.h.in 2012-01-18 22:30:05.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/include/SDL_config.h.in 2016-09-19 13:42:59.000000000 -0700 @@ -292,6 +292,7 @@ #undef SDL_VIDEO_DRIVER_X11_XME #undef SDL_VIDEO_DRIVER_X11_XRANDR #undef SDL_VIDEO_DRIVER_X11_XV +#undef SDL_VIDEO_DRIVER_MIR #undef SDL_VIDEO_DRIVER_XBIOS /* Enable OpenGL support */ diff -Nru libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirbuffer.c libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirbuffer.c --- libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirbuffer.c 1969-12-31 16:00:00.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirbuffer.c 2016-09-19 13:42:59.000000000 -0700 @@ -0,0 +1,58 @@ +#include "SDL_mirbuffer.h" +#include "SDL_endian.h" + +static void RedrawRegion(_THIS, const MirGraphicsRegion* region) +{ + Uint32 w, h; + + int d_stride = region->stride; + int s_stride = SDL_VideoSurface->pitch; + + char* dest = region->vaddr; + char* src = (char*)SDL_VideoSurface->pixels; + + int bytes_per_pixel = SDL_VideoSurface->format->BytesPerPixel; + int bytes_per_row = bytes_per_pixel * SDL_VideoSurface->w; + Uint32 alpha_index = (SDL_BYTEORDER == SDL_BIG_ENDIAN) ? 0 : bytes_per_pixel - 1; + + SDL_bool lp_bug_1423462_workaround = false; + + if (bytes_per_pixel == 4 && region->pixel_format == this->hidden->opaque_pixel_format) + lp_bug_1423462_workaround = true; + + for (h = 0; h < SDL_VideoSurface->h; h++) + { + memcpy(dest, src, bytes_per_row); + if (lp_bug_1423462_workaround) + { + for (w = 0; w < SDL_VideoSurface->w; ++w) + { + // FIXME Mir should ignore alpha in x* formats + dest[(w * bytes_per_pixel) + alpha_index] = 0xff; + } + } + + dest += d_stride; + src += s_stride; + } +} + +void Mir_UpdateRects(_THIS, int numrects, SDL_Rect* rects) +{ + if (!mir_surface_is_valid(this->hidden->surface)) + { + const char* error = mir_surface_get_error_message(this->hidden->surface); + fprintf(stderr, "Failed to created a mir surface: %s", error); + return; + } + + MirGraphicsRegion region; + MirBufferStream *bs; + + bs = mir_surface_get_buffer_stream(this->hidden->surface); + mir_buffer_stream_get_graphics_region(bs, ®ion); + + RedrawRegion(this, ®ion); + + mir_buffer_stream_swap_buffers_sync(bs); +} diff -Nru libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirbuffer.h libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirbuffer.h --- libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirbuffer.h 1969-12-31 16:00:00.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirbuffer.h 2016-09-19 13:42:59.000000000 -0700 @@ -0,0 +1,32 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 2013-2016 Canonical Ltd + + 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 + + Brandon Schaefer + brandon.schaefer@canonical.com +*/ + +#include "SDL_config.h" + +#ifndef _SDL_mirbuffer_h +#define _SDL_mirbuffer_h + +#include "SDL_mirvideo.h" + +extern void Mir_UpdateRects(_THIS, int numrects, SDL_Rect* rects); + +#endif // _SDL_mirbuffer_h diff -Nru libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirevents.c libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirevents.c --- libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirevents.c 1969-12-31 16:00:00.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirevents.c 2016-09-19 13:42:59.000000000 -0700 @@ -0,0 +1,266 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 2013-2016 Canonical Ltd + + 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 + + Brandon Schaefer + brandon.schaefer@canonical.com +*/ + +#include "SDL_mirevents.h" + +#include "../../events/SDL_events_c.h" +#include + +#define MIN_KEYCODE 8 + +static SDLKey MISC_keymap[256]; + +static void Mir_InitKeymap() +{ + int i; + + // Taken mostly from SDL_x11events.c, switched to xkbcommon keysym + for ( i=0; i> 8) + { + case(0x00): + key = key_code & 0xFF; + break; + case(0xFF): + key = MISC_keymap[key_code & 0xFF]; + break; + default: + break; + } + + size = xkb_keysym_to_utf8(key_code, text, sizeof text); + + SDL_keysym keysym; + keysym.sym = key; + keysym.scancode = scan_code + MIN_KEYCODE; + keysym.mod = KMOD_NONE; + memcpy(&keysym.unicode, text, size); + + SDL_PrivateKeyboard(key_state, &keysym); +} + +static void Mir_HandleInputEvent(MirSurface* surface, MirInputEvent const* event) +{ + switch (mir_input_event_get_type(event)) + { + case(mir_input_event_type_key): + Mir_HandleKeyEvent(surface, mir_input_event_get_keyboard_event(event)); + break; + case(mir_input_event_type_touch): + break; + case(mir_input_event_type_pointer): + Mir_HandlePointerEvent(surface, mir_input_event_get_pointer_event(event)); + break; + default: + break; + } +} + +void Mir_HandleSurfaceEvent(MirSurface* surface, + MirEvent const* event, void* context) +{ + switch (mir_event_get_type(event)) + { + case(mir_event_type_input): + Mir_HandleInputEvent(surface, mir_event_get_input_event(event)); + break; + default: + break; + } +} diff -Nru libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirevents.h libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirevents.h --- libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirevents.h 1969-12-31 16:00:00.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirevents.h 2016-09-19 13:42:59.000000000 -0700 @@ -0,0 +1,33 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 2013-2016 Canonical Ltd + + 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 + + Brandon Schaefer + brandon.schaefer@canonical.com +*/ +#include "SDL_config.h" + +#ifndef _SDL_mirevents_h +#define _SDL_mirevents_h + +#include "SDL_mirvideo.h" + +extern void Mir_InitOSKeymap(_THIS); +extern void Mir_HandleSurfaceEvent(MirSurface* surface, + MirEvent const* event, void* context); + +#endif // _SDL_mirevents_h diff -Nru libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirgl.c libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirgl.c --- libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirgl.c 1969-12-31 16:00:00.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirgl.c 2016-09-19 13:42:59.000000000 -0700 @@ -0,0 +1,218 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 2013-2016 Canonical Ltd + + 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 + + Brandon Schaefer + brandon.schaefer@canonical.com +*/ + +#include "SDL_mirgl.h" + +int Mir_GL_CreateESurface(_THIS) +{ + if (Mir_GL_LoadLibrary(this, NULL) < 0) + return -1; + + EGLNativeWindowType egl_nwin = (EGLNativeWindowType) + mir_buffer_stream_get_egl_native_window(mir_surface_get_buffer_stream(this->hidden->surface)); + + this->gl_data->esurface = eglCreateWindowSurface(this->gl_data->edpy, + this->gl_data->econf, + egl_nwin, NULL); + + if (this->gl_data->esurface == EGL_NO_SURFACE) + { + SDL_SetError("Error Could not create EGL Surface"); + return -1; + } + + return 0; +} + +int Mir_GL_LoadLibrary(_THIS, const char* path) +{ + if (this->gl_config.dll_handle != NULL) + return 0; + + int major, minor; + EGLint neglconfigs; + + EGLenum renderable_type = EGL_OPENGL_BIT; + EGLenum rendering_api = EGL_OPENGL_API; + + EGLint attribs[] = + { + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_RENDERABLE_TYPE, renderable_type, + EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER, + EGL_BUFFER_SIZE, this->gl_config.buffer_size, + EGL_RED_SIZE, this->gl_config.red_size, + EGL_GREEN_SIZE, this->gl_config.green_size, + EGL_BLUE_SIZE, this->gl_config.blue_size, + EGL_ALPHA_SIZE, this->gl_config.alpha_size, + EGL_DEPTH_SIZE, this->gl_config.depth_size, + EGL_STENCIL_SIZE, this->gl_config.stencil_size, + EGL_NONE, + }; + + this->gl_data->edpy = eglGetDisplay( + mir_connection_get_egl_native_display(this->hidden->connection)); + + if (!eglInitialize(this->gl_data->edpy, &major, &minor)) + { + SDL_SetError("Failed to initialize EGL"); + return -1; + } + + eglBindAPI(rendering_api); + + if (!eglChooseConfig(this->gl_data->edpy, attribs, + &this->gl_data->econf, 1, &neglconfigs)) + { + SDL_SetError("Failed to choose econfig"); + return -1; + } + + if (neglconfigs != 1) + { + SDL_SetError("Failed to choose econfig"); + return -1; + } + + this->gl_config.driver_loaded = 1; + + return 0; +} + +void* Mir_GL_GetProcAddress(_THIS, const char* proc) +{ + return eglGetProcAddress(proc); +} + +int Mir_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) +{ + switch (attrib) + { + case SDL_GL_DOUBLEBUFFER: + *value=this->gl_config.double_buffer; + break; + case SDL_GL_STENCIL_SIZE: + *value=this->gl_config.stencil_size; + break; + case SDL_GL_DEPTH_SIZE: + *value=this->gl_config.depth_size; + break; + case SDL_GL_RED_SIZE: + *value=this->gl_config.red_size; + break; + case SDL_GL_GREEN_SIZE: + *value=this->gl_config.green_size; + break; + case SDL_GL_BLUE_SIZE: + *value=this->gl_config.blue_size; + break; + case SDL_GL_ALPHA_SIZE: + *value=this->gl_config.alpha_size; + break; + case SDL_GL_ACCUM_RED_SIZE: + *value=this->gl_config.accum_red_size; + break; + case SDL_GL_ACCUM_GREEN_SIZE: + *value=this->gl_config.accum_green_size; + break; + case SDL_GL_ACCUM_BLUE_SIZE: + *value=this->gl_config.accum_blue_size; + break; + case SDL_GL_ACCUM_ALPHA_SIZE: + *value=this->gl_config.accum_alpha_size; + break; + case SDL_GL_STEREO: + *value=this->gl_config.stereo; + break; + default: + *value=0; + return(-1); + } + + return 0; +} + +int Mir_GL_MakeCurrent(_THIS) +{ + EGLSurface* surface = this->gl_data->esurface; + + if (!eglMakeCurrent(this->gl_data->edpy, surface, surface, this->gl_data->context)) + { + SDL_SetError("Unable to make EGL context current"); + return -1; + } + + return 0; +} + +int Mir_GL_CreateContext(_THIS) +{ + int client_version = 2; + + const EGLint context_atrribs[] = { + EGL_CONTEXT_CLIENT_VERSION, client_version, EGL_NONE + }; + + this->gl_data->context = eglCreateContext(this->gl_data->edpy, this->gl_data->econf, + EGL_NO_CONTEXT, context_atrribs); + + if (this->gl_data->context == EGL_NO_CONTEXT) + { + SDL_SetError("Could not create EGL context"); + return -1; + } + + if (Mir_GL_MakeCurrent(this) < 0) + { + return -1; + } + + return 0; +} + +void Mir_GL_DeleteContext(_THIS) +{ + eglDestroyContext(this->gl_data->edpy, this->gl_data->context); + eglDestroySurface(this->gl_data->edpy, this->gl_data->esurface); + + eglMakeCurrent(this->gl_data->edpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglReleaseThread(); + + this->gl_data->context = 0; + this->gl_data->esurface = NULL; +} + +void Mir_GL_UnloadLibrary(_THIS) +{ + if (this->gl_config.driver_loaded) + { + eglTerminate(this->gl_data->edpy); + + this->gl_config.dll_handle = NULL; + this->gl_config.driver_loaded = 0; + } +} + +void Mir_GL_SwapBuffers(_THIS) +{ + eglSwapBuffers(this->gl_data->edpy, this->gl_data->esurface); +} diff -Nru libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirgl.h libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirgl.h --- libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirgl.h 1969-12-31 16:00:00.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirgl.h 2016-09-19 13:42:59.000000000 -0700 @@ -0,0 +1,55 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 2013-2016 Canonical Ltd + + 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 + + Brandon Schaefer + brandon.schaefer@canonical.com +*/ + +#include "SDL_config.h" + +#ifndef _SDL_mirgl_h +#define _SDL_mirgl_h + +#if SDL_VIDEO_OPENGL +#include +#include "SDL_mirvideo.h" +#endif // SDL_VIDEO_OPENGL + +struct SDL_PrivateGLData +{ +#if SDL_VIDEO_OPENGL + EGLDisplay edpy; + EGLContext context; + EGLConfig econf; + EGLSurface esurface; +#endif // SDL_VIDEO_OPENGL +}; + +extern int Mir_GL_CreateESurface(_THIS); +extern int Mir_GL_CreateContext(_THIS); +extern void Mir_GL_DeleteContext(_THIS); +extern void Mir_GL_UnloadLibrary(_THIS); +#if SDL_VIDEO_OPENGL +extern int Mir_GL_LoadLibrary(_THIS, const char* path); +extern void *Mir_GL_GetProcAddress(_THIS, const char* proc); +extern int Mir_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value); +extern int Mir_GL_MakeCurrent(_THIS); +extern void Mir_GL_SwapBuffers(_THIS); +#endif // SDL_VIDEO_OPENGL + +#endif diff -Nru libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirhw.c libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirhw.c --- libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirhw.c 1969-12-31 16:00:00.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirhw.c 2016-09-19 13:42:59.000000000 -0700 @@ -0,0 +1,46 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 2013-2016 Canonical Ltd + + 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 + + Brandon Schaefer + brandon.schaefer@canonical.com +*/ + +#include "SDL_mirhw.h" + +int Mir_AllocHWSurface(_THIS, SDL_Surface* surface) +{ + return -1; +} + +void Mir_FreeHWSurface(_THIS, SDL_Surface* surface) +{ +} + +int Mir_LockHWSurface(_THIS, SDL_Surface* surface) +{ + return 0; +} + +void Mir_UnlockHWSurface(_THIS, SDL_Surface* surface) +{ +} + +int Mir_FlipHWSurface(_THIS, SDL_Surface* surface) +{ + return 0; +} diff -Nru libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirhw.h libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirhw.h --- libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirhw.h 1969-12-31 16:00:00.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirhw.h 2016-09-19 13:42:59.000000000 -0700 @@ -0,0 +1,36 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 2013-2016 Canonical Ltd + + 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 + + Brandon Schaefer + brandon.schaefer@canonical.com +*/ + +#include "SDL_config.h" + +#ifndef _SDL_mirhw_h +#define _SDL_mirhw_h + +#include "SDL_mirvideo.h" + +extern int Mir_AllocHWSurface(_THIS, SDL_Surface* surface); +extern void Mir_FreeHWSurface(_THIS, SDL_Surface* surface); +extern int Mir_LockHWSurface(_THIS, SDL_Surface* surface); +extern void Mir_UnlockHWSurface(_THIS, SDL_Surface* surface); +extern int Mir_FlipHWSurface(_THIS, SDL_Surface* surface); + +#endif //_SDL_mirhw_h diff -Nru libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirmouse.c libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirmouse.c --- libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirmouse.c 1969-12-31 16:00:00.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirmouse.c 2016-09-19 13:42:59.000000000 -0700 @@ -0,0 +1,62 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 2013-2016 Canonical Ltd + + 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 + + Brandon Schaefer + brandon.schaefer@canonical.com +*/ + +#include "SDL_mirmouse.h" + +#include "../SDL_cursor_c.h" + +struct WMcursor { +}; + +void Mir_FreeWMCursor(_THIS, WMcursor* cursor) +{ + SDL_free(cursor); + cursor = NULL; +} + +WMcursor* Mir_CreateWMCursor(_THIS, Uint8* data, Uint8* mask, + int w, int h, int hot_x, int hot_y) +{ + WMcursor* cursor; + + cursor = (WMcursor*)SDL_calloc(1, sizeof(WMcursor)); + if (!cursor) + { + SDL_OutOfMemory(); + return NULL; + } + + return cursor; +} + +int Mir_ShowWMCursor(_THIS, WMcursor* cursor) +{ + return 1; +} + +void Mir_WrapWMCursor(_THIS, Uint16 x, Uint16 y) +{ +} + +void Mir_CheckMouseMode(_THIS) +{ +} diff -Nru libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirmouse.h libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirmouse.h --- libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirmouse.h 1969-12-31 16:00:00.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirmouse.h 2016-09-19 13:42:59.000000000 -0700 @@ -0,0 +1,37 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 2013-2016 Canonical Ltd + + 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 + + Brandon Schaefer + brandon.schaefer@canonical.com +*/ + +#include "SDL_config.h" + +#ifndef _SDL_mirmouse_h +#define _SDL_mirmouse_h + +#include "SDL_mirvideo.h" + +extern void Mir_FreeWMCursor(_THIS, WMcursor* cursor); +extern WMcursor* Mir_CreateWMCursor(_THIS, Uint8* data, Uint8* mask, + int w, int h, int hot_x, int hot_y); +extern int Mir_ShowWMCursor(_THIS, WMcursor* cursor); +extern void Mir_WrapWMCursor(_THIS, Uint16 x, Uint16 y); +extern void Mir_CheckMouseMode(_THIS); + +#endif // _SDL_mirmouse_h diff -Nru libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirvideo.c libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirvideo.c --- libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirvideo.c 1969-12-31 16:00:00.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirvideo.c 2016-09-19 13:42:59.000000000 -0700 @@ -0,0 +1,590 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 2013-2016 Canonical Ltd + + 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 + + Brandon Schaefer + brandon.schaefer@canonical.com +*/ + +#include "SDL_config.h" + + +#include "SDL_video.h" +#include "../SDL_pixels_c.h" +#include "../SDL_sysvideo.h" + +#include "SDL_mirbuffer.h" +#include "SDL_mirevents.h" +#include "SDL_mirgl.h" +#include "SDL_mirhw.h" +#include "SDL_mirmouse.h" +#include "SDL_mirvideo.h" + +static int Mir_VideoInit(_THIS, SDL_PixelFormat* vformat); +static void Mir_VideoQuit(_THIS); +static SDL_Surface* Mir_SetVideoMode(_THIS, SDL_Surface* current, int width, + int height, int bpp, Uint32 flags); + +SDL_Rect** Mir_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) +{ + return this->hidden->modelist; +} + +static int Mir_Available(void) +{ + return 1; +} + +void Mir_PumpEvents(_THIS) +{ +} + +static int Mir_ToggleFullScreen(_THIS, int on) +{ + if (!mir_surface_is_valid(this->hidden->surface)) + { + const char* error = mir_surface_get_error_message(this->hidden->surface); + SDL_SetError("Failed to created a mir surface: %s", error); + mir_surface_release_sync(this->hidden->surface); + return 0; + } + + if (on) + { + mir_surface_set_state(this->hidden->surface, mir_surface_state_fullscreen); + } + else + { + mir_surface_set_state(this->hidden->surface, mir_surface_state_restored); + } + + return 1; +} + +static void Mir_DeleteDevice(SDL_VideoDevice* device) +{ + if (device) + { + if (device->hidden) + SDL_free(device->hidden); + + if (device->gl_data) + SDL_free(device->gl_data); + + SDL_free(device); + } +} + +static SDL_VideoDevice* Mir_CreateDevice(int devindex) +{ + SDL_VideoDevice *device = NULL; + device = (SDL_VideoDevice*)SDL_calloc(1, sizeof(SDL_VideoDevice)); + + if (!device) + { + SDL_OutOfMemory(); + return 0; + } + + device->hidden = (struct SDL_PrivateVideoData*) + SDL_calloc(1, (sizeof *device->hidden)); + + if (!device->hidden) + { + Mir_DeleteDevice(device); + SDL_OutOfMemory(); + return 0; + } + +#if SDL_VIDEO_OPENGL + device->gl_data = (struct SDL_PrivateGLData*) + SDL_calloc(1, (sizeof *device->gl_data)); + + if (!device->gl_data) + { + Mir_DeleteDevice(device); + SDL_OutOfMemory(); + return 0; + } +#endif // SDL_VIDEO_OPENGL + + device->hidden->connection = NULL; + device->hidden->surface = NULL; + + device->handles_any_size = 1; + device->input_grab = 0; + + device->VideoInit = Mir_VideoInit; + device->VideoQuit = Mir_VideoQuit; + device->SetVideoMode = Mir_SetVideoMode; + device->InitOSKeymap = Mir_InitOSKeymap; + device->ListModes = Mir_ListModes; + device->UpdateMouse = NULL; + device->free = Mir_DeleteDevice; + + device->ToggleFullScreen = Mir_ToggleFullScreen; + + device->AllocHWSurface = Mir_AllocHWSurface; + device->LockHWSurface = Mir_LockHWSurface; + device->UnlockHWSurface = Mir_UnlockHWSurface; + device->FlipHWSurface = Mir_FlipHWSurface; + device->FreeHWSurface = Mir_FreeHWSurface; + + device->CheckHWBlit = NULL; + device->SetHWColorKey = NULL; + device->UpdateRects = NULL; + device->FillHWRect = NULL; + device->SetHWColorKey = NULL; + device->SetHWAlpha = NULL; + device->GetGammaRamp = NULL; + device->SetCaption = NULL; + device->GrabInput = NULL; + + device->FreeWMCursor = Mir_FreeWMCursor; + device->CreateWMCursor = Mir_CreateWMCursor; + device->ShowWMCursor = Mir_ShowWMCursor; + device->WarpWMCursor = Mir_WrapWMCursor; + device->CheckMouseMode = Mir_CheckMouseMode; + device->MoveWMCursor = NULL; + +#if SDL_VIDEO_OPENGL + device->GL_LoadLibrary = Mir_GL_LoadLibrary; + device->GL_GetProcAddress = Mir_GL_GetProcAddress; + device->GL_GetAttribute = Mir_GL_GetAttribute; + device->GL_MakeCurrent = Mir_GL_MakeCurrent; + device->GL_SwapBuffers = Mir_GL_SwapBuffers; +#endif // SDL_VIDEO_OPENGL + + device->PumpEvents = Mir_PumpEvents; + + return device; +} + +VideoBootStrap Mir_bootstrap = { + "mir", "Mir Video Driver", + Mir_Available, Mir_CreateDevice +}; + +SDL_Surface* Mir_SetVideoMode(_THIS, SDL_Surface* current, + int width, int height, int bpp, Uint32 flags) +{ + if (this->hidden->surface && mir_surface_is_valid(this->hidden->surface)) + { + mir_surface_release_sync(this->hidden->surface); + this->hidden->surface = NULL; + } + + Uint32 output_id = mir_display_output_id_invalid; + + if (flags & SDL_FULLSCREEN) + { + MirDisplayConfiguration* display_config = + mir_connection_create_display_config(this->hidden->connection); + + Uint32 fallback_output_id = mir_display_output_id_invalid; + Uint32 d; + Uint32 m; + + this->hidden->mode_changed = SDL_FALSE; + + for (d = 0; d < display_config->num_outputs; ++d) + { + MirDisplayOutput const* out = display_config->outputs + d; + if (out->used && out->connected) + { + if (out->modes[out->current_mode].horizontal_resolution == width && + out->modes[out->current_mode].vertical_resolution == height) + { + output_id = out->output_id; + break; + } + + if (fallback_output_id == mir_display_output_id_invalid && + out->modes[out->current_mode].horizontal_resolution >= width && + out->modes[out->current_mode].vertical_resolution >= height) + { + fallback_output_id = out->output_id; + } + } + } + + if (output_id == mir_display_output_id_invalid) + { + for (d = 0; d < display_config->num_outputs; ++d) + { + MirDisplayOutput* out = display_config->outputs + d; + if (out->used && out->connected) + { + for (m = 0; m < out->num_modes; ++m) + { + if (out->modes[m].horizontal_resolution == width && + out->modes[m].vertical_resolution == height) + { + this->hidden->mode_changed = SDL_TRUE; + output_id = out->output_id; + out->current_mode = m; + + mir_wait_for( + mir_connection_apply_display_config(this->hidden->connection, + display_config) + ); + break; + } + } + } + } + } + + if (fallback_output_id == mir_display_output_id_invalid) + { + /* There's no native resolution for the requested format, so let's + * just ensure we've an output large enough to show it */ + + for (d = 0; d < display_config->num_outputs; ++d) + { + MirDisplayOutput* out = display_config->outputs + d; + if (out->used && out->connected) + { + for (m = 0; m < out->num_modes; ++m) + { + if (out->modes[m].horizontal_resolution >= width && + out->modes[m].vertical_resolution >= height) + { + this->hidden->mode_changed = SDL_TRUE; + fallback_output_id = out->output_id; + out->current_mode = m; + + mir_wait_for( + mir_connection_apply_display_config(this->hidden->connection, + display_config) + ); + break; + } + } + } + } + + /* Setting output_id = fallback_output_id here seems to cause + * troubles to mir in creating a new surface */ + } + + mir_display_config_destroy(display_config); + + if (output_id == mir_display_output_id_invalid && + fallback_output_id == mir_display_output_id_invalid) + { + SDL_SetError("Impossible to find a valid output for mode %dx%d", + width, height); + return NULL; + } + } + else if (this->hidden->mode_changed) + { + Uint32 d; + SDL_bool any_changed = SDL_FALSE; + + MirDisplayConfiguration* display_config = + mir_connection_create_display_config(this->hidden->connection); + + for (d = 0; d < display_config->num_outputs; ++d) + { + MirDisplayOutput* out = display_config->outputs + d; + if (out->used && out->connected) + { + if (out->current_mode != out->preferred_mode) + { + out->current_mode = out->preferred_mode; + any_changed = SDL_TRUE; + } + } + } + + if (any_changed) + { + mir_wait_for( + mir_connection_apply_display_config(this->hidden->connection, + display_config) + ); + } + + this->hidden->mode_changed = SDL_FALSE; + mir_display_config_destroy(display_config); + } + + MirPixelFormat pixel_format = (current->flags & SDL_SRCALPHA) ? + this->hidden->alpha_pixel_format : + this->hidden->opaque_pixel_format; + + MirSurfaceSpec* spec = + mir_connection_create_spec_for_normal_surface(this->hidden->connection, + width, height, pixel_format); + + MirBufferUsage buffer_usage = (flags & SDL_OPENGL) ? mir_buffer_usage_hardware : + mir_buffer_usage_software; + + mir_surface_spec_set_buffer_usage(spec, buffer_usage); + mir_surface_spec_set_name(spec, "MirSurface"); + + this->hidden->surface = mir_surface_create_sync(spec); + + mir_surface_spec_release(spec); + + if (!mir_surface_is_valid(this->hidden->surface)) + { + const char* error = mir_surface_get_error_message(this->hidden->surface); + SDL_SetError("Failed to created a mir surface: %s", error); + mir_surface_release_sync(this->hidden->surface); + return NULL; + } + + mir_surface_set_event_handler(this->hidden->surface, Mir_HandleSurfaceEvent, NULL); + + if (flags & SDL_OPENGL) + { + current->flags |= SDL_OPENGL; + + if (Mir_GL_CreateESurface(this) < 0) + { + SDL_SetError("Could not Create EGL Surface"); + return NULL; + } + + if (Mir_GL_CreateContext(this) < 0) + { + SDL_SetError("Could not Create GL Context"); + return NULL; + } + } + else + { + if ((current->w != width || current->h != height)) + { + current->pixels = NULL; + current->w = width; + current->h = height; + current->pitch = SDL_CalculatePitch(current); + + current->pixels = SDL_calloc(1, current->h * current->pitch); + if (!current->pixels) + { + SDL_OutOfMemory(); + return NULL; + } + this->UpdateRects = Mir_UpdateRects; + } + } + + return current; +} + +static void Mir_ModeListFree(_THIS) +{ + if (this->hidden->modelist) + { + int i = 0; + while (this->hidden->modelist[i] != NULL) + { + SDL_free(this->hidden->modelist[i]); + ++i; + } + + SDL_free(this->hidden->modelist); + this->hidden->modelist = NULL; + } +} + +static void Mir_ModeListUpdate(_THIS) +{ + Uint32 d, m; + Uint32 valid_outputs = 0; + + Mir_ModeListFree(this); + + MirDisplayConfiguration* display_config = + mir_connection_create_display_config(this->hidden->connection); + + for (d = 0; d < display_config->num_outputs; d++) + { + MirDisplayOutput const* out = display_config->outputs + d; + if (out->used && out->connected) + valid_outputs += out->num_modes; + } + + this->hidden->modelist = SDL_calloc(valid_outputs + 1, sizeof(SDL_Rect*)); + + valid_outputs = 0; + + for (d = 0; d < display_config->num_outputs; ++d) + { + MirDisplayOutput const* out = display_config->outputs + d; + if (out->used && out->connected) + { + for (m = 0; m < out->num_modes; ++m) + { + SDL_Rect* sdl_output = SDL_calloc(1, sizeof(SDL_Rect)); + sdl_output->x = out->position_x; + sdl_output->y = out->position_y; + sdl_output->w = out->modes[m].horizontal_resolution; + sdl_output->h = out->modes[m].vertical_resolution; + this->hidden->modelist[valid_outputs] = sdl_output; + + ++valid_outputs; + } + } + } + + this->hidden->modelist[valid_outputs] = NULL; + + mir_display_config_destroy(display_config); +} + +static void Mir_DisplayConfigChanged(MirConnection *connection, void* data) +{ + Mir_ModeListUpdate(data); +} + +int Mir_VideoInit(_THIS, SDL_PixelFormat *vformat) +{ + this->hidden->connection = mir_connect_sync(NULL, __PRETTY_FUNCTION__); + + if (!mir_connection_is_valid(this->hidden->connection)) + { + SDL_SetError("Failed to connect to the Mir Server: %s", + mir_connection_get_error_message(this->hidden->connection)); + mir_connection_release(this->hidden->connection); + return -1; + } + + MirPixelFormat formats[mir_pixel_formats]; + this->hidden->alpha_pixel_format = mir_pixel_format_invalid; + this->hidden->opaque_pixel_format = mir_pixel_format_invalid; + Uint32 n_formats, f; + + mir_connection_get_available_surface_formats (this->hidden->connection, formats, + mir_pixel_formats, &n_formats); + + for (f = 0; f < n_formats; ++f) + { + if (formats[f] == mir_pixel_format_xbgr_8888 || + formats[f] == mir_pixel_format_xrgb_8888) + { + this->hidden->opaque_pixel_format = formats[f]; + break; + } + } + + if (this->hidden->opaque_pixel_format == mir_pixel_format_invalid) + { + SDL_SetError("No valid opaque pixel format found"); + mir_connection_release(this->hidden->connection); + return -1; + } + + MirPixelFormat alpha_format = mir_pixel_format_invalid; + + switch (this->hidden->opaque_pixel_format) + { + case mir_pixel_format_xrgb_8888: + alpha_format = mir_pixel_format_argb_8888; + break; + case mir_pixel_format_xbgr_8888: + alpha_format = mir_pixel_format_abgr_8888; + break; + default: + break; + } + + for (f = 0; f < n_formats; ++f) + { + if (formats[f] == alpha_format) + { + this->hidden->alpha_pixel_format = alpha_format; + break; + } + } + + if (this->hidden->alpha_pixel_format == mir_pixel_format_invalid) + { + SDL_SetError("No valid alpha pixel format found"); + mir_connection_release(this->hidden->connection); + return -1; + } + + vformat->BytesPerPixel = MIR_BYTES_PER_PIXEL(this->hidden->alpha_pixel_format); + vformat->BitsPerPixel = vformat->BytesPerPixel * 8; + vformat->Amask = 0; + + switch (this->hidden->alpha_pixel_format) + { + case mir_pixel_format_abgr_8888: + vformat->Bmask = 0x00FF0000; + vformat->Gmask = 0x0000FF00; + vformat->Rmask = 0x000000FF; + break; + case mir_pixel_format_argb_8888: + vformat->Rmask = 0x00FF0000; + vformat->Gmask = 0x0000FF00; + vformat->Bmask = 0x000000FF; + break; + default: + break; + } + + if (vformat->BytesPerPixel == 4) + vformat->Amask = (0xFFFFFFFF & ~(vformat->Rmask|vformat->Gmask|vformat->Bmask)); + + Mir_ModeListUpdate(this); + mir_connection_set_display_config_change_callback(this->hidden->connection, + Mir_DisplayConfigChanged, this); + + this->info.wm_available = 1; + + return 0; +} + +// FIXME Make sure we clean everything up, Also: +// we get a crash (call of virtual function) when releasing the connection :( +void Mir_VideoQuit(_THIS) +{ + if (this->hidden->surface) + { + mir_surface_release_sync(this->hidden->surface); + this->hidden->surface = NULL; + } + +#if SDL_VIDEO_OPENGL + if (this->gl_config.driver_loaded != 0) + { + Mir_GL_DeleteContext(this); + Mir_GL_UnloadLibrary(this); + } +#endif // SDL_VIDEO_OPENGL + + if (mir_connection_is_valid(this->hidden->connection)) + { + mir_connection_set_display_config_change_callback(this->hidden->connection, + NULL, NULL); + } + + if (this->hidden->connection) + { + mir_connection_release(this->hidden->connection); + this->hidden->connection = NULL; + } + + Mir_ModeListFree(this); +} diff -Nru libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirvideo.h libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirvideo.h --- libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirvideo.h 1969-12-31 16:00:00.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/src/video/mir/SDL_mirvideo.h 2016-09-19 13:42:59.000000000 -0700 @@ -0,0 +1,44 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 2013-2016 Canonical Ltd + + 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 + + Brandon Schaefer + brandon.schaefer@canonical.com +*/ + +#include "SDL_config.h" + +#ifndef _SDL_mirvideo_h +#define _SDL_mirvideo_h + +#include "../SDL_sysvideo.h" + +#include + +#define _THIS SDL_VideoDevice *this + +struct SDL_PrivateVideoData { + MirConnection* connection; + MirSurface* surface; + MirPixelFormat alpha_pixel_format; + MirPixelFormat opaque_pixel_format; + + SDL_bool mode_changed; + SDL_Rect** modelist; +}; + +#endif //_SDL_mirvideo_h diff -Nru libsdl1.2-1.2.15+dfsg1/src/video/SDL_sysvideo.h libsdl1.2-1.2.15+dfsg1/src/video/SDL_sysvideo.h --- libsdl1.2-1.2.15+dfsg1/src/video/SDL_sysvideo.h 2012-01-18 22:30:06.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/src/video/SDL_sysvideo.h 2016-09-19 13:42:59.000000000 -0700 @@ -323,6 +323,9 @@ #if SDL_VIDEO_DRIVER_X11 extern VideoBootStrap X11_bootstrap; #endif +#if SDL_VIDEO_DRIVER_MIR +extern VideoBootStrap Mir_bootstrap; +#endif #if SDL_VIDEO_DRIVER_DGA extern VideoBootStrap DGA_bootstrap; #endif diff -Nru libsdl1.2-1.2.15+dfsg1/src/video/SDL_video.c libsdl1.2-1.2.15+dfsg1/src/video/SDL_video.c --- libsdl1.2-1.2.15+dfsg1/src/video/SDL_video.c 2012-01-18 22:30:06.000000000 -0800 +++ libsdl1.2-1.2.15+dfsg1/src/video/SDL_video.c 2016-09-19 13:42:59.000000000 -0700 @@ -39,6 +39,9 @@ #if SDL_VIDEO_DRIVER_X11 &X11_bootstrap, #endif +#if SDL_VIDEO_DRIVER_MIR + &Mir_bootstrap, +#endif #if SDL_VIDEO_DRIVER_DGA &DGA_bootstrap, #endif