#include "qapi-types.h"
#include "qapi/error.h"
+#if defined(CONFIG_MARU) && !defined(CONFIG_USE_SHM)
+#define SDL_THREAD
+#endif
+
/* keyboard/mouse support */
#define MOUSE_EVENT_LBUTTON 0x01
#define BLANK_GUIDE_IMAGE_PATH "../images/"
#define BLANK_GUIDE_IMAGE_NAME "blank-guide.png"
-
-#define SDL_THREAD
-
-static pthread_mutex_t sdl_mutex = PTHREAD_MUTEX_INITIALIZER;
#ifdef SDL_THREAD
-static pthread_cond_t sdl_cond = PTHREAD_COND_INITIALIZER;
+pthread_mutex_t sdl_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t sdl_cond = PTHREAD_COND_INITIALIZER;
static int sdl_thread_initialized;
#endif
INFO("qemu_ds_sdl_switch : (%d, %d)\n", console_width, console_height);
-#ifdef SDL_THREAD
- pthread_mutex_lock(&sdl_mutex);
-#endif
-
/* switch */
dpy_surface = new_surface;
0, 0, 0, 0);
}
-#ifdef SDL_THREAD
- pthread_mutex_unlock(&sdl_mutex);
-#endif
-
if (surface_qemu == NULL) {
ERR("Unable to set the RGBSurface: %s\n", SDL_GetError());
return;
#include "qmp-commands.h"
#include "sysemu/char.h"
+#ifdef SDL_THREAD
+extern pthread_mutex_t sdl_mutex;
+#endif
+
//#define DEBUG_CONSOLE
#define DEFAULT_BACKSCROLL 512
#define MAX_CONSOLES 12
con = active_console;
}
if (dcl->ops->dpy_gfx_switch) {
+#ifdef SDL_THREAD
+ pthread_mutex_lock(&sdl_mutex);
+#endif
+
if (con) {
dcl->ops->dpy_gfx_switch(dcl, con->surface);
} else {
}
dcl->ops->dpy_gfx_switch(dcl, dummy);
}
+
+#ifdef SDL_THREAD
+ pthread_mutex_unlock(&sdl_mutex);
+#endif
}
}
DisplaySurface *old_surface = con->surface;
DisplayChangeListener *dcl;
+#ifdef SDL_THREAD
+ pthread_mutex_lock(&sdl_mutex);
+#endif
+
con->surface = surface;
QLIST_FOREACH(dcl, &s->listeners, next) {
if (con != (dcl->con ? dcl->con : active_console)) {
dcl->ops->dpy_gfx_switch(dcl, surface);
}
}
+
+#ifdef SDL_THREAD
+ pthread_mutex_unlock(&sdl_mutex);
+#endif
+
qemu_free_displaysurface(old_surface);
}