diff -Nru mupen64plus-core-2.0/debian/changelog mupen64plus-core-2.0/debian/changelog --- mupen64plus-core-2.0/debian/changelog 2013-12-13 16:30:08.000000000 +0100 +++ mupen64plus-core-2.0/debian/changelog 2014-08-14 11:12:00.000000000 +0200 @@ -1,3 +1,11 @@ +mupen64plus-core (2.0-4ubuntu0.1) trusty-proposed; urgency=medium + + * debian/patches: + - Add sdl2_no_surface.patch, Remove unused SDL2 surface in compat code + (LP: #1355747) + + -- Sven Eckelmann Thu, 14 Aug 2014 11:07:15 +0200 + mupen64plus-core (2.0-4) unstable; urgency=low * Fix version number of the unicode FTBFS bug in the changelog diff -Nru mupen64plus-core-2.0/debian/patches/sdl2_no_surface.patch mupen64plus-core-2.0/debian/patches/sdl2_no_surface.patch --- mupen64plus-core-2.0/debian/patches/sdl2_no_surface.patch 1970-01-01 01:00:00.000000000 +0100 +++ mupen64plus-core-2.0/debian/patches/sdl2_no_surface.patch 2014-08-14 11:05:44.000000000 +0200 @@ -0,0 +1,490 @@ +Description: Remove unused SDL2 surface in compat code + mupen64plus doesn't support 2D video output because it forces OPENGL mode. + Unfortunately, the rest of the compat code still assumes that surfaces for 2D + data are used and overwrites the data when the window is changed. + . + The surface code can be removed to avoid these problems. +Origin: upstream, https://github.com/mupen64plus/mupen64plus-core/commit/38233c42236f6730917d98884ccee323884eb1bb +Author: Sven Eckelmann + +--- +diff --git a/src/api/vidext_sdl2_compat.h b/src/api/vidext_sdl2_compat.h +index 9c6804082796c250651a94c60cacf7d44e381339..85075e8337f80db881315fd0b5d43489f09f8b46 100644 +--- a/src/api/vidext_sdl2_compat.h ++++ b/src/api/vidext_sdl2_compat.h +@@ -21,39 +21,6 @@ + + #include + +-typedef struct +-{ +- Uint8 *src; +- int src_w, src_h; +- int src_pitch; +- int src_skip; +- Uint8 *dst; +- int dst_w, dst_h; +- int dst_pitch; +- int dst_skip; +- SDL_PixelFormat *src_fmt; +- SDL_PixelFormat *dst_fmt; +- Uint8 *table; +- int flags; +- Uint32 colorkey; +- Uint8 r, g, b, a; +-} SDL_BlitInfo; +- +-/* Blit mapping definition */ +-typedef struct SDL_BlitMap +-{ +- SDL_Surface *dst; +- int identity; +- SDL_blit blit; +- void *data; +- SDL_BlitInfo info; +- +- /* the version count matches the destination; mismatch indicates +- an invalid mapping */ +- Uint32 dst_palette_version; +- Uint32 src_palette_version; +-} SDL_BlitMap; +- + typedef struct SDL_VideoInfo + { + Uint32 hw_available:1; +@@ -76,8 +43,6 @@ typedef struct SDL_VideoInfo + int current_h; + } SDL_VideoInfo; + +-#define SDL_ANYFORMAT 0x00100000 +-#define SDL_HWPALETTE 0x00200000 + #define SDL_FULLSCREEN 0x00800000 + #define SDL_RESIZABLE 0x01000000 + #define SDL_NOFRAME 0x02000000 +@@ -90,9 +55,7 @@ typedef struct SDL_VideoInfo + int initialized_video = 0; + + static SDL_Window *SDL_VideoWindow = NULL; +-static SDL_Surface *SDL_WindowSurface = NULL; + static SDL_Surface *SDL_VideoSurface = NULL; +-static SDL_Surface *SDL_ShadowSurface = NULL; + static SDL_Surface *SDL_PublicSurface = NULL; + static SDL_Rect SDL_VideoViewport; + static char *wm_title = NULL; +@@ -209,110 +172,6 @@ SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags) + } + + static void +-SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects) +-{ +- int i; +- +- if (screen == SDL_ShadowSurface) { +- for (i = 0; i < numrects; ++i) { +- SDL_BlitSurface(SDL_ShadowSurface, &rects[i], SDL_VideoSurface, +- &rects[i]); +- } +- +- /* Fall through to video surface update */ +- screen = SDL_VideoSurface; +- } +- if (screen == SDL_VideoSurface) { +- if (SDL_VideoViewport.x || SDL_VideoViewport.y) { +- SDL_Rect *stackrects = SDL_stack_alloc(SDL_Rect, numrects); +- SDL_Rect *stackrect; +- const SDL_Rect *rect; +- +- /* Offset all the rectangles before updating */ +- for (i = 0; i < numrects; ++i) { +- rect = &rects[i]; +- stackrect = &stackrects[i]; +- stackrect->x = SDL_VideoViewport.x + rect->x; +- stackrect->y = SDL_VideoViewport.y + rect->y; +- stackrect->w = rect->w; +- stackrect->h = rect->h; +- } +- SDL_UpdateWindowSurfaceRects(SDL_VideoWindow, stackrects, numrects); +- SDL_stack_free(stackrects); +- } else { +- SDL_UpdateWindowSurfaceRects(SDL_VideoWindow, rects, numrects); +- } +- } +-} +- +-static void +-SDL_UpdateRect(SDL_Surface * screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h) +-{ +- if (screen) { +- SDL_Rect rect; +- +- /* Fill the rectangle */ +- rect.x = (int) x; +- rect.y = (int) y; +- rect.w = (int) (w ? w : screen->w); +- rect.h = (int) (h ? h : screen->h); +- SDL_UpdateRects(screen, 1, &rect); +- } +-} +- +-static int +-SDL_Flip(SDL_Surface * screen) +-{ +- SDL_UpdateRect(screen, 0, 0, 0, 0); +- return 0; +-} +- +-/* +- * Calculate the pad-aligned scanline width of a surface +- */ +-static int +-SDL_CalculatePitch(SDL_Surface * surface) +-{ +- int pitch; +- +- /* Surface should be 4-byte aligned for speed */ +- pitch = surface->w * surface->format->BytesPerPixel; +- switch (surface->format->BitsPerPixel) { +- case 1: +- pitch = (pitch + 7) / 8; +- break; +- case 4: +- pitch = (pitch + 1) / 2; +- break; +- default: +- break; +- } +- pitch = (pitch + 3) & ~3; /* 4-byte aligning */ +- return (pitch); +-} +- +-static void +-SDL_InvalidateMap(SDL_BlitMap * map) +-{ +- if (!map) { +- return; +- } +- if (map->dst) { +- /* Release our reference to the surface - see the note below */ +- if (--map->dst->refcount <= 0) { +- SDL_FreeSurface(map->dst); +- } +- } +- map->dst = NULL; +- map->src_palette_version = 0; +- map->dst_palette_version = 0; +- if (map->info.table) { +- SDL_free(map->info.table); +- map->info.table = NULL; +- } +-} +- +-static void + SDL_GL_SwapBuffers(void) + { + SDL_GL_SwapWindow(SDL_VideoWindow); +@@ -321,10 +180,6 @@ SDL_GL_SwapBuffers(void) + static int + SDL_WM_ToggleFullScreen(SDL_Surface * surface) + { +- int length; +- void *pixels; +- Uint8 *src, *dst; +- int row; + int window_w; + int window_h; + +@@ -333,19 +188,6 @@ SDL_WM_ToggleFullScreen(SDL_Surface * surface) + return 0; + } + +- /* Copy the old bits out */ +- length = SDL_PublicSurface->w * SDL_PublicSurface->format->BytesPerPixel; +- pixels = SDL_malloc(SDL_PublicSurface->h * length); +- if (pixels && SDL_PublicSurface->pixels) { +- src = (Uint8*)SDL_PublicSurface->pixels; +- dst = (Uint8*)pixels; +- for (row = 0; row < SDL_PublicSurface->h; ++row) { +- SDL_memcpy(dst, src, length); +- src += SDL_PublicSurface->pitch; +- dst += length; +- } +- } +- + /* Do the physical mode switch */ + if (SDL_GetWindowFlags(SDL_VideoWindow) & SDL_WINDOW_FULLSCREEN) { + if (SDL_SetWindowFullscreen(SDL_VideoWindow, 0) < 0) { +@@ -359,103 +201,24 @@ SDL_WM_ToggleFullScreen(SDL_Surface * surface) + SDL_PublicSurface->flags |= SDL_FULLSCREEN; + } + +- /* Recreate the screen surface */ +- SDL_WindowSurface = SDL_GetWindowSurface(SDL_VideoWindow); +- if (!SDL_WindowSurface) { +- /* We're totally hosed... */ +- return 0; +- } +- + /* Center the public surface in the window surface */ + SDL_GetWindowSize(SDL_VideoWindow, &window_w, &window_h); +- SDL_VideoViewport.x = (window_w - SDL_VideoSurface->w)/2; +- SDL_VideoViewport.y = (window_h - SDL_VideoSurface->h)/2; +- SDL_VideoViewport.w = SDL_VideoSurface->w; +- SDL_VideoViewport.h = SDL_VideoSurface->h; +- +- /* Do some shuffling behind the application's back if format changes */ +- if (SDL_VideoSurface->format->format != SDL_WindowSurface->format->format) { +- if (SDL_ShadowSurface) { +- if (SDL_ShadowSurface->format->format == SDL_WindowSurface->format->format) { +- /* Whee! We don't need a shadow surface anymore! */ +- SDL_VideoSurface->flags &= ~SDL_DONTFREE; +- SDL_FreeSurface(SDL_VideoSurface); +- SDL_free(SDL_ShadowSurface->pixels); +- SDL_VideoSurface = SDL_ShadowSurface; +- SDL_VideoSurface->flags |= SDL_PREALLOC; +- SDL_ShadowSurface = NULL; +- } else { +- /* No problem, just change the video surface format */ +- SDL_FreeFormat(SDL_VideoSurface->format); +- SDL_VideoSurface->format = SDL_WindowSurface->format; +- SDL_VideoSurface->format->refcount++; +- SDL_InvalidateMap(SDL_ShadowSurface->map); +- } +- } else { +- /* We can make the video surface the shadow surface */ +- SDL_ShadowSurface = SDL_VideoSurface; +- SDL_ShadowSurface->pitch = SDL_CalculatePitch(SDL_ShadowSurface); +- SDL_ShadowSurface->pixels = SDL_malloc(SDL_ShadowSurface->h * SDL_ShadowSurface->pitch); +- if (!SDL_ShadowSurface->pixels) { +- /* Uh oh, we're hosed */ +- SDL_ShadowSurface = NULL; +- return 0; +- } +- SDL_ShadowSurface->flags &= ~SDL_PREALLOC; +- +- SDL_VideoSurface = SDL_CreateRGBSurfaceFrom(NULL, 0, 0, 32, 0, 0, 0, 0, 0); +- SDL_VideoSurface->flags = SDL_ShadowSurface->flags; +- SDL_VideoSurface->flags |= SDL_PREALLOC; +- SDL_FreeFormat(SDL_VideoSurface->format); +- SDL_VideoSurface->format = SDL_WindowSurface->format; +- SDL_VideoSurface->format->refcount++; +- SDL_VideoSurface->w = SDL_ShadowSurface->w; +- SDL_VideoSurface->h = SDL_ShadowSurface->h; +- } +- } +- +- /* Update the video surface */ +- SDL_VideoSurface->pitch = SDL_WindowSurface->pitch; +- SDL_VideoSurface->pixels = (void *)((Uint8 *)SDL_WindowSurface->pixels + +- SDL_VideoViewport.y * SDL_VideoSurface->pitch + +- SDL_VideoViewport.x * SDL_VideoSurface->format->BytesPerPixel); +- SDL_SetClipRect(SDL_VideoSurface, NULL); +- +- /* Copy the old bits back */ +- if (pixels) { +- src = (Uint8*)pixels; +- dst = (Uint8*)SDL_PublicSurface->pixels; +- for (row = 0; row < SDL_PublicSurface->h; ++row) { +- SDL_memcpy(dst, src, length); +- src += length; +- dst += SDL_PublicSurface->pitch; +- } +- SDL_Flip(SDL_PublicSurface); +- SDL_free(pixels); +- } ++ SDL_VideoViewport.x = 0; ++ SDL_VideoViewport.y = 0; ++ SDL_VideoViewport.w = window_w; ++ SDL_VideoViewport.h = window_h; + + /* We're done! */ + return 1; + } + +-static void +-ClearVideoSurface() +-{ +- if (SDL_ShadowSurface) { +- SDL_FillRect(SDL_ShadowSurface, NULL, +- SDL_MapRGB(SDL_ShadowSurface->format, 0, 0, 0)); +- } +- SDL_FillRect(SDL_WindowSurface, NULL, 0); +- SDL_UpdateWindowSurface(SDL_VideoWindow); +-} +- + static int + SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags) + { + int w, h; + + /* We can't resize something we don't have... */ +- if (!SDL_VideoSurface) { ++ if (!SDL_PublicSurface) { + return -1; + } + +@@ -478,40 +241,8 @@ SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags) + SDL_SetWindowSize(SDL_VideoWindow, width, height); + } + +- /* If we're in OpenGL mode, just resize the stub surface and we're done! */ +- if (flags & SDL_OPENGL) { +- SDL_VideoSurface->w = width; +- SDL_VideoSurface->h = height; +- return 0; +- } +- +- SDL_WindowSurface = SDL_GetWindowSurface(SDL_VideoWindow); +- if (!SDL_WindowSurface) { +- return -1; +- } +- if (SDL_VideoSurface->format != SDL_WindowSurface->format) { +- return -1; +- } + SDL_VideoSurface->w = width; + SDL_VideoSurface->h = height; +- SDL_VideoSurface->pixels = SDL_WindowSurface->pixels; +- SDL_VideoSurface->pitch = SDL_WindowSurface->pitch; +- SDL_SetClipRect(SDL_VideoSurface, NULL); +- +- if (SDL_ShadowSurface) { +- SDL_ShadowSurface->w = width; +- SDL_ShadowSurface->h = height; +- SDL_ShadowSurface->pitch = SDL_CalculatePitch(SDL_ShadowSurface); +- SDL_ShadowSurface->pixels = +- SDL_realloc(SDL_ShadowSurface->pixels, +- SDL_ShadowSurface->h * SDL_ShadowSurface->pitch); +- SDL_SetClipRect(SDL_ShadowSurface, NULL); +- SDL_InvalidateMap(SDL_ShadowSurface->map); +- } else { +- SDL_PublicSurface = SDL_VideoSurface; +- } +- +- ClearVideoSurface(); + + return 0; + } +@@ -604,6 +335,26 @@ GetEnvironmentWindowPosition(int w, int h, int *x, int *y) + } + } + ++static void SDL2_DestroyWindow(void) ++{ ++ /* Destroy existing window */ ++ SDL_PublicSurface = NULL; ++ if (SDL_VideoSurface) { ++ SDL_VideoSurface->flags &= ~SDL_DONTFREE; ++ SDL_FreeSurface(SDL_VideoSurface); ++ SDL_VideoSurface = NULL; ++ } ++ if (SDL_VideoContext) { ++ /* SDL_GL_MakeCurrent(0, NULL); *//* Doesn't do anything */ ++ SDL_GL_DeleteContext(SDL_VideoContext); ++ SDL_VideoContext = NULL; ++ } ++ if (SDL_VideoWindow) { ++ SDL_DestroyWindow(SDL_VideoWindow); ++ SDL_VideoWindow = NULL; ++ } ++} ++ + static SDL_Surface * + SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) + { +@@ -611,8 +362,6 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) + int display = GetVideoDisplay(); + int window_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(display); + int window_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(display); +- int window_w; +- int window_h; + Uint32 window_flags; + Uint32 surface_flags; + +@@ -641,26 +390,9 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) + } + + /* Destroy existing window */ +- SDL_PublicSurface = NULL; +- if (SDL_ShadowSurface) { +- SDL_ShadowSurface->flags &= ~SDL_DONTFREE; +- SDL_FreeSurface(SDL_ShadowSurface); +- SDL_ShadowSurface = NULL; +- } +- if (SDL_VideoSurface) { +- SDL_VideoSurface->flags &= ~SDL_DONTFREE; +- SDL_FreeSurface(SDL_VideoSurface); +- SDL_VideoSurface = NULL; +- } +- if (SDL_VideoContext) { +- /* SDL_GL_MakeCurrent(0, NULL); *//* Doesn't do anything */ +- SDL_GL_DeleteContext(SDL_VideoContext); +- SDL_VideoContext = NULL; +- } +- if (SDL_VideoWindow) { ++ if (SDL_VideoWindow) + SDL_GetWindowPosition(SDL_VideoWindow, &window_x, &window_y); +- SDL_DestroyWindow(SDL_VideoWindow); +- } ++ SDL2_DestroyWindow(); + + /* Set up the event filter */ + if (!SDL_GetEventFilter(NULL, NULL)) { +@@ -726,58 +458,6 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) + return SDL_PublicSurface; + } + +- /* Create the screen surface */ +- SDL_WindowSurface = SDL_GetWindowSurface(SDL_VideoWindow); +- if (!SDL_WindowSurface) { +- return NULL; +- } +- +- /* Center the public surface in the window surface */ +- SDL_GetWindowSize(SDL_VideoWindow, &window_w, &window_h); +- SDL_VideoViewport.x = (window_w - width)/2; +- SDL_VideoViewport.y = (window_h - height)/2; +- SDL_VideoViewport.w = width; +- SDL_VideoViewport.h = height; +- +- SDL_VideoSurface = SDL_CreateRGBSurfaceFrom(NULL, 0, 0, 32, 0, 0, 0, 0, 0); +- SDL_VideoSurface->flags |= surface_flags; +- SDL_VideoSurface->flags |= SDL_DONTFREE; +- SDL_FreeFormat(SDL_VideoSurface->format); +- SDL_VideoSurface->format = SDL_WindowSurface->format; +- SDL_VideoSurface->format->refcount++; +- SDL_VideoSurface->w = width; +- SDL_VideoSurface->h = height; +- SDL_VideoSurface->pitch = SDL_WindowSurface->pitch; +- SDL_VideoSurface->pixels = (void *)((Uint8 *)SDL_WindowSurface->pixels + +- SDL_VideoViewport.y * SDL_VideoSurface->pitch + +- SDL_VideoViewport.x * SDL_VideoSurface->format->BytesPerPixel); +- SDL_SetClipRect(SDL_VideoSurface, NULL); +- +- /* Create a shadow surface if necessary */ +- if ((bpp != SDL_VideoSurface->format->BitsPerPixel) +- && !(flags & SDL_ANYFORMAT)) { +- SDL_ShadowSurface = +- SDL_CreateRGBSurface(0, width, height, bpp, 0, 0, 0, 0); +- if (!SDL_ShadowSurface) { +- return NULL; +- } +- SDL_ShadowSurface->flags |= surface_flags; +- SDL_ShadowSurface->flags |= SDL_DONTFREE; +- +- /* 8-bit SDL_ShadowSurface surfaces report that they have exclusive palette */ +- if (SDL_ShadowSurface->format->palette) { +- SDL_ShadowSurface->flags |= SDL_HWPALETTE; +- //TODO SDL_DitherColors(SDL_ShadowSurface->format->palette->colors, +- // SDL_ShadowSurface->format->BitsPerPixel); +- } +- SDL_FillRect(SDL_ShadowSurface, NULL, +- SDL_MapRGB(SDL_ShadowSurface->format, 0, 0, 0)); +- } +- SDL_PublicSurface = +- (SDL_ShadowSurface ? SDL_ShadowSurface : SDL_VideoSurface); +- +- ClearVideoSurface(); +- + /* We're finally done! */ +- return SDL_PublicSurface; ++ return NULL; + } diff -Nru mupen64plus-core-2.0/debian/patches/series mupen64plus-core-2.0/debian/patches/series --- mupen64plus-core-2.0/debian/patches/series 2013-12-13 16:30:08.000000000 +0100 +++ mupen64plus-core-2.0/debian/patches/series 2014-08-14 11:06:54.000000000 +0200 @@ -12,3 +12,4 @@ delay_si.patch config_currentstateslot.patch obsolete_variable.patch +sdl2_no_surface.patch