From: varinder.p Date: Mon, 21 Mar 2022 17:52:01 +0000 (+0530) Subject: Untangled headers, enabled sdl,fixed pci and vritio devices. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bfcfeff3b86a03de98b60f23c75982e649f4eaac;p=sdk%2Femulator%2Fqemu.git Untangled headers, enabled sdl,fixed pci and vritio devices. Change-Id: I6763b9cfecc56ed83f729b6a485d806b7e87afc9 Signed-off-by: varinder.p --- diff --git a/configure b/configure index f03100329c..d9730ab9f4 100755 --- a/configure +++ b/configure @@ -628,6 +628,7 @@ QEMU_INCLUDES="-iquote . -iquote \$(SRC_PATH) -iquote \$(SRC_PATH)/accel/tcg -iq QEMU_INCLUDES="$QEMU_INCLUDES -iquote \$(SRC_PATH)/disas/libvixl" if test "$debug_info" = "yes"; then CFLAGS="-g $CFLAGS" + LDFLAGS="-g $LDFLAGS" fi # running configure in the source tree? @@ -1960,7 +1961,6 @@ disabled with --disable-FEATURE, default is enabled if available: libpmem libpmem support xkbcommon xkbcommon support qt Qt5 UI - hax HAX acceleration support yagl YaGL device yagl-stats YaGL stats vigs VIGS device @@ -3262,11 +3262,11 @@ if test "$qt" != "no"; then libs_softmmu="$qt_libs $x11_libs $libs_softmmu" fi - qt_cflags_private=`pkg-config --modversion Qt5Gui` + qt_cflags_private=`$pkg_config --modversion Qt5Gui` if test "$darwin" = "yes" ; then - qt_cflags_private=`pkg-config --cflags Qt5Gui | sed "s,QtGui.framework/Headers,&/$qt_cflags_private/QtGui,g"` + qt_cflags_private=`$pkg_config --cflags Qt5Gui | sed "s,QtGui.framework/Headers,&/$qt_cflags_private/QtGui,g"` else - qt_cflags_private=`pkg-config --cflags Qt5Gui | sed "s,QtGui,&/$qt_cflags_private/QtGui,g"` + qt_cflags_private=`$pkg_config --cflags Qt5Gui | sed "s,QtGui,&/$qt_cflags_private/QtGui,g"` fi qt_cflags="$qt_cflags $qt_cflags_private" @@ -5239,6 +5239,8 @@ if test "$libtizenusb" != "no" ; then else error_exit "libtizenusb not found (you might not be set PKG_CONFIG_PATH" fi + QEMU_CFLAGS="$QEMU_CFLAGS $libtizenusb_cflags" + libs_softmmu="$libs_softmmu $libtizenusb_libs" fi # check for libusb @@ -6690,8 +6692,8 @@ if test "$want_tools" = "yes" ; then fi fi if test "$softmmu" = yes ; then - if test "$linux" = yes; then - if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr" = yes ; then + if test "$virtfs" != no; then + if test "$cap_ng" = yes && test "$linux" = yes && test "$attr" = yes ; then virtfs=yes tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)" elif test "$maru" = yes && test "$darwin" = yes ; then @@ -7060,7 +7062,6 @@ echo "fuzzing support $fuzzing" #TIZEN echo "Qt support $qt" -echo "HAX support $hax" echo "YaGL support $yagl" echo "YaGL stats $yagl_stats" echo "VIGS support $vigs" diff --git a/hw/Makefile.objs b/hw/Makefile.objs index bd7fb3a2c7..2d668357b6 100644 --- a/hw/Makefile.objs +++ b/hw/Makefile.objs @@ -40,11 +40,9 @@ devices-dirs-$(CONFIG_MEM_DEVICE) += mem/ devices-dirs-$(CONFIG_NUBUS) += nubus/ devices-dirs-y += semihosting/ devices-dirs-y += smbios/ -ifeq ($(CONFIG_MARU), y) devices-dirs-$(CONFIG_BUILD_VIGS) += yagl/ devices-dirs-$(CONFIG_BUILD_VIGS) += vigs/ endif -endif common-obj-y += $(devices-dirs-y) obj-y += $(devices-dirs-y) diff --git a/hw/audio/soundhw.c b/hw/audio/soundhw.c index c750473c8f..7cf242087a 100644 --- a/hw/audio/soundhw.c +++ b/hw/audio/soundhw.c @@ -40,7 +40,8 @@ struct soundhw { } init; }; -static struct soundhw soundhw[9]; +//Increase number of hw supported or disable registration for not required sound hw +static struct soundhw soundhw[11]; static int soundhw_count; void isa_register_soundhw(const char *name, const char *descr, diff --git a/hw/vigs/Makefile.objs b/hw/vigs/Makefile.objs index 40b5786a32..123bc8e259 100644 --- a/hw/vigs/Makefile.objs +++ b/hw/vigs/Makefile.objs @@ -23,7 +23,7 @@ obj-y += work_queue.o obj-y += winsys.o obj-y += display.o -$(obj)/vigs_qt5.o: QEMU_CXXFLAGS := $(QT_CFLAGS) +$(obj)/vigs_qt5.o: QEMU_CXXFLAGS += $(QT_CFLAGS) $(QEMU_INCLUDES) # GL GLX backend ifdef CONFIG_LINUX diff --git a/hw/vigs/vigs_device.c b/hw/vigs/vigs_device.c index b69d3bb88d..4e487788e9 100644 --- a/hw/vigs/vigs_device.c +++ b/hw/vigs/vigs_device.c @@ -93,6 +93,10 @@ typedef struct VIGSState #define TYPE_VIGS_DEVICE "vigs" +#define VIGS_DEVICE_PCI(obj) OBJECT_CHECK(VIGSState, (obj), \ + TYPE_VIGS_DEVICE) + + static void vigs_update_irq(VIGSState *s) { bool raise = false; @@ -370,7 +374,7 @@ static void vigs_vblank_timer_init(VIGSState *s) { //TODO: varinder.p return proper error static void vigs_device_init(PCIDevice *dev, Error **err) { - VIGSState *s = DO_UPCAST(VIGSState, dev, dev); + VIGSState *s = VIGS_DEVICE_PCI(dev); DisplayObject *dobj = NULL; WorkQueueObject *wqobj = NULL; WSIObject *wsiobj = NULL; @@ -433,16 +437,16 @@ static void vigs_device_init(PCIDevice *dev, Error **err) } if (s->wsi) { - + Error *local_err = NULL; wsiobj = WSIOBJECT(object_new(TYPE_WSIOBJECT)); object_property_add_child(container_get(object_get_root(), "/objects"), - s->wsi, &wsiobj->base, err); + s->wsi, &wsiobj->base, &local_err); object_unref(&wsiobj->base); if (err) { - error_report_err(*err); + error_propagate(err, local_err); return; } } @@ -548,10 +552,12 @@ fail: if (s->fence_ack_bh) { qemu_bh_delete(s->fence_ack_bh); + s->fence_ack_bh = NULL; } if (s->fenceman) { vigs_fenceman_destroy(s->fenceman); + s->fenceman = NULL; } vigs_log_cleanup(); @@ -561,7 +567,7 @@ fail: static void vigs_device_reset(DeviceState *d) { - VIGSState *s = container_of(d, VIGSState, dev.qdev); + VIGSState *s = VIGS_DEVICE_PCI(d); vigs_server_reset(s->server); @@ -577,13 +583,16 @@ static void vigs_device_reset(DeviceState *d) static void vigs_device_exit(PCIDevice *dev) { - VIGSState *s = DO_UPCAST(VIGSState, dev, dev); + VIGSState *s = VIGS_DEVICE_PCI(dev); s->server->destroy(s->server); + s->server = NULL; qemu_bh_delete(s->fence_ack_bh); + s->fence_ack_bh = NULL; vigs_fenceman_destroy(s->fenceman); + s->fenceman = NULL; VIGS_LOG_INFO("VIGS deinitialized"); @@ -625,10 +634,9 @@ static TypeInfo vigs_device_info = .instance_size = sizeof(VIGSState), .class_init = vigs_class_init, .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } - }, + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, }; static void vigs_register_types(void) diff --git a/hw/vigs/vigs_fenceman.c b/hw/vigs/vigs_fenceman.c index 634493f972..737bb0aa6c 100644 --- a/hw/vigs/vigs_fenceman.c +++ b/hw/vigs/vigs_fenceman.c @@ -65,6 +65,8 @@ struct vigs_fenceman *vigs_fenceman_create(void) void vigs_fenceman_destroy(struct vigs_fenceman *fenceman) { + if (fenceman == NULL) + return; vigs_fenceman_reset(fenceman); qemu_mutex_destroy(&fenceman->mutex); g_free(fenceman); @@ -73,6 +75,8 @@ void vigs_fenceman_destroy(struct vigs_fenceman *fenceman) void vigs_fenceman_reset(struct vigs_fenceman *fenceman) { struct vigs_fence_ack *ack, *tmp; + if (fenceman == NULL) + return; qemu_mutex_lock(&fenceman->mutex); diff --git a/hw/vigs/vigs_qt5.cpp b/hw/vigs/vigs_qt5.cpp index 598200b3ea..223210d862 100644 --- a/hw/vigs/vigs_qt5.cpp +++ b/hw/vigs/vigs_qt5.cpp @@ -29,9 +29,17 @@ #include #include -#include "qpa/qplatformnativeinterface.h" +#include #include "vigs_qt5.h" +extern "C" { +#define QObject qemu_QObject +#define QList qemu_QList +#include "qemu/osdep.h" +#undef QObject +#undef QList +} + extern bool qt5IsOnscreen; extern QApplication *qt5App; extern QOpenGLContext *qt5GLContext; diff --git a/hw/vigs/vigs_server.c b/hw/vigs/vigs_server.c index 993ce31c9c..dba531c4b1 100644 --- a/hw/vigs/vigs_server.c +++ b/hw/vigs/vigs_server.c @@ -644,6 +644,10 @@ static void vigs_server_dispatch_reset(void *user_data) GHashTableIter iter; gpointer key, value; + if (server == NULL || server->initialized == false) { + return; + } + work_queue_wait(server->render_queue); if (!server->initialized) { @@ -816,6 +820,10 @@ void vigs_server_reset(struct vigs_server *server) GHashTableIter iter; gpointer key, value; + if (server == NULL || server->initialized == false) { + return; + } + work_queue_wait(server->render_queue); server->backend->batch_start(server->backend); diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 44e436aaec..f10638a684 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1919,7 +1919,6 @@ static const TypeInfo virtio_pci_info = { .class_size = sizeof(VirtioPCIClass), .abstract = true, .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { } }, diff --git a/hw/yagl/yagl_device.c b/hw/yagl/yagl_device.c index fa28f678e9..c6fe8c1e80 100644 --- a/hw/yagl/yagl_device.c +++ b/hw/yagl/yagl_device.c @@ -86,6 +86,10 @@ typedef struct YaGLState #define TYPE_YAGL_DEVICE "yagl" +#define YAGL_DEVICE_PCI(obj) OBJECT_CHECK(YaGLState, (obj), \ + TYPE_YAGL_DEVICE) + + static void yagl_device_operate(YaGLState *s, int user_index, hwaddr buff_pa) { yagl_pid target_pid; @@ -226,7 +230,7 @@ static const MemoryRegionOps yagl_device_ops = //TODO: varinder.p return proper error static void yagl_device_init(PCIDevice *dev, Error **err) { - YaGLState *s = DO_UPCAST(YaGLState, dev, dev); + YaGLState *s = YAGL_DEVICE_PCI(dev); DisplayObject *dobj = NULL; WorkQueueObject *wqobj = NULL; WSIObject *wsiobj = NULL; @@ -375,7 +379,7 @@ fail: static void yagl_device_reset(DeviceState *d) { - YaGLState *s = container_of(d, YaGLState, dev.qdev); + YaGLState *s = YAGL_DEVICE_PCI(d); int i; YAGL_LOG_FUNC_ENTER(yagl_device_reset, NULL); @@ -393,11 +397,12 @@ static void yagl_device_reset(DeviceState *d) static void yagl_device_exit(PCIDevice *dev) { - YaGLState *s = DO_UPCAST(YaGLState, dev, dev); + YaGLState *s = YAGL_DEVICE_PCI(dev); YAGL_LOG_FUNC_ENTER(yagl_device_exit, NULL); yagl_server_state_destroy(s->ss); + s->ss = NULL; yagl_handle_gen_cleanup(); @@ -437,7 +442,6 @@ static TypeInfo yagl_device_info = .instance_size = sizeof(YaGLState), .class_init = yagl_class_init, .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { } }, diff --git a/hw/yagl/yagl_process.c b/hw/yagl/yagl_process.c index 383e09869c..477448509e 100644 --- a/hw/yagl/yagl_process.c +++ b/hw/yagl/yagl_process.c @@ -61,6 +61,10 @@ void yagl_process_state_destroy(struct yagl_process_state *ps) { struct yagl_thread_state *ts, *next; + if (ps == NULL) { + return; + } + YAGL_LOG_FUNC_ENTER(yagl_process_state_destroy, NULL); QLIST_FOREACH_SAFE(ts, &ps->threads, entry, next) { @@ -73,6 +77,7 @@ void yagl_process_state_destroy(struct yagl_process_state *ps) assert(QLIST_EMPTY(&ps->threads)); yagl_object_map_destroy(ps->object_map); + ps->object_map = NULL; g_free(ps); diff --git a/hw/yagl/yagl_server.c b/hw/yagl/yagl_server.c index 3e65ac12ff..b74846809d 100644 --- a/hw/yagl/yagl_server.c +++ b/hw/yagl/yagl_server.c @@ -139,6 +139,10 @@ void yagl_server_reset(struct yagl_server_state *ss) { struct yagl_process_state *ps, *next; + if (ss == NULL) { + return; + } + work_queue_wait(ss->render_queue); QLIST_FOREACH_SAFE(ps, &ss->processes, entry, next) { diff --git a/net/net.c b/net/net.c index 2c20aabebb..0f0ccf0974 100644 --- a/net/net.c +++ b/net/net.c @@ -1416,6 +1416,7 @@ static void net_vm_change_state_handler(void *opaque, int running, } } +#if defined(CONFIG_MARU) LinkInfo *qmp_get_link(const char *name, Error **errp) { NetClientState *ncs[MAX_QUEUE_NUM]; @@ -1438,6 +1439,7 @@ LinkInfo *qmp_get_link(const char *name, Error **errp) } return info; } +#endif void net_cleanup(void) { diff --git a/net/tap.c b/net/tap.c index ddfff17fcf..166fe7c44c 100644 --- a/net/tap.c +++ b/net/tap.c @@ -478,13 +478,10 @@ static void launch_script(const char *setup_script, const char *ifname, *parg++ = (char *)sudo_path; #endif *parg++ = (char *)setup_script; -#if defined(CONFIG_MARU) + *parg++ = (char *)ifname; if (host_ifname) { *parg++ = (char *)host_ifname; } -#else - *parg++ = (char *)ifname; -#endif *parg = NULL; #if defined(CONFIG_MARU) diff --git a/package/build.common b/package/build.common index 215629c054..217fe23fec 100644 --- a/package/build.common +++ b/package/build.common @@ -78,7 +78,7 @@ install_common() echo "Removing old builds: " $VER-emulator-qemu-x86_${QEMU_VERSION}_${TARGET_OS}.zip rm -f ${SRCDIR}/$VER-emulator-qemu-x86_${QEMU_VERSION}_${TARGET_OS}.zip - rm -f ${SRCDIR}/$VER-emulator-common-x86_${QEMU_VERSION}_${TARGET_OS}.zip + rm -f ${SRCDIR}/$VER-emulator-qemu-common_${QEMU_VERSION}_${TARGET_OS}.zip done } diff --git a/package/build.linux b/package/build.linux index fad94e72e6..e8231546bb 100755 --- a/package/build.linux +++ b/package/build.linux @@ -39,7 +39,7 @@ prepare() REQUIRED_PKG="ant python3 zlib1g-dev libglib2.0-dev \ libasound2-dev libx11-dev libv4l-dev libxcomposite-dev \ - libswresample-dev libswscale-dev libpixman-1-dev libcurl4-gnutls-dev libcap-dev libattr1-dev" + libswscale-dev libpixman-1-dev libcurl4-gnutls-dev libcap-dev libattr1-dev" echo "Checking required packages before compling!!" for pkg in ${REQUIRED_PKG} diff --git a/softmmu/vl.c b/softmmu/vl.c index d89cf39531..23e4759fc4 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -27,6 +27,7 @@ #include "qemu/units.h" #include "hw/boards.h" #include "hw/qdev-properties.h" +#include "hw/pci/pci_bus.h" #include "qapi/error.h" #include "qemu-version.h" #include "qemu/cutils.h" @@ -121,6 +122,9 @@ #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"); @@ -2916,6 +2920,13 @@ 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; @@ -3520,6 +3531,30 @@ 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"); @@ -4480,7 +4515,42 @@ void qemu_init(int argc, char **argv, char **envp) if (is_maru_machine(machine_class)) { prepare_maru_after_device_init(); } -#endif //CONFIG_MARU +#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(); @@ -4584,6 +4654,10 @@ void qemu_init(int argc, char **argv, char **envp) accel_setup_post(current_machine); os_setup_post(); +#ifdef CONFIG_MARU + enable_print_backtrace_at_normal_exit(); +#endif + return; } diff --git a/tizen/emulator_configure.sh b/tizen/emulator_configure.sh index b82238fa9a..fd684630fe 100755 --- a/tizen/emulator_configure.sh +++ b/tizen/emulator_configure.sh @@ -127,9 +127,9 @@ CONFIGURE_APPEND=" --enable-yagl --enable-vigs --enable-qt - --disable-libav + --enable-libav --enable-libpng - --disable-virtfs + --enable-virtfs --disable-bzip2 --disable-curl --disable-lzo @@ -144,7 +144,6 @@ CONFIGURE_APPEND=" --disable-curses --disable-xen --disable-tpm - --disable-sdl --disable-sheepdog --enable-debug --enable-debug-info @@ -155,6 +154,7 @@ CONFIGURE_APPEND_WIN=" --extra-ldflags=-static-libstdc++ --audio-drv-list=dsound --winver=0x0600 + --enable-sdl --enable-hax" # append platform specific options @@ -164,6 +164,7 @@ CONFIGURE_APPEND=" --extra-ldflags=-rdynamic --extra-ldflags=-Wl,-rpath,'\$\$ORIGIN' --audio-drv-list=alsa + --enable-sdl --enable-kvm $CONFIGURE_APPEND " diff --git a/tizen/src/ecs/Makefile.objs b/tizen/src/ecs/Makefile.objs index 9c276bc0fa..0662176a67 100644 --- a/tizen/src/ecs/Makefile.objs +++ b/tizen/src/ecs/Makefile.objs @@ -7,4 +7,6 @@ obj-y += ecs_sensor.o obj-$(CONFIG_VIRTFS) += ecs_hds.o obj-y += ecs_nfc.o ecs_nfc.o-cflags += -Wno-stringop-truncation -obj-y += ecs_sdcard.o \ No newline at end of file +obj-y += ecs_sdcard.o +ecs_msg_device.o-cflags += $(LIBAV_CFLAGS) +ecs_msg.o-cflags += $(LIBAV_CFLAGS) diff --git a/tizen/src/ecs/ecs-json-streamer.c b/tizen/src/ecs/ecs-json-streamer.c index 71d5592c86..1db50d84b8 100644 --- a/tizen/src/ecs/ecs-json-streamer.c +++ b/tizen/src/ecs/ecs-json-streamer.c @@ -121,16 +121,14 @@ void ecs_json_message_parser_init(ECSJSONMessageParser *parser, int ecs_json_message_parser_feed(ECSJSONMessageParser *parser, const char *buffer, size_t size) { - //TIZEN_VERIFY: - json_lexer_feed(&parser->lexer, buffer, size); - return 0; + json_lexer_feed(&parser->lexer, buffer, size); + return 0; } int ecs_json_message_parser_flush(ECSJSONMessageParser *parser) { - //TIZEN_VERIFY: - json_lexer_flush(&parser->lexer); - return 0; + json_lexer_flush(&parser->lexer); + return 0; } void ecs_json_message_parser_destroy(ECSJSONMessageParser *parser) diff --git a/tizen/src/ecs/ecs.c b/tizen/src/ecs/ecs.c index 8fb5cf1e58..eec866df55 100644 --- a/tizen/src/ecs/ecs.c +++ b/tizen/src/ecs/ecs.c @@ -29,15 +29,8 @@ * */ -#include -#include - -#include "qemu/osdep.h" -#include "hw/qdev.h" -#include "net/net.h" -#include "ui/console.h" - -#include "qemu-common.h" +#include "emulator.h" +#include "emul_state.h" #include "qemu/queue.h" #include "qemu/sockets.h" #include "qemu/option.h" @@ -47,11 +40,13 @@ #include "chardev/char.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qnum.h" +#include "hw/qdev.h" +#include "net/net.h" +#include "ui/console.h" -#include "emulator.h" #include "util/net_helper.h" #include "ecs.h" -#include "emul_state.h" +#include "ecs_internal.h" #include "hw/virtio/maru_virtio_sensor.h" #include "hw/virtio/maru_virtio_nfc.h" @@ -340,9 +335,9 @@ static EcsMonitor *monitor_create(void) { EcsMonitor *mon; - mon = g_malloc0(sizeof(*mon)); + mon = g_malloc0(sizeof(EcsMonitor)); if (NULL == mon) { - LOG_SEVERE("monitor allocation failed.\n"); + LOG_SEVERE("EcsMonitor allocation failed.\n"); return NULL; } @@ -421,11 +416,11 @@ static ssize_t ecs_recv(int fd, char *buf, size_t len) } #endif -static void reset_sbuf(sbuf *sbuf) +static void reset_ecsbuffer(ecsbuffer *sbuff) { - memset(sbuf->_buf, 0, 4096); - sbuf->_use = 0; - sbuf->_netlen = 0; + memset(sbuff->_buf, 0, 4096); + sbuff->_use = 0; + sbuff->_netlen = 0; } static bool handle_protobuf_msg(ECS_Client *cli, char *data, int len) @@ -541,7 +536,7 @@ static void ecs_read(ECS_Client *cli) goto fail; } - if (cli->sbuf._netlen == 0) { + if (cli->sbuff._netlen == 0) { if (to_read_bytes < 4) { return; } @@ -556,7 +551,7 @@ static void ecs_read(ECS_Client *cli) payloadsize = ntohl(payloadsize); - cli->sbuf._netlen = payloadsize; + cli->sbuff._netlen = payloadsize; LOG_TRACE("payload size: %ld\n", payloadsize); @@ -567,18 +562,18 @@ static void ecs_read(ECS_Client *cli) return; } - to_read_bytes = min(to_read_bytes, cli->sbuf._netlen - cli->sbuf._use); + to_read_bytes = min(to_read_bytes, cli->sbuff._netlen - cli->sbuff._use); - read = ecs_recv(cli->client_fd, (char *)(cli->sbuf._buf + cli->sbuf._use), to_read_bytes); + read = ecs_recv(cli->client_fd, (char *)(cli->sbuff._buf + cli->sbuff._use), to_read_bytes); if (read == 0) { goto fail; } - cli->sbuf._use += read; + cli->sbuff._use += read; - if (cli->sbuf._netlen == cli->sbuf._use) { - handle_protobuf_msg(cli, (char *)cli->sbuf._buf, cli->sbuf._use); - reset_sbuf(&cli->sbuf); + if (cli->sbuff._netlen == cli->sbuff._use) { + handle_protobuf_msg(cli, (char *)cli->sbuff._buf, cli->sbuff._use); + reset_ecsbuffer(&cli->sbuff); } return; @@ -635,15 +630,15 @@ static int ecs_add_client(ECS_State *cs, int fd) return -1; } - reset_sbuf(&clii->sbuf); + reset_ecsbuffer(&clii->sbuff); qemu_set_nonblock(fd); clii->client_fd = fd; clii->cs = cs; clii->client_type = TYPE_NONE; - //TIZEN_Verify - ecs_json_message_parser_init(&clii->parser, ecs_handle_qmp_command, clii,NULL); + + ecs_json_message_parser_init(&clii->parser, ecs_handle_qmp_command, clii, NULL); #ifdef CONFIG_LINUX epoll_cli_add(cs, fd); @@ -926,7 +921,7 @@ static void *ecs_initialize(void *args) mon = monitor_create(); if (NULL == mon) { - LOG_SEVERE("monitor initialization failed.\n"); + LOG_SEVERE("EcsMonitor initialization failed.\n"); ecs_close(cs); return NULL; } diff --git a/tizen/src/ecs/ecs.h b/tizen/src/ecs/ecs.h index 1eda628c0d..72dbc3f222 100644 --- a/tizen/src/ecs/ecs.h +++ b/tizen/src/ecs/ecs.h @@ -32,7 +32,7 @@ #ifndef __ECS_H__ #define __ECS_H__ -#include "ecs_internal.h" +#include "emulator_common.h" #define COMMANDS_TYPE "type" #define COMMANDS_DATA "data" diff --git a/tizen/src/ecs/ecs_eventcast.c b/tizen/src/ecs/ecs_eventcast.c index 49524ea835..3aee525037 100644 --- a/tizen/src/ecs/ecs_eventcast.c +++ b/tizen/src/ecs/ecs_eventcast.c @@ -27,16 +27,15 @@ * */ -#include "qemu/osdep.h" -#include "ui/console.h" - #include "ecs.h" +#include "ecs_internal.h" #include "ecs_sensor.h" #include "ecs_eventcast.h" #include "eventcast/common.h" #include "eventcast/sensor.h" #include "eventcast/touch.h" #include "hw/virtio/maru_virtio_input.h" +#include "ui/console.h" #include "util/new_debug_ch.h" @@ -226,8 +225,8 @@ static bool send_eventcast_ntf(const char *data) ECS__EventCastNtf ntf = ECS__EVENT_CAST_NTF__INIT; ntf.category = (char *) g_malloc(catsize + 1); - strncpy(ntf.category, cat, 10); - ntf.category[10] = 0; + strncpy(ntf.category, cat, catsize); + ntf.category[catsize] = 0; ntf.length = length; ntf.group = group; ntf.action = action; diff --git a/tizen/src/ecs/ecs_hds.c b/tizen/src/ecs/ecs_hds.c index 614cc62e6c..339ddd15cb 100644 --- a/tizen/src/ecs/ecs_hds.c +++ b/tizen/src/ecs/ecs_hds.c @@ -27,14 +27,11 @@ * */ -#include - -#include "qemu/osdep.h" -#include "qemu-common.h" +#include "emulator_common.h" #include "qemu/thread.h" #include "fsdev/qemu-fsdev.h" - #include "emul_state.h" +#include "ecs.h" #include "ecs_hds.h" #include "util/hds.h" #include "util/device_hotplug.h" diff --git a/tizen/src/ecs/ecs_hds.h b/tizen/src/ecs/ecs_hds.h index c76468c86d..80f7a27df1 100644 --- a/tizen/src/ecs/ecs_hds.h +++ b/tizen/src/ecs/ecs_hds.h @@ -30,7 +30,7 @@ #ifndef __ECS_HDS_H__ #define __ECS_HDS_H__ -#include "ecs.h" +#include "ecs_internal.h" #define ECS_HDS_HIDDEN_RESERVED 4 diff --git a/tizen/src/ecs/ecs_internal.h b/tizen/src/ecs/ecs_internal.h index c7f2c6b6f3..99671fd768 100644 --- a/tizen/src/ecs/ecs_internal.h +++ b/tizen/src/ecs/ecs_internal.h @@ -31,17 +31,13 @@ #ifndef __ECS_INTERNAL_H__ #define __ECS_INTERNAL_H__ -#ifdef CONFIG_LINUX -#include -#endif +#include "emulator_common.h" #include "qemu/queue.h" -#include "qemu-common.h" -#include "qapi/qmp/qerror.h" #include "ecs-json-streamer.h" #include "genmsg/ecs.pb-c.h" #include "genmsg/ecs_ids.pb-c.h" -#include "ecs_sensor.h" + #define TIMER_ALIVE_S 60 #define TYPE_DATA_SELF "self" @@ -88,11 +84,11 @@ enum injector_level { level_pedo = 23, }; -typedef struct sbuf { +typedef struct _sbuffer { int _netlen; int _use; char _buf[OUT_BUF_SIZE]; -} sbuf; +} ecsbuffer; typedef struct mon_fd_t mon_fd_t; struct mon_fd_t { @@ -138,7 +134,7 @@ typedef struct ECS_Client { int keep_alive; const char *type; - sbuf sbuf; + ecsbuffer sbuff; ECS_State *cs; ECSJSONMessageParser parser; diff --git a/tizen/src/ecs/ecs_mon.c b/tizen/src/ecs/ecs_mon.c index 73130faebf..4866fbf2a2 100644 --- a/tizen/src/ecs/ecs_mon.c +++ b/tizen/src/ecs/ecs_mon.c @@ -47,6 +47,7 @@ #include "qapi/qmp/dispatch.h" #include "ecs.h" +#include "ecs_internal.h" #include "hw/virtio/maru_virtio_evdi.h" #include "hw/virtio/maru_virtio_sensor.h" #include "hw/virtio/maru_virtio_nfc.h" diff --git a/tizen/src/ecs/ecs_msg.c b/tizen/src/ecs/ecs_msg.c index ead8be94ac..89f5a596fc 100644 --- a/tizen/src/ecs/ecs_msg.c +++ b/tizen/src/ecs/ecs_msg.c @@ -28,8 +28,7 @@ * */ -#include "qemu/osdep.h" -#include +#include "emulator_common.h" #include "hw/qdev.h" #include "net/net.h" #include "net/slirp.h" @@ -45,6 +44,8 @@ #include "qemu/main-loop.h" #include "qapi/qmp/qstring.h" #include "qapi/qmp/qdict.h" +#include "ecs.h" +#include "ecs_internal.h" #ifdef CONFIG_LINUX #include @@ -54,14 +55,11 @@ #include #endif -#include "qemu-common.h" #include "ecs-json-streamer.h" #include "hw/virtio/maru_virtio_vmodem.h" #include "hw/virtio/maru_virtio_evdi.h" -#include "ecs.h" - #include "debug_ch.h" MULTI_DEBUG_CHANNEL(qemu, ecs); diff --git a/tizen/src/ecs/ecs_msg_device.c b/tizen/src/ecs/ecs_msg_device.c index 933122d0db..96f4ca3e69 100644 --- a/tizen/src/ecs/ecs_msg_device.c +++ b/tizen/src/ecs/ecs_msg_device.c @@ -28,10 +28,8 @@ * */ -#include "qemu/osdep.h" -#include "qemu-common.h" +#include "emulator_common.h" #include "qemu/option.h" -#include "qemu/config-file.h" #include "net/slirp.h" #include "monitor/qdev.h" @@ -39,12 +37,12 @@ #include "hw/virtio/maru_virtio_nfc.h" #include "util/ui_operations.h" +#include "ecs.h" +#include "emul_state.h" #include "ecs_sensor.h" #include "ecs_hds.h" -#include "emul_state.h" -#include "ecs.h" -#include "debug_ch.h" #include "ecs_sdcard.h" +#include "debug_ch.h" #if defined(CONFIG_LIBAV) #include "ecs_tuner.h" @@ -172,6 +170,15 @@ static void msgproc_device_req_sensor(ECS_Client *ccli, ECS__DeviceReq *msg, cha #define MSG_NET_GROUP 0 #define MSG_NET_ACTION 123 + + +static int net_slirp_redir(const char *redir_str) +{ + //TODO call slirp_hostfwd(QTAILQ_FIRST(&slirp_stacks), redir_str, 1); instead + return 0; +} + + static void msgproc_device_req_network(ECS_Client *ccli, ECS__DeviceReq *msg, char *cmd) { char *data = NULL; @@ -183,13 +190,12 @@ static void msgproc_device_req_network(ECS_Client *ccli, ECS__DeviceReq *msg, ch if (data != NULL) { LOG_TRACE(">>> Network msg: '%s'\n", data); - //TIZEN_VERIFY - //if (net_slirp_redir(data) < 0) { + if (net_slirp_redir(data) < 0) { LOG_SEVERE("redirect [%s] fail\n", data); make_send_device_ntf(cmd, MSG_NET_GROUP, MSG_NET_ACTION, ret); - // } else { - // LOG_TRACE("redirect [%s] success\n", data); - //} + } else { + LOG_TRACE("redirect [%s] success\n", data); + } } else { LOG_SEVERE("Network redirection data is null.\n"); } diff --git a/tizen/src/ecs/ecs_msg_injector.c b/tizen/src/ecs/ecs_msg_injector.c index e17548ce06..0489955a49 100644 --- a/tizen/src/ecs/ecs_msg_injector.c +++ b/tizen/src/ecs/ecs_msg_injector.c @@ -28,11 +28,7 @@ * */ -#include -#include - -#include "qemu/osdep.h" -#include "qemu-common.h" +#include "emulator_common.h" #include "qemu/error-report.h" #include "qemu/thread.h" @@ -41,6 +37,7 @@ #include "hw/virtio/maru_virtio_jack.h" #include "hw/virtio/maru_virtio_power.h" +#include "ecs.h" #include "emul_state.h" #include "ecs_hds.h" #include "ecs_sensor.h" @@ -474,14 +471,12 @@ static void show_error_popup(char *data) char *addon = strtok(data, token); memset(fail_msg, 0, sizeof(fail_msg)); - strncpy(fail_msg, FAILED_TO_INSTALL_EXTRAPACKAGE_1, strlen(FAILED_TO_INSTALL_EXTRAPACKAGE_1)); - fail_msg[strlen(FAILED_TO_INSTALL_EXTRAPACKAGE_1)] = 0; - + strncpy(fail_msg, FAILED_TO_INSTALL_EXTRAPACKAGE_1, sizeof(fail_msg)); if (addon != NULL && (strlen(addon)+strlen(fail_msg)) < MAX_PKGS_LIST) { - strncat(fail_msg, addon, strlen(addon) + 1); + strncat(fail_msg, addon, strlen(addon)); } if ((strlen(FAILED_TO_INSTALL_EXTRAPACKAGE_2)+strlen(fail_msg)) < MAX_PKGS_LIST) { - strncat(fail_msg, FAILED_TO_INSTALL_EXTRAPACKAGE_2, strlen(FAILED_TO_INSTALL_EXTRAPACKAGE_2) + 1); + strncat(fail_msg, FAILED_TO_INSTALL_EXTRAPACKAGE_2, strlen(FAILED_TO_INSTALL_EXTRAPACKAGE_2)); } error_report("%s", fail_msg); diff --git a/tizen/src/ecs/ecs_nfc.c b/tizen/src/ecs/ecs_nfc.c index c028b27c18..c37936b92c 100644 --- a/tizen/src/ecs/ecs_nfc.c +++ b/tizen/src/ecs/ecs_nfc.c @@ -30,9 +30,10 @@ #include "qemu/osdep.h" #include "qemu-common.h" -#include "hw/virtio/maru_virtio_nfc.h" - #include "ecs.h" +#include "ecs_internal.h" + +#include "hw/virtio/maru_virtio_nfc.h" #include "debug_ch.h" diff --git a/tizen/src/ecs/ecs_sdcard.c b/tizen/src/ecs/ecs_sdcard.c index 19f28c354a..cc2bbc838d 100644 --- a/tizen/src/ecs/ecs_sdcard.c +++ b/tizen/src/ecs/ecs_sdcard.c @@ -28,12 +28,16 @@ * */ -#include "ecs_sdcard.h" +#include "emulator_common.h" +#include "emul_state.h" #include "ecs.h" +#include "ecs_internal.h" +#include "ecs_sdcard.h" #include "util/osutil.h" #include "util/device_hotplug.h" +#include "qapi/qapi-commands-block.h" +#include "qapi/qapi-visit-block-core.h" #include "debug_ch.h" -#include "emul_state.h" MULTI_DEBUG_CHANNEL(qemu, ecs); @@ -92,7 +96,7 @@ static char *get_human_readable_size(char *buf, int buf_size, int64_t size) } return buf; } -extern BlockInfoList *qmp_query_block(Error **errp); + static void send_sdcard_status(void) { BlockInfoList *block_list, *info; diff --git a/tizen/src/ecs/ecs_sensor.c b/tizen/src/ecs/ecs_sensor.c index 269c035424..3ddcd75b7d 100644 --- a/tizen/src/ecs/ecs_sensor.c +++ b/tizen/src/ecs/ecs_sensor.c @@ -29,17 +29,14 @@ * */ -#include "qemu/osdep.h" -#include "qemu-common.h" - -#include - #include "ecs.h" +#include "ecs_internal.h" +#include "ecs_sensor.h" #include "hw/virtio/maru_virtio_sensor.h" #include "hw/virtio/maru_virtio_power.h" #include "hw/virtio/maru_virtio_jack.h" - #include "debug_ch.h" +#include MULTI_DEBUG_CHANNEL(qemu, ecs); @@ -70,18 +67,6 @@ static int _accel_min_max(char *tmp) return accel_min_max(atof(tmp)); } -#if defined(CONFIG_JAVA_UI) -void req_set_sensor_accel(int x, int y, int z) -{ - char tmp[TEMP_BUF_SIZE] = { 0, }; - - sprintf(tmp, "%d, %d, %d", x, y, z); - - set_sensor_accel(tmp, strlen(tmp)); -} -#endif - -#if defined(CONFIG_QT) static int convert_abs_angle(int angle) { if (angle < SENSOR_ANGLE_MIN) { @@ -144,7 +129,6 @@ void req_set_sensor_accel_angle(int angle) set_sensor_accel(accel, strlen(accel)); } -#endif static void _req_set_sensor_accel(int len, const char *data) { diff --git a/tizen/src/ecs/ecs_sensor.h b/tizen/src/ecs/ecs_sensor.h index 4b07745703..4a2e374d0f 100644 --- a/tizen/src/ecs/ecs_sensor.h +++ b/tizen/src/ecs/ecs_sensor.h @@ -31,14 +31,14 @@ #ifndef __ECS_SENSOR_H__ #define __ECS_SENSOR_H__ +#ifdef __cplusplus +extern "C" { +#endif /* skin rotation request */ int accel_min_max(double value); -#if defined(CONFIG_QT) void req_set_sensor_accel_angle(int angle); -#elif defined(CONFIG_JAVA_UI) -void req_set_sensor_accel(int x, int y, int z); -#endif - void ecs_sensor_set_injector_data(const char *data); - +#ifdef __cplusplus +} +#endif #endif /* __ECS_SENSOR_H__ */ diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index 85d0fe3399..03ec9a992c 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -29,13 +29,10 @@ * */ -#include "emul_state.h" - -#include -#include "emulator_common.h" -#include "qemu/osdep.h" -#include "qemu-common.h" +#include "emulator.h" +#include "emul_state.h" +#include "qemu/option.h" #include "qapi/error.h" #include "qapi/qapi-commands-misc.h" #include "ui/console.h" @@ -47,8 +44,8 @@ #include "fsdev/qemu-fsdev.h" #endif -#include "emulator.h" #include "emulator_options.h" +#include "hw/maru_device_ids.h" #include "hw/virtio/maru_virtio_input.h" #include "hw/virtio/maru_virtio_evdi.h" #include "util/net_helper.h" @@ -447,9 +444,9 @@ bool is_gpu_accel_enabled(void) } // ram size -uint64_t get_ram_size(void) +unsigned long int get_ram_size(void) { - return ram_size; + return (unsigned long int)ram_size; } // VM base port diff --git a/tizen/src/emul_state.h b/tizen/src/emul_state.h index 91a427a952..4fe321da5f 100644 --- a/tizen/src/emul_state.h +++ b/tizen/src/emul_state.h @@ -33,9 +33,6 @@ #ifndef __EMUL_STATE_H__ #define __EMUL_STATE_H__ -#include "emulator_common.h" -#include "hw/maru_device_ids.h" - #define MAX_ADDR_LEN 256 #define MAX_PORT_LEN 256 @@ -44,6 +41,10 @@ #define DEFAULT_STATIC_HDS_ID "fsdef0" +#ifdef __cplusplus +extern "C" { +#endif + enum { RESET = 0, BOOT_COMPLETED = 1, @@ -142,7 +143,7 @@ bool is_mouse_enabled(void); bool is_touchscreen_enabled(void); bool is_netclient_tap_attached(void); -uint64_t get_ram_size(void); +unsigned long int get_ram_size(void); int get_vm_base_port(void); int get_vm_device_serial_number(void); @@ -161,4 +162,8 @@ const char* get_platform_default_home(void); void set_platform_default_home(const char *path); void init_emul_state(void); + +#ifdef __cplusplus +} +#endif #endif /* __EMUL_STATE_H__ */ diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index ce57eda9db..bfe3d62480 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -28,34 +28,26 @@ * */ -#include -#include -#include - -#include "qemu/osdep.h" +#include "emulator.h" +#include "emul_state.h" #include "qemu/config-file.h" #include "qemu/sockets.h" #include "qemu/error-report.h" #include "qemu/thread.h" - +#include "qemu/option.h" +#include "sysemu/sysemu.h" #include "sysemu/runstate.h" - #include "build_info.h" -#include "emulator.h" -#include "emul_state.h" #include "emulator_options.h" #include "util/error_handler.h" #include "util/osutil.h" #include "util/net_helper.h" #include "ecs/ecs.h" +#include "ecs/ecs_internal.h" #include "util/device_hotplug.h" #include "util/exported_strings.h" -#ifdef CONFIG_WIN32 -#include -#include -#endif #ifdef CONFIG_QT -#include +#include "ui/qt5_supplement.h" #endif #ifdef CONFIG_SDL diff --git a/tizen/src/emulator.h b/tizen/src/emulator.h index a48c083348..157b89bb69 100644 --- a/tizen/src/emulator.h +++ b/tizen/src/emulator.h @@ -38,14 +38,18 @@ #define __EMULATOR_H__ #include "emulator_common.h" -#include "qapi/qmp/qlist.h" -#include "qemu/option.h" -#include "sysemu/sysemu.h" +#include "qemu/notify.h" + +#ifdef __cplusplus +extern "C" { +#endif const char *prepare_maru(const gchar * const kernel_cmdline); void prepare_maru_after_device_init(void); void print_system_info(void); void emulator_add_exit_notifier(Notifier *notify); void qemu_system_graceful_shutdown_request(unsigned int sec); - +#ifdef __cplusplus +} +#endif #endif /* __EMULATOR_H__ */ diff --git a/tizen/src/emulator_common.h b/tizen/src/emulator_common.h index ed418e2ba4..3b3b20df00 100644 --- a/tizen/src/emulator_common.h +++ b/tizen/src/emulator_common.h @@ -38,31 +38,25 @@ #ifndef __EMULATOR_COMMON_H__ #define __EMULATOR_COMMON_H__ -#include -#include -#include -#include -#include -#include -#include -#include +#include "qemu/osdep.h" +#include "qemu-common.h" #ifdef CONFIG_DARWIN #include "sys/syslimits.h" #endif -#ifdef CONFIG_WIN32 +#if defined (CONFIG_LINUX) +#include +#include +#include +#endif + +#if defined(CONFIG_WIN32) #if defined(__MINGW64_VERSION_MAJOR) #define __MINGW_W64__ #endif +#include #endif -#if !defined(PATH_MAX) -#if defined(MAX_PATH) -#define PATH_MAX MAX_PATH -#else -#define PATH_MAX 256 -#endif -#endif #endif /* __EMULATOR_COMMON_H__ */ diff --git a/tizen/src/emulator_options.c b/tizen/src/emulator_options.c index 2980432395..7615fd9971 100644 --- a/tizen/src/emulator_options.c +++ b/tizen/src/emulator_options.c @@ -26,11 +26,7 @@ * */ -#include -#include -#include - -#include "qemu/osdep.h" +#include "emulator_common.h" #include "qemu/queue.h" #include "emulator_options.h" diff --git a/tizen/src/emulator_options.h b/tizen/src/emulator_options.h index 4e4538e02e..c4507d0a0a 100644 --- a/tizen/src/emulator_options.h +++ b/tizen/src/emulator_options.h @@ -28,13 +28,15 @@ #ifndef __EMULATOR_OPTIONS_H__ #define __EMULATOR_OPTIONS_H__ - -#include "emulator_common.h" - +#ifdef __cplusplus +extern "C" { +#endif void set_variable(const char * const arg1, const char * const arg2, bool override); const char *get_variable(const char * const name); void reset_variables(void); bool load_conf(const char * const conf); bool assemble_emulator_args(int *qemu_argc, char **qemu_argv); - +#ifdef __cplusplus +} +#endif #endif /* __EMULATOR_OPTIONS_H__ */ diff --git a/tizen/src/eventcast/common.c b/tizen/src/eventcast/common.c index 61ba748cf1..6672e65f05 100644 --- a/tizen/src/eventcast/common.c +++ b/tizen/src/eventcast/common.c @@ -28,30 +28,29 @@ * */ -#ifndef __WIN32 -#include -#else -#define EISCONN WSAEISCONN -#define EALREADY WSAEALREADY -#endif -#include "qemu/osdep.h" -#include "qemu-common.h" +#include "emulator.h" #include "qemu/main-loop.h" #include "qemu/sockets.h" #include "qemu/thread.h" -#include "ui/console.h" - -#include "emulator.h" #include "common.h" #include "sensor.h" #include "touch.h" #include "emul_state.h" +#include "ui/console.h" #include "ecs/ecs_eventcast.h" #include "genmsg/eventcast.pb-c.h" #include "util/new_debug_ch.h" +#ifndef __WIN32 +#include +#else +#define EISCONN WSAEISCONN +#define EALREADY WSAEALREADY +#endif + + DECLARE_DEBUG_CHANNEL(eventcast); #define EVENTCAST_MSG_HANDSHAKE_KEY 100 diff --git a/tizen/src/eventcast/sensor.c b/tizen/src/eventcast/sensor.c index ef20fa643d..f8b805eab3 100644 --- a/tizen/src/eventcast/sensor.c +++ b/tizen/src/eventcast/sensor.c @@ -31,7 +31,6 @@ #include "emulator_common.h" #include "emul_state.h" - #include "sensor.h" #include "common.h" #include "ecs/ecs_eventcast.h" diff --git a/tizen/src/eventcast/touch.c b/tizen/src/eventcast/touch.c index 4f0428e470..94c6137b9f 100644 --- a/tizen/src/eventcast/touch.c +++ b/tizen/src/eventcast/touch.c @@ -28,7 +28,6 @@ * */ -#include "qemu/osdep.h" #include "emulator_common.h" #include "emul_state.h" #include "common.h" diff --git a/tizen/src/hw/arm/maru_arm_vpci.c b/tizen/src/hw/arm/maru_arm_vpci.c index e0f5ea18f6..3bf3196578 100644 --- a/tizen/src/hw/arm/maru_arm_vpci.c +++ b/tizen/src/hw/arm/maru_arm_vpci.c @@ -175,7 +175,6 @@ static TypeInfo tizen_vpci_host_info = { .instance_size = sizeof(PCIDevice), .class_init = tizen_vpci_host_class_init, .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { } }, diff --git a/tizen/src/hw/maru_board.c b/tizen/src/hw/maru_board.c index 99eadff06d..16e5802fc3 100644 --- a/tizen/src/hw/maru_board.c +++ b/tizen/src/hw/maru_board.c @@ -27,11 +27,10 @@ * add some TIZEN-speciaized device... */ -#include "qemu/osdep.h" +#include "emulator_common.h" #include "hw/boards.h" #include "hw/i386/pc.h" -#include "emulator_common.h" #include "maru_pm.h" /* maru specialized device init */ @@ -60,9 +59,7 @@ static void maru_x86_machine_options(MachineClass *m) m->no_cdrom = 1; m->no_sdcard = 1; m->default_boot_order = "c"; -#ifdef CONFIG_HAX compat_props_add(m->compat_props, hw_compat_2_6, hw_compat_2_6_len); -#endif //CONFIG_HAX } DEFINE_PC_MACHINE(maru, "maru-x86-machine", maru_x86_board_init, diff --git a/tizen/src/hw/pci/maru_brightness.c b/tizen/src/hw/pci/maru_brightness.c index 04d6b545ce..c070ef6e5b 100644 --- a/tizen/src/hw/pci/maru_brightness.c +++ b/tizen/src/hw/pci/maru_brightness.c @@ -238,7 +238,6 @@ static TypeInfo brightness_info = { .instance_size = sizeof(BrightnessState), .class_init = brightness_classinit, .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { } }, diff --git a/tizen/src/hw/pci/maru_brillcodec.c b/tizen/src/hw/pci/maru_brillcodec.c index b584c53d27..b825242fdc 100644 --- a/tizen/src/hw/pci/maru_brillcodec.c +++ b/tizen/src/hw/pci/maru_brillcodec.c @@ -30,11 +30,12 @@ #include "maru_brillcodec.h" +#include "libavresample/avresample.h" #include "libavutil/mathematics.h" #include "libavutil/opt.h" #include "libavformat/avformat.h" #include "libavutil/pixdesc.h" -#include "libswresample/swresample.h" + #include "util/new_debug_ch.h" /* define debug channel */ @@ -229,8 +230,8 @@ typedef struct CodecDataStg { } CodecDataStg; // define two queue to store input and output buffers. -union codec_wq codec_wq = QTAILQ_HEAD_INITIALIZER(codec_wq); -static QTAILQ_HEAD(codec_rq, CodecDataStg) codec_rq = +union Codec_wq codec_wq = QTAILQ_HEAD_INITIALIZER(codec_wq); +static QTAILQ_HEAD(Codec_rq, CodecDataStg) codec_rq = QTAILQ_HEAD_INITIALIZER(codec_rq); // codec functions @@ -1270,12 +1271,12 @@ static AVFrame *resample_audio(AVCodecContext *avctx, AVFrame *sample_frame, AVFrame *resample_frame, int *resample_buffer_size, int resample_sample_fmt) { - SwrContext *avr = NULL; + AVAudioResampleContext *avr = NULL; uint8_t *resample_buffer = NULL; int buffer_size = 0; int resample_nb_samples = sample_frame->nb_samples; - avr = swr_alloc(); + avr = avresample_alloc_context(); if (!avr) { LOG_SEVERE("failed to allocate avresample context\n"); return NULL; @@ -1293,9 +1294,9 @@ static AVFrame *resample_audio(AVCodecContext *avctx, AVFrame *sample_frame, av_opt_set_int(avr, "out_sample_rate", avctx->sample_rate, 0); LOG_TRACE("open avresample context\n"); - if (swr_init(avr) < 0) { + if (avresample_open(avr) < 0) { LOG_SEVERE("failed to open avresample context\n"); - swr_free(&avr); + avresample_free(&avr); return NULL; } @@ -1309,31 +1310,31 @@ static AVFrame *resample_audio(AVCodecContext *avctx, AVFrame *sample_frame, *resample_buffer_size = av_samples_get_buffer_size(NULL, avctx->channels, resample_nb_samples, resample_sample_fmt, 0); if (*resample_buffer_size < 0) { LOG_SEVERE("failed to get size of resample buffer %d\n", *resample_buffer_size); - swr_close(avr); - swr_free(&avr); + avresample_close(avr); + avresample_free(&avr); return NULL; } resample_buffer = av_mallocz(*resample_buffer_size); if (!resample_buffer) { LOG_SEVERE("failed to allocate resample buffer\n"); - swr_close(avr); - swr_free(&avr); + avresample_close(avr); + avresample_free(&avr); return NULL; } fill_audio_into_frame(avctx, resample_frame, resample_buffer, *resample_buffer_size, resample_nb_samples, resample_sample_fmt); - buffer_size = swr_convert(avr, resample_frame->data, + buffer_size = avresample_convert(avr, resample_frame->data, *resample_buffer_size, resample_nb_samples, sample_frame->data, sample_buffer_size, sample_frame->nb_samples); LOG_TRACE("resample_audio buffer_size %d\n", buffer_size); - swr_close(avr); - swr_free(&avr); + avresample_close(avr); + avresample_free(&avr); return resample_frame; } @@ -1619,6 +1620,11 @@ static enum PixelFormat get_format(AVCodecContext *avctx, CodecContext *context = (CodecContext *)avctx->opaque; MaruBrillCodecState *s = context->state; + if (!s->hwaccel_plugin || + !check_av_hw_accel(avctx->codec_id)) { + goto end; + } + for (i = 0; pi_fmt[i] != PIX_FMT_NONE; ++i) { const AVPixFmtDescriptor *dsc = av_pix_fmt_desc_get(pi_fmt[i]); if (dsc == NULL) { diff --git a/tizen/src/hw/pci/maru_brillcodec.h b/tizen/src/hw/pci/maru_brillcodec.h index 66cd647ce0..aaf3d87429 100644 --- a/tizen/src/hw/pci/maru_brillcodec.h +++ b/tizen/src/hw/pci/maru_brillcodec.h @@ -32,8 +32,10 @@ #define __MARU_BRILLCODEC_H__ #include "qemu/osdep.h" -#include "hw/pci/pci.h" #include "qemu/thread.h" +#include "hw/pci/pci.h" + +#include "libavcodec/avcodec.h" #include "maru_brillcodec_plugin.h" @@ -136,8 +138,8 @@ typedef struct DeviceMemEntry { QTAILQ_ENTRY(DeviceMemEntry) node; } DeviceMemEntry; -QTAILQ_HEAD(codec_wq, DeviceMemEntry); -extern union codec_wq codec_wq; +QTAILQ_HEAD(Codec_wq, DeviceMemEntry); +extern union Codec_wq codec_wq; extern DeviceMemEntry *entry[CODEC_CONTEXT_MAX]; diff --git a/tizen/src/hw/pci/maru_brillcodec_device.c b/tizen/src/hw/pci/maru_brillcodec_device.c index 25edb3272a..db77dd7910 100644 --- a/tizen/src/hw/pci/maru_brillcodec_device.c +++ b/tizen/src/hw/pci/maru_brillcodec_device.c @@ -261,9 +261,13 @@ static const MemoryRegionOps brillcodec_mmio_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; + +#define CODEC_DEVICE_PCI(obj) OBJECT_CHECK(MaruBrillCodecState, (obj), \ + CODEC_DEVICE_NAME) + static void brillcodec_initfn(PCIDevice *dev, Error **errp) { - MaruBrillCodecState *s = DO_UPCAST(MaruBrillCodecState, dev, dev); + MaruBrillCodecState *s = CODEC_DEVICE_PCI(dev); uint8_t *pci_conf = s->dev.config; LOG_INFO("device initialization.\n"); @@ -313,7 +317,7 @@ static void brillcodec_initfn(PCIDevice *dev, Error **errp) static void brillcodec_exitfn(PCIDevice *dev) { - MaruBrillCodecState *s = DO_UPCAST(MaruBrillCodecState, dev, dev); + MaruBrillCodecState *s = CODEC_DEVICE_PCI(dev); LOG_INFO("device exit\n"); qemu_mutex_destroy(&s->context_mutex); @@ -350,7 +354,7 @@ static void brillcodec_class_init(ObjectClass *klass, void *data) k->device_id = PCI_DEVICE_ID_VIRTUAL_BRILL_CODEC; k->class_id = PCI_CLASS_OTHERS; dc->reset = brillcodec_reset; - device_class_set_props(dc,brillcodec_props); + device_class_set_props(dc, brillcodec_props); dc->desc = "Virtual new codec device for Tizen emulator"; } @@ -360,7 +364,6 @@ static TypeInfo codec_device_info = { .instance_size = sizeof(MaruBrillCodecState), .class_init = brillcodec_class_init, .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { } }, diff --git a/tizen/src/hw/pci/maru_brillcodec_plugin.h b/tizen/src/hw/pci/maru_brillcodec_plugin.h index 885628e5fc..71cc316b9c 100644 --- a/tizen/src/hw/pci/maru_brillcodec_plugin.h +++ b/tizen/src/hw/pci/maru_brillcodec_plugin.h @@ -45,8 +45,8 @@ extern void set_plugin_context(AVCodecContext *avctx, void *plugin_context); typedef struct CodecPlugin { char const *name; - enum AVPixelFormat pix_fmt; - enum AVPixelFormat output_pix_fmt; + enum PixelFormat pix_fmt; + enum PixelFormat output_pix_fmt; bool (*probe)(void); void *(*setup)(AVCodecContext *, int , int); void (*cleanup)(void *); @@ -90,7 +90,6 @@ static inline CodecPlugin *probe_plugin(void) { return NULL; } -#if 0 //AV hwaccel deprecated static inline bool check_av_hw_accel(enum AVCodecID id) { AVHWAccel *av_hw = NULL; @@ -107,5 +106,5 @@ static inline bool check_av_hw_accel(enum AVCodecID id) return is_exist; } -#endif //0 + #endif //__MARU_BRILLCODEC_PLUGIN_H__ diff --git a/tizen/src/hw/pci/maru_camera.c b/tizen/src/hw/pci/maru_camera.c index a01afa5fb3..d992216e37 100644 --- a/tizen/src/hw/pci/maru_camera.c +++ b/tizen/src/hw/pci/maru_camera.c @@ -364,7 +364,6 @@ static TypeInfo maru_camera_info = { .instance_size = sizeof(MaruCamState), .class_init = maru_camera_pci_class_init, .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { } }, diff --git a/tizen/src/hw/pci/maru_camera_qtimage.cpp b/tizen/src/hw/pci/maru_camera_qtimage.cpp index 26e76d0f9c..b725aa1d89 100644 --- a/tizen/src/hw/pci/maru_camera_qtimage.cpp +++ b/tizen/src/hw/pci/maru_camera_qtimage.cpp @@ -28,7 +28,7 @@ * with Qt5 QImage class */ -#include +#include #include #include #define QObject qemu_QObject diff --git a/tizen/src/hw/pci/maru_camera_virtual.c b/tizen/src/hw/pci/maru_camera_virtual.c index 5754408b2a..000c578336 100644 --- a/tizen/src/hw/pci/maru_camera_virtual.c +++ b/tizen/src/hw/pci/maru_camera_virtual.c @@ -28,8 +28,7 @@ * with Qt5 QImage class */ -#include "qemu/osdep.h" -#include "qemu-common.h" +#include "emulator_common.h" #include "qemu/timer.h" #include "qemu/cutils.h" #include "sysemu/kvm.h" diff --git a/tizen/src/hw/pci/maru_dtv_audio.c b/tizen/src/hw/pci/maru_dtv_audio.c index 84a14007e2..22924085b9 100644 --- a/tizen/src/hw/pci/maru_dtv_audio.c +++ b/tizen/src/hw/pci/maru_dtv_audio.c @@ -1547,7 +1547,6 @@ static const TypeInfo maru_dtv_audio_info = { .instance_size = sizeof (MaruDtvAudioState), .class_init = maru_dtv_audio_class_init, .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { } }, diff --git a/tizen/src/hw/pci/maru_external_input_pci.c b/tizen/src/hw/pci/maru_external_input_pci.c index 967576126e..ee1a3dbb7b 100644 --- a/tizen/src/hw/pci/maru_external_input_pci.c +++ b/tizen/src/hw/pci/maru_external_input_pci.c @@ -1068,11 +1068,9 @@ static TypeInfo maru_external_input_info = { .instance_size = sizeof(MaruExtInputState), .class_init = maru_external_input_pci_class_init, .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, }, - }; static void maru_external_input_pci_register_types(void) diff --git a/tizen/src/hw/pci/maru_tuner.c b/tizen/src/hw/pci/maru_tuner.c index fd949b8b64..f9ec9e01b9 100644 --- a/tizen/src/hw/pci/maru_tuner.c +++ b/tizen/src/hw/pci/maru_tuner.c @@ -27,13 +27,8 @@ * */ -#include -#include -#include - #include "qemu/osdep.h" #include "qemu/thread.h" - #include "exec/memory.h" #include "exec/memory-internal.h" #include "tizen/src/emulator.h" @@ -43,6 +38,7 @@ #include "qapi/qmp/qdict.h" #include "hw/maru_device_ids.h" #include "hw/qdev-properties.h" +#include "hw/pci/maru_tuner.h" #include "maru_tuner.h" #include "ecs/ecs.h" #include "util/new_debug_ch.h" @@ -1608,11 +1604,9 @@ static TypeInfo marutuner_info = { .instance_size = sizeof(MaruTunerState), .class_init = marutuner_class_init, .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { } }, - }; static void tuner_register_types(void) diff --git a/tizen/src/hw/pci/maru_tuner_decoder.c b/tizen/src/hw/pci/maru_tuner_decoder.c index 3e79410ca8..8e937fb5b8 100644 --- a/tizen/src/hw/pci/maru_tuner_decoder.c +++ b/tizen/src/hw/pci/maru_tuner_decoder.c @@ -368,10 +368,10 @@ static enum PixelFormat maru_tuner_dec_get_format( AVCodecContext *dec_ctx, int i = 0; uint8_t flag_hwaccel = 0; - // if (!s->hwaccel_plugin || - // !check_av_hw_accel(dec_ctx->codec_id)) { - // goto end; - // } + if (!s->hwaccel_plugin || + !check_av_hw_accel(dec_ctx->codec_id)) { + goto end; + } /* Enumerate available formats */ for(i = 0; pi_fmt[i] != PIX_FMT_NONE; i++) @@ -524,9 +524,9 @@ int maru_tuner_dec_init_ctx(MaruTunerDecoderState* s, AVStream* stream) } LOG_TRACE("decoder name : %s\n", dec->long_name); - // if (check_av_hw_accel(dec_ctx->codec_id)) { - // dec_ctx->thread_type &= ~FF_THREAD_SLICE; - // } + if (check_av_hw_accel(dec_ctx->codec_id)) { + dec_ctx->thread_type &= ~FF_THREAD_SLICE; + } /* init the decoder */ ret = avcodec_open2(dec_ctx, dec, NULL); @@ -569,7 +569,7 @@ static void pcm_save(int16_t *samples, int size) static uint8_t *resample_audio(AVCodecContext * avctx, AVFrame *samples, int *out_size) { - SwrContext *avr = NULL; + AVAudioResampleContext *avr = NULL; uint8_t *resample_audio = NULL; int buffer_size = 0, out_linesize = 0; int nb_samples = samples->nb_samples; @@ -582,7 +582,7 @@ static uint8_t *resample_audio(AVCodecContext * avctx, AVFrame *samples, int *ou LOG_TRACE("sample_rate=%d\n", avctx->sample_rate); #endif - avr = swr_alloc(); + avr = avresample_alloc_context(); if (!avr) { LOG_SEVERE("failed to allocate avresample context\n"); return NULL; @@ -596,9 +596,9 @@ static uint8_t *resample_audio(AVCodecContext * avctx, AVFrame *samples, int *ou av_opt_set_int(avr, "out_sample_rate", avctx->sample_rate, 0); LOG_TRACE("open avresample context\n"); - if (swr_init(avr) < 0) { + if (avresample_open(avr) < 0) { LOG_SEVERE("failed to open avresample context\n"); - swr_free(&avr); + avresample_free(&avr); return NULL; } @@ -614,15 +614,15 @@ static uint8_t *resample_audio(AVCodecContext * avctx, AVFrame *samples, int *ou return NULL; } - buffer_size = swr_convert(avr, &resample_audio, + buffer_size = avresample_convert(avr, &resample_audio, out_linesize, nb_samples, samples->data, samples->linesize[0], samples->nb_samples); LOG_TRACE("resample_audio out_size %d buffer_size %d\n", *out_size, buffer_size); - swr_close(avr); - swr_free(&avr); + avresample_close(avr); + avresample_free(&avr); return resample_audio; } @@ -2433,11 +2433,9 @@ static TypeInfo tuner_decoder_device_info = { .instance_size = sizeof(MaruTunerDecoderState), .class_init = maru_tuner_decoder_class_init, .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, }, - }; static void tuner_decoder_register_types(void) diff --git a/tizen/src/hw/pci/maru_tuner_decoder.h b/tizen/src/hw/pci/maru_tuner_decoder.h index 614762abce..7e820424be 100644 --- a/tizen/src/hw/pci/maru_tuner_decoder.h +++ b/tizen/src/hw/pci/maru_tuner_decoder.h @@ -34,9 +34,7 @@ */ /// @cond -#include -#include - +#include "qemu/osdep.h" #include "hw/hw.h" #include "sysemu/kvm.h" #include "hw/pci/pci.h" @@ -52,8 +50,9 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "libswscale/swscale.h" -#include "libswresample/swresample.h" +#include "libavresample/avresample.h" +#include /* Tuner Image */ extern uint8_t tuner_video_power; diff --git a/tizen/src/hw/virtio/maru_virtio_nfc.c b/tizen/src/hw/virtio/maru_virtio_nfc.c index ef4d01bce9..bbb43bc63f 100644 --- a/tizen/src/hw/virtio/maru_virtio_nfc.c +++ b/tizen/src/hw/virtio/maru_virtio_nfc.c @@ -26,13 +26,12 @@ * */ -#include - #include "qemu/osdep.h" #include "qemu/iov.h" #include "hw/maru_device_ids.h" #include "maru_virtio_nfc.h" #include "ecs/ecs.h" +#include "ecs/ecs_internal.h" #include "hw/qdev-properties.h" #include "block/aio.h" #include "qemu/main-loop.h" diff --git a/tizen/src/hw/virtio/maru_virtio_nfc.h b/tizen/src/hw/virtio/maru_virtio_nfc.h index ae6c170ff1..56ac1b5f97 100644 --- a/tizen/src/hw/virtio/maru_virtio_nfc.h +++ b/tizen/src/hw/virtio/maru_virtio_nfc.h @@ -35,7 +35,6 @@ extern "C" { #include "hw/virtio/virtio.h" - enum request_cmd_nfc { request_nfc_get = 0, request_nfc_set, diff --git a/tizen/src/hw/virtio/maru_virtio_pci.c b/tizen/src/hw/virtio/maru_virtio_pci.c index 570dc9faf4..4e244fd7d5 100644 --- a/tizen/src/hw/virtio/maru_virtio_pci.c +++ b/tizen/src/hw/virtio/maru_virtio_pci.c @@ -203,7 +203,7 @@ static Property virtio_touchscreen_pci_properties[] = { static void virtio_touchscreen_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { - object_property_set_bool(OBJECT(vpci_dev), true, "disable-modern", errp); + virtio_pci_disable_modern(vpci_dev); VirtIOTouchscreenPCI *dev = VIRTIO_MARU_TOUCHSCREEN_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); @@ -241,18 +241,13 @@ static TypeInfo virtio_touchscreen_pci_info = { .instance_size = sizeof(VirtIOTouchscreenPCI), .instance_init = virtio_touchscreen_pci_instance_init, .class_init = virtio_touchscreen_pci_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } - }, }; /* virtio-maru-keyboard-pci */ static void virtio_keyboard_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { - object_property_set_bool(OBJECT(vpci_dev), true, "disable-modern", errp); + virtio_pci_disable_modern(vpci_dev); VirtIOKeyboardPCI *dev = VIRTIO_MARU_KEYBOARD_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); @@ -286,19 +281,13 @@ static TypeInfo virtio_keyboard_pci_info = { .instance_size = sizeof(VirtIOKeyboardPCI), .instance_init = virtio_keyboard_pci_instance_init, .class_init = virtio_keyboard_pci_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } - }, - }; /* virtio-maru-esm-pci */ static void virtio_esm_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { - object_property_set_bool(OBJECT(vpci_dev), true, "disable-modern", errp); + virtio_pci_disable_modern(vpci_dev); VirtIOESMPCI *dev = VIRTIO_MARU_ESM_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); @@ -332,19 +321,13 @@ static TypeInfo virtio_esm_pci_info = { .instance_size = sizeof(VirtIOESMPCI), .instance_init = virtio_esm_pci_instance_init, .class_init = virtio_esm_pci_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } - }, - }; /* virtio-maru-hwkey-pci */ static void virtio_hwkey_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { - object_property_set_bool(OBJECT(vpci_dev), true, "disable-modern", errp); + virtio_pci_disable_modern(vpci_dev); VirtIOHWKeyPCI *dev = VIRTIO_MARU_HWKEY_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); @@ -378,19 +361,13 @@ static TypeInfo virtio_hwkey_pci_info = { .instance_size = sizeof(VirtIOHWKeyPCI), .instance_init = virtio_hwkey_pci_instance_init, .class_init = virtio_hwkey_pci_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } - }, - }; /* virtio-maru-tablet-pci */ static void virtio_tablet_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { - object_property_set_bool(OBJECT(vpci_dev), true, "disable-modern", errp); + virtio_pci_disable_modern(vpci_dev); VirtIOTabletPCI *dev = VIRTIO_MARU_TABLET_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); @@ -424,12 +401,6 @@ static TypeInfo virtio_tablet_pci_info = { .instance_size = sizeof(VirtIOTabletPCI), .instance_init = virtio_tablet_pci_instance_init, .class_init = virtio_tablet_pci_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } - }, - }; /* virtio-maru-evdi-pci */ @@ -440,7 +411,7 @@ static Property virtio_evdi_pci_properties[] = { static void virtio_evdi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { - object_property_set_bool(OBJECT(vpci_dev), true, "disable-modern", errp); + virtio_pci_disable_modern(vpci_dev); VirtIOEVDIPCI *dev = VIRTIO_MARU_EVDI_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); @@ -476,11 +447,6 @@ static TypeInfo virtio_evdi_pci_info = { .instance_size = sizeof(VirtIOEVDIPCI), .instance_init = virtio_evdi_pci_instance_init, .class_init = virtio_evdi_pci_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } - }, }; /* virtio-maru-sensor-pci */ @@ -491,7 +457,7 @@ static Property virtio_sensor_pci_properties[] = { static void virtio_sensor_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { - object_property_set_bool(OBJECT(vpci_dev), true, "disable-modern", errp); + virtio_pci_disable_modern(vpci_dev); VirtIOSENSORPCI *dev = VIRTIO_MARU_SENSOR_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); @@ -527,18 +493,13 @@ static TypeInfo virtio_sensor_pci_info = { .instance_size = sizeof(VirtIOSENSORPCI), .instance_init = virtio_sensor_pci_instance_init, .class_init = virtio_sensor_pci_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } - }, }; /* virtio maru NFC */ static void virtio_nfc_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { - object_property_set_bool(OBJECT(vpci_dev), true, "disable-modern", errp); + virtio_pci_disable_modern(vpci_dev); VirtIONFCPCI *dev = VIRTIO_MARU_NFC_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); @@ -572,11 +533,6 @@ static TypeInfo virtio_nfc_pci_info = { .instance_size = sizeof(VirtIONFCPCI), .instance_init = virtio_nfc_pci_instance_init, .class_init = virtio_nfc_pci_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } - }, }; /* virtio-maru-jack-pci */ @@ -587,7 +543,7 @@ static Property virtio_jack_pci_properties[] = { static void virtio_jack_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { - object_property_set_bool(OBJECT(vpci_dev), true, "disable-modern", errp); + virtio_pci_disable_modern(vpci_dev); VirtIOJACKPCI *dev = VIRTIO_MARU_JACK_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); @@ -623,19 +579,13 @@ static TypeInfo virtio_jack_pci_info = { .instance_size = sizeof(VirtIOJACKPCI), .instance_init = virtio_jack_pci_instance_init, .class_init = virtio_jack_pci_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } - }, - }; /* virtio-maru-power-pci */ static void virtio_power_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { - object_property_set_bool(OBJECT(vpci_dev), true, "disable-modern", errp); + virtio_pci_disable_modern(vpci_dev); VirtIOPOWERPCI *dev = VIRTIO_MARU_POWER_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); @@ -669,19 +619,13 @@ static TypeInfo virtio_power_pci_info = { .instance_size = sizeof(VirtIOPOWERPCI), .instance_init = virtio_power_pci_instance_init, .class_init = virtio_power_pci_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } - }, - }; /* virtio-maru-vmodem-pci */ static void virtio_vmodem_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { - object_property_set_bool(OBJECT(vpci_dev), true, "disable-modern", errp); + virtio_pci_disable_modern(vpci_dev); VirtIOVModemPCI *dev = VIRTIO_MARU_VMODEM_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); @@ -715,19 +659,13 @@ static TypeInfo virtio_vmodem_pci_info = { .instance_size = sizeof(VirtIOVModemPCI), .instance_init = virtio_vmodem_pci_instance_init, .class_init = virtio_vmodem_pci_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } - }, - }; /* virtio-maru-rotary-pci */ static void virtio_rotary_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { - object_property_set_bool(OBJECT(vpci_dev), true, "disable-modern", errp); + virtio_pci_disable_modern(vpci_dev); VirtIORotaryPCI *dev = VIRTIO_MARU_ROTARY_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); @@ -761,11 +699,6 @@ static TypeInfo virtio_rotary_pci_info = { .instance_size = sizeof(VirtIORotaryPCI), .instance_init = virtio_rotary_pci_instance_init, .class_init = virtio_rotary_pci_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } - }, }; static void maru_virtio_pci_register_types(void) diff --git a/tizen/src/hw/virtio/maru_virtio_power.c b/tizen/src/hw/virtio/maru_virtio_power.c index 4710d4ebe1..9deefe64a0 100644 --- a/tizen/src/hw/virtio/maru_virtio_power.c +++ b/tizen/src/hw/virtio/maru_virtio_power.c @@ -255,13 +255,7 @@ static const TypeInfo virtio_device_info = { .name = TYPE_VIRTIO_MARU_POWER, .parent = TYPE_VIRTIO_DEVICE, .instance_size = sizeof(VirtIOPOWER), - .class_init = virtio_power_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { } - }, - + .class_init = virtio_power_class_init, }; static void virtio_register_types(void) diff --git a/tizen/src/hw/virtio/maru_virtio_sensor.c b/tizen/src/hw/virtio/maru_virtio_sensor.c index bf0c764cff..05b1621d93 100644 --- a/tizen/src/hw/virtio/maru_virtio_sensor.c +++ b/tizen/src/hw/virtio/maru_virtio_sensor.c @@ -40,6 +40,7 @@ #include "maru_virtio_sensor.h" #include "debug_ch.h" #include "ecs/ecs.h" +#include "ecs/ecs_internal.h" MULTI_DEBUG_CHANNEL(qemu, sensor); diff --git a/tizen/src/ns_event.h b/tizen/src/ns_event.h index 1ca3ff9dfe..b78443c917 100644 --- a/tizen/src/ns_event.h +++ b/tizen/src/ns_event.h @@ -1,6 +1,9 @@ #ifndef _NS_EVENT_H_ #define _NS_EVENT_H_ +#ifdef __cplusplus +extern "C" { +#endif void ns_event_loop(int* keepRunning); void ns_run_in_event_loop(void (*func)()); @@ -8,5 +11,7 @@ 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); - +#ifdef __cplusplus +} +#endif #endif /* _NS_EVENT_H_ */ diff --git a/tizen/src/ui/displaybase.cpp b/tizen/src/ui/displaybase.cpp index c9fe65aa18..b592e481b3 100644 --- a/tizen/src/ui/displaybase.cpp +++ b/tizen/src/ui/displaybase.cpp @@ -33,13 +33,10 @@ #include "mainwindow.h" #include "resource/ui_strings.h" #include "menu/sdbhelper.h" - -extern "C" { #include "util/ui_operations.h" - -void qt5_graphic_hw_invalidate(void); -void req_set_sensor_accel_angle(int angle); -} +#include "qt5_supplement.h" +#include "emul_state.h" +#include "ecs/ecs_sensor.h" DisplayBase::DisplayBase(DisplayType *displayForm, QSize resolution, qreal scaleFactor, QWidget *w) : resolution(resolution), widget(w) diff --git a/tizen/src/ui/displayglwidget.h b/tizen/src/ui/displayglwidget.h index f6883ff592..1de2ddf0de 100644 --- a/tizen/src/ui/displayglwidget.h +++ b/tizen/src/ui/displayglwidget.h @@ -86,7 +86,6 @@ private: void* current; void* next; QMutex textureListMutex; - GLuint mtTexture; QMatrix4x4 mOrtho; diff --git a/tizen/src/ui/displayswwidget.cpp b/tizen/src/ui/displayswwidget.cpp index 97c968ee32..3f16cd2185 100644 --- a/tizen/src/ui/displayswwidget.cpp +++ b/tizen/src/ui/displayswwidget.cpp @@ -33,7 +33,12 @@ #include "input/multitouchtracker.h" extern "C" { +#define QObject qemu_QObject +#define QList qemu_QList +#include "emulator_common.h" #include "emul_state.h" +#undef QObject +#undef QList }; DisplaySWWidget::DisplaySWWidget(QWidget *parent, diff --git a/tizen/src/ui/input/keyboardshortcut.cpp b/tizen/src/ui/input/keyboardshortcut.cpp index 101d1ff199..13ecaf89ab 100644 --- a/tizen/src/ui/input/keyboardshortcut.cpp +++ b/tizen/src/ui/input/keyboardshortcut.cpp @@ -33,6 +33,7 @@ #include "mainwindow.h" extern "C" { +#include "emul_state.h" #include "util/ui_operations.h" } diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp index 7250da9209..0dcad5206f 100644 --- a/tizen/src/ui/mainwindow.cpp +++ b/tizen/src/ui/mainwindow.cpp @@ -41,11 +41,13 @@ #include "uiutil.h" extern "C" { +#define QObject qemu_QObject +#define QList qemu_QList +#include "emulator.h" #include "util/ui_operations.h" - -void qt5_graphic_hw_update(void); -// FIXME: To avoid very complex header inclusion chains -void qemu_system_graceful_shutdown_request(unsigned int sec); +#include "qt5_supplement.h" +#undef QObject +#undef QList } MainWindow::MainWindow(UiInformation *uiInfo, bool useGL, QWidget *parent) : diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp index 31819f4df6..e4051c0bfe 100644 --- a/tizen/src/ui/menu/contextmenu.cpp +++ b/tizen/src/ui/menu/contextmenu.cpp @@ -31,7 +31,6 @@ #include "contextmenu.h" #include "resource/ui_strings.h" -#include "emulator_common.h" #include "mainwindow.h" #include "uiutil.h" #include "menu/advancedmenuitem.h" @@ -39,22 +38,18 @@ #include "emul_state.h" extern "C" { -// FIXME: To avoid very complex header inclusion chains -void qemu_system_graceful_shutdown_request(unsigned int sec); -void qemu_system_reset_request(void); -#define MENU_ACTION_REBOOT 1 -void send_shutdown_request(int action); - #define QObject qemu_QObject -#include "util/net_helper.h" +#define QList qemu_QList #include "util/osutil.h" +#include "util/net_helper.h" #include "util/device_hotplug.h" #include "util/ui_operations.h" +#include "sysemu/runstate.h" +#include "ecs/ecs.h" #undef QObject +#undef QList } -#undef connect - ContextMenu::ContextMenu(QWidget *parent) : QMenu(parent) { this->parent = (MainWindow *)parent; @@ -1189,7 +1184,7 @@ void ContextMenu::slotAbout() void ContextMenu::slotDeviceReset() { qDebug("System reset request."); - qemu_system_reset_request(); + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); qDebug("Done for system reset request."); } @@ -1201,7 +1196,7 @@ void ContextMenu::slotSystemReset() if (result == QMessageBox::Yes) { qDebug() << "Reboot."; - send_shutdown_request(MENU_ACTION_REBOOT); + send_shutdown_request(ECS_SYSTEM_ACTION_REBOOT); rebootTimer->start(); } else { diff --git a/tizen/src/ui/menu/contextmenu.h b/tizen/src/ui/menu/contextmenu.h index 2a8837cd6a..3fad2cac42 100644 --- a/tizen/src/ui/menu/contextmenu.h +++ b/tizen/src/ui/menu/contextmenu.h @@ -32,15 +32,8 @@ #ifndef CONTEXTMENU_H #define CONTEXTMENU_H -#define QObject qemu_QObject -#define QList qemu_QList -#include "qemu/typedefs.h" -#undef QObject -#undef QList - #include -#include "emulator_common.h" #include "detailedinfodialog.h" #include "aboutdialog.h" #include "screenshotdialog.h" @@ -50,10 +43,6 @@ class MainWindow; -extern "C" { -#include "emul_state.h" -} - #define CLOSE_POWER_KEY_INTERVAL 1200 /* milli-seconds */ #define HARDWARE_REBOOT_INTERVAL 1000 /* milli-seconds */ diff --git a/tizen/src/ui/menu/screenshotdialog.cpp b/tizen/src/ui/menu/screenshotdialog.cpp index be5e7b7e3e..e9be457dd0 100644 --- a/tizen/src/ui/menu/screenshotdialog.cpp +++ b/tizen/src/ui/menu/screenshotdialog.cpp @@ -34,6 +34,7 @@ #include "resource/ui_strings.h" #include "screenshotview.h" #include "mainwindow.h" +#include "emul_state.h" ScreenShotDialog::ScreenShotDialog(QWidget *parent) : QDialog(parent, Qt::Window) diff --git a/tizen/src/ui/menu/sdbhelper.cpp b/tizen/src/ui/menu/sdbhelper.cpp index c4203b70aa..a8e386eb44 100644 --- a/tizen/src/ui/menu/sdbhelper.cpp +++ b/tizen/src/ui/menu/sdbhelper.cpp @@ -35,9 +35,13 @@ #include "resource/ui_strings.h" extern "C" { -#include "qemu/osdep.h" +#define QObject qemu_QObject +#define QList qemu_QList +#include "emulator_common.h" #include "emul_state.h" #include "util/net_helper.h" +#undef QObject +#undef QList } SdbHelper::SdbHelper(MainWindow *parent, DisplayBase *displaybase) diff --git a/tizen/src/ui/qt5.c b/tizen/src/ui/qt5.c index 8d3a3aeb6b..bb58705ead 100644 --- a/tizen/src/ui/qt5.c +++ b/tizen/src/ui/qt5.c @@ -27,12 +27,11 @@ * */ -#include "qemu/osdep.h" -#include "ui/console.h" - -#include "qt5.h" +#include "emulator_common.h" #include "emul_state.h" +#include "qt5.h" #include "qt5_supplement.h" +#include "ui/console.h" #include "hw/pci/maru_brightness.h" #include "resource/ui_strings.h" @@ -233,4 +232,4 @@ static void register_maru_qt5_app(void) qemu_display_register(&qemu_display_maru_qt5_app); } -type_init(register_maru_qt5_app); \ No newline at end of file +type_init(register_maru_qt5_app); diff --git a/tizen/src/ui/qt5.h b/tizen/src/ui/qt5.h index 89707d50b4..690fe69b21 100644 --- a/tizen/src/ui/qt5.h +++ b/tizen/src/ui/qt5.h @@ -29,16 +29,16 @@ #ifndef __QT5_H__ #define __QT5_H__ -#include - -#include "qemu/osdep.h" -#include "sysemu/sysemu.h" - +#ifdef __cplusplus +extern "C" { +#endif void maru_qt5_display_fini(void); void set_display_pixel_density(int dpi); int get_display_pixel_density(void); void maru_qt5_set_force_legacy(bool isLegacy); - +#ifdef __cplusplus +} +#endif #endif // __QT5_H__ diff --git a/tizen/src/ui/qt5_supplement.cpp b/tizen/src/ui/qt5_supplement.cpp index bc3e44fd99..63b35de3b4 100644 --- a/tizen/src/ui/qt5_supplement.cpp +++ b/tizen/src/ui/qt5_supplement.cpp @@ -28,15 +28,6 @@ * */ -extern "C" { -#define QObject qemu_QObject -#define QList qemu_QList -#include "qemu/osdep.h" -#include "emul_state.h" -#include "emulator_options.h" -#undef QObject -#undef QList -} #include #include @@ -49,6 +40,17 @@ extern "C" { #include "resource/ui_strings.h" #include "displaybase.h" #include "util/new_debug_ch.h" + +extern "C" { +#define QObject qemu_QObject +#define QList qemu_QList +#include "emulator_common.h" +#include "emul_state.h" +#include "emulator_options.h" +#undef QObject +#undef QList +} + // XXX: all modules in ui/* are controlled by channel name "qt5_ui" DECLARE_DEBUG_CHANNEL(qt5_ui); @@ -62,8 +64,8 @@ QApplication *qt5App = NULL; QOpenGLContext *qt5GLContext; bool isForceLegacy; -static int argc = 1; -static char *argv[2] = { NULL, NULL} ; +static int argc = 0; +static char *argv[0]; #define MAX_DPY_BLANK_FRAME_CNT 10 static unsigned int dpy_blank_cnt; @@ -471,21 +473,16 @@ void qt5_early_prepare(bool isOnscreen) sfcFormat.setProfile(QSurfaceFormat::CoreProfile); } QSurfaceFormat::setDefaultFormat(sfcFormat); - qDebug("Called QSurfaceFormat::setDefaultFormat()"); } - argv[0] = new char[12]; - strcpy(argv[0], "qt5_msgbox"); qt5App = new QApplication(argc, argv); - qDebug("Created new QApplication"); + // add the path in the application's main() function, // right after the QApplication object is created. // TODO: consider a symbolic link qt5App->addLibraryPath(QDir::currentPath()); - qDebug("Set addLibraryPath to QApplication"); qInstallMessageHandler(qMessageOutput); - qDebug("Set qInstallMessageHandler"); #ifdef CONFIG_WIN32 eventFilter = new EventFilter(); qt5App->installNativeEventFilter(eventFilter); diff --git a/tizen/src/ui/uiutil.h b/tizen/src/ui/uiutil.h index 5df4837408..23a129562c 100644 --- a/tizen/src/ui/uiutil.h +++ b/tizen/src/ui/uiutil.h @@ -35,15 +35,6 @@ #include #include -#include "emulator_common.h" - -#ifdef CONFIG_WIN32 -#include -#elif defined (CONFIG_LINUX) -#include -#include -#endif - class UiUtil { public: diff --git a/tizen/src/util/device_hotplug.c b/tizen/src/util/device_hotplug.c index 7ed6bb4134..3f6c0bd3d4 100644 --- a/tizen/src/util/device_hotplug.c +++ b/tizen/src/util/device_hotplug.c @@ -26,13 +26,16 @@ * */ -#include "qemu/osdep.h" +#include "emulator.h" +#include "emul_state.h" +#include "qemu/option.h" #include "qemu/main-loop.h" #include "qemu/config-file.h" #include "hw/qdev.h" #include "qemu/event_notifier.h" #include "qapi/qmp/qstring.h" #include "sysemu/block-backend.h" +#include "sysemu/sysemu.h" #include "qapi/qmp/qerror.h" #include "qapi/qmp/qdict.h" #include "qapi/error.h" @@ -42,8 +45,7 @@ #include "fsdev/qemu-fsdev.h" #endif -#include "emulator.h" -#include "emul_state.h" +#include "ecs/ecs.h" #include "device_hotplug.h" #include "ecs/ecs_hds.h" #include "hds.h" diff --git a/tizen/src/util/device_hotplug.h b/tizen/src/util/device_hotplug.h index 538c4013b5..669df16957 100644 --- a/tizen/src/util/device_hotplug.h +++ b/tizen/src/util/device_hotplug.h @@ -28,7 +28,9 @@ #ifndef _MARU_DEVICE_HOTPLUG_H_ #define _MARU_DEVICE_HOTPLUG_H_ - +#ifdef __cplusplus +extern "C" { +#endif enum command { ATTACH_HOST_KEYBOARD, DETACH_HOST_KEYBOARD, @@ -44,5 +46,7 @@ void do_hotplug(int command, void *opaque, size_t size); bool is_host_keyboard_attached(void); bool is_sdcard_attached(void); - +#ifdef __cplusplus +} +#endif #endif /* _MARU_DEVICE_HOTPLUG_H_ */ diff --git a/tizen/src/util/error_handler.c b/tizen/src/util/error_handler.c index 4bda0540b1..efa9d77633 100644 --- a/tizen/src/util/error_handler.c +++ b/tizen/src/util/error_handler.c @@ -28,8 +28,7 @@ * */ -#include "qemu/osdep.h" -#include "qemu-common.h" +#include "emulator.h" #include "qemu/thread.h" #ifdef CONFIG_WIN32 @@ -42,8 +41,7 @@ #include "qemu/error-report.h" #include "error_handler.h" -#include "emulator_common.h" -#include "emulator.h" + #ifdef CONFIG_QT #include "qt5_error_report.h" diff --git a/tizen/src/util/error_handler.h b/tizen/src/util/error_handler.h index 783dd00dc3..ee67300b91 100644 --- a/tizen/src/util/error_handler.h +++ b/tizen/src/util/error_handler.h @@ -30,8 +30,12 @@ #ifndef __ERROR_HANDLER_H__ #define __ERROR_HANDLER_H__ - +#ifdef __cplusplus +extern "C" { +#endif void init_error_handler(void); void enable_print_backtrace_at_normal_exit(void); - +#ifdef __cplusplus +} +#endif #endif /* __ERROR_HANDLER_H__ */ diff --git a/tizen/src/util/extra_pkgs_install.h b/tizen/src/util/extra_pkgs_install.h index 95db8f896f..c665a1fe8f 100644 --- a/tizen/src/util/extra_pkgs_install.h +++ b/tizen/src/util/extra_pkgs_install.h @@ -41,7 +41,11 @@ #define MAX_PKG_LIST 1024 #define MAX_PATH_PKG_LIST 256 - +#ifdef __cplusplus +extern "C" { +#endif void epi_init(void); - +#ifdef __cplusplus +} +#endif #endif /* _EXTRA_PKGS_INSTALL_ */ diff --git a/tizen/src/util/hds.c b/tizen/src/util/hds.c index cdcc585c0a..c07e96277c 100644 --- a/tizen/src/util/hds.c +++ b/tizen/src/util/hds.c @@ -27,12 +27,13 @@ * */ -#include "hds.h" + #include "qemu/osdep.h" #include "qapi/error.h" #include "qapi/qapi-commands-misc.h" #include "hw/pci/pci.h" +#include "hds.h" #include "debug_ch.h" MULTI_DEBUG_CHANNEL(qemu, hds); diff --git a/tizen/src/util/hds.h b/tizen/src/util/hds.h index 5980b1411f..3c99b7edfc 100644 --- a/tizen/src/util/hds.h +++ b/tizen/src/util/hds.h @@ -37,8 +37,9 @@ #define MAX_HDS_ID_LEN 32 #define MAX_HDS_LIST_LEN 4096 -#include "qemu/osdep.h" -#include "qemu-common.h" +#ifdef __cplusplus +extern "C" { +#endif enum hds_level { hds_level_normal = 0, @@ -63,5 +64,7 @@ char *get_hds_lists(void); int hds_get_pci_available_slot_num(void); int hds_get_num_hidden_conn(void); - +#ifdef __cplusplus +} +#endif #endif /* _HDS_ */ diff --git a/tizen/src/util/net_helper.c b/tizen/src/util/net_helper.c index 5e0d7cc551..b12e22d853 100644 --- a/tizen/src/util/net_helper.c +++ b/tizen/src/util/net_helper.c @@ -28,21 +28,19 @@ * */ +#include "emulator.h" +#include "emul_state.h" #include "net_helper.h" - -#include "qemu/osdep.h" #include "qemu/sockets.h" #include "net/slirp.h" #include "block/nbd.h" #include "qemu/error-report.h" -#include "emulator.h" -#include "emulator_common.h" -#include "emul_state.h" #include "hw/virtio/maru_virtio_input.h" #include "hw/maru_pm.h" #include "ecs/ecs.h" +#include "ecs/ecs_internal.h" #include "new_debug_ch.h" #include "sysemu/runstate.h" diff --git a/tizen/src/util/net_helper.h b/tizen/src/util/net_helper.h index dd3cc9ff6b..806fa551ce 100644 --- a/tizen/src/util/net_helper.h +++ b/tizen/src/util/net_helper.h @@ -61,7 +61,9 @@ #define SDB_GUEST_PORT (START_VM_BASE_PORT + SDB_TCP_INDEX) #define GDB_GUEST_PORT (START_VM_BASE_PORT + GDB_TCP_INDEX) - +#ifdef __cplusplus +extern "C" { +#endif void init_sdb_and_vm_base_port(void); int inet_strtoip(const char* str, uint32_t *ip); int socket_send(int fd, const void* buf, int buflen); @@ -73,6 +75,8 @@ extern int emul_vm_base_socket; #define STATE_RUNNING 0 #define STATE_SUSPEND 1 void notify_all_sdb_clients(int state); - +#ifdef __cplusplus +} +#endif #endif diff --git a/tizen/src/util/osutil.h b/tizen/src/util/osutil.h index d478155f28..cd3b28309d 100644 --- a/tizen/src/util/osutil.h +++ b/tizen/src/util/osutil.h @@ -29,21 +29,18 @@ #ifndef __OSUTIL_H__ #define __OSUTIL_H__ -#include "qemu/osdep.h" #include "emulator_common.h" -#ifdef CONFIG_WIN32 -#include "sysemu/os-win32.h" -#else -#include "sysemu/os-posix.h" -#endif - #define ERR_SUCCESS 0 #define ERR_NODEV 4 /* ACT_SDCARD_DETACH_FAIL. No sdcard attached. */ #define ERR_BUSY 5 /* ACT_SDCARD_ATTACH_FAIL. Already sdcard attached. */ #define ERR_NOENT 6 /* ACT_SDCARD_NO_ATTACH_FOUND. Other sdcard attached. */ #define VMLOCK_FILE "vm.lock" +#ifdef __cplusplus +extern "C" { +#endif + extern const char *pac_tempfile; void make_vm_lock_os(gchar *vms_path); @@ -100,5 +97,8 @@ static inline void get_java_path(const char **java_path) #endif } +#ifdef __cplusplus +} +#endif #endif // __OS_UTIL_H__ diff --git a/tizen/src/util/qt5_error_report.c b/tizen/src/util/qt5_error_report.c index 56d44b8bb8..665ffd08ec 100644 --- a/tizen/src/util/qt5_error_report.c +++ b/tizen/src/util/qt5_error_report.c @@ -28,19 +28,11 @@ * */ +#include "emulator_common.h" #include "qt5_error_report.h" -#include -#include -#include -#include #include "debug_ch.h" #include "emul_state.h" -#ifdef CONFIG_WIN32 -#include -#include -#endif - #define MAX_MESSAGE_LEN 2048 MULTI_DEBUG_CHANNEL(qemu, qt5_msgbox); diff --git a/tizen/src/util/qt5_error_report.h b/tizen/src/util/qt5_error_report.h index f1aecac317..f9e0a843dc 100644 --- a/tizen/src/util/qt5_error_report.h +++ b/tizen/src/util/qt5_error_report.h @@ -31,6 +31,10 @@ #ifndef __ERROR_REPORT_H__ #define __ERROR_REPORT_H__ +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { NO_ICON = 0, INFORMATION_ICON = 1, @@ -41,5 +45,7 @@ typedef enum { char *get_app_path(void); void start_qt5_msgbox(qt5_msgbox_icon icon, const char *message); - +#ifdef __cplusplus +} +#endif #endif /* __ERROR_REPORT_H__ */ diff --git a/tizen/src/util/tap_helper.h b/tizen/src/util/tap_helper.h index a14169ef2b..f03ccb4443 100644 --- a/tizen/src/util/tap_helper.h +++ b/tizen/src/util/tap_helper.h @@ -28,7 +28,11 @@ #ifndef __TAP_HELPER_H__ #define __TAP_HELPER_H__ - +#ifdef __cplusplus +extern "C" { +#endif void tap_create(char *); - +#ifdef __cplusplus +} +#endif #endif //__TAP_HELPER_H__ diff --git a/tizen/src/util/ui_operations.c b/tizen/src/util/ui_operations.c index 75f9cdf3ff..9644fd781c 100644 --- a/tizen/src/util/ui_operations.c +++ b/tizen/src/util/ui_operations.c @@ -162,7 +162,7 @@ void do_mouse_event(int button_type, int event_type, } } -void do_rotary_event(int32_t delta, int32_t type) +void do_rotary_event(int delta, int type) { LOG_TRACE("rotaty event: delta(%d), type(%d)\n", delta, type); maru_rotary_event(delta, type); diff --git a/tizen/src/util/ui_operations.h b/tizen/src/util/ui_operations.h index 910f1fb8d1..a131bb6d9e 100644 --- a/tizen/src/util/ui_operations.h +++ b/tizen/src/util/ui_operations.h @@ -31,14 +31,17 @@ #ifndef __UI_OPERATIONS_H__ #define __UI_OPERATIONS_H__ -#include "tizen/src/emulator_common.h" - #define TIMEOUT_FOR_SHUTDOWN 10 /* seconds */ +#ifdef __cplusplus +extern "C" { +#endif void do_hw_key_event(int event_type, int keycode); void do_mouse_event(int button_type, int event_type, int origin_x, int origin_y, int x, int y, int z); -void do_rotary_event(int32_t delta, int32_t type); +void do_rotary_event(int delta, int type); void do_qt_keyboard_key_event(int event_type, int keycode); - +#ifdef __cplusplus +} +#endif #endif // __UI_OPERATIONS_H___ diff --git a/tizen/standalone-src/Makefile b/tizen/standalone-src/Makefile index 9b882d6836..3413469db3 100644 --- a/tizen/standalone-src/Makefile +++ b/tizen/standalone-src/Makefile @@ -1,10 +1,6 @@ ifeq ($(wildcard ../../config-host.mak),../../config-host.mak) include ../../config-host.mak -# Set project directory one level above the Makefile directory. -#$(CURDIR) is a GNU make variable containing the path to the current working directory -BUILD_PATH := $(realpath $(CURDIR)) - TARGET_EXE += qt5_msgbox$(EXESUF) ifdef CONFIG_QT @@ -12,7 +8,6 @@ EMUL_DIR=../emulator COMMON_FLAGS=$(QT_CFLAGS) $(QEMU_INCLUDES) $(libs_softmmu) -DQT_NO_OPENGL -lstdc++ - # for building qt5_msgbox $(TARGET_EXE): $(SRC_PATH)/tizen/standalone-src/qt5_msgbox.cpp ifdef CONFIG_WIN32