display: block the updating while surface switching 52/18552/1
authorGiWoong Kim <giwoong.kim@samsung.com>
Tue, 25 Mar 2014 10:04:07 +0000 (19:04 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Wed, 26 Mar 2014 02:21:55 +0000 (11:21 +0900)
block the display updating while surface switching
on maru_sdl

Change-Id: If7a44181d1fe2c80c1fb19842746427486973774
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
include/ui/console.h
tizen/src/maru_sdl.c
ui/console.c

index af29ae4..8fcf031 100644 (file)
 #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
index 33f6e35..366ee82 100644 (file)
@@ -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;
index 199ba69..86df4bd 100644 (file)
 #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);
 }