Removed old params, remove prealloc ram, other minor fixes 83/276783/1
authorVarinder Pratap <varinder.p@samsung.com>
Fri, 24 Jun 2022 10:49:11 +0000 (16:19 +0530)
committerVarinder Pratap <varinder.p@samsung.com>
Fri, 24 Jun 2022 11:07:06 +0000 (16:37 +0530)
Change-Id: I1b2837ef1a4a7def4dd1cd905edd5f8bb3924fdb
Signed-off-by: Varinder Pratap <varinder.p@samsung.com>
13 files changed:
hw/vigs/vigs_device.c
hw/vigs/vigs_qt5.cpp
hw/yagl/yagl_device.c
qapi/ui.json
softmmu/vl.c
tizen/emulator_configure.sh
tizen/src/emul_state.c
tizen/src/hw/Makefile.objs
tizen/src/hw/pci/maru_camera.c
tizen/src/hw/pci/maru_tuner_decoder.c
tizen/src/ui/menu/sdbhelper.cpp
util/oslib-posix.c
util/oslib-win32.c

index 0565f3678d5fc981df049aea1b9435d30bb4fc4f..ed33b2fa3545db7ced4103e41d4567a7ac3be562 100644 (file)
@@ -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);
 
index 91b743ee929ee9ed4ddd4ccadf88da7967eaea39..e33817a61e9a63343a32071aca0e1657166a48b5 100644 (file)
  *
  */
 
-
-extern "C" {
-#define QObject qemu_QObject
-#define QList qemu_QList
-#include "qemu/osdep.h"
-#undef QObject
-#undef QList
-}
-
+#include <stdio.h>
 #include <QGuiApplication>
 #include <QOpenGLContext>
 #include <qpa/qplatformnativeinterface.h>
+#include "config-host.h"
 #include "vigs_qt5.h"
 
 extern bool qt5IsOnscreen;
index 42af00f372e5e31aafe5f40e97793d14ee4985b8..2af93083ede6e7afdf329225ecc61cc2a8dc5dbe 100644 (file)
@@ -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;
 
index 3bfacfd74d5061b40f5d06f1ab51709d8561a351..b1852ecc7af258d2f0d484b40755b146376faf63 100644 (file)
 { 'enum'    : 'DisplayType',
   'data'    : [ 'default', 'none', 'gtk', 'sdl',
                 'egl-headless', 'curses', 'cocoa',
-                'spice-app','maru_remote_spice', 'maru_qt' ] }
+                'spice-app', 'maru_qt' ] }
 
 ##
 # @DisplayOptions:
index 23e4759fc49bb51ae3c4bffe0442d34c23c37175..413acb1ac6c33c0cd24f64b7c5c70b115301bf60 100644 (file)
 #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=<display>");
             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 */
 }
index aa71d86a1a6d01263e67ba88dbc8d50d79baa38d..385b54ba2877caaf855d6a81c69b77ebb053d6ab 100755 (executable)
@@ -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="
index 28d21a192b85cd4ad670de04d737f3f6acad9627..c4749333fd69d8ae937fdae85b7fda88c4cdba72 100644 (file)
@@ -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) {
index a72d5d6c071081f86f1579a362183c6c2f724727..197e5c0ae88e0cc942e058f3fde1fdf540347330 100644 (file)
@@ -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/
 
index 426e0d7d131eafa45ce3ec9dc810111207496e77..3e3ee932c0c588217a70f884a322cd5a766d93f7 100644 (file)
@@ -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;
index 8e937fb5b8e7fc95920111d5e7a40e284f363e83..5a7437b27906cdf7bd00b0e6a84f6ed22da81b05 100644 (file)
@@ -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
index 03a647385ac94190493afcf730f3268e0e19d677..6a7745fd252b9b02bd13a2914c6914cf3cea45d9 100644 (file)
@@ -28,6 +28,7 @@
  *
  */
 
+#include "config-host.h"
 #include "mainwindow.h"
 #include "displaybase.h"
 #include "sdbhelper.h"
index 6e13ad301abaf89b86932db5fa3e004974f5cee1..f2672713b17e7955b1e891fd898e306aa3102cd3 100644 (file)
@@ -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);
 
index 9167b58f9242a0ffa29a398a80595bd262d0c62b..3fe30b5eb3fe0d5caa6d7000418c03330200f4e0 100644 (file)
@@ -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);