display: select display type with display options. 22/29522/3
authorGiWoong Kim <giwoong.kim@samsung.com>
Wed, 29 Oct 2014 04:50:03 +0000 (13:50 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Wed, 29 Oct 2014 08:10:31 +0000 (17:10 +0900)
Select display type with display options - DT_MARU_SDL, DT_MARU_SHM.
Clean-up definitions and display type names.

Change-Id: I67a551db1d39e39afa49b92d3ac65ac8b4946b40
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
include/sysemu/sysemu.h
tizen/src/display/Makefile.objs
tizen/src/display/maru_display.c
tizen/src/display/maru_display.h
tizen/src/display/maru_sdl.c
tizen/src/display/maru_sdl.h
tizen/src/display/maru_shm.c
tizen/src/display/maru_shm.h
tizen/src/skin/maruskin_client.c
tizen/src/skin/maruskin_operation.c
vl.c

index 0a44fcef0ed21474c7b1a1d4dc9f2d3c957a8a2c..dd7f17430706a2f357757f1d607c295e16108330 100644 (file)
@@ -98,7 +98,8 @@ typedef enum DisplayType
     DT_GTK,
     DT_NOGRAPHIC,
 #ifdef CONFIG_MARU
-    DT_MARU,
+    DT_MARU_SDL,
+    DT_MARU_SHM,
 #endif
     DT_NONE,
 } DisplayType;
index 3660db9ee4630b6b6906dc739d5f416f561bfe27..b546ca2ef36971659fb351ff7762e7630ddc5627 100644 (file)
@@ -1,10 +1,7 @@
 obj-y += maru_display.o
-ifdef CONFIG_USE_SHM
-obj-y += maru_shm.o
-else
-ifdef CONFIG_SDL
-obj-y += maru_sdl.o maru_sdl_processing.o maru_finger.o
-endif
-endif
+
+obj-$(CONFIG_USE_SHM) += maru_shm.o
+
+obj-$(CONFIG_SDL) += maru_sdl.o maru_sdl_processing.o maru_finger.o
 
 $(obj)/maru_display.o $(obj)/maru_sdl.o $(obj)/maru_sdl_processing.o $(obj)/maru_finger.o: QEMU_CFLAGS += $(SDL_CFLAGS)
index 7616657a24566de6ecee975bc6cdf125608983e0..fcf229e213aa3ce270ed884b3dcdac2fa0430fb8 100644 (file)
 
 
 #include "emulator.h"
-#include "emulator_common.h"
 #include "maru_display.h"
 #include "debug_ch.h"
 
-#ifndef CONFIG_USE_SHM
-#ifdef CONFIG_SDL
-#include "maru_sdl.h"
-#endif
-#else
-#include "maru_shm.h"
-#endif
-
 MULTI_DEBUG_CHANNEL(tizen, display);
 
 MaruScreenShot* screenshot = NULL;
 
+static MaruDisplayChangeListener *mdcl;
+
 static void maru_display_fini(void)
 {
     INFO("fini qemu display\n");
 
     g_free(screenshot);
 
-#ifndef CONFIG_USE_SHM
-#ifdef CONFIG_SDL
-    maru_sdl_quit();
-#endif
-#else
-    maru_shm_quit();
-#endif
+    if (mdcl->fini) {
+        mdcl->fini();
+    }
+
+    g_free(mdcl);
 }
 
 static void maru_display_notify_exit(Notifier *notifier, void *data) {
@@ -65,28 +56,28 @@ static void maru_display_notify_exit(Notifier *notifier, void *data) {
 }
 static Notifier maru_display_exit = { .notify = maru_display_notify_exit };
 
-//TODO: interface
-void maru_display_init(DisplayState *ds)
+void maru_display_init(DisplayState *ds, DisplayType display_type, int full_screen)
 {
     INFO("init qemu display\n");
 
-#ifndef CONFIG_USE_SHM
+    mdcl = g_malloc0(sizeof(MaruDisplayChangeListener));
+
+    switch (display_type) {
 #ifdef CONFIG_SDL
-    maru_sdl_pre_init();
+    case DT_MARU_SDL:
+        maru_sdl_pre_init(mdcl);
+        break;
 #endif
-#else
-    maru_shm_pre_init();
+#ifdef CONFIG_USE_SHM
+    case DT_MARU_SHM:
+        maru_shm_pre_init(mdcl);
+        break;
 #endif
-
-    /*  graphics context information */
-    DisplayChangeListener *dcl;
-
-    dcl = g_malloc0(sizeof(DisplayChangeListener));
-#if defined(CONFIG_USE_SHM) || defined(CONFIG_SDL)
-    //FIXME
-    dcl->ops = &maru_dcl_ops;
-#endif
-    register_displaychangelistener(dcl);
+    default:
+        ERR("can not enter here.\n");
+        // can not enter here...
+        break;
+    }
 
     screenshot = g_malloc0(sizeof(MaruScreenShot));
     screenshot->pixels = NULL;
@@ -98,61 +89,40 @@ void maru_display_init(DisplayState *ds)
 
 void maru_display_resize(void)
 {
-#ifndef CONFIG_USE_SHM
-#ifdef CONFIG_SDL
-    maru_sdl_resize();
-#endif
-#else
-    maru_shm_resize();
-#endif
+    if (mdcl->resize) {
+        mdcl->resize();
+    }
 }
 
 void maru_display_update(void)
 {
-#ifndef CONFIG_USE_SHM
-#ifdef CONFIG_SDL
-    maru_sdl_update();
-#endif
-#else
-    maru_shm_update();
-#endif
+    if (mdcl->update) {
+        mdcl->update();
+    }
 }
 
-void maru_display_invalidate(bool on)
+void maru_display_set_invalidate(bool on)
 {
-#ifndef CONFIG_USE_SHM
-#ifdef CONFIG_SDL
-    maru_sdl_invalidate(on);
-#endif
-#else
-    /* do nothing */
-#endif
+    if (mdcl->set_invalidate) {
+        mdcl->set_invalidate(on);
+    }
 }
 
-void maru_display_interpolation(bool on)
+void maru_display_set_interpolation(bool on)
 {
-#ifndef CONFIG_USE_SHM
-#ifdef CONFIG_SDL
-    maru_sdl_interpolation(on);
-#endif
-#else
-    /* do nothing */
-#endif
+    if (mdcl->set_interpolation) {
+        mdcl->set_interpolation(on);
+    }
 }
 
 void maru_ds_surface_init(uint64 swt_handle,
     unsigned int display_width, unsigned int display_height,
     bool blank_guide)
 {
-#ifndef CONFIG_USE_SHM
-#ifdef CONFIG_SDL
-    maru_sdl_init(swt_handle,
-        display_width, display_height, blank_guide);
-#endif
-#else
-    maru_shm_init(swt_handle,
-        display_width, display_height, blank_guide);
-#endif
+    if (mdcl->surface_init) {
+        mdcl->surface_init(swt_handle, display_width,
+                display_height, blank_guide);
+    }
 }
 
 MaruScreenShot *get_screenshot(void)
index c9c4552912d3e15027b6d6a9c3ab403fa2fc7225..8c746f26cda0d65026d97dd4f0b1f153804560f8 100644 (file)
 #ifndef __MARU_DISPLAY_H__
 #define __MARU_DISPLAY_H__
 
+#include "sysemu/sysemu.h"
 #include "ui/console.h"
 
+typedef struct {
+    void (*surface_init)(uint64 swt_handle,
+            unsigned int display_width, unsigned int display_height,
+            bool blank_guide);
+    void (*fini)(void);
+
+    void (*resize)(void);
+    void (*update)(void);
+    void (*set_invalidate)(bool);
+    void (*set_interpolation)(bool);
+} MaruDisplayChangeListener;
+
 typedef struct MaruScreenShot {
     unsigned char *pixels;
     bool request;
     bool ready;
 } MaruScreenShot;
 
-void maru_display_init(DisplayState *ds);
+void maru_display_init(DisplayState *ds, DisplayType display_type, int full_screen);
 void maru_display_resize(void);
 void maru_display_update(void);
-void maru_display_invalidate(bool on);
-void maru_display_interpolation(bool on);
+void maru_display_set_invalidate(bool on);
+void maru_display_set_interpolation(bool on);
+
 void maru_ds_surface_init(uint64 swt_handle,
     unsigned int display_width, unsigned int display_height,
     bool blank_guide);
@@ -51,4 +65,10 @@ void maru_ds_surface_init(uint64 swt_handle,
 MaruScreenShot *get_screenshot(void);
 void save_screenshot(DisplaySurface *surface);
 
+// maru_sdl
+void maru_sdl_pre_init(MaruDisplayChangeListener *mdcl);
+
+// maru_shm
+void maru_shm_pre_init(MaruDisplayChangeListener *mdcl);
+
 #endif /* __MARU_DISPLAY_H__ */
index 88697b2e0081f85492cb5f5b5cf4cae138099cf9..43aea68c07f54395ac4975a99f553c7593fdd418 100644 (file)
@@ -34,7 +34,6 @@
 #include "emulator.h"
 #include "emul_state.h"
 #include "maru_display.h"
-#include "maru_sdl.h"
 #include "maru_sdl_processing.h"
 #include "hw/pci/maru_brightness.h"
 #include "debug_ch.h"
@@ -48,6 +47,8 @@
 
 MULTI_DEBUG_CHANNEL(tizen, maru_sdl);
 
+static DisplayChangeListener *dcl;
+
 static QEMUBH *sdl_init_bh;
 static QEMUBH *sdl_resize_bh;
 static QEMUBH *sdl_update_bh;
@@ -280,28 +281,13 @@ static void qemu_ds_sdl_refresh(DisplayChangeListener *dcl)
 #endif
 }
 
-DisplayChangeListenerOps maru_dcl_ops = {
+static DisplayChangeListenerOps dcl_ops = {
     .dpy_name          = "maru_sdl",
     .dpy_gfx_update    = qemu_ds_sdl_update,
     .dpy_gfx_switch    = qemu_ds_sdl_switch,
     .dpy_refresh       = qemu_ds_sdl_refresh,
 };
 
-void maru_sdl_interpolation(bool on)
-{
-    if (on == true) {
-        INFO("set PIXMAN_FILTER_BEST filter for image processing\n");
-
-        /* PIXMAN_FILTER_BILINEAR */
-        sdl_pixman_filter = PIXMAN_FILTER_BEST;
-    } else {
-        INFO("set PIXMAN_FILTER_FAST filter for image processing\n");
-
-        /* PIXMAN_FILTER_NEAREST */
-        sdl_pixman_filter = PIXMAN_FILTER_FAST;
-    }
-}
-
 static void qemu_update(void)
 {
     if (sdl_alteration < 0) {
@@ -502,6 +488,8 @@ static void maru_sdl_init_bh(void *opaque)
     SDL_GetWMInfo(&info);
 #endif
 
+    sdl_resize_bh = qemu_bh_new(maru_sdl_resize_bh, NULL);
+    sdl_update_bh = qemu_bh_new(maru_sdl_update_bh, NULL);
     qemu_bh_schedule(sdl_resize_bh);
 
 #ifdef SDL_THREAD
@@ -517,46 +505,7 @@ static void maru_sdl_init_bh(void *opaque)
 #endif
 }
 
-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)
-{
-    gchar SDL_windowhack[32] = { 0, };
-    long window_id = swt_handle;
-    blank_guide_enable = blank_guide;
-
-    INFO("maru sdl init\n");
-
-    sprintf(SDL_windowhack, "%ld", window_id);
-    g_setenv("SDL_WINDOWID", SDL_windowhack, 1);
-
-    INFO("register SDL environment variable. "
-        "(SDL_WINDOWID = %s)\n", SDL_windowhack);
-
-    set_emul_resolution(display_width, display_height);
-    set_emul_sdl_bpp(SDL_BPP);
-    maru_sdl_interpolation(false);
-    init_multi_touch_state();
-
-    if (blank_guide_enable == true) {
-        INFO("blank guide is on\n");
-    }
-
-    qemu_bh_schedule(sdl_init_bh);
-}
-
-void maru_sdl_quit(void)
+static void maru_sdl_quit(void)
 {
     INFO("maru sdl quit\n");
 
@@ -595,27 +544,98 @@ void maru_sdl_quit(void)
     qemu_cond_destroy(&sdl_cond);
     qemu_mutex_destroy(&sdl_mutex);
 #endif
+
+    unregister_displaychangelistener(dcl);
+    g_free(dcl);
 }
 
-void maru_sdl_resize(void)
+static void maru_sdl_resize(void)
 {
     INFO("maru sdl resize\n");
 
-    qemu_bh_schedule(sdl_resize_bh);
+    if (sdl_resize_bh != NULL) {
+        qemu_bh_schedule(sdl_resize_bh);
+    }
 }
 
-void maru_sdl_update(void)
+static void maru_sdl_update(void)
 {
     if (sdl_update_bh != NULL) {
         qemu_bh_schedule(sdl_update_bh);
     }
 }
 
-void maru_sdl_invalidate(bool on)
+static void maru_sdl_set_invalidate(bool on)
 {
     sdl_invalidate = on;
 }
 
+static void maru_sdl_set_interpolation(bool on)
+{
+    if (on == true) {
+        INFO("set PIXMAN_FILTER_BEST filter for image processing\n");
+
+        /* PIXMAN_FILTER_BILINEAR */
+        sdl_pixman_filter = PIXMAN_FILTER_BEST;
+    } else {
+        INFO("set PIXMAN_FILTER_FAST filter for image processing\n");
+
+        /* PIXMAN_FILTER_NEAREST */
+        sdl_pixman_filter = PIXMAN_FILTER_FAST;
+    }
+}
+
+static void maru_sdl_init(uint64 swt_handle,
+    unsigned int display_width, unsigned int display_height,
+    bool blank_guide)
+{
+    gchar SDL_windowhack[32] = { 0, };
+    long window_id = swt_handle;
+    blank_guide_enable = blank_guide;
+
+    INFO("maru sdl init\n");
+
+    sprintf(SDL_windowhack, "%ld", window_id);
+    g_setenv("SDL_WINDOWID", SDL_windowhack, 1);
+
+    INFO("register SDL environment variable. "
+        "(SDL_WINDOWID = %s)\n", SDL_windowhack);
+
+    set_emul_resolution(display_width, display_height);
+    set_emul_sdl_bpp(SDL_BPP);
+    maru_sdl_set_interpolation(false);
+    init_multi_touch_state();
+
+    if (blank_guide_enable == true) {
+        INFO("blank guide is on\n");
+    }
+
+    qemu_bh_schedule(sdl_init_bh);
+}
+
+void maru_sdl_pre_init(MaruDisplayChangeListener *mdcl)
+{
+    dcl = g_malloc0(sizeof(DisplayChangeListener));
+    dcl->ops = &dcl_ops;
+
+    mdcl->surface_init = maru_sdl_init;
+    mdcl->fini = maru_sdl_quit;
+
+    mdcl->resize = maru_sdl_resize;
+    mdcl->update = maru_sdl_update;
+    mdcl->set_invalidate = maru_sdl_set_invalidate;
+    mdcl->set_interpolation = maru_sdl_set_interpolation;
+
+    sdl_init_bh = qemu_bh_new(maru_sdl_init_bh, NULL);
+
+#ifdef SDL_THREAD
+    qemu_mutex_init(&sdl_mutex);
+    qemu_cond_init(&sdl_cond);
+#endif
+
+    register_displaychangelistener(dcl);
+}
+
 bool maru_extract_framebuffer(void *buffer)
 {
     uint32_t buffer_size = 0;
index 87e4ec877d94486f202a3677e0db489e819e61fa..9fa2f645b6dd396c7d42797cb156305bbf930768 100644 (file)
 #define MARU_SDL_H_
 
 #include "ui/console.h"
+#include "maru_display.h"
 
-extern DisplayChangeListenerOps maru_dcl_ops;
-
-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 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);
+void maru_sdl_pre_init(MaruDisplayChangeListener *mdcl);
 
 #endif /* MARU_SDL_H_ */
index 82d0cf56355dc016590ecab5c3fa1450afddac3b..12674d713ff7db5c7da0fc37e4789d8e1022b316 100644 (file)
@@ -33,9 +33,8 @@
 #include <sys/shm.h>
 
 #include "qemu/main-loop.h"
-#include "emul_state.h"
 #include "maru_display.h"
-#include "maru_shm.h"
+#include "emul_state.h"
 #include "hw/pci/maru_brightness.h"
 #include "skin/maruskin_server.h"
 #include "util/maru_err_table.h"
@@ -45,7 +44,7 @@
 
 MULTI_DEBUG_CHANNEL(tizen, maru_shm);
 
-static QEMUBH *shm_update_bh;
+static DisplayChangeListener *dcl;
 
 static DisplaySurface *dpy_surface;
 static void *shared_memory = (void *) 0;
@@ -201,24 +200,54 @@ static void qemu_ds_shm_refresh(DisplayChangeListener *dcl)
     }
 }
 
-static void maru_shm_update_bh(void *opaque)
-{
-    graphic_hw_invalidate(NULL);
-}
-
-DisplayChangeListenerOps maru_dcl_ops = {
+static DisplayChangeListenerOps dcl_ops = {
     .dpy_name          = "maru_shm",
     .dpy_refresh       = qemu_ds_shm_refresh,
     .dpy_gfx_update    = qemu_ds_shm_update,
     .dpy_gfx_switch    = qemu_ds_shm_switch,
 };
 
-void maru_shm_pre_init(void)
+static void maru_shm_quit(void)
+{
+    struct shmid_ds shm_info;
+
+    INFO("maru shm quit\n");
+
+    if (shmctl(skin_shmid, IPC_STAT, &shm_info) == -1) {
+        ERR("shmctl failed\n");
+        shm_info.shm_nattch = 0;
+    }
+
+    if (shmdt(shared_memory) == -1) {
+        ERR("shmdt failed\n");
+        perror("maru_vga: ");
+        return;
+    }
+    shared_memory = NULL;
+
+    if (shm_info.shm_nattch == 1) {
+        /* remove */
+        if (shmctl(skin_shmid, IPC_RMID, 0) == -1) {
+            INFO("segment was already removed\n");
+            perror("maru_vga: ");
+        } else {
+            INFO("shared memory was removed\n");
+        }
+    } else {
+        INFO("number of current attaches = %d\n",
+            (int)shm_info.shm_nattch);
+    }
+
+    unregister_displaychangelistener(dcl);
+    g_free(dcl);
+}
+
+static void maru_shm_resize(void)
 {
-    shm_update_bh = qemu_bh_new(maru_shm_update_bh, NULL);
+    shm_skip_update = 0;
 }
 
-void maru_shm_init(uint64 swt_handle,
+static void maru_shm_init(uint64 swt_handle,
     unsigned int display_width, unsigned int display_height,
     bool blank_guide)
 {
@@ -271,48 +300,18 @@ void maru_shm_init(uint64 swt_handle,
     INFO("Memory attached at 0x%X\n", (int)shared_memory);
 }
 
-void maru_shm_quit(void)
-{
-    struct shmid_ds shm_info;
-
-    INFO("maru shm quit\n");
-
-    if (shmctl(skin_shmid, IPC_STAT, &shm_info) == -1) {
-        ERR("shmctl failed\n");
-        shm_info.shm_nattch = 0;
-    }
 
-    if (shmdt(shared_memory) == -1) {
-        ERR("shmdt failed\n");
-        perror("maru_vga: ");
-        return;
-    }
-    shared_memory = NULL;
+void maru_shm_pre_init(MaruDisplayChangeListener *mdcl)
+{
+    dcl = g_malloc0(sizeof(DisplayChangeListener));
+    dcl->ops = &dcl_ops;
 
-    if (shm_info.shm_nattch == 1) {
-        /* remove */
-        if (shmctl(skin_shmid, IPC_RMID, 0) == -1) {
-            INFO("segment was already removed\n");
-            perror("maru_vga: ");
-        } else {
-            INFO("shared memory was removed\n");
-        }
-    } else {
-        INFO("number of current attaches = %d\n",
-            (int)shm_info.shm_nattch);
-    }
-}
+    mdcl->surface_init = maru_shm_init;
+    mdcl->fini = maru_shm_quit;
 
-void maru_shm_resize(void)
-{
-    shm_skip_update = 0;
-}
+    mdcl->resize = maru_shm_resize;
 
-void maru_shm_update(void)
-{
-    if (shm_update_bh != NULL) {
-        qemu_bh_schedule(shm_update_bh);
-    }
+    register_displaychangelistener(dcl);
 }
 
 bool maru_extract_framebuffer(void *buffer)
index e52d3898470e1c041b249d9039e5f61e8f1277c4..14eb281971167a13433e805a750b6d7402954a0f 100644 (file)
 #define MARU_SHM_H_
 
 #include "ui/console.h"
+#include "maru_display.h"
 
-extern DisplayChangeListenerOps maru_dcl_ops;
-
-void maru_shm_pre_init(void);
-void maru_shm_init(uint64 swt_handle,
-    unsigned int display_width, unsigned int display_height,
-    bool blank_guide);
-void maru_shm_resize(void);
-void maru_shm_quit(void);
-void maru_shm_update(void);
+void maru_shm_pre_init(MaruDisplayChangeListener *mdcl);
 
 #endif /* MARU_SHM_H_ */
index 5001a1cb52b47c4b6f0140e79f48ccf0935e6550..e6a97dc7a9517a7816a2120443bee14653ddf5b3 100644 (file)
@@ -112,11 +112,17 @@ static void *run_skin_client(void *arg)
 
     /* display */
     char buf_display_shm[8] = { 0, };
-#ifdef CONFIG_USE_SHM
-    strcpy(buf_display_shm, OPT_BOOLEAN_TRUE); /* maru_shm */
-#else
-    strcpy(buf_display_shm, OPT_BOOLEAN_FALSE); /* maru_sdl */
-#endif
+    switch (display_type) {
+    case DT_MARU_SDL:
+        strcpy(buf_display_shm, OPT_BOOLEAN_FALSE); /* maru_sdl */
+        break;
+    case DT_MARU_SHM:
+        strcpy(buf_display_shm, OPT_BOOLEAN_TRUE); /* maru_shm */
+        break;
+    default:
+        ERR("Can not enter here.\n");
+        break;
+    }
 
     /* input */
     char buf_input[12] = { 0, };
index 9ce874f8bb3c4c6efc6a6ceb91c6510d05a5c89c..f2611eced875c653619875a2cc0529751d084cad 100644 (file)
@@ -97,7 +97,7 @@ void do_grabbing_enable(bool on)
 {
     INFO("skin grabbing enable : %d\n", on);
 
-    maru_display_invalidate(on);
+    maru_display_set_invalidate(on);
 }
 
 void do_mouse_event(int button_type, int event_type,
@@ -562,7 +562,7 @@ void do_interpolation_enable(bool on)
 {
     INFO("interpolation enable : %d\n", on);
 
-    maru_display_interpolation(on);
+    maru_display_set_interpolation(on);
 }
 
 void do_ram_dump(void)
diff --git a/vl.c b/vl.c
index 7095d729a8e52851311b41382c5e25e44d970608..e68ed4dff80f2fc1e5271d80cdbf3cf800303dfd 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -2368,6 +2368,16 @@ static DisplayType select_display(const char *p)
         fprintf(stderr, "GTK support is disabled\n");
         exit(1);
 #endif
+#ifdef CONFIG_MARU
+# ifdef CONFIG_SDL
+    } else if (strstart(p, "maru_sdl", &opts)) {
+        display = DT_MARU_SDL;
+# endif
+# ifdef CONFIG_USE_SHM
+    } else if (strstart(p, "maru_shm", &opts)) {
+        display = DT_MARU_SHM;
+# endif
+#endif /* CONFIG_MARU */
     } else if (strstart(p, "none", &opts)) {
         display = DT_NONE;
     } else {
@@ -3001,8 +3011,6 @@ out:
 }
 
 #ifdef CONFIG_MARU
-int use_qemu_display = 0; //0:use tizen qemu sdl, 1:use original qemu sdl
-
 // W/A for preserve larger continuous heap for RAM.
 extern void *preallocated_ram_ptr;
 extern int preallocated_ram_size;
@@ -4258,7 +4266,15 @@ int main(int argc, char **argv, char **envp)
 
     if (display_type == DT_DEFAULT && !display_remote) {
 #if defined(CONFIG_MARU)
-        display_type = DT_MARU;
+        // FIXME: for compatibility...
+        // If no display_type is specified,
+        // we use DT_MARU_SDL on Linux, Windows and
+        // use DT_MARU_SHM on MacOS.
+#if defined(CONFIG_SDL)
+        display_type = DT_MARU_SDL;
+#elif defined(CONFIG_USE_SHM)
+        display_type = DT_MARU_SHM;
+#endif
 #elif defined(CONFIG_GTK)
         display_type = DT_GTK;
 #elif defined(CONFIG_SDL) || defined(CONFIG_COCOA)
@@ -4600,20 +4616,6 @@ int main(int argc, char **argv, char **envp)
         curses_display_init(ds, full_screen);
         break;
 #endif
-#if defined(CONFIG_MARU)
-#if defined(CONFIG_SDL) || defined(CONFIG_USE_SHM)
-    case DT_MARU:
-        maru_display_init(ds);
-        if (skin_disabled == 1) {
-            /* do not start skin client process */
-            set_emul_skin_enable(false);
-        } else {
-            set_emul_skin_enable(true);
-        }
-        start_skin();
-        break;
-#endif
-#endif
 #if defined(CONFIG_SDL)
     case DT_SDL:
         sdl_display_init(ds, full_screen, no_frame);
@@ -4627,6 +4629,21 @@ int main(int argc, char **argv, char **envp)
     case DT_GTK:
         gtk_display_init(ds, full_screen, grab_on_hover);
         break;
+#endif
+#if defined(CONFIG_MARU)
+#if defined(CONFIG_SDL) || defined(CONFIG_USE_SHM)
+    case DT_MARU_SDL:
+    case DT_MARU_SHM:
+        maru_display_init(ds, display_type, full_screen);
+        if (skin_disabled == 1) {
+            /* do not start skin client process */
+            set_emul_skin_enable(false);
+        } else {
+            set_emul_skin_enable(true);
+        }
+        start_skin();
+        break;
+#endif
 #endif
     default:
         break;