From 1d0ecc4a405f43d571a6eb6250010fc4ccee114d Mon Sep 17 00:00:00 2001 From: SeokYeon Hwang Date: Fri, 21 Aug 2015 15:32:06 +0900 Subject: [PATCH] emulator: restricted tizen specific features Tizen specific features are activated on maru board only. Change-Id: I1fce2a4d8da5d17611144892ffd3f662de005833 Signed-off-by: SeokYeon Hwang --- tizen/emulator_configure.sh | 2 ++ tizen/src/emul_state.h | 3 ++- vl.c | 52 ++++++++++++++++++++++--------------- 3 files changed, 35 insertions(+), 22 deletions(-) diff --git a/tizen/emulator_configure.sh b/tizen/emulator_configure.sh index ab5dbbb399..51492fbb7e 100755 --- a/tizen/emulator_configure.sh +++ b/tizen/emulator_configure.sh @@ -107,6 +107,7 @@ CONFIGURE_APPEND=" --disable-pie --enable-virtfs --disable-xen + --enable-sdl --enable-java-ui $CONFIGURE_APPEND " @@ -123,6 +124,7 @@ CONFIGURE_APPEND=" --audio-drv-list=winwave --enable-hax --disable-vnc + --enable-sdl --enable-java-ui $CONFIGURE_APPEND " diff --git a/tizen/src/emul_state.h b/tizen/src/emul_state.h index fe1a73fff2..12e68f0765 100644 --- a/tizen/src/emul_state.h +++ b/tizen/src/emul_state.h @@ -33,8 +33,9 @@ #ifndef __EMUL_STATE_H__ #define __EMUL_STATE_H__ -#include "display/maru_finger.h" #include "config-host.h" + +#include "display/maru_finger.h" #include "hw/maru_device_ids.h" #define SUPPORT_LEGACY_ARGS diff --git a/vl.c b/vl.c index 1fb6182e81..809a65df9f 100644 --- a/vl.c +++ b/vl.c @@ -140,6 +140,9 @@ int qemu_main(int argc, char **argv, char **envp); # ifdef CONFIG_JAVA_UI #include "tizen/src/display/maru_display.h" # endif +inline static bool is_maru_machine(MachineClass *mc) { + return g_str_has_prefix(mc->name, "maru"); +} #endif #define DEFAULT_RAM_SIZE 128 @@ -1813,7 +1816,10 @@ void qemu_system_killed(int signal, pid_t pid) no_shutdown = 0; #ifdef CONFIG_MARU - qemu_system_graceful_shutdown_request(TIMEOUT_FOR_SHUTDOWN); + if (current_machine && + is_maru_machine(MACHINE_GET_CLASS(current_machine))) { + qemu_system_graceful_shutdown_request(TIMEOUT_FOR_SHUTDOWN); + } #else qemu_system_shutdown_request(); #endif @@ -4008,15 +4014,17 @@ int main(int argc, char **argv, char **envp) } #if defined(CONFIG_MARU) - preallocated_ram_ptr = qemu_anon_ram_alloc(ram_size, NULL); - if (preallocated_ram_ptr) { - preallocated_ram_size = ram_size; - } + if (is_maru_machine(machine_class)) { + preallocated_ram_ptr = qemu_anon_ram_alloc(ram_size, NULL); + if (preallocated_ram_ptr) { + preallocated_ram_size = ram_size; + } - kernel_cmdline = qemu_opt_get(qemu_get_machine_opts(), "append"); - // Returned variable points different address from input variable. - kernel_cmdline = prepare_maru(kernel_cmdline); - qemu_opt_set(qemu_get_machine_opts(), "append", kernel_cmdline); + kernel_cmdline = qemu_opt_get(qemu_get_machine_opts(), "append"); + // Returned variable points different address from input variable. + kernel_cmdline = prepare_maru(kernel_cmdline); + qemu_opt_set(qemu_get_machine_opts(), "append", kernel_cmdline); + } #endif /* Open the logfile at this point, if necessary. We can't open the logfile @@ -4168,17 +4176,7 @@ int main(int argc, char **argv, char **envp) } if (display_type == DT_DEFAULT && !display_remote) { -#if defined(CONFIG_MARU) - // If no display_type is specified, - // we use DT_MARU_QT_OFFSCREEN -#if defined(CONFIG_QT) - display_type = DT_MARU_QT_OFFSCREEN; -#elif defined(CONFIG_SDL) && defined(CONFIG_JAVA_UI) - display_type = DT_MARU_SDL; -#elif defined(CONFIG_USE_SHM) && defined(CONFIG_JAVA_UI) - display_type = DT_MARU_SHM; -#endif -#elif defined(CONFIG_GTK) +#if defined(CONFIG_GTK) display_type = DT_GTK; #elif defined(CONFIG_SDL) || defined(CONFIG_COCOA) display_type = DT_SDL; @@ -4465,7 +4463,9 @@ int main(int argc, char **argv, char **envp) exit(1); #if defined(CONFIG_MARU) - prepare_maru_after_device_init(); + if (is_maru_machine(machine_class)) { + prepare_maru_after_device_init(); + } #endif #ifdef CONFIG_VIGS // To support legacy VIGS options @@ -4528,6 +4528,11 @@ int main(int argc, char **argv, char **envp) #if defined(CONFIG_JAVA_UI) case DT_MARU_SDL: case DT_MARU_SHM: + if (!is_maru_machine(machine_class)) { + error_report("maru_sdl or maru_shm can not work" + " without maru machine"); + exit(1); + } maru_display_init(ds, display_type, full_screen); start_skin(skin_enabled); break; @@ -4535,6 +4540,11 @@ int main(int argc, char **argv, char **envp) #if defined(CONFIG_QT) case DT_MARU_QT_ONSCREEN: case DT_MARU_QT_OFFSCREEN: + if (!is_maru_machine(machine_class)) { + error_report("maru_qt can not work" + " without maru machine"); + exit(1); + } maru_qt5_display_init(ds, full_screen); break; #endif -- 2.34.1