From: Varinder Pratap Date: Fri, 24 Jun 2022 10:49:11 +0000 (+0530) Subject: Removed old params, remove prealloc ram, other minor fixes X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1de5dcf2a08ab98954e26ba9702e89e589526a99;p=sdk%2Femulator%2Fqemu.git Removed old params, remove prealloc ram, other minor fixes Change-Id: I1b2837ef1a4a7def4dd1cd905edd5f8bb3924fdb Signed-off-by: Varinder Pratap --- diff --git a/hw/vigs/vigs_device.c b/hw/vigs/vigs_device.c index 0565f3678d..ed33b2fa35 100644 --- a/hw/vigs/vigs_device.c +++ b/hw/vigs/vigs_device.c @@ -567,7 +567,7 @@ fail: static void vigs_device_reset(DeviceState *d) { - VIGSState *s = VIGS_DEVICE_PCI(d); + VIGSState *s = container_of(d, VIGSState, dev.qdev); vigs_server_reset(s->server); diff --git a/hw/vigs/vigs_qt5.cpp b/hw/vigs/vigs_qt5.cpp index 91b743ee92..e33817a61e 100644 --- a/hw/vigs/vigs_qt5.cpp +++ b/hw/vigs/vigs_qt5.cpp @@ -27,18 +27,11 @@ * */ - -extern "C" { -#define QObject qemu_QObject -#define QList qemu_QList -#include "qemu/osdep.h" -#undef QObject -#undef QList -} - +#include #include #include #include +#include "config-host.h" #include "vigs_qt5.h" extern bool qt5IsOnscreen; diff --git a/hw/yagl/yagl_device.c b/hw/yagl/yagl_device.c index 42af00f372..2af93083ed 100644 --- a/hw/yagl/yagl_device.c +++ b/hw/yagl/yagl_device.c @@ -384,7 +384,7 @@ fail: static void yagl_device_reset(DeviceState *d) { - YaGLState *s = YAGL_DEVICE_PCI(d); + YaGLState *s = container_of(d, YaGLState, dev.qdev); int i; YAGL_LOG_NO_TS; diff --git a/qapi/ui.json b/qapi/ui.json index 3bfacfd74d..b1852ecc7a 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1168,7 +1168,7 @@ { 'enum' : 'DisplayType', 'data' : [ 'default', 'none', 'gtk', 'sdl', 'egl-headless', 'curses', 'cocoa', - 'spice-app','maru_remote_spice', 'maru_qt' ] } + 'spice-app', 'maru_qt' ] } ## # @DisplayOptions: diff --git a/softmmu/vl.c b/softmmu/vl.c index 23e4759fc4..413acb1ac6 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -122,9 +122,6 @@ #include "tizen/src/ecs/ecs.h" #include "tizen/src/util/error_handler.h" #include "tizen/src/util/exported_strings.h" -#include "tizen/src/debug_ch.h" - -DECLARE_DEBUG_CHANNEL(vl_main); inline static bool is_maru_machine(MachineClass *mc) { return g_str_has_prefix(mc->name, "maru"); @@ -517,7 +514,6 @@ static QemuOptsList qemu_fw_cfg_opts = { # ifdef CONFIG_MARU static bool set_maru_display_option(void) { # ifdef CONFIG_QT -if (dpy.type == DISPLAY_TYPE_MARU_QT) { if (dpy.u.maru_qt.resolution != NULL) { char *endptr = NULL; // Resolution should be formed "640x480" or "640*480". @@ -537,7 +533,6 @@ if (dpy.type == DISPLAY_TYPE_MARU_QT) { if (dpy.u.maru_qt.forcelegacy == true) { maru_qt5_set_force_legacy(true); } -} #endif // CONFIG_QT return true; @@ -2012,15 +2007,6 @@ static void parse_display(const char *p) error_report("VNC requires a display argument vnc="); exit(1); } -#ifdef CONFIG_MARU - } else if (strstart(p, "maru_remote_spice", &opts)) { -# ifdef CONFIG_SPICE - dpy.type = DISPLAY_TYPE_MARU_REMOTE_SPICE; -# else - fprintf(stderr, "maru_remote_spice is disabled\n"); - exit(1); -# endif //CONFIG_SPICE -#endif /* CONFIG_MARU */ } else { parse_display_qapi(p); } @@ -2723,9 +2709,6 @@ static int global_init_func(void *opaque, QemuOpts *opts, Error **errp) } #if defined(CONFIG_MARU) -// W/A for preserve larger continuous heap for RAM. -extern void *preallocated_ram_ptr; -extern int preallocated_ram_size; // FIXME extern bool nodisplay; #endif //CONFIG_MARU @@ -2920,13 +2903,6 @@ void qemu_init(int argc, char **argv, char **envp) Error *main_loop_err = NULL; Error *err = NULL; bool list_data_dirs = false; -#ifdef CONFIG_YAGL - static bool yagl_enabled = false; -#endif /* CONFIG_YAGL */ -#ifdef CONFIG_VIGS - static bool vigs_enabled = false; - static char *vigs_backend = NULL; -#endif /* CONFIG_VIGS */ char *dir, **dirs; const char *mem_path = NULL; bool have_custom_ram_size; @@ -3531,30 +3507,6 @@ void qemu_init(int argc, char **argv, char **envp) olist = qemu_find_opts("machine"); qemu_opts_parse_noisily(olist, "accel=kvm", false); break; - case QEMU_OPTION_enable_yagl: -#if defined(CONFIG_YAGL) - yagl_enabled = true; -#else - fprintf(stderr, "YaGL openGLES passthrough support is disabled," - " ignoring -enable-yagl\n"); -#endif - break; - case QEMU_OPTION_enable_vigs: -#if defined(CONFIG_VIGS) - vigs_enabled = true; -#else - fprintf(stderr, "VIGS support is disabled," - " ignoring -enable-vigs\n"); -#endif - break; - case QEMU_OPTION_vigs_backend: -#if defined(CONFIG_VIGS) - vigs_backend = g_strdup(optarg); -#else - fprintf(stderr, "VIGS support is disabled," - " ignoring -vigs-backend\n"); -#endif - break; case QEMU_OPTION_M: case QEMU_OPTION_machine: olist = qemu_find_opts("machine"); @@ -3937,15 +3889,6 @@ void qemu_init(int argc, char **argv, char **envp) machine_class = select_machine(); object_set_machine_compat_props(machine_class->compat_props); -#if defined(CONFIG_MARU) - if (is_maru_machine(machine_class)) { - preallocated_ram_ptr = qemu_anon_ram_alloc(ram_size, NULL, true); - if (preallocated_ram_ptr) { - preallocated_ram_size = ram_size; - } - } -#endif //CONFIG_MARU - have_custom_ram_size = set_memory_options(&ram_slots, &maxram_size, machine_class); @@ -4221,10 +4164,14 @@ void qemu_init(int argc, char **argv, char **envp) "ignoring option"); } #if defined(CONFIG_MARU) - if (set_maru_display_option() == false) { - error_report("-display maru_qt is failed to parse resolution option, " + if (dpy.type == DISPLAY_TYPE_MARU_QT) { + if (set_maru_display_option() == false) { + error_report("-display maru_qt is failed to parse resolution option, " "ignoring option"); - } + } + } else if (dpy.type == DISPLAY_TYPE_NONE) { + nodisplay = true; + } #endif //CONFIG_MARU qemu_display_early_init(&dpy); qemu_console_early_init(); @@ -4423,21 +4370,6 @@ void qemu_init(int argc, char **argv, char **envp) current_machine->cpu_type = parse_cpu_option(cpu_option); } -#if defined(CONFIG_MARU) - if (is_maru_machine(machine_class)) { - kernel_cmdline = qemu_opt_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, &error_abort); - - current_machine->kernel_cmdline = (char *)kernel_cmdline; - if (dpy.type == DISPLAY_TYPE_NONE) { - nodisplay = true; - } - } -#endif //CONFIG_MARU - if (current_machine->ram_memdev_id) { Object *backend; ram_addr_t backend_size; @@ -4471,6 +4403,17 @@ void qemu_init(int argc, char **argv, char **envp) } } +#if defined(CONFIG_MARU) + if (is_maru_machine(machine_class)) { + // Returned variable points different address from input variable. + kernel_cmdline = prepare_maru(kernel_cmdline); + qemu_opt_set(qemu_get_machine_opts(), "append", + kernel_cmdline, &error_abort); + + current_machine->kernel_cmdline = (char *)kernel_cmdline; + } +#endif //CONFIG_MARU + parse_numa_opts(current_machine); if (machine_class->default_ram_id && current_machine->ram_size && @@ -4516,41 +4459,6 @@ void qemu_init(int argc, char **argv, char **envp) prepare_maru_after_device_init(); } #endif -#ifdef CONFIG_VIGS - // To support legacy VIGS options - if (vigs_enabled) { - PCIBus *pci_bus = (PCIBus *) object_resolve_path_type("", TYPE_PCI_BUS, NULL); - if (pci_bus == NULL) { - LOG_INFO("Failed to get PCI bus of VIGS\n"); - } - PCIDevice *pci_dev = pci_create(pci_bus, -1, "vigs"); - if (pci_dev == NULL) { - LOG_INFO("Failed to get PCI DEVICE of VIGS\n"); - } - if (vigs_backend) { - qdev_prop_set_string(&pci_dev->qdev, "backend", vigs_backend); - } else { - qdev_prop_set_string(&pci_dev->qdev, "backend", "gl"); - } - qdev_prop_set_string(&pci_dev->qdev, "wsi", "wsi0"); - qdev_init_nofail(&pci_dev->qdev); - } -#endif -#ifdef CONFIG_YAGL - // To support legacy YaGL options - if (yagl_enabled) { - PCIBus *pci_bus = (PCIBus *) object_resolve_path_type("", TYPE_PCI_BUS, NULL); - if (pci_bus == NULL) { - LOG_INFO("Failed to get PCI bus of YAGL\n"); - } - PCIDevice *pci_dev = pci_create(pci_bus, -1, "yagl"); - LOG_INFO("Failed to get PCI DEVICE of YAGL\n"); - if (vigs_enabled) { - qdev_prop_set_string(&pci_dev->qdev, "wsi", "wsi0"); - } - qdev_init_nofail(&pci_dev->qdev); - } -#endif /* Did we create any drives that we failed to create a device for? */ drive_check_orphaned(); @@ -4698,5 +4606,10 @@ void qemu_cleanup(void) monitor_cleanup(); qemu_chr_cleanup(); user_creatable_cleanup(); +#if defined(CONFIG_MARU) + if (dpy.type == DISPLAY_TYPE_MARU_QT) { + maru_qt5_display_fini(); + } +#endif /* TODO: unref root container, check all devices are ok */ } diff --git a/tizen/emulator_configure.sh b/tizen/emulator_configure.sh index aa71d86a1a..385b54ba28 100755 --- a/tizen/emulator_configure.sh +++ b/tizen/emulator_configure.sh @@ -154,8 +154,8 @@ CONFIGURE_APPEND=" --disable-sheepdog --disable-plugins --disable-modules - --enable-debug - --enable-debug-info + --disable-auth-pam + --extra-cflags=-Wno-error=stringop-truncation $CONFIGURE_APPEND" CONFIGURE_APPEND_WIN=" diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index 28d21a192b..c4749333fd 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -169,11 +169,6 @@ const char *get_kernel_log_redirect_file(void) // emulator log file static const char *log_redirect_file = NULL; -#ifdef CONFIG_WIN32 -// for checking Windows version -extern OSVERSIONINFO osvi; -#endif - const char *get_log_redirect_file(void) { int result = -1; @@ -189,23 +184,22 @@ const char *get_log_redirect_file(void) result = fcntl(STDOUT_FILENO, F_GETPATH, log_filename); #elif defined(CONFIG_WIN32) // works only vista or newer... - if (osvi.dwMajorVersion >= 6) { - char win32_log_filename_normalized[PATH_MAX]; - HANDLE handle_stdout = GetStdHandle(STD_OUTPUT_HANDLE); - DWORD ret = GetFinalPathNameByHandle(handle_stdout, - win32_log_filename_normalized, - PATH_MAX, FILE_NAME_NORMALIZED); - // strip "\\?\" - if (ret > 0) { - g_stpcpy(log_filename, win32_log_filename_normalized + 4); - result = 0; - } else { - result = -1; - } + char win32_log_filename_normalized[PATH_MAX]; + HANDLE handle_stdout = GetStdHandle(STD_OUTPUT_HANDLE); + DWORD ret = GetFinalPathNameByHandle(handle_stdout, + win32_log_filename_normalized, + PATH_MAX, FILE_NAME_NORMALIZED); + // strip "\\?\" + if (ret > 0) { + g_stpcpy(log_filename, win32_log_filename_normalized + 4); + result = 0; + } else { + result = -1; } #endif if (log_redirect_file) { g_free((void *)log_redirect_file); + log_redirect_file = NULL; } if (result >= 0) { diff --git a/tizen/src/hw/Makefile.objs b/tizen/src/hw/Makefile.objs index a72d5d6c07..197e5c0ae8 100644 --- a/tizen/src/hw/Makefile.objs +++ b/tizen/src/hw/Makefile.objs @@ -1,5 +1,5 @@ -obj-y += maru_board.o maru_pm.o - +#obj-y += maru_board.o +obj-y += maru_pm.o obj-y += pci/ obj-y += virtio/ diff --git a/tizen/src/hw/pci/maru_camera.c b/tizen/src/hw/pci/maru_camera.c index 426e0d7d13..3e3ee932c0 100644 --- a/tizen/src/hw/pci/maru_camera.c +++ b/tizen/src/hw/pci/maru_camera.c @@ -63,7 +63,7 @@ marucam_mmio_read(void *opaque, uint64_t ret = 0; MaruCamState *state = (MaruCamState *)opaque; - switch (addr) { + switch (addr & 0xFF) { /* Passes the index into the kernel driver */ case MARUCAM_CMD_INIT: ret = state->index; @@ -123,7 +123,7 @@ marucam_mmio_write(void *opaque, } state->ret_val = 0; - switch (addr) { + switch (addr & 0xFF) { case MARUCAM_CMD_OPEN: state->backend->open(state); break; diff --git a/tizen/src/hw/pci/maru_tuner_decoder.c b/tizen/src/hw/pci/maru_tuner_decoder.c index 8e937fb5b8..5a7437b279 100644 --- a/tizen/src/hw/pci/maru_tuner_decoder.c +++ b/tizen/src/hw/pci/maru_tuner_decoder.c @@ -2416,7 +2416,7 @@ static void maru_tuner_decoder_class_init(ObjectClass *klass, void *data) PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); #ifdef QTEST_TIZEN - k->init = maru_tuner_decoder_qtest_initfn; + k->realize = maru_tuner_decoder_qtest_initfn; #else k->realize = maru_tuner_decoder_initfn; #endif diff --git a/tizen/src/ui/menu/sdbhelper.cpp b/tizen/src/ui/menu/sdbhelper.cpp index 03a647385a..6a7745fd25 100644 --- a/tizen/src/ui/menu/sdbhelper.cpp +++ b/tizen/src/ui/menu/sdbhelper.cpp @@ -28,6 +28,7 @@ * */ +#include "config-host.h" #include "mainwindow.h" #include "displaybase.h" #include "sdbhelper.h" diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 6e13ad301a..f2672713b1 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -175,7 +175,7 @@ void *qemu_oom_check(void *ptr) error_report("Failed to allocate memory: %s", strerror(errno)); #else fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno)); -#endif +#endif //CONFIG_MARU abort(); } return ptr; @@ -210,23 +210,9 @@ void *qemu_memalign(size_t alignment, size_t size) return qemu_oom_check(qemu_try_memalign(alignment, size)); } -#ifdef CONFIG_MARU -void *preallocated_ram_ptr = NULL; -int preallocated_ram_size = -1; -#endif - - /* alloc shared memory pages */ void *qemu_anon_ram_alloc(size_t size, uint64_t *alignment, bool shared) { -#ifdef CONFIG_MARU - if (size == preallocated_ram_size && preallocated_ram_ptr) { - void *ptr = preallocated_ram_ptr; - preallocated_ram_ptr = NULL; - preallocated_ram_size = -1; - return ptr; - } -#endif size_t align = QEMU_VMALLOC_ALIGN; void *ptr = qemu_ram_mmap(-1, size, align, shared, false); diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 9167b58f92..3fe30b5eb3 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -82,26 +82,10 @@ static int get_allocation_granularity(void) return system_info.dwAllocationGranularity; } -#ifdef CONFIG_MARU -void *preallocated_ram_ptr = NULL; -int preallocated_ram_size = -1; -#endif - void *qemu_anon_ram_alloc(size_t size, uint64_t *align, bool shared) { void *ptr; - /* FIXME: this is not exactly optimal solution since VirtualAlloc - has 64Kb granularity, but at least it guarantees us that the - memory is page aligned. */ -#ifdef CONFIG_MARU - if (size == preallocated_ram_size && preallocated_ram_ptr) { - void *ptr = preallocated_ram_ptr; - preallocated_ram_ptr = NULL; - preallocated_ram_size = -1; - return ptr; - } -#endif ptr = VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE); trace_qemu_anon_ram_alloc(size, ptr);