qt5: detached from maru_display
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Sun, 9 Aug 2015 07:50:34 +0000 (16:50 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 10 Aug 2015 12:03:06 +0000 (21:03 +0900)
Detached initializing logic from maru_display to prepare
removing JAVA UI.

Change-Id: I7e281be5ca9e231dd505f3e077095836fdcc34c8
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
include/sysemu/sysemu.h
tizen/src/display/maru_display.c
tizen/src/display/maru_display.h
tizen/src/display/qt5.c
tizen/src/display/qt5.h [new file with mode: 0644]
ui/console.c
vl.c

index 7652c16fa562165a2bd1b506650cc855c5b19999..1715a8146b58aa17e03b67c0df06f78925589c4c 100644 (file)
@@ -101,10 +101,14 @@ typedef enum DisplayType
     DT_GTK,
     DT_NOGRAPHIC,
 #ifdef CONFIG_MARU
+# ifdef CONFIG_JAVA_UI
     DT_MARU_SDL,
     DT_MARU_SHM,
+# endif
+# ifdef CONFIG_QT
     DT_MARU_QT_ONSCREEN,
     DT_MARU_QT_OFFSCREEN,
+# endif
 #endif
     DT_NONE,
 } DisplayType;
index 1a84dd44a761e6fbcb693acb8a7477e060df39c2..9f97fa665e945f9b7b251e8bc3acde123668d2ca 100644 (file)
@@ -60,24 +60,6 @@ static void maru_display_notify_exit(Notifier *notifier, void *data)
 
 static Notifier maru_display_exit = { .notify = maru_display_notify_exit };
 
-void maru_display_early_init(DisplayType display_type)
-{
-    switch (display_type) {
-#ifdef CONFIG_QT
-    case DT_MARU_QT_ONSCREEN:
-        INFO("Display Type: Qt5 Onscreen\n");
-        maru_qt5_display_early_init(true);
-        break;
-    case DT_MARU_QT_OFFSCREEN:
-        INFO("Display Type: Qt5 Offscreen\n");
-        maru_qt5_display_early_init(false);
-        break;
-#endif
-    default:
-        break;
-    }
-}
-
 // FIXME
 #ifdef SDL_THREAD
 QemuMutex sdl_mutex;
@@ -103,17 +85,6 @@ void maru_display_init(DisplayState *ds, DisplayType display_type,
         maru_shm_pre_init(mdcl);
         break;
  #endif
-#endif
-#ifdef CONFIG_QT
-    case DT_MARU_QT_ONSCREEN:
-    case DT_MARU_QT_OFFSCREEN:
- #ifdef SDL_THREAD
-        // FIXME
-        qemu_mutex_init(&sdl_mutex);
- #endif
-
-        maru_qt5_display_init(mdcl, full_screen);
-        break;
 #endif
     default:
         ERR("can not enter here.\n");
index caee72c542d859b1977cd4df40a9a3ae7d15997e..67c9162a2df6982b881ad4575b44cd0abeec7179 100644 (file)
@@ -52,7 +52,6 @@ typedef struct MaruScreenShot {
     bool ready;
 } MaruScreenShot;
 
-void maru_display_early_init(DisplayType display_type);
 void maru_display_init(DisplayState *ds, DisplayType display_type,
                        int full_screen);
 void maru_display_resize(void);
@@ -72,11 +71,4 @@ void maru_sdl_pre_init(MaruDisplayChangeListener *mdcl);
 
 /* maru_shm */
 void maru_shm_pre_init(MaruDisplayChangeListener *mdcl);
-
-/* maru_qt */
-void maru_qt5_display_early_init(bool isOnscreen);
-
-void maru_qt5_display_init(MaruDisplayChangeListener *mdcl, int full_screen);
-
-void maru_qt5_display_quit(void);
 #endif /* __MARU_DISPLAY_H__ */
index e39875847d8183a6327f912393a9fdc65ad3c99f..ac830640a22f88e20266d3db2754a761c832e4c8 100644 (file)
  */
 
 #include "ui/console.h"
+
+#include "qt5.h"
 #include "emul_state.h"
-#include "maru_display.h"
 #include "qt5_supplement.h"
 #include "hw/pci/maru_brightness.h"
+#ifdef CONFIG_DARWIN
+#include "ns_event.h"
+#endif
+
 
 #include "util/new_debug_ch.h"
 
 DECLARE_DEBUG_CHANNEL(qt5_console);
 
-/* static Notifier mouse_mode_notifier; */
 static int qt5_num_outputs;
 
 static struct qt5_state {
@@ -120,13 +124,7 @@ static const DisplayChangeListenerOps dcl_ops = {
     .dpy_cursor_define = qt5_mouse_define,
 };
 
-#ifdef CONFIG_DARWIN
-void ns_run_in_event_loop(void (*func)());
-void ns_run_in_event_loop_with_bool(void (*func)(bool bArg), bool isTrue);
-void set_application_icon(char *path);
-#endif
-
-void maru_qt5_display_early_init(bool isOnscreen)
+void maru_early_qt5_display_init(bool isOnscreen)
 {
 #ifdef CONFIG_DARWIN
     ns_run_in_event_loop_with_bool(&qt5_early_prepare, isOnscreen);
@@ -147,17 +145,23 @@ void maru_qt5_display_early_init(bool isOnscreen)
 #else
     qt5_early_prepare(isOnscreen);
 #endif
+    if (isOnscreen) {
+        LOG_INFO("Display Type: QT5 Onscreen\n");
+    } else {
+        LOG_INFO("Display Type: QT5 Offscreen\n");
+    }
 }
 
-void maru_qt5_display_quit(void)
+static void maru_qt5_display_fini(void)
 {
     if (qt5_console) {
         g_free(qt5_console);
         qt5_console = NULL;
     }
+    qt5_destroy();
 }
 
-void maru_qt5_display_init(MaruDisplayChangeListener *mdcl, int full_screen)
+void maru_qt5_display_init(DisplayState *ds, int full_screen)
 {
     int i;
 
@@ -187,7 +191,7 @@ void maru_qt5_display_init(MaruDisplayChangeListener *mdcl, int full_screen)
     if (full_screen) {
         /* TODO */
     }
-    atexit(qt5_destroy);
+    atexit(maru_qt5_display_fini);
 
     /* TODO
     mouse_mode_notifier.notify = qt2_mouse_mode_change;
diff --git a/tizen/src/display/qt5.h b/tizen/src/display/qt5.h
new file mode 100644 (file)
index 0000000..b1aac1c
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * QT5 display driver
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef __QT5_H__
+#define __QT5_H__
+
+#include <stdbool.h>
+
+#include "sysemu/sysemu.h"
+
+void maru_early_qt5_display_init(bool isOnscreen);
+void maru_qt5_display_init(DisplayState *ds, int full_screen);
+
+void set_display_pixel_density(int dpi);
+
+#endif // __QT5_H__
index 118da3e294fe60392a6b56e319d1cc670831688f..d79d43b4d01d35229f73c65b2b7abb909b5d09a5 100644 (file)
@@ -31,6 +31,8 @@
 #include "exec/memory.h"
 
 #ifdef CONFIG_MARU
+#include "sysemu/sysemu.h"
+
 extern int initial_resolution_width;
 extern int initial_resolution_height;
 # ifdef SDL_THREAD
@@ -1358,7 +1360,9 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
     }
     if (dcl->ops->dpy_gfx_switch) {
 #ifdef SDL_THREAD
-        qemu_mutex_lock(&sdl_mutex);
+        if (display_type == DT_MARU_SDL) {
+            qemu_mutex_lock(&sdl_mutex);
+        }
 #endif
 
         if (con) {
@@ -1371,7 +1375,9 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
         }
 
 #ifdef SDL_THREAD
-        qemu_mutex_unlock(&sdl_mutex);
+        if (display_type == DT_MARU_SDL) {
+            qemu_mutex_unlock(&sdl_mutex);
+        }
 #endif
     }
     text_console_update_cursor(NULL);
@@ -1444,7 +1450,9 @@ void dpy_gfx_replace_surface(QemuConsole *con,
     DisplayChangeListener *dcl;
 
 #ifdef SDL_THREAD
-    qemu_mutex_lock(&sdl_mutex);
+    if (display_type == DT_MARU_SDL) {
+        qemu_mutex_lock(&sdl_mutex);
+    }
 #endif
 
     con->surface = surface;
@@ -1458,7 +1466,9 @@ void dpy_gfx_replace_surface(QemuConsole *con,
     }
 
 #ifdef SDL_THREAD
-    qemu_mutex_unlock(&sdl_mutex);
+    if (display_type == DT_MARU_SDL) {
+        qemu_mutex_unlock(&sdl_mutex);
+    }
 #endif
 
     qemu_free_displaysurface(old_surface);
diff --git a/vl.c b/vl.c
index 190886c592d8e9feadd633cf3118d6561a3972ed..9a4034292ea01ed694896377414836ad8a0254bf 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -133,9 +133,12 @@ int qemu_main(int argc, char **argv, char **envp);
 #ifdef CONFIG_MARU
 #include "tizen/src/emulator.h"
 #include "tizen/src/emul_state.h"
-#include "tizen/src/display/maru_display.h"
+#include "tizen/src/display/qt5.h"
 #include "tizen/src/skin/maruskin_operation.h"
 #include "tizen/src/ecs/ecs.h"
+# ifdef CONFIG_JAVA_UI
+#include "tizen/src/display/maru_display.h"
+# endif
 #endif
 
 #define DEFAULT_RAM_SIZE 128
@@ -4206,10 +4209,13 @@ int main(int argc, char **argv, char **envp)
 #endif
 
 #ifdef CONFIG_MARU
-    if (display_type == DT_MARU_QT_ONSCREEN ||
-            display_type == DT_MARU_QT_OFFSCREEN) {
-        maru_display_early_init(display_type);
+# if defined(CONFIG_QT)
+    if (display_type == DT_MARU_QT_ONSCREEN) {
+        maru_early_qt5_display_init(true);
+    } else if (display_type == DT_MARU_QT_OFFSCREEN) {
+        maru_early_qt5_display_init(false);
     }
+# endif
 #endif
 
     socket_init();
@@ -4532,7 +4538,7 @@ int main(int argc, char **argv, char **envp)
  #if defined(CONFIG_QT)
     case DT_MARU_QT_ONSCREEN:
     case DT_MARU_QT_OFFSCREEN:
-        maru_display_init(ds, display_type, full_screen);
+        maru_qt5_display_init(ds, full_screen);
         break;
  #endif
 #endif