summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiWoong Kim <giwoong.kim@samsung.com>2014-05-08 11:49:12 +0900
committerGiWoong Kim <giwoong.kim@samsung.com>2014-05-12 11:03:50 +0900
commit60226af4c94af357759275583b21a4afeadfadb6 (patch)
tree7bd5bac79b9516928173600d85c606cde15014b3
parentf53705eb0170fc51cfc2f2d4441d440844534111 (diff)
downloadqemu-60226af4c94af357759275583b21a4afeadfadb6.tar.gz
qemu-60226af4c94af357759275583b21a4afeadfadb6.tar.bz2
qemu-60226af4c94af357759275583b21a4afeadfadb6.zip
display: source clean-uptizen_qemu_2.0
convert pthread to qemu_thread modified function name & etc Change-Id: I022a36e51186367b87283fc07754847a98413f4e Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
-rw-r--r--tizen/src/maru_display.c32
-rw-r--r--tizen/src/maru_display.h3
-rw-r--r--tizen/src/maru_sdl.c77
-rw-r--r--tizen/src/maru_sdl.h13
-rw-r--r--tizen/src/maru_shm.c6
-rw-r--r--tizen/src/maru_shm.h6
-rw-r--r--tizen/src/skin/maruskin_operation.c2
-rw-r--r--tizen/src/skin/maruskin_server.c32
-rw-r--r--ui/console.c11
9 files changed, 92 insertions, 90 deletions
diff --git a/tizen/src/maru_display.c b/tizen/src/maru_display.c
index e5286734ca..9b89ececb8 100644
--- a/tizen/src/maru_display.c
+++ b/tizen/src/maru_display.c
@@ -38,7 +38,6 @@
#include "maru_shm.h"
#endif
-
MULTI_DEBUG_CHANNEL(tizen, display);
MaruScreenshot* maru_screenshot = NULL;
@@ -48,6 +47,12 @@ void maru_display_init(DisplayState *ds)
{
INFO("init qemu display\n");
+#ifndef CONFIG_USE_SHM
+ maru_sdl_pre_init();
+#else
+ /* do nothing */
+#endif
+
/* graphics context information */
DisplayChangeListener *dcl;
@@ -68,16 +73,25 @@ void maru_display_fini(void)
g_free(maru_screenshot);
#ifndef CONFIG_USE_SHM
- maruskin_sdl_quit();
+ maru_sdl_quit();
+#else
+ maru_shm_quit();
+#endif
+}
+
+void maru_display_resize(void)
+{
+#ifndef CONFIG_USE_SHM
+ maru_sdl_resize();
#else
- maruskin_shm_quit();
+ maru_shm_resize();
#endif
}
void maru_display_update(void)
{
#ifndef CONFIG_USE_SHM
- maruskin_sdl_update();
+ maru_sdl_update();
#else
/* do nothing */
#endif
@@ -86,7 +100,7 @@ void maru_display_update(void)
void maru_display_invalidate(bool on)
{
#ifndef CONFIG_USE_SHM
- maruskin_sdl_invalidate(on);
+ maru_sdl_invalidate(on);
#else
/* do nothing */
#endif
@@ -95,21 +109,21 @@ void maru_display_invalidate(bool on)
void maru_display_interpolation(bool on)
{
#ifndef CONFIG_USE_SHM
- maruskin_sdl_interpolation(on);
+ maru_sdl_interpolation(on);
#else
/* do nothing */
#endif
}
-void maruskin_init(uint64 swt_handle,
+void maru_ds_surface_init(uint64 swt_handle,
unsigned int display_width, unsigned int display_height,
bool blank_guide)
{
#ifndef CONFIG_USE_SHM
- maruskin_sdl_init(swt_handle,
+ maru_sdl_init(swt_handle,
display_width, display_height, blank_guide);
#else
- maruskin_shm_init(swt_handle,
+ maru_shm_init(swt_handle,
display_width, display_height, blank_guide);
#endif
}
diff --git a/tizen/src/maru_display.h b/tizen/src/maru_display.h
index e85cc3ebc9..ec0b90124e 100644
--- a/tizen/src/maru_display.h
+++ b/tizen/src/maru_display.h
@@ -41,10 +41,11 @@ typedef struct MaruScreenshot {
void maru_display_init(DisplayState *ds);
void maru_display_fini(void);
+void maru_display_resize(void);
void maru_display_update(void);
void maru_display_invalidate(bool on);
void maru_display_interpolation(bool on);
-void maruskin_init(uint64 swt_handle,
+void maru_ds_surface_init(uint64 swt_handle,
unsigned int display_width, unsigned int display_height,
bool blank_guide);
diff --git a/tizen/src/maru_sdl.c b/tizen/src/maru_sdl.c
index cc118984da..dcd6aa93d4 100644
--- a/tizen/src/maru_sdl.c
+++ b/tizen/src/maru_sdl.c
@@ -29,7 +29,6 @@
*/
-#include <pthread.h>
#include <png.h>
#include "qemu/main-loop.h"
#include "emulator.h"
@@ -70,24 +69,27 @@ static unsigned int blank_cnt;
#define BLANK_GUIDE_IMAGE_NAME "blank-guide.png"
#ifdef SDL_THREAD
-pthread_mutex_t sdl_mutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_cond_t sdl_cond = PTHREAD_COND_INITIALIZER;
+QemuMutex sdl_mutex;
+QemuCond sdl_cond;
static int sdl_thread_initialized;
#endif
#define SDL_FLAGS (SDL_SWSURFACE | SDL_ASYNCBLIT | SDL_NOFRAME)
#define SDL_BPP 32
+static void qemu_update(void);
+
+
static void qemu_ds_sdl_update(DisplayChangeListener *dcl,
int x, int y, int w, int h)
{
/* call sdl update */
#ifdef SDL_THREAD
- pthread_mutex_lock(&sdl_mutex);
+ qemu_mutex_lock(&sdl_mutex);
- pthread_cond_signal(&sdl_cond);
+ qemu_cond_signal(&sdl_cond);
- pthread_mutex_unlock(&sdl_mutex);
+ qemu_mutex_unlock(&sdl_mutex);
#else
qemu_update();
#endif
@@ -251,7 +253,7 @@ static void qemu_ds_sdl_refresh(DisplayChangeListener *dcl)
#ifdef TARGET_ARM
#ifdef SDL_THREAD
- pthread_mutex_lock(&sdl_mutex);
+ qemu_mutex_lock(&sdl_mutex);
#endif
/*
@@ -262,7 +264,7 @@ static void qemu_ds_sdl_refresh(DisplayChangeListener *dcl)
SDL_UpdateRect(surface_screen, 0, 0, 0, 0);
#ifdef SDL_THREAD
- pthread_mutex_unlock(&sdl_mutex);
+ qemu_mutex_unlock(&sdl_mutex);
#endif
#endif
}
@@ -274,7 +276,7 @@ DisplayChangeListenerOps maru_dcl_ops = {
.dpy_refresh = qemu_ds_sdl_refresh,
};
-void maruskin_sdl_interpolation(bool on)
+void maru_sdl_interpolation(bool on)
{
if (on == true) {
INFO("set PIXMAN_FILTER_BEST filter for image processing\n");
@@ -358,13 +360,13 @@ static void qemu_update(void)
static void *run_qemu_update(void *arg)
{
while(1) {
- pthread_mutex_lock(&sdl_mutex);
+ qemu_mutex_lock(&sdl_mutex);
- pthread_cond_wait(&sdl_cond, &sdl_mutex);
+ qemu_cond_wait(&sdl_cond, &sdl_mutex);
qemu_update();
- pthread_mutex_unlock(&sdl_mutex);
+ qemu_mutex_unlock(&sdl_mutex);
}
return NULL;
@@ -389,7 +391,7 @@ static void maru_sdl_resize_bh(void *opaque)
sdl_skip_update = 0;
#ifdef SDL_THREAD
- pthread_mutex_lock(&sdl_mutex);
+ qemu_mutex_lock(&sdl_mutex);
#endif
/* get current setting information and calculate screen size */
@@ -429,7 +431,7 @@ static void maru_sdl_resize_bh(void *opaque)
get_emul_sdl_bpp(), SDL_GetError());
#ifdef SDL_THREAD
- pthread_mutex_unlock(&sdl_mutex);
+ qemu_mutex_unlock(&sdl_mutex);
#endif
return;
@@ -464,7 +466,7 @@ static void maru_sdl_resize_bh(void *opaque)
}
#ifdef SDL_THREAD
- pthread_mutex_unlock(&sdl_mutex);
+ qemu_mutex_unlock(&sdl_mutex);
#endif
graphic_hw_invalidate(NULL);
@@ -493,16 +495,25 @@ static void maru_sdl_init_bh(void *opaque)
INFO("sdl update thread create\n");
- pthread_t thread_id;
- if (pthread_create(&thread_id, NULL, run_qemu_update, NULL) != 0) {
- ERR("pthread_create fail\n");
- return;
- }
+ QemuThread sdl_thread;
+ qemu_thread_create(&sdl_thread, "sdl-workthread", run_qemu_update,
+ NULL, QEMU_THREAD_JOINABLE);
}
#endif
}
-void maruskin_sdl_init(uint64 swt_handle,
+void maru_sdl_pre_init(void) {
+ sdl_init_bh = qemu_bh_new(maru_sdl_init_bh, NULL);
+ sdl_resize_bh = qemu_bh_new(maru_sdl_resize_bh, NULL);
+ sdl_update_bh = qemu_bh_new(maru_sdl_update_bh, NULL);
+
+#ifdef SDL_THREAD
+ qemu_mutex_init(&sdl_mutex);
+ qemu_cond_init(&sdl_cond);
+#endif
+}
+
+void maru_sdl_init(uint64 swt_handle,
unsigned int display_width, unsigned int display_height,
bool blank_guide)
{
@@ -512,10 +523,6 @@ void maruskin_sdl_init(uint64 swt_handle,
INFO("maru sdl init\n");
- sdl_init_bh = qemu_bh_new(maru_sdl_init_bh, NULL);
- sdl_resize_bh = qemu_bh_new(maru_sdl_resize_bh, NULL);
- sdl_update_bh = qemu_bh_new(maru_sdl_update_bh, NULL);
-
sprintf(SDL_windowhack, "%ld", window_id);
g_setenv("SDL_WINDOWID", SDL_windowhack, 1);
@@ -524,7 +531,7 @@ void maruskin_sdl_init(uint64 swt_handle,
set_emul_resolution(display_width, display_height);
set_emul_sdl_bpp(SDL_BPP);
- maruskin_sdl_interpolation(false);
+ maru_sdl_interpolation(false);
init_multi_touch_state();
if (blank_guide_enable == true) {
@@ -534,7 +541,7 @@ void maruskin_sdl_init(uint64 swt_handle,
qemu_bh_schedule(sdl_init_bh);
}
-void maruskin_sdl_quit(void)
+void maru_sdl_quit(void)
{
INFO("maru sdl quit\n");
@@ -556,32 +563,32 @@ void maruskin_sdl_quit(void)
sdl_alteration = -1;
#ifdef SDL_THREAD
- pthread_mutex_lock(&sdl_mutex);
+ qemu_mutex_lock(&sdl_mutex);
#endif
SDL_Quit();
#ifdef SDL_THREAD
- pthread_mutex_unlock(&sdl_mutex);
- pthread_cond_destroy(&sdl_cond);
-#endif
+ qemu_mutex_unlock(&sdl_mutex);
+ qemu_cond_destroy(&sdl_cond);
- pthread_mutex_destroy(&sdl_mutex);
+ qemu_mutex_destroy(&sdl_mutex);
+#endif
}
-void maruskin_sdl_resize(void)
+void maru_sdl_resize(void)
{
INFO("maru sdl resize\n");
qemu_bh_schedule(sdl_resize_bh);
}
-void maruskin_sdl_update(void)
+void maru_sdl_update(void)
{
qemu_bh_schedule(sdl_update_bh);
}
-void maruskin_sdl_invalidate(bool on)
+void maru_sdl_invalidate(bool on)
{
sdl_invalidate = on;
}
diff --git a/tizen/src/maru_sdl.h b/tizen/src/maru_sdl.h
index e093627d74..342f4d24d1 100644
--- a/tizen/src/maru_sdl.h
+++ b/tizen/src/maru_sdl.h
@@ -38,13 +38,14 @@
extern DisplayChangeListenerOps maru_dcl_ops;
-void maruskin_sdl_init(uint64 swt_handle,
+void maru_sdl_pre_init(void);
+void maru_sdl_init(uint64 swt_handle,
unsigned int display_width, unsigned int display_height,
bool blank_guide);
-void maruskin_sdl_resize(void);
-void maruskin_sdl_update(void);
-void maruskin_sdl_invalidate(bool on);
-void maruskin_sdl_interpolation(bool on);
-void maruskin_sdl_quit(void);
+void maru_sdl_resize(void);
+void maru_sdl_update(void);
+void maru_sdl_invalidate(bool on);
+void maru_sdl_interpolation(bool on);
+void maru_sdl_quit(void);
#endif /* MARU_SDL_H_ */
diff --git a/tizen/src/maru_shm.c b/tizen/src/maru_shm.c
index 5efb83cd66..86ad700383 100644
--- a/tizen/src/maru_shm.c
+++ b/tizen/src/maru_shm.c
@@ -213,7 +213,7 @@ DisplayChangeListenerOps maru_dcl_ops = {
.dpy_gfx_switch = qemu_ds_shm_switch,
};
-void maruskin_shm_init(uint64 swt_handle,
+void maru_shm_init(uint64 swt_handle,
unsigned int display_width, unsigned int display_height,
bool blank_guide)
{
@@ -266,7 +266,7 @@ void maruskin_shm_init(uint64 swt_handle,
INFO("Memory attached at 0x%X\n", (int)shared_memory);
}
-void maruskin_shm_quit(void)
+void maru_shm_quit(void)
{
struct shmid_ds shm_info;
@@ -298,7 +298,7 @@ void maruskin_shm_quit(void)
}
}
-void maruskin_shm_resize(void)
+void maru_shm_resize(void)
{
shm_skip_update = 0;
}
diff --git a/tizen/src/maru_shm.h b/tizen/src/maru_shm.h
index ed2898874c..d24b1b69e0 100644
--- a/tizen/src/maru_shm.h
+++ b/tizen/src/maru_shm.h
@@ -35,10 +35,10 @@
extern DisplayChangeListenerOps maru_dcl_ops;
-void maruskin_shm_init(uint64 swt_handle,
+void maru_shm_init(uint64 swt_handle,
unsigned int display_width, unsigned int display_height,
bool blank_guide);
-void maruskin_shm_resize(void);
-void maruskin_shm_quit(void);
+void maru_shm_resize(void);
+void maru_shm_quit(void);
#endif /* MARU_SHM_H_ */
diff --git a/tizen/src/skin/maruskin_operation.c b/tizen/src/skin/maruskin_operation.c
index 3cc555fb64..b66c3db35e 100644
--- a/tizen/src/skin/maruskin_operation.c
+++ b/tizen/src/skin/maruskin_operation.c
@@ -90,7 +90,7 @@ void start_display(uint64 handle_id,
scale_factor, rotation_type, blank_guide);
set_emul_win_scale(scale_factor);
- maruskin_init(handle_id,
+ maru_ds_surface_init(handle_id,
display_width, display_height, blank_guide);
}
diff --git a/tizen/src/skin/maruskin_server.c b/tizen/src/skin/maruskin_server.c
index 49454c06d8..7a7cae3c6c 100644
--- a/tizen/src/skin/maruskin_server.c
+++ b/tizen/src/skin/maruskin_server.c
@@ -28,30 +28,14 @@
*/
-#include "maru_common.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/time.h>
#include <pthread.h>
+#include "maru_common.h"
#include "maruskin_server.h"
#include "maruskin_operation.h"
-#include "qemu/thread.h"
-#include "emul_state.h"
-#include "maruskin_client.h"
-#include "emulator.h"
+#include "maru_display.h"
#include "maru_err_table.h"
#include "ecs/ecs.h"
-#ifndef CONFIG_USE_SHM
-#include "maru_sdl.h"
-#else
-#include "maru_shm.h"
-#endif
-
#ifdef CONFIG_WIN32
#include <windows.h>
#include <winsock2.h>
@@ -59,7 +43,7 @@
#define SLEEP(x) Sleep(x)
#define SOCKET_CLOSE(sock) closesocket(sock)
-#define SOCKET_ERROR() WSAGetLastError()
+#define SOCKET_ERR() WSAGetLastError()
#else
#include <arpa/inet.h>
#include <netinet/in.h>
@@ -67,7 +51,7 @@
#define SLEEP(x) usleep(x * 1000)
#define SOCKET_CLOSE(sock) close(sock)
-#define SOCKET_ERROR() errno
+#define SOCKET_ERR() errno
#endif
#include "debug_ch.h"
@@ -752,7 +736,7 @@ static void* run_skin_server(void* args)
is_force_close_client = 0;
} else {
ERR("skin_server read error (%d): %d\n",
- SOCKET_ERROR(), read_cnt);
+ SOCKET_ERR(), read_cnt);
perror("skin_server read error : ");
}
@@ -1028,11 +1012,7 @@ static void* run_skin_server(void* args)
is_rotate = true;
}
-#ifndef CONFIG_USE_SHM
- maruskin_sdl_resize();
-#else
- maruskin_shm_resize();
-#endif
+ maru_display_resize();
/* after display resizing */
if (is_rotate == true && is_sensord_initialized == 1) {
diff --git a/ui/console.c b/ui/console.c
index 311e13c6bf..1d714e2624 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -30,8 +30,7 @@
#include "trace.h"
#ifdef SDL_THREAD
-#include <pthread.h>
-extern pthread_mutex_t sdl_mutex;
+extern QemuMutex sdl_mutex;
#endif
#define DEFAULT_BACKSCROLL 512
@@ -1324,7 +1323,7 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
}
if (dcl->ops->dpy_gfx_switch) {
#ifdef SDL_THREAD
- pthread_mutex_lock(&sdl_mutex);
+ qemu_mutex_lock(&sdl_mutex);
#endif
if (con) {
@@ -1337,7 +1336,7 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
}
#ifdef SDL_THREAD
- pthread_mutex_unlock(&sdl_mutex);
+ qemu_mutex_unlock(&sdl_mutex);
#endif
}
}
@@ -1409,7 +1408,7 @@ void dpy_gfx_replace_surface(QemuConsole *con,
DisplayChangeListener *dcl;
#ifdef SDL_THREAD
- pthread_mutex_lock(&sdl_mutex);
+ qemu_mutex_lock(&sdl_mutex);
#endif
con->surface = surface;
@@ -1423,7 +1422,7 @@ void dpy_gfx_replace_surface(QemuConsole *con,
}
#ifdef SDL_THREAD
- pthread_mutex_unlock(&sdl_mutex);
+ qemu_mutex_unlock(&sdl_mutex);
#endif
qemu_free_displaysurface(old_surface);