From: GiWoong Kim Date: Tue, 25 Mar 2014 10:04:07 +0000 (+0900) Subject: display: block the updating while surface switching X-Git-Tag: TizenStudio_2.0_p2.3~316^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=606a7b821d039ca5274a373d640b643b2ce0ca18;p=sdk%2Femulator%2Fqemu.git display: block the updating while surface switching block the display updating while surface switching on maru_sdl Change-Id: If7a44181d1fe2c80c1fb19842746427486973774 Signed-off-by: GiWoong Kim --- diff --git a/include/ui/console.h b/include/ui/console.h index af29ae4..8fcf031 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -10,6 +10,10 @@ #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 diff --git a/tizen/src/maru_sdl.c b/tizen/src/maru_sdl.c index 33f6e35..366ee82 100644 --- a/tizen/src/maru_sdl.c +++ b/tizen/src/maru_sdl.c @@ -71,12 +71,9 @@ static unsigned int blank_cnt; #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 @@ -239,10 +236,6 @@ static void qemu_ds_sdl_switch(DisplayChangeListener *dcl, 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; @@ -277,10 +270,6 @@ static void qemu_ds_sdl_switch(DisplayChangeListener *dcl, 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; diff --git a/ui/console.c b/ui/console.c index 199ba69..86df4bd 100644 --- a/ui/console.c +++ b/ui/console.c @@ -28,6 +28,10 @@ #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 @@ -1315,6 +1319,10 @@ void register_displaychangelistener(DisplayChangeListener *dcl) 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 { @@ -1323,6 +1331,10 @@ void register_displaychangelistener(DisplayChangeListener *dcl) } dcl->ops->dpy_gfx_switch(dcl, dummy); } + +#ifdef SDL_THREAD + pthread_mutex_unlock(&sdl_mutex); +#endif } } @@ -1382,6 +1394,10 @@ void dpy_gfx_replace_surface(QemuConsole *con, 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)) { @@ -1391,6 +1407,11 @@ void dpy_gfx_replace_surface(QemuConsole *con, dcl->ops->dpy_gfx_switch(dcl, surface); } } + +#ifdef SDL_THREAD + pthread_mutex_unlock(&sdl_mutex); +#endif + qemu_free_displaysurface(old_surface); }