From: SeokYeon Hwang Date: Sun, 9 Aug 2015 07:50:34 +0000 (+0900) Subject: qt5: detached from maru_display X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~40^2~213 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c7cec5516e83cb0c38688f1b702405d8b51840de;p=sdk%2Femulator%2Fqemu.git qt5: detached from maru_display Detached initializing logic from maru_display to prepare removing JAVA UI. Change-Id: I7e281be5ca9e231dd505f3e077095836fdcc34c8 Signed-off-by: SeokYeon Hwang --- diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 7652c16fa5..1715a8146b 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -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; diff --git a/tizen/src/display/maru_display.c b/tizen/src/display/maru_display.c index 1a84dd44a7..9f97fa665e 100644 --- a/tizen/src/display/maru_display.c +++ b/tizen/src/display/maru_display.c @@ -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"); diff --git a/tizen/src/display/maru_display.h b/tizen/src/display/maru_display.h index caee72c542..67c9162a2d 100644 --- a/tizen/src/display/maru_display.h +++ b/tizen/src/display/maru_display.h @@ -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__ */ diff --git a/tizen/src/display/qt5.c b/tizen/src/display/qt5.c index e39875847d..ac830640a2 100644 --- a/tizen/src/display/qt5.c +++ b/tizen/src/display/qt5.c @@ -28,16 +28,20 @@ */ #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 index 0000000000..b1aac1c354 --- /dev/null +++ b/tizen/src/display/qt5.h @@ -0,0 +1,41 @@ +/* + * QT5 display driver + * + * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * GiWoong Kim + * SeokYeon Hwang + * + * 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 + +#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__ diff --git a/ui/console.c b/ui/console.c index 118da3e294..d79d43b4d0 100644 --- a/ui/console.c +++ b/ui/console.c @@ -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 190886c592..9a4034292e 100644 --- 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