Merge develop into ecp
authorchoisjin80 <jinhyung2.choi@samsung.com>
Mon, 8 Apr 2013 06:37:07 +0000 (15:37 +0900)
committerchoisjin80 <jinhyung2.choi@samsung.com>
Mon, 8 Apr 2013 06:37:07 +0000 (15:37 +0900)
43 files changed:
exec.c
hw/virtio-pci.c [changed mode: 0644->0755]
package/changelog
package/pkginfo.manifest
tizen/src/Makefile
tizen/src/Makefile.tizen
tizen/src/debug_ch.c
tizen/src/ecs.c
tizen/src/ecs.h
tizen/src/emul_state.c
tizen/src/emul_state.h
tizen/src/emulator.c
tizen/src/hw/gl_func_perso.h
tizen/src/hw/gloffscreen.h
tizen/src/hw/gloffscreen_agl.c
tizen/src/hw/gloffscreen_common.c
tizen/src/hw/gloffscreen_glx.c
tizen/src/hw/gloffscreen_test.c
tizen/src/hw/gloffscreen_wgl.c
tizen/src/hw/gloffscreen_xcomposite.c
tizen/src/hw/maru_device_ids.h [changed mode: 0644->0755]
tizen/src/hw/maru_vga.c
tizen/src/hw/maru_virtio_evdi.c [new file with mode: 0755]
tizen/src/hw/maru_virtio_evdi.h [new file with mode: 0755]
tizen/src/hw/maru_virtio_keyboard.c
tizen/src/hw/maru_virtio_keyboard.h
tizen/src/hw/opengl_exec.c
tizen/src/hw/opengl_func.h
tizen/src/maru_err_table.c
tizen/src/skin/client/native_src/share.c
tizen/src/skin/client/skins/emul-320x480/default.dbi
tizen/src/skin/client/skins/emul-480x800/default.dbi
tizen/src/skin/client/skins/emul-600x1024/default.dbi
tizen/src/skin/client/skins/emul-720x1280/default.dbi
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShmSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinState.java
tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/PhoneShapeSkinComposer.java
tizen/src/skin/maruskin_client.c
tizen/src/skin/maruskin_operation.c

diff --git a/exec.c b/exec.c
index a64e70b..8e6bf12 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -1386,10 +1386,10 @@ void tb_link_page(TranslationBlock *tb,
 /* check whether the given addr is in TCG generated code buffer or not */
 bool is_tcg_gen_code(uintptr_t tc_ptr)
 {
-    /* This can be called during code generation, code_gen_buffer_max_size
+    /* This can be called during code generation, code_gen_buffer_size
        is used instead of code_gen_ptr for upper boundary checking */
     return (tc_ptr >= (uintptr_t)code_gen_buffer &&
-            tc_ptr < (uintptr_t)(code_gen_buffer + code_gen_buffer_max_size));
+            tc_ptr < (uintptr_t)(code_gen_buffer + code_gen_buffer_size));
 }
 #endif
 
old mode 100644 (file)
new mode 100755 (executable)
index eb6e236..f8ad834
@@ -35,6 +35,7 @@
 #include "range.h"
 #ifdef CONFIG_MARU
 #include "../tizen/src/hw/maru_device_ids.h"
+#include "../tizen/src/hw/maru_virtio_evdi.h"
 #include "../tizen/src/mloop_event.h"
 #endif
 
@@ -993,6 +994,28 @@ static void virtio_hwkey_exit_pci(PCIDevice *pci_dev)
     virtio_exit_pci(pci_dev);
 }
 
+static int virtio_evdi_init_pci(PCIDevice *pci_dev)
+{
+    VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
+    VirtIODevice *vdev;
+
+    vdev = virtio_evdi_init(&pci_dev->qdev);
+    if (!vdev) {
+        return -1;
+    }
+    virtio_init_pci(proxy, vdev);
+    return 0;
+}
+
+static void virtio_evdi_exit_pci(PCIDevice *pci_dev)
+{
+    VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
+
+    virtio_pci_stop_ioeventfd(proxy);
+    virtio_evdi_exit(proxy->vdev);
+    virtio_exit_pci(pci_dev);
+}
+
 #endif
 
 static Property virtio_blk_properties[] = {
@@ -1290,6 +1313,27 @@ static TypeInfo virtio_hwkey_info = {
     .class_init    = virtio_hwkey_class_init,
 };
 
+static void virtio_evdi_class_init(ObjectClass *klass, void *data) {
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+    k->init = virtio_evdi_init_pci;
+    k->exit = virtio_evdi_exit_pci;
+    k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
+    k->device_id = PCI_DEVICE_ID_VIRTIO_EVDI;
+    k->revision = VIRTIO_PCI_ABI_VERSION;
+    k->class_id = PCI_CLASS_OTHERS;
+    dc->reset = virtio_pci_reset;
+}
+
+static TypeInfo virtio_evdi_info = {
+    .name          = "virtio-evdi-pci",
+    .parent        = TYPE_PCI_DEVICE,
+    .instance_size = sizeof(VirtIOPCIProxy),
+    .class_init    = virtio_evdi_class_init,
+};
+
+
 #endif /* CONFIG_MARU */
 
 static void virtio_pci_register_types(void)
@@ -1307,6 +1351,7 @@ static void virtio_pci_register_types(void)
     type_register_static(&virtio_keyboard_info);
     type_register_static(&virtio_esm_info);
     type_register_static(&virtio_hwkey_info);
+    type_register_static(&virtio_evdi_info);
 #endif
 }
 
index 8ba16c7..c2e2972 100644 (file)
@@ -1,3 +1,27 @@
+* 1.5.24
+- increased virtio keyboard queue and fixed overwrite bug
+== SungMin Ha <sungmin82.ha@samsung.com> 2013-04-06
+* 1.5.23
+- no need to get the shmkey from another shm
+== GiWoong Kim <giwoong.kim@samsung.com> 2013-04-03
+* 1.5.18
+- modified skin's dbi file for key code of phone shape
+== Sungmin Ha <sungmin82.ha@samsung.com> 2013-03-29
+* 1.5.17
+- modified elem index and mutex lock in virtio-kbd
+== Sungmin Ha <sungmin82.ha@samsung.com> 2013-03-29
+* 1.5.16
+- modified Makefile to library load on mac from check-gl
+== Sungmin Ha <sungmin82.ha@samsung.com> 2013-03-26
+* 1.5.15
+- Fix dibs build error.
+== Sangjin Kim <sangjin3.kim@samsung.com> 2013-03-21
+* 1.5.14
+- Generate check-gl binary to use at an emulator-manager.
+== Sangjin Kim <sangjin3.kim@samsung.com> 2013-03-21
+* 1.5.13
+- Enable pbuffer surface.
+== Sangjin Kim <sangjin3.kim@samsung.com> 2013-03-20
 * 1.5.12
 - modified virtio hwkey device and improved hwkey mapping 
 == Sungmin Ha <sungmin82.ha@samsung.com> 2013-03-20
index 59b53ad..0aacd9e 100644 (file)
@@ -1,4 +1,4 @@
-Version: 1.5.12
+Version: 1.5.24
 Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
 Source: emulator
 
index 7a139d4..5f648f1 100755 (executable)
@@ -101,16 +101,16 @@ endif
        
        cp skin/client/emulator-skin.jar $(EMUL_DIR)/bin
 ifdef CONFIG_WIN32
-       cp ../../i386-softmmu/check-gl.exe $(EMUL_DIR)/bin/
+       cp ../../i386-softmmu/check-gl.exe $(EMUL_DIR)/bin
        cp check-hax.exe $(EMUL_DIR)/bin
 endif
 ifdef CONFIG_DARWIN
-       cp ../../i386-softmmu/check-gl $(EMUL_DIR)/bin/
+       cp ../../i386-softmmu/check-gl $(EMUL_DIR)/bin
        cp check-hax $(EMUL_DIR)/bin
        cp sdbscript $(EMUL_DIR)/bin
 endif
 ifdef CONFIG_LINUX
-       cp ../../i386-softmmu/check-gl $(EMUL_DIR)/bin/
+       cp ../../i386-softmmu/check-gl $(EMUL_DIR)/bin
        cp -pPr ../distrib/initscript/tizen-kvm $(EMUL_DIR)/etc
        cp -pPr ../distrib/initscript/45-tizen-kvm.rules $(EMUL_DIR)/etc
 endif
@@ -135,6 +135,9 @@ ifdef CONFIG_DARWIN
        install_name_tool -change /opt/local/lib/gcc47/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib $(EMUL_DIR)/bin/qemu-img
        install_name_tool -change /opt/local/lib/libz.1.dylib @loader_path/libz.1.dylib $(EMUL_DIR)/bin/qemu-img
        install_name_tool -change /opt/local/lib/libcurl.4.dylib @loader_path/libcurl.4.dylib $(EMUL_DIR)/bin/qemu-img
+       install_name_tool -change /opt/local/lib/libglib-2.0.*.dylib @loader_path/libglib-2.0.0.dylib $(EMUL_DIR)/bin/check-gl
+       install_name_tool -change /opt/local/lib/libintl.8.dylib @loader_path/libintl.8.dylib $(EMUL_DIR)/bin/check-gl
+       install_name_tool -change /opt/local/lib/gcc47/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib $(EMUL_DIR)/bin/check-gl
 
        @for target in $(TARGET_DIRS); do \
        case "$$target" in \
@@ -204,14 +207,17 @@ endif
 
        cp skin/client/emulator-skin.jar $(DIBS_COMMON_DIR)/bin
 ifdef CONFIG_WIN32
+       cp ../../i386-softmmu/check-gl.exe $(DIBS_COMMONL_DIR)/bin
        cp check-hax.exe $(DIBS_COMMON_DIR)/bin
 endif
 
 ifdef CONFIG_DARWIN
+       cp ../../i386-softmmu/check-gl $(DIBS_COMMON_DIR)/bin
        cp check-hax $(DIBS_COMMON_DIR)/bin
        cp sdbscript $(DIBS_COMMON_DIR)/bin
 endif
 ifdef CONFIG_LINUX
+       cp ../../i386-softmmu/check-gl $(DIBS_COMMON_DIR)/bin
        echo "Copying tizen-kvm to $(DIBS_X86_DIR)/etc"
        cp -pPr ../distrib/initscript/tizen-kvm $(DIBS_X86_DIR)/etc
        cp -pPr ../distrib/initscript/45-tizen-kvm.rules $(DIBS_X86_DIR)/etc
@@ -235,6 +241,9 @@ ifdef CONFIG_DARWIN
        install_name_tool -change /opt/local/lib/gcc47/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib $(DIBS_COMMON_DIR)/bin/qemu-img
        install_name_tool -change /opt/local/lib/libz.1.dylib @loader_path/libz.1.dylib $(DIBS_COMMON_DIR)/bin/qemu-img
        install_name_tool -change /opt/local/lib/libcurl.4.dylib @loader_path/libcurl.4.dylib $(DIBS_COMMON_DIR)/bin/qemu-img
+       install_name_tool -change /opt/local/lib/libglib-2.0.*.dylib @loader_path/libglib-2.0.0.dylib $(DIBS_COMMON_DIR)/bin/check-gl
+       install_name_tool -change /opt/local/lib/libintl.8.dylib @loader_path/libintl.8.dylib $(DIBS_COMMON_DIR)/bin/check-gl
+       install_name_tool -change /opt/local/lib/gcc47/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib $(DIBS_COMMON_DIR)/bin/check-gl
 
        @for target in $(TARGET_DIRS); do \
        case "$$target" in \
index c8b354e..a7378fa 100755 (executable)
@@ -116,6 +116,7 @@ obj-y += maru_virtio_keyboard.o
 obj-y += maru_codec.o
 obj-y += maru_virtio_esm.o
 obj-y += maru_virtio_hwkey.o
+obj-y += maru_virtio_evdi.o
 
 obj-$(CONFIG_PCI) += maru_camera_common_pci.o
 obj-$(CONFIG_LINUX) += maru_camera_linux_pci.o
index 3008803..1795455 100644 (file)
@@ -440,7 +440,7 @@ int dbg_log( enum _debug_class cls, struct _debug_channel *channel,
        ret += vsnprintf(buf + ret, sizeof(buf) - ret, format, valist );
        va_end(valist);
    
-    open_flags = O_RDWR | O_APPEND | O_BINARY ;
+    open_flags = O_RDWR | O_APPEND | O_BINARY | O_CREAT ;
        fd = qemu_open(log_path, open_flags, 0666);
        if(fd < 0) {
         fprintf(stderr, "Can't open logfile: %s\n", log_path);
index d38f63b..0b2a0c0 100644 (file)
@@ -55,12 +55,14 @@ typedef struct ECS_State {
        struct epoll_event events[MAX_EVENTS];
        int is_unix;
        int ecs_running;
+       QEMUTimer *alive_timer;
        Monitor *mon;
 } ECS_State;
 
 typedef struct ECS_Client {
        int client_fd;
        int client_id;
+       int keep_alive;
        const char* type;
        ECS_State *cs;
        JSONMessageParser parser;
@@ -135,7 +137,7 @@ void send_to_client(int fd, const char *str)
 #define QMP_ACCEPT_UNKNOWNS 1
 static void ecs_monitor_flush(ECS_Client *clii, Monitor *mon)
 {
-    if (clii && mon && mon->outbuf_index != 0) {
+    if (clii && 0 < clii->client_fd && mon && mon->outbuf_index != 0) {
         ecs_write(clii->client_fd, mon->outbuf, mon->outbuf_index);
         mon->outbuf_index = 0;
     }
@@ -149,7 +151,6 @@ static void ecs_monitor_puts(ECS_Client *clii, Monitor *mon, const char *str)
                return;
        }
 
-       LOG("ecs_monitor_puts: %s", str);
     for(;;) {
         c = *str++;
         if (c == '\0')
@@ -171,10 +172,8 @@ void ecs_vprintf(const char *type, const char *fmt, va_list ap)
        ECS_Client *clii;
 
     QTAILQ_FOREACH(clii, &clients, next) {
-        if (!strcmp(type, TYPE_ALL) || !strcmp(clii->type, type)) {
-                       vsnprintf(buf, sizeof(buf), fmt, ap);
-                       ecs_monitor_puts(clii, clii->cs->mon, buf);
-               }
+               vsnprintf(buf, sizeof(buf), fmt, ap);
+               ecs_monitor_puts(clii, clii->cs->mon, buf);
     }
 }
 
@@ -200,10 +199,9 @@ static QDict *build_qmp_error_dict(const QError *err)
     return qobject_to_qdict(obj);
 }
 
-static void ecs_json_emitter(ECS_Client *clii, const char* type, const QObject *data)
+static void ecs_json_emitter(ECS_Client *clii, const QObject *data)
 {
     QString *json;
-       char type_full_string [OUT_BUF_SIZE];
 
     json = qobject_to_json(data);
 
@@ -244,7 +242,7 @@ static void ecs_protocol_emitter(ECS_Client *clii, const char* type, QObject *da
         clii->cs->mon->error = NULL;
     }
 
-    ecs_json_emitter(clii, type, QOBJECT(qmp));
+    ecs_json_emitter(clii, QOBJECT(qmp));
     QDECREF(qmp);
 }
 
@@ -614,25 +612,6 @@ out:
 
 }
 
-static void print_all_json(QObject *input_obj)
-{ 
-       const QDictEntry *ent;
-    QDict *input_dict;
-
-    if (qobject_type(input_obj) != QTYPE_QDICT) {
-        qerror_report(QERR_QMP_BAD_INPUT_OBJECT, "object");
-        return;
-    }
-
-    input_dict = qobject_to_qdict(input_obj);
-
-    for (ent = qdict_first(input_dict); ent; ent = qdict_next(input_dict, ent)){
-        const char *arg_name = qdict_entry_key(ent);
-        const char *value_name = qdict_get_str(qobject_to_qdict(input_obj), arg_name);
-       LOG("received command: %s, value: %s", arg_name, value_name);
-       }
-}
-
 static int check_key(QObject *input_obj, const char *key)
 {
     const QDictEntry *ent;
@@ -702,10 +681,6 @@ static void handle_ecs_command(JSONMessageParser *parser, QList *tokens, void *o
                return;
     }
 
-#ifdef DEBUG
-       //print_all_json(obj);
-#endif
-
        def_target = check_key(obj, COMMANDS_TYPE);
 #ifdef DEBUG
        LOG("check_key(COMMAND_TYPE): %d", def_target);
@@ -721,6 +696,14 @@ static void handle_ecs_command(JSONMessageParser *parser, QList *tokens, void *o
                return;
        }
 
+       type_name = qdict_get_str(qobject_to_qdict(obj), COMMANDS_TYPE);
+
+       if (!strcmp(type_name, TYPE_DATA_SELF)) {
+               LOG("set client fd %d keep alive 0", clii->client_fd);
+               clii->keep_alive = 0;
+               return;
+       }
+
        def_data = check_key(obj, COMMANDS_DATA);
        if (0 > def_data) {
                LOG("json format error: data.");
@@ -730,8 +713,6 @@ static void handle_ecs_command(JSONMessageParser *parser, QList *tokens, void *o
                return;
        }
        
-       type_name = qdict_get_str(qobject_to_qdict(obj), COMMANDS_TYPE);
-               
        handle_qmp_command(clii, type_name, get_data_object(obj));
 }
 
@@ -739,10 +720,6 @@ static Monitor *monitor_create(void)
 {
     Monitor *mon;
 
-       // TODO: event related work
-       //key_timer = qemu_new_timer_ns(vm_clock, release_keys, NULL);
-    //monitor_protocol_event_init();
-
     mon = g_malloc0(sizeof(*mon));
        if (NULL == mon) {
                LOG("monitor allocation failed.");
@@ -764,6 +741,7 @@ static void ecs_client_close(ECS_Client* clii)
        if (0 <= clii->client_fd) {
                LOG("ecs client closed with fd: %d", clii->client_fd);
                closesocket(clii->client_fd);
+               clii->client_fd = -1;
        }
        QTAILQ_REMOVE(&clients, clii, next);
        if (NULL != clii) {
@@ -784,6 +762,11 @@ static void ecs_close(ECS_State *cs)
                g_free(cs->mon);
        }
 
+       if (NULL != cs->alive_timer) {
+               qemu_del_timer(cs->alive_timer);
+               cs->alive_timer = NULL;
+       }
+
     QTAILQ_FOREACH(clii, &clients, next) {
                ecs_client_close(clii);
        }
@@ -798,6 +781,10 @@ static void ecs_close(ECS_State *cs)
 static int ecs_write(int fd, const uint8_t *buf, int len)
 {
        LOG("write buflen : %d, buf : %s", len, buf);
+       if (fd < 0) {
+               return -1;
+       }
+
        return send_all(fd, buf, len);
 }
 
@@ -835,21 +822,21 @@ static ssize_t ecs_recv(int fd, char *buf, size_t len)
 
 static void ecs_read (ECS_Client *clii)
 {
-       uint8_t buf[READ_BUF_LEN];
+       uint8_t buf[READ_BUF_LEN]; 
        int len, size;
        len = sizeof(buf);
 
-       if (!clii) {
+       if (!clii || 0 > clii->client_fd) {
                LOG ("read client info is NULL.");
                return;
        }
 
-       size = ecs_recv(clii->client_fd, (void *)buf, len);
+       size = ecs_recv(clii->client_fd, (char*)buf, len);
        if (0 == size) {
                ecs_client_close(clii);
        } else if (0 < size) {
-               LOG("read data: %s, size: %d", buf, size);
-           ecs_json_message_parser_feed(&clii->parser, (const char *) buf, size);
+               LOG("read data: %s, len: %d, size: %d", buf, len, size);
+               ecs_json_message_parser_feed(&clii->parser, (const char *) buf, size);
        }
 }
 
@@ -960,6 +947,33 @@ static void epoll_init(ECS_State *cs)
        }
 }
 
+static void alive_checker(void *opaque)
+{
+       ECS_State *cs = opaque;
+       ECS_Client *clii;
+    QObject *obj;
+
+    obj = qobject_from_jsonf("{\"type\":\"self\"}");
+
+       if (NULL != current_ecs && !current_ecs->ecs_running) {
+               return;
+       }
+
+    QTAILQ_FOREACH(clii, &clients, next) {
+               if (1 == clii->keep_alive) {
+                       LOG("get client fd %d - keep alive fail", clii->client_fd);
+                       ecs_client_close(clii);
+                       continue;
+               }
+               LOG("set client fd %d - keep alive 1", clii->client_fd);
+               clii->keep_alive = 1;
+       ecs_json_emitter(clii, obj);
+       }
+       
+       qemu_mod_timer(cs->alive_timer, qemu_get_clock_ns(vm_clock) + 
+                                                                       get_ticks_per_sec() * TIMER_ALIVE_S);
+}
+
 static int socket_initialize(ECS_State *cs, QemuOpts *opts)
 {
        int fd = -1;
@@ -974,6 +988,11 @@ static int socket_initialize(ECS_State *cs, QemuOpts *opts)
        cs->listen_fd = fd;
        epoll_init(cs);
 
+       cs->alive_timer = qemu_new_timer_ns(vm_clock, alive_checker, cs);
+
+       qemu_mod_timer(cs->alive_timer, qemu_get_clock_ns(vm_clock) + 
+                                                                       get_ticks_per_sec() * TIMER_ALIVE_S);
+
        return 0;
 }
 
index 3b70a73..7fb1f30 100644 (file)
 #define COMMANDS_TYPE                  "type"
 #define COMMANDS_DATA                  "data"
 
-#define TYPE_ALL                               "all"
-#define TYPE_ECP                               "ecp"
-#define TYPE_SELF                              "self"
-#define TYPE_QMP                               "qmp"
-#define TYPE_VIRTUAL                   "virtual"
+#define TIMER_ALIVE_S                  60      
+#define TYPE_DATA_SELF                 "self"
 
 int start_ecs(void);
 int stop_ecs(void);
index b6d78ed..ea71444 100644 (file)
@@ -57,17 +57,6 @@ int get_emul_skin_enable(void)
     return _emul_info.skin_enable;
 }
 
-/* current emulator condition */
-int get_emulator_condition(void)
-{
-    return _emul_state.emulator_condition;
-}
-
-void set_emulator_condition(int state)
-{
-    _emul_state.emulator_condition = state;
-}
-
 /* lcd screen size */
 void set_emul_lcd_size(int width, int height)
 {
@@ -120,6 +109,28 @@ int get_emul_max_touch_point(void)
     return _emul_info.max_touch_point;
 }
 
+/* base port for emualtor vm */
+void set_emul_vm_base_port(int port)
+{
+    _emul_info.vm_base_port = port;
+}
+
+int get_emul_vm_base_port(void)
+{
+    return _emul_info.vm_base_port;
+}
+
+/* current emulator condition */
+int get_emulator_condition(void)
+{
+    return _emul_state.emulator_condition;
+}
+
+void set_emulator_condition(int state)
+{
+    _emul_state.emulator_condition = state;
+}
+
 /* emulator window scale */
 void set_emul_win_scale(double scale_factor)
 {
@@ -191,7 +202,7 @@ int get_host_lock_key_state(int key)
     return -1;
 }
 
-/* manage CapsLock key state for usb keyboard input */
+/* manage CapsLock key state for host keyboard input */
 void set_emul_caps_lock_state(int state)
 {
     _emul_state.qemu_caps_lock = state;
@@ -199,10 +210,10 @@ void set_emul_caps_lock_state(int state)
 
 int get_emul_caps_lock_state(void)
 {
-    return  _emul_state.qemu_caps_lock;
+    return _emul_state.qemu_caps_lock;
 }
 
-/* manage NumLock key state for usb keyboard input */
+/* manage NumLock key state for host keyboard input */
 void set_emul_num_lock_state(int state)
 {
     _emul_state.qemu_num_lock = state;
@@ -210,5 +221,6 @@ void set_emul_num_lock_state(int state)
 
 int get_emul_num_lock_state(void)
 {
-    return  _emul_state.qemu_num_lock;
+    return _emul_state.qemu_num_lock;
 }
+
index 4a6baf9..efb1232 100644 (file)
@@ -80,7 +80,8 @@ typedef  struct EmulatorConfigInfo {
     int lcd_size_h;
     int sdl_bpp;
     int max_touch_point;
-    //TODO:
+    int vm_base_port;
+    /* add here */
 } EmulatorConfigInfo;
 
 typedef struct EmulatorConfigState {
@@ -90,7 +91,7 @@ typedef struct EmulatorConfigState {
     MultiTouchState qemu_mts;
     int qemu_caps_lock;
     int qemu_num_lock;
-    //TODO:
+    /* add here */
 } EmulatorConfigState;
 
 
@@ -100,6 +101,8 @@ void set_emul_lcd_size(int width, int height);
 void set_emul_win_scale(double scale);
 void set_emul_sdl_bpp(int bpp);
 void set_emul_max_touch_point(int cnt);
+void set_emul_vm_base_port(int port);
+
 void set_emulator_condition(int state);
 void set_emul_rotation(short rotation_type);
 void set_emul_caps_lock_state(int state);
@@ -112,6 +115,8 @@ int get_emul_lcd_height(void);
 double get_emul_win_scale(void);
 int get_emul_sdl_bpp(void);
 int get_emul_max_touch_point(void);
+int get_emul_vm_base_port(void);
+
 int get_emulator_condition(void);
 short get_emul_rotation(void);
 MultiTouchState *get_emul_multi_touch_state(void);
index 32fe1af..95a5688 100644 (file)
@@ -347,20 +347,20 @@ static void prepare_basic_features(void)
     tizen_base_port = get_sdb_base_port();
 
     get_host_proxy(http_proxy, https_proxy, ftp_proxy, socks_proxy);
-    // using "DNS" provided by default QEMU
+    /* using "DNS" provided by default QEMU */
     g_strlcpy(dns, DEFAULT_QEMU_DNS_IP, strlen(DEFAULT_QEMU_DNS_IP) + 1);
 
     check_vm_lock();
     socket_init();
     make_vm_lock();
 
-    sdb_setup();
+    sdb_setup(); /* determine the base port for emulator */
+    set_emul_vm_base_port(tizen_base_port);
 
     gchar * const tmp_str = g_strdup_printf(" sdb_port=%d,"
-            " http_proxy=%s https_proxy=%s ftp_proxy=%s socks_proxy=%s"
-            " dns1=%s", tizen_base_port,
-            http_proxy, https_proxy, ftp_proxy, socks_proxy,
-            dns);
+        " http_proxy=%s https_proxy=%s ftp_proxy=%s socks_proxy=%s"
+        " dns1=%s", get_emul_vm_base_port(),
+        http_proxy, https_proxy, ftp_proxy, socks_proxy, dns);
 
     g_strlcat(maru_kernel_cmdline, tmp_str, LEN_MARU_KERNEL_CMDLINE);
 
index 1488343..4d7ad9e 100644 (file)
@@ -60,6 +60,10 @@ MAGIC_MACRO(glXGetDriverConfig),
 MAGIC_MACRO(glXSwapIntervalSGI),
 MAGIC_MACRO(glXCreatePixmap),
 MAGIC_MACRO(glXDestroyPixmap),
+MAGIC_MACRO(glXBindTexImageARB_fake),
+MAGIC_MACRO(glXReleaseTexImageARB_fake),
+MAGIC_MACRO(glXCreatePbuffer),
+MAGIC_MACRO(glXDestroyPbuffer),
 
 MAGIC_MACRO(glGetString),
 
index 806db14..11547c7 100644 (file)
@@ -83,8 +83,10 @@ extern void glo_context_destroy(GloContext *context);
 /* Update the context in surface and free previous light-weight context */
 extern void glo_surface_update_context(GloSurface *surface, GloContext *context, int free_flags);
 
-/* Link the pixmap associated with surface as texture */
-extern void glo_surface_as_texture(GloSurface *surface);
+/* Link the pixmap/pbuffer associated with surface as texture.
+ * ctxt is the target context for the texture operation
+ */
+extern void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface);
 
 /* Create a surface with given width and height, */
 extern GloSurface *glo_surface_create(int width, int height, GloContext *context);
index 4a42907..0d61423 100644 (file)
@@ -188,51 +188,52 @@ GloContext *__glo_context_create(int formatFlags)
  
 GloContext *glo_context_create(int formatFlags, GloContext *shareLists) 
 { 
-        GloContext *context = __glo_context_create(formatFlags);
-        if(!context)
-                return NULL;
+       GloContext *context = __glo_context_create(formatFlags);
+       if(!context)
+               return NULL;
 
-        context->context = aglCreateContext(context->pixelFormat, shareLists ? shareLists->context : NULL); 
-        if (context->context == NULL) 
-        { 
-                fprintf(stderr, "aglCreateContext failed: %s", aglErrorString(aglGetError())); 
-        } 
-        else
-        {
-                if(context->pixelFormat != NULL)
-                {
-                        aglDestroyPixelFormat(context->pixelFormat);
-                        context->pixelFormat = NULL;    
-                }
-        }
+       context->context = aglCreateContext(context->pixelFormat, shareLists ? shareLists->context : NULL); 
+       if (context->context == NULL) 
+       { 
+               fprintf(stderr, "aglCreateContext failed: %s", aglErrorString(aglGetError())); 
+       } 
 
-        TRACE("context=%p", context); 
-        return context; 
-} 
+       else
+       {
+               if(context->pixelFormat != NULL)
+               {
+                       aglDestroyPixelFormat(context->pixelFormat);
+                       context->pixelFormat = NULL;    
+               }
+       }
 
+       TRACE("context=%p", context); 
+       return context; 
+} 
+  
 /* Destroy a previously created OpenGL context */ 
 void glo_context_destroy(GloContext *context) 
 { 
-     TRACE("context=%p", context); 
-     if (context) 
-     { 
-             aglDestroyContext(context->context);
-             if(context->pixelFormat != NULL)
-             { 
-                     aglDestroyPixelFormat(context->pixelFormat);
-                     context->pixelFormat = NULL; 
-             }
-             context->context = NULL;  
-             g_free(context); 
-     } 
- }
+       TRACE("context=%p", context); 
+       if (context) 
+       
+               aglDestroyContext(context->context);
+               if(context->pixelFormat != NULL)
+               
+                       aglDestroyPixelFormat(context->pixelFormat);
+                       context->pixelFormat = NULL; 
+               }
+               context->context = NULL;  
+               g_free(context); 
+       
+}
 
 void glo_surface_update_context(GloSurface *surface, GloContext *context, int free_flags)
 {
     if ( surface->context )
     {
-            if (free_flags) /* light-weight context */
-                    g_free(surface->context);
+               if ( free_flags) /* light-weight context */
+            g_free(surface->context);
     }
     surface->context = context;
 }
@@ -334,8 +335,9 @@ void glo_surface_get_size(GloSurface *surface, int *width, int *height)
 } 
  
 /* Bind the surface as texture */
-void glo_surface_as_texture(GloSurface *surface)
+void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface)
 {
+#if 0
        //Not QUit sure about this function;
        int glFormat, glType;
        glo_surface_updatecontents(surface);
@@ -345,8 +347,11 @@ void glo_surface_as_texture(GloSurface *surface)
     /* glTexImage2D use different RGB order than the contexts in the pixmap surface */
 /*    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surface->width, surface->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, surface->image->data);*/
     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surface->width, surface->height, 0, glFormat, glType, surface->pbuffer);
+#else
+       if (aglTexImagePBuffer(ctxt->context, surface->pbuffer, GL_BACK) == GL_FALSE)
+               fprintf(stderr, "aglTexImagePBuffer failed: %s", aglErrorString(aglGetError())); 
 
-       
+#endif
 }
 
 void glo_surface_release_texture(GloSurface *surface)
index 433c78e..bd12854 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef MANGLE_OPENGL_SYMBOLS
+#include "gl_mangled.h"
+#endif
+
 void *g_malloc(size_t size);
 void *g_realloc(void *ptr, size_t size);
 void g_free(void *ptr);
index 6580dea..f649a0f 100644 (file)
 #include <sys/shm.h>
 #include <X11/extensions/XShm.h>
 
+#ifdef MANGLE_OPENGL_SYMBOLS
+#include "gl_mangled.h"
+#endif
+
 struct GloMain {
   Display *dpy;
   int use_ximage;
index 67ce8f2..2799421 100644 (file)
 #include <sys/time.h>
 #endif
 
+#ifdef MANGLE_OPENGL_SYMBOLS
+#include "gl_mangled.h"
+#endif
+
 // ---------------------------------------------------
 //  Copied from glx.h as we need them in windows too
 /*
@@ -90,6 +94,12 @@ int gl_acceleration_capability_check (void) {
             0,
         };
 
+#ifdef MANGLE_OPENGL_SYMBOLS
+    if (mgl_load_symbols("libGL.so.1")) {
+               return CHECK_FAIL;
+    }
+#endif
+
     int bufferFlags = glo_flags_get_from_glx(bufferAttributes, 0);
     int bpp = glo_flags_get_bytes_per_pixel(bufferFlags);
     int glFormat, glType;
index 0290d76..15f22fe 100644 (file)
@@ -659,6 +659,9 @@ static const char *STANDARD_GL_FUNCTIONS ={
 "glXGetVisualFromFBConfig\0"
 "glXIsDirect\0"
 "glXCreatePixmap\0"
+"glXDestroyPixmap\0"
+"glXCreatePbuffer\n"
+"glXDestroyPbuffer\n"
 "\0"
 };
 
@@ -879,7 +882,7 @@ void glo_surface_update_context(GloSurface *surface, GloContext *context, int fr
 
     if ( surface->context )
     {
-            if ( free_flags) /* light-weight context */
+               if ( free_flags ) /* light-weight context */
             g_free(surface->context);
     }
     surface->context = context;
@@ -964,7 +967,7 @@ void glo_surface_get_size(GloSurface *surface, int *width, int *height) {
 }
 
 /* Bind the surface as texture */
-void glo_surface_as_texture(GloSurface *surface)
+void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface)
 {
 #if 0
     int glFormat, glType;
index 4389749..6162d72 100644 (file)
 #include <X11/extensions/XShm.h>
 #include <X11/extensions/Xcomposite.h>
 
+#ifdef MANGLE_OPENGL_SYMBOLS
+#include "gl_mangled.h"
+#endif
+
 void *g_malloc(size_t size);
 void *g_realloc(void *ptr, size_t size);
 void g_free(void *ptr);
@@ -264,7 +268,7 @@ void glo_surface_update_context(GloSurface *surface, GloContext *context, int fr
 
      if ( surface->context )
     {
-            if ( free_flags ) /* light-weight context */
+               if (free_flags) /* light-weight context */
             g_free(surface->context);
     }
     surface->context = context;
@@ -475,7 +479,7 @@ void glo_surface_get_size(GloSurface *surface, int *width, int *height) {
 }
 
 /* Bind the surface as texture */
-void glo_surface_as_texture(GloSurface *surface)
+void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface)
 {
 #if 0
     void (*ptr_func_glXBindTexImageEXT) (Display *dpy, GLXDrawable draw, int buffer, int *attrib_list);
old mode 100644 (file)
new mode 100755 (executable)
index 8a2a0bd..47a2fda
@@ -12,6 +12,7 @@
  * SungMin Ha <sungmin82.ha@samsung.com>
  * JiHye Kim <jihye1128.kim@samsung.com>
  * GiWoong Kim <giwoong.kim@samsung.com>
+ * DaiYoung Kim <daiyoung777.kim@samsung.com>
  * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
  * DongKyun Yun
  * DoHyung Hong
@@ -52,6 +53,7 @@
 #define PCI_DEVICE_ID_VIRTIO_KEYBOARD    0x1020
 #define PCI_DEVICE_ID_VIRTIO_ESM         0x1024
 #define PCI_DEVICE_ID_VIRTIO_HWKEY       0x1028
+#define PCI_DEVICE_ID_VIRTIO_EVDI        0x1028
 
 /* Virtio */
 /*
@@ -84,5 +86,6 @@
 #define VIRTIO_ID_KEYBOARD      12
 #define VIRTIO_ID_ESM           13
 #define VIRTIO_ID_HWKEY         14
+#define VIRTIO_ID_EVDI          15
 
 #endif /* MARU_DEVICE_IDS_H_ */
index a6788be..fbb7f81 100644 (file)
@@ -2,7 +2,7 @@
  * Maru vga device
  * Based on qemu/hw/vga.c
  *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact:
  * GiWoong Kim <giwoong.kim@samsung.com>
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #include "maru_err_table.h"
+#include "emul_state.h"
 #endif
 
 #ifdef CONFIG_USE_SHM
 void *shared_memory = (void*) 0;
 int skin_shmid;
-int port_shmid;
 #endif
 
 
@@ -1873,34 +1873,19 @@ void maru_vga_common_init(VGACommonState *s)
     vga_dirty_log_start(s);
 
 #ifdef CONFIG_USE_SHM
-    int mykey;
-    void *temp;
+    /* base + 1 = sdb port */
+    /* base + 2 = shared memory key */
+    int mykey = get_emul_vm_base_port() + 2;
 
-    port_shmid = shmget((key_t)SHMKEY, (size_t)MAXLEN, 0666 | IPC_CREAT);
-    if (port_shmid == -1) {
-        ERR("shmget failed\n");
-        perror("maru_vga: ");
-        exit(1);
-    }
-
-    temp = shmat(port_shmid, (char*)0x0, 0);
-    if (temp == (void *)-1) {
-        ERR("shmat failed\n");
-        perror("maru_vga: ");
-        exit(1);
-    }
-
-    mykey = atoi(temp);
-    shmdt(temp);
-    
     INFO("shared memory key: %d, vga ram_size : %d\n", mykey, s->vram_size);
 
     skin_shmid = shmget((key_t)mykey, (size_t)s->vram_size, 0666 | IPC_CREAT);
     if (skin_shmid == -1) {
         ERR("shmget failed\n");
         perror("maru_vga: ");
-        maru_register_exit_msg(MARU_EXIT_UNKNOWN, (char*)"Cannot launch this VM.\n"
-                        "Shared memory is not enough.");
+        maru_register_exit_msg(MARU_EXIT_UNKNOWN,
+            (char*) "Cannot launch this VM.\n"
+            "Shared memory is not enough.");
         exit(0);
     }
 
@@ -1929,11 +1914,6 @@ void maru_vga_common_fini(void)
         ERR("shmctl failed\n");
         perror("maru_vga: ");
     }
-    
-    if (shmctl(port_shmid, IPC_RMID, 0) == -1) {
-        ERR("temp shmctl failed\n");
-        perror("maru_vga: ");
-    }
 }
 #endif
 
diff --git a/tizen/src/hw/maru_virtio_evdi.c b/tizen/src/hw/maru_virtio_evdi.c
new file mode 100755 (executable)
index 0000000..01d54eb
--- /dev/null
@@ -0,0 +1,196 @@
+/*\r
+ * Virtio EmulatorVirtualDeviceInterface Device\r
+ *\r
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Contact:\r
+ *  DaiYoung Kim <daiyoung777.kim.hwang@samsung.com>\r
+ *  YeongKyoon Lee <yeongkyoon.lee@samsung.com>\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+\r
+#include "maru_device_ids.h"\r
+#include "maru_virtio_evdi.h"\r
+#include "debug_ch.h"\r
+\r
+MULTI_DEBUG_CHANNEL(qemu, virtio-evdi);\r
+\r
+#define VIRTIO_EVDI_DEVICE_NAME "virtio-evdi"\r
+\r
+#define __MAX_BUF_SIZE 1024\r
+\r
+enum {\r
+       IOTYPE_INPUT = 0,\r
+       IOTYPE_OUTPUT = 1\r
+};\r
+\r
+struct msg_info {\r
+       char buf[__MAX_BUF_SIZE];\r
+       uint32_t use;\r
+};\r
+\r
+typedef struct VirtIO_EVDI{\r
+    VirtIODevice    vdev;\r
+    VirtQueue       *rvq;\r
+    VirtQueue          *svq;\r
+    DeviceState     *qdev;\r
+\r
+    QEMUBH *bh;\r
+} VirtIO_EVDI;\r
+\r
+\r
+VirtIO_EVDI* vio_evdi;\r
+\r
+static int g_cnt = 0;\r
+\r
+static void virtio_evdi_recv(VirtIODevice *vdev, VirtQueue *vq)\r
+{\r
+    int index = 0;\r
+\r
+    struct msg_info _msg;\r
+\r
+    INFO(">> evdirecv : virtio_evdi_recv\n");\r
+\r
+       if (unlikely(virtio_queue_empty(vio_evdi->rvq))) {\r
+               INFO(">> evdirecv : virtqueue is empty\n");\r
+               return;\r
+       }\r
+\r
+    VirtQueueElement elem;\r
+\r
+    while ((index = virtqueue_pop(vq, &elem))) {\r
+\r
+       INFO(">> evdirecv : virtqueue_pop. index: %d\n", index);\r
+       INFO(">> evdirecv : element out_num : %d, in_num : %d\n", elem.out_num, elem.in_num);\r
+\r
+       if (index == 0) {\r
+               INFO("evdirecv : virtqueue break\n");\r
+                       break;\r
+               }\r
+\r
+       INFO(">> evdirecv : received use = %d, iov_len = %d\n", _msg.use, elem.in_sg[0].iov_len);\r
+\r
+       memcpy(&_msg, elem.in_sg[0].iov_base,  elem.in_sg[0].iov_len);\r
+\r
+\r
+       if (g_cnt < 10)\r
+       {\r
+                       memset(&_msg, 0x00, sizeof(_msg));\r
+                       sprintf(_msg.buf, "test_%d\n", g_cnt++);\r
+                       memcpy(elem.in_sg[0].iov_base, &_msg, sizeof(struct msg_info));\r
+\r
+                       INFO(">> evdirecv : send to guest msg use = %d, msg = %s, iov_len = %d \n",\r
+                                       _msg.use, _msg.buf, elem.in_sg[0].iov_len);\r
+\r
+\r
+                       virtqueue_push(vq, &elem, sizeof(VirtIO_EVDI));\r
+                       virtio_notify(&vio_evdi->vdev, vq);\r
+       }\r
+       }\r
+\r
+    INFO("enf of virtio_evdi_recv\n");\r
+}\r
+\r
+\r
+static void virtio_evdi_send(VirtIODevice *vdev, VirtQueue *vq)\r
+{\r
+       VirtIO_EVDI *vevdi = (VirtIO_EVDI *)vdev;\r
+    int index = 0;\r
+    struct msg_info _msg;\r
+\r
+    INFO("<< evdisend : virtio_evdi_send \n");\r
+    if (virtio_queue_empty(vevdi->svq)) {\r
+        INFO("<< evdisend : virtqueue is empty.\n");\r
+        return;\r
+    }\r
+\r
+    VirtQueueElement elem;\r
+\r
+    while ((index = virtqueue_pop(vq, &elem))) {\r
+\r
+               INFO("<< evdisend : virtqueue pop. index: %d\n", index);\r
+               INFO("<< evdisend : element out_num : %d, in_num : %d\n", elem.out_num, elem.in_num);\r
+\r
+               if (index == 0) {\r
+                       INFO("<< evdisend : virtqueue break\n");\r
+                       break;\r
+               }\r
+\r
+               INFO("<< evdisend : use=%d, iov_len = %d\n", _msg.use, elem.out_sg[0].iov_len);\r
+\r
+               memset(&_msg, 0x00, sizeof(_msg));\r
+               memcpy(&_msg, elem.out_sg[0].iov_base, elem.out_sg[0].iov_len);\r
+\r
+               INFO("<< evdisend : recv from guest len = %d, msg = %s \n", _msg.use, _msg.buf);\r
+    }\r
+\r
+       virtqueue_push(vq, &elem, sizeof(VirtIO_EVDI));\r
+       virtio_notify(&vio_evdi->vdev, vq);\r
+}\r
+\r
+static void maru_virtio_evdi_notify(void)\r
+{\r
+       TRACE("nothing to do.\n");\r
+}\r
+\r
+static uint32_t virtio_evdi_get_features(VirtIODevice *vdev,\r
+                                            uint32_t request_feature)\r
+{\r
+    TRACE("virtio_evdi_get_features.\n");\r
+    return 0;\r
+}\r
+\r
+static void maru_evdi_bh(void *opaque)\r
+{\r
+    maru_virtio_evdi_notify();\r
+}\r
+\r
+VirtIODevice *virtio_evdi_init(DeviceState *dev)\r
+{\r
+    INFO("initialize evdi device\n");\r
+\r
+    vio_evdi = (VirtIO_EVDI *)virtio_common_init(VIRTIO_EVDI_DEVICE_NAME,\r
+            VIRTIO_ID_EVDI, 0, sizeof(VirtIO_EVDI));\r
+    if (vio_evdi == NULL) {\r
+        ERR("failed to initialize evdi device\n");\r
+        return NULL;\r
+    }\r
+\r
+    vio_evdi->vdev.get_features = virtio_evdi_get_features;\r
+    vio_evdi->rvq = virtio_add_queue(&vio_evdi->vdev, 256, virtio_evdi_recv);\r
+    vio_evdi->svq = virtio_add_queue(&vio_evdi->vdev, 256, virtio_evdi_send);\r
+    vio_evdi->qdev = dev;\r
+\r
+    vio_evdi->bh = qemu_bh_new(maru_evdi_bh, vio_evdi);\r
+\r
+    return &vio_evdi->vdev;\r
+}\r
+\r
+void virtio_evdi_exit(VirtIODevice *vdev)\r
+{\r
+    INFO("destroy evdi device\n");\r
+\r
+    if (vio_evdi->bh) {\r
+            qemu_bh_delete(vio_evdi->bh);\r
+        }\r
+\r
+    virtio_cleanup(vdev);\r
+}\r
+\r
diff --git a/tizen/src/hw/maru_virtio_evdi.h b/tizen/src/hw/maru_virtio_evdi.h
new file mode 100755 (executable)
index 0000000..ad88b68
--- /dev/null
@@ -0,0 +1,26 @@
+/*\r
+ * maru_virtio_evdi.h\r
+ *\r
+ *  Created on: 2013. 3. 30.\r
+ *      Author: dykim\r
+ */\r
+\r
+#ifndef MARU_VIRTIO_EVDI_H_\r
+#define MARU_VIRTIO_EVDI_H_\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+#include "hw/virtio.h"\r
+\r
+VirtIODevice *virtio_evdi_init(DeviceState *dev);\r
+\r
+void virtio_evdi_exit(VirtIODevice *vdev);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif /* MARU_VIRTIO_EVDI_H_ */\r
index 00c4f3d..6cae72f 100644 (file)
@@ -61,22 +61,13 @@ void virtio_keyboard_notify(void *opaque)
     EmulKbdEvent *kbdevt;
     int index = 0;
     int written_cnt = 0;
-    int *rptr = NULL;
 
     if (!vkbd) {
         ERR("VirtIOKeyboard is NULL.\n");
         return;
     }
 
-    qemu_mutex_lock(&vkbd->event_mutex);
-    written_cnt = vkbd->kbdqueue.wptr;
     TRACE("[Enter] virtqueue notifier. %d\n", written_cnt);
-    qemu_mutex_unlock(&vkbd->event_mutex);
-    if (written_cnt < 0) {
-        TRACE("there is no input data to copy to guest.\n");
-        return;
-    }
-    rptr = &vkbd->kbdqueue.rptr;
 
     if (!virtio_queue_ready(vkbd->vq)) {
         INFO("virtqueue is not ready.\n");
@@ -84,30 +75,41 @@ void virtio_keyboard_notify(void *opaque)
     }
 
     if (vkbd->kbdqueue.rptr == VIRTIO_KBD_QUEUE_SIZE) {
-        *rptr = 0;
+        vkbd->kbdqueue.rptr = 0;
     }
 
+    qemu_mutex_lock(&vkbd->event_mutex);
+    written_cnt = vkbd->kbdqueue.wptr;
+
     while ((written_cnt--)) {
-        index = *rptr;
-        kbdevt = &vkbd->kbdqueue.kbdevent[index];
+        kbdevt = &vkbd->kbdqueue.kbdevent[vkbd->kbdqueue.rptr];
+
+        while (((EmulKbdEvent*)(elem.in_sg[index].iov_base))->code != 0) {
+            if (++index == VIRTIO_KBD_QUEUE_SIZE) {
+                index--;
+                TRACE("virtio queue is full.\n");
+                break;
+            }
+        }
 
         /* Copy keyboard data into guest side. */
-        TRACE("copy: keycode %d, type %d, index %d\n",
+        TRACE("copy: keycode %d, type %d, elem_index %d\n",
             kbdevt->code, kbdevt->type, index);
-        memcpy(elem.in_sg[index].iov_base, kbdevt, sizeof(EmulKbdEvent));
+        memcpy(elem.in_sg[index++].iov_base, kbdevt, sizeof(EmulKbdEvent));
         memset(kbdevt, 0x00, sizeof(EmulKbdEvent));
 
-        qemu_mutex_lock(&vkbd->event_mutex);
         if (vkbd->kbdqueue.wptr > 0) {
             vkbd->kbdqueue.wptr--;
+            TRACE("written_cnt: %d, wptr: %d, qemu_index: %d\n", written_cnt, vkbd->kbdqueue.wptr, vkbd->kbdqueue.rptr);
         }
-        qemu_mutex_unlock(&vkbd->event_mutex);
 
-        (*rptr)++;
-        if (*rptr == VIRTIO_KBD_QUEUE_SIZE) {
-            *rptr = 0;
+        vkbd->kbdqueue.rptr++;
+        if (vkbd->kbdqueue.rptr == VIRTIO_KBD_QUEUE_SIZE) {
+            vkbd->kbdqueue.rptr = 0;
+            TRACE("kbdqueue is full.\n");
         }
     }
+    qemu_mutex_unlock(&vkbd->event_mutex);
 
     virtqueue_push(vkbd->vq, &elem, sizeof(EmulKbdEvent));
     virtio_notify(&vkbd->vdev, vkbd->vq);
@@ -199,11 +201,11 @@ static void virtio_keyboard_event(void *opaque, int keycode)
         vkbd->extension_key = 1;
     }
 
+    qemu_mutex_lock(&vkbd->event_mutex);
     memcpy(&vkbd->kbdqueue.kbdevent[(*index)++], &kbdevt, sizeof(kbdevt));
     TRACE("event: keycode %d, type %d, index %d.\n",
         kbdevt.code, kbdevt.type, ((*index) - 1));
 
-    qemu_mutex_lock(&vkbd->event_mutex);
     vkbd->kbdqueue.wptr++;
     qemu_mutex_unlock(&vkbd->event_mutex);
 
@@ -242,7 +244,7 @@ VirtIODevice *virtio_keyboard_init(DeviceState *dev)
 
 
     vkbd->vdev.get_features = virtio_keyboard_get_features;
-    vkbd->vq = virtio_add_queue(&vkbd->vdev, 64, virtio_keyboard_handle);
+    vkbd->vq = virtio_add_queue(&vkbd->vdev, 128, virtio_keyboard_handle);
     vkbd->qdev = dev;
 
     /* bottom half */
@@ -250,7 +252,7 @@ VirtIODevice *virtio_keyboard_init(DeviceState *dev)
 
     /* register keyboard handler */
     qemu_add_kbd_event_handler(virtio_keyboard_event, vkbd);
-
     return &vkbd->vdev;
 }
 
index a744760..4cd9b4c 100644 (file)
@@ -39,7 +39,7 @@ extern "C" {
 #include "hw/virtio.h"
 
 #define VIRTIO_KBD_DEVICE_NAME "virtio-keyboard"
-#define VIRTIO_KBD_QUEUE_SIZE  10
+#define VIRTIO_KBD_QUEUE_SIZE  100
 
 typedef struct EmulKbdEvent {
     uint16_t code;
index 43c1f35..5085d4a 100644 (file)
@@ -209,8 +209,8 @@ enum {
 };
 
 enum {
-        SURFACE_PENDING,    /* Created with light-weight context */
-        SURFACE_ACTIVE,     /* Ready after MakeCurrent */
+       SURFACE_PENDING,    /* Created with light-weight context */
+       SURFACE_ACTIVE,     /* Ready after MakeCurrent */
 };
 
 typedef struct QGloSurface {
@@ -219,7 +219,7 @@ typedef struct QGloSurface {
     ClientGLXDrawable *client_drawable;
     int type; /* window, pixmap or pbuffer */
     int ready;
-    int status;
+       int status;
     int ref;
     QTAILQ_ENTRY(QGloSurface) next;
 } QGloSurface;
@@ -628,17 +628,12 @@ static void unbind_qsurface(GLState *state,
                state->current_qsurface = NULL;
 }
 
-/* Find the qsurface with required drawable in active & pending qsurfaces */
+/* Find the qsurface with required drawable in all pixmap/pbuffer surfaces */
 QGloSurface* find_qsurface_from_client_drawable(ProcessState *process, ClientGLXDrawable client_drawable)
 {
-    /* search for surfaces in current conetxt */
     int i;
-    QGloSurface *qsurface = get_qsurface_from_client_drawable(process->current_state, client_drawable);
-
-    if (qsurface)
-        return qsurface;
+    QGloSurface *qsurface;
 
-    /* search the pending surfaces */
     for ( i = 0; i < process->nb_qsurf; i++ )
     {
         qsurface = process->pending_qsurfaces[i];
@@ -661,7 +656,7 @@ static int set_current_qsurface(GLState *state,
     QTAILQ_FOREACH(qsurface, &state->qsurfaces, next) {
         if(qsurface->client_drawable == client_drawable) {
             state->current_qsurface = qsurface;
-            qsurface->glstate = state;
+                       qsurface->glstate = state;
             return 1;
         }
     }
@@ -700,14 +695,13 @@ static int link_drawable(ProcessState *process, ClientGLXDrawable drawable)
     return 0;
 }
 
-/* Need to create pixmap surface when guest do so, as guest may use it before
- * MakeCurrent. As no context available at this point, we do the follwoing:
+/* Need to create pixmap/pbuffer surface when guest do so, as guest may use it
+ * before MakeCurrent. As no context available at this point, do the following:
  * 1. Create one light-weight context just for surface creation.
  * 2. Store this qsurface, and link it with right context when MakeCurrent
  */
 static void keep_qsurface(ProcessState *process, QGloSurface *qsurface)
 {
-    int i;
     process->pending_qsurfaces =
         g_realloc(process->pending_qsurfaces,
                   (process->nb_qsurf + 1) * sizeof(QGloSurface*));
@@ -740,17 +734,17 @@ static int link_qsurface(ProcessState *process, GLState *glstate, ClientGLXDrawa
 #endif
 
             qsurface->ref = 1;
-            if(qsurface->status == SURFACE_PENDING)
-            {
-                    glo_surface_update_context(qsurface->surface, glstate->context, 1);
-                    qsurface->status = SURFACE_ACTIVE;
-            }
-            else
-            {
-                    unbind_qsurface(qsurface->glstate, qsurface);
-                    glo_surface_update_context(qsurface->surface, glstate->context, 0);
+                       if(qsurface->status == SURFACE_PENDING)
+                       {
+                               glo_surface_update_context(qsurface->surface, glstate->context, 1);
+                               qsurface->status = SURFACE_ACTIVE;
+                       }
+                       else
+                       {
+                               unbind_qsurface(qsurface->glstate, qsurface);
+                               glo_surface_update_context(qsurface->surface, glstate->context, 0);
 
-            }
+                       }
 
             bind_qsurface(glstate, qsurface);
             return 1;
@@ -760,8 +754,9 @@ static int link_qsurface(ProcessState *process, GLState *glstate, ClientGLXDrawa
     return 0;
 }
 
-/* Pixmap can be used as texture via glEGLImageTargetTexture2DOES, so need keep
- * the mapping between them to add proper action when bind the texture again
+/* Pixmap and Pbuffer can be used as texture via glEGLImageTargetTexture2DOES
+ * and glXBindTexImage, so need keep the mapping between them to add proper
+ * action when bind the texture again
  */
 static void del_pixmap_texture_mapping(GLState *state,
         unsigned int texture)
@@ -780,6 +775,23 @@ static void del_pixmap_texture_mapping(GLState *state,
     }
 }
 
+static void remove_pixmap_texture_mapping(GLState *state,
+        ClientGLXDrawable drawable)
+{
+    int i;
+    for ( i = 0; i < MAX_PIXMAP_TEXTURE; i++ )
+    {
+        if ( state->pixmapTextures[i].used &&
+             state->pixmapTextures[i].drawable == drawable )
+        {
+            state->pixmapTextures[i].used = 0;
+            state->pixmapTextures[i].texture = 0;
+            state->pixmapTextures[i].drawable = 0;
+            return;
+        }
+    }
+}
+
 static int add_pixmap_texture_mapping(GLState *state,
         unsigned int texture, ClientGLXDrawable drawable)
 {
@@ -796,8 +808,7 @@ static int add_pixmap_texture_mapping(GLState *state,
         }
     }
 
-    if ( i >= MAX_PIXMAP_TEXTURE )
-        return 0;
+    return 0;
 }
 
 static ClientGLXDrawable find_pixmap_texture(GLState *state,
@@ -1400,21 +1411,21 @@ shadersrc_gles_to_gl(GLsizei count, const char** string, char **s, const GLint*
  */
 static void mac_dump_texture()
 {
-    int w, h;
-    unsigned char *buf;
+       int w, h;
+       unsigned char *buf;
 
-    /* only handle target=GL_TEXTURE_2D, level=0, format=GL_RGBA, type=GL_UNSIGNED_BYTE */
-    glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
-    glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
+       /* only handle target=GL_TEXTURE_2D, level=0, format=GL_RGBA, type=GL_UNSIGNED_BYTE */
+       glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
+       glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
 
-    if ( w == 0 && h == 0 )
-        return;
+       if ( w == 0 && h == 0 )
+               return;
 
-    buf = g_malloc( (w*4) * h); /* XXX:need allignment? */
+       buf = g_malloc( (w*4) * h); /* XXX:need allignment? */
 
-    glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf);
+       glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf);
 
-    g_free(buf);
+       g_free(buf);
 }
 #endif
 
@@ -1759,7 +1770,7 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args
 
                     ret.i = glo_surface_makecurrent(glstate->current_qsurface->surface);
 /*                    if (reset_texture)*/
-/*                        glo_surface_as_texture(old_glstate->current_qsurface->surface);*/
+/*                        glo_surface_as_texture(process->current_state->context, old_glstate->current_qsurface->surface);*/
                 }
             }
             break;
@@ -2022,16 +2033,18 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args
                 DEBUGF( "glXCreatePixmap: %dX%d.\n", width, height);
                 qsurface->surface = glo_surface_create(width, height, context);
                 qsurface->client_drawable = client_drawable;
-                qsurface->type = SURFACE_PIXMAP;
-                qsurface->status = SURFACE_PENDING;
+                               qsurface->type = SURFACE_PIXMAP;
+                               qsurface->status = SURFACE_PENDING;
                 /*                qsurface->ref = 1;*/
 
                 /* Keep this surface, will link it with context in MakeCurrent */
                 keep_qsurface(process, qsurface);
 
                 /* If this pixmap is linked as texture previously */
-                if (link_drawable(process, client_drawable))
-                        glo_surface_as_texture(qsurface->surface);
+                               if (link_drawable(process, client_drawable))
+                                       glo_surface_as_texture(process->current_state->context,
+                                                       qsurface->surface);
+
 
                 ret.i = client_drawable;
 
@@ -2040,6 +2053,17 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args
         }
     case glXDestroyPixmap_func:
         {
+            /* glXPixmap same as input Pixmap */
+            ClientGLXDrawable client_drawable = to_drawable(args[1]);
+            QGloSurface *qsurface = find_qsurface_from_client_drawable(process, client_drawable);
+            if ( qsurface &&
+                 qsurface != process->current_state->current_qsurface &&
+                 qsurface->glstate == NULL &&
+                 qsurface->type == SURFACE_PIXMAP )
+            {
+                glo_surface_destroy(qsurface->surface);
+                g_free(qsurface);
+            }
             break;
         }
     case glEGLImageTargetTexture2DOES_fake_func:
@@ -2063,10 +2087,93 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args
                 }
             }
             else
-                glo_surface_as_texture(qsurface->surface);
+                               glo_surface_as_texture(process->current_state->context, qsurface->surface);
+
+                       break;
+               }
+       case glXBindTexImageARB_fake_func:
+               {
+                       ClientGLXDrawable client_drawable = to_drawable(args[1]);
+                       QGloSurface *qsurface = find_qsurface_from_client_drawable(process, client_drawable);
+                       ret.i = 0;
+
+
+                       if ( qsurface )
+                       {
+                               add_pixmap_texture_mapping(process->current_state,
+                                               process->current_state->bindTexture2D,
+                                               client_drawable);
+                               glo_surface_as_texture(process->current_state->context, qsurface->surface);
+                               ret.i = 1;
+                       }
+                       else
+                               DEBUGF( "Not found pbuffer surface for BindTexImage!\n");
+
+                       break;
+               }
+       case glXReleaseTexImageARB_fake_func:
+               {
+                       ClientGLXDrawable client_drawable = to_drawable(args[1]);
+                       QGloSurface *qsurface = find_qsurface_from_client_drawable(process, client_drawable);
+
+                       if ( qsurface )
+                       {
+                               remove_pixmap_texture_mapping(process->current_state,
+                                               client_drawable);
+                               glo_surface_release_texture(qsurface->surface);
+                       }
+
+                       break;
+               }
+       case glXCreatePbuffer_func:
+               {
+                       int client_fbconfig = args[1];
+
+                       ret.i = 0;
+                       const GLXFBConfig *fbconfig = get_fbconfig(process, client_fbconfig);
+
+                       if (fbconfig) {
+
+                               /* Create a light-weight context just for creating surface */
+                               GloContext *context = __glo_context_create(fbconfig->formatFlags);
+
+                               QGloSurface *qsurface = calloc(1, sizeof(QGloSurface));
+
+                               /* get the width and height */
+                               int width, height;
+                               glo_geometry_get_from_glx((int*)args[2], &width, &height);
+
+                               DEBUGF( "glXCreatePbuffer: %dX%d.\n", width, height);
+                               qsurface->surface = glo_surface_create(width, height, context);
+                               /* Use GloSurface handler as no input client_drawable, and
+                                * keep only low 32bit of handler on x86_64 host.  */
+                               qsurface->client_drawable = (int)qsurface->surface;
+                               qsurface->type = SURFACE_PBUFFER;
+                               qsurface->status = SURFACE_PENDING;
+                               /*                qsurface->ref = 1;*/
+
+                               /* Keep this surface, will link it with context in MakeCurrent */
+                               keep_qsurface(process, qsurface);
+
+                               ret.i = qsurface->client_drawable;
 
+                       }
+                       break;
+               }
+       case glXDestroyPbuffer_func:
+               {
+            ClientGLXDrawable client_drawable = to_drawable(args[1]);
+            QGloSurface *qsurface = find_qsurface_from_client_drawable(process, client_drawable);
+            if ( qsurface &&
+                 qsurface != process->current_state->current_qsurface &&
+                 qsurface->glstate == NULL &&
+                 qsurface->type == SURFACE_PBUFFER )
+            {
+                glo_surface_destroy(qsurface->surface);
+                g_free(qsurface);
+            }
             break;
-        }
+               }
 
 /* Begin of texture stuff */
     case glBindTexture_func:
@@ -2102,7 +2209,7 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args
 
                     if ( qsurface )
                     {
-                        glo_surface_as_texture(qsurface->surface);
+                        glo_surface_as_texture(process->current_state->context, qsurface->surface);
                         fprintf(stderr, "edwin:bindtexture: drawable=0x%x,qsurface=%p.\n", drawable, qsurface);
                     }
                 }
@@ -3052,15 +3159,14 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args
             glDrawArrays(mode, 0, count);
 
 #ifdef __APPLE__  //only for mac
-            {
-                    int prev_fbo;
-                    glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &prev_fbo);
-                    if ( prev_fbo != 0 )
-                            glFlush();
-            }
+                       {
+                               int prev_fbo;
+                               glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &prev_fbo);
+                               if ( prev_fbo != 0 )
+                                       glFlush();
+                       }
 #endif
 
-
             break;
         }
 
@@ -3533,12 +3639,12 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args
             glDrawElements(args[0], args[1], args[2], (void *) args[3]);
 
 #ifdef __APPLE__  //only for mac
-            {
-                    int prev_fbo;
-                    glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &prev_fbo);
-                    if ( prev_fbo != 0 )
-                            glFlush();
-            }
+                       {
+                               int prev_fbo;
+                               glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &prev_fbo);
+                               if ( prev_fbo != 0 )
+                                       glFlush();
+                       }
 #endif
 
             break;
@@ -3556,37 +3662,37 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args
             GET_EXT_PTR(void, glMultiDrawElements,
                         (int, int *, int, void **, int));
             ptr_func_glMultiDrawElements(args[0], (int *) args[1], args[2],
-                                         (void **) args[3], args[4]);
+                                       (void **) args[3], args[4]);
 #ifdef __APPLE__  //only for mac
-            {
-                    int prev_fbo;
-                    glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &prev_fbo);
-                    if ( prev_fbo != 0 )
-                            glFlush();
-            }
+                       {
+                               int prev_fbo;
+                               glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &prev_fbo);
+                               if ( prev_fbo != 0 )
+                                       glFlush();
+                       }
 #endif
 
-            break;
-        }
+                       break;
+               }
 #ifdef __APPLE__  // only for mac
-    case glDrawArrays_func:
-        {
-                int prev_fbo;
-                glDrawArrays(ARG_TO_UNSIGNED_INT(args[0]), ARG_TO_INT(args[1]), ARG_TO_INT(args[2]));
-                glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &prev_fbo);
-                if ( prev_fbo != 0 )
-                        glFlush();
-                break;
-        }
-    case glDrawElements_func:
-        {
-                int prev_fbo;
-                glDrawElements(ARG_TO_UNSIGNED_INT(args[0]), ARG_TO_INT(args[1]), ARG_TO_UNSIGNED_INT(args[2]), (const void*)(args[3]));
-                glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &prev_fbo);
-                if ( prev_fbo != 0 )
-                        glFlush();
-                break;
-        }
+       case glDrawArrays_func:
+               {
+                       int prev_fbo;
+                       glDrawArrays(ARG_TO_UNSIGNED_INT(args[0]), ARG_TO_INT(args[1]), ARG_TO_INT(args[2]));
+                       glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &prev_fbo);
+                       if ( prev_fbo != 0 )
+                               glFlush();
+                       break;
+               }
+       case glDrawElements_func:
+               {
+                       int prev_fbo;
+                       glDrawElements(ARG_TO_UNSIGNED_INT(args[0]), ARG_TO_INT(args[1]), ARG_TO_UNSIGNED_INT(args[2]), (const void*)(args[3]));
+                       glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &prev_fbo);
+                       if ( prev_fbo != 0 )
+                               glFlush();
+                       break;
+               }
 #endif
 
     case _glGetError_fake_func:
@@ -3759,61 +3865,61 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args
 #endif
 
 #ifdef _WIN32
-    /* workaround for bug T_SDK-128. If GL_UNPACK_ROW_LENGTH==0, GL driver
-     * should calculate it for glTexSubImage2D according to width parameter and
-     * GL_UNPACK_ALIGNMENT. But on windows, some vender's driver like nvidia,
-     * don't follow it. So we need do it for the driver, and probably remove
-     * this hack in future if driver get fixed.
-     */
-    case glTexSubImage2D_func:
-        {
-            int origin_row_length, alignment, width;
+       /* workaround for bug T_SDK-128. If GL_UNPACK_ROW_LENGTH==0, GL driver
+        * should calculate it for glTexSubImage2D according to width parameter and
+        * GL_UNPACK_ALIGNMENT. But on windows, some vender's driver like nvidia,
+        * don't follow it. So we need do it for the driver, and probably remove
+        * this hack in future if driver get fixed.
+        */
+       case glTexSubImage2D_func:
+               {
+                       int origin_row_length, alignment, width;
 
-            if (args[6] == GL_ALPHA) {
-                width = args[4];
-                glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
-                glGetIntegerv(GL_UNPACK_ROW_LENGTH, &origin_row_length);
+                       if (args[6] == GL_ALPHA) {
+                               width = args[4];
+                               glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
+                               glGetIntegerv(GL_UNPACK_ROW_LENGTH, &origin_row_length);
 
-                if (width%alignment != 0) {
-                    width = (width/alignment + 1) * alignment;
-                }
+                               if (width%alignment != 0) {
+                                       width = (width/alignment + 1) * alignment;
+                               }
 
-                glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
-            }
+                               glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
+                       }
 
-            glTexSubImage2D(ARG_TO_UNSIGNED_INT(args[0]), ARG_TO_INT(args[1]),
-                        ARG_TO_INT(args[2]), ARG_TO_INT(args[3]),
-                        ARG_TO_INT(args[4]), ARG_TO_INT(args[5]),
-                        ARG_TO_UNSIGNED_INT(args[6]),
-                        ARG_TO_UNSIGNED_INT(args[7]), (const void*)(args[8]));
+                       glTexSubImage2D(ARG_TO_UNSIGNED_INT(args[0]), ARG_TO_INT(args[1]),
+                                               ARG_TO_INT(args[2]), ARG_TO_INT(args[3]),
+                                               ARG_TO_INT(args[4]), ARG_TO_INT(args[5]),
+                                               ARG_TO_UNSIGNED_INT(args[6]),
+                                               ARG_TO_UNSIGNED_INT(args[7]), (const void*)(args[8]));
 
-            if (args[6] == GL_ALPHA)
-                glPixelStorei(GL_UNPACK_ROW_LENGTH, origin_row_length);
+                       if (args[6] == GL_ALPHA)
+                               glPixelStorei(GL_UNPACK_ROW_LENGTH, origin_row_length);
 
-            break;
-        }
+                       break;
+               }
 #endif
 
 #ifdef __APPLE__
-    case glTexSubImage2D_func:
-    {
+       case glTexSubImage2D_func:
+               {
 
-      glTexSubImage2D(ARG_TO_UNSIGNED_INT(args[0]), ARG_TO_INT(args[1]),
-                  ARG_TO_INT(args[2]), ARG_TO_INT(args[3]),
-                  ARG_TO_INT(args[4]), ARG_TO_INT(args[5]),
-                  ARG_TO_UNSIGNED_INT(args[6]), ARG_TO_UNSIGNED_INT(args[7]),
-                  (const void*)(args[8]));
-
-      if ( ARG_TO_UNSIGNED_INT(args[0]) == GL_TEXTURE_2D &&
-              ARG_TO_INT(args[1]) == 0 &&
-              ARG_TO_UNSIGNED_INT(args[6]) == GL_RGBA &&
-              ARG_TO_UNSIGNED_INT(args[7]) == GL_UNSIGNED_BYTE )
-          mac_dump_texture();
-      else
-          fprintf(stderr, "!!! Probable screen crash, no work around as glTexSubImage2d parameters do not match!\n");
-
-      break;
-    }
+                       glTexSubImage2D(ARG_TO_UNSIGNED_INT(args[0]), ARG_TO_INT(args[1]),
+                                       ARG_TO_INT(args[2]), ARG_TO_INT(args[3]),
+                                       ARG_TO_INT(args[4]), ARG_TO_INT(args[5]),
+                                       ARG_TO_UNSIGNED_INT(args[6]), ARG_TO_UNSIGNED_INT(args[7]),
+                                       (const void*)(args[8]));
+
+                       if ( ARG_TO_UNSIGNED_INT(args[0]) == GL_TEXTURE_2D &&
+                                       ARG_TO_INT(args[1]) == 0 &&
+                                       ARG_TO_UNSIGNED_INT(args[6]) == GL_RGBA &&
+                                       ARG_TO_UNSIGNED_INT(args[7]) == GL_UNSIGNED_BYTE )
+                               mac_dump_texture();
+                       else
+                               fprintf(stderr, "!!! Probable screen crash, no work around as glTexSubImage2d parameters do not match!\n");
+
+                       break;
+               }
 #endif
 
     default:
index 3b30217..e29f0d9 100644 (file)
@@ -428,9 +428,9 @@ static const int glXBindTexImageATI_signature[] =
     { TYPE_NONE, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT };
 static const int glXReleaseTexImageATI_signature[] =
     { TYPE_NONE, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT };
-static const int glXBindTexImageARB_signature[] =
+static const int glXBindTexImageARB_fake_signature[] =
     { TYPE_INT, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT };
-static const int glXReleaseTexImageARB_signature[] =
+static const int glXReleaseTexImageARB_fake_signature[] =
     { TYPE_INT, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT };
 
 static const int glEGLImageTargetTexture2DOES_fake_signature[] =
index 6bb5cd0..e1753ac 100644 (file)
@@ -51,7 +51,8 @@ Check if the file is corrupted or missing.\n\n",
     /* 3 */ "Failed to load a bios file the following path.\
 Check if the file is corrupted or missing.\n\n",
     /* 4 */ "Skin process cannot be initialized. Skin server is not ready.",
-    /* 5 */ "Skin client could not connect to Skin server. The time of internal heartbeat has expired.",
+    /* 5 */ "Emulator has stopped working.\n\
+A problem caused the program to stop working correctly.",
     /* add here.. */
     ""
 };
@@ -76,6 +77,11 @@ void maru_register_exit_msg(int maru_exit_index, char const *const additional_ms
     maru_exit_status = maru_exit_index;
 
     if (maru_exit_status != MARU_EXIT_UNKNOWN) {
+        if (maru_exit_status == MARU_EXIT_HB_TIME_EXPIRED) {
+            fprintf(stderr, "Skin client could not connect to Skin server.\
+The time of internal heartbeat has expired.\n");
+        }
+
         if (additional_msg != NULL) {
             len = strlen(_maru_string_table[maru_exit_status])
                     + strlen(additional_msg) + 1;
@@ -94,7 +100,7 @@ void maru_register_exit_msg(int maru_exit_index, char const *const additional_ms
             snprintf(maru_exit_msg, len,
                     "%s", _maru_string_table[maru_exit_status]);
         }
-    } else if (additional_msg != NULL) {
+    } else if (additional_msg != NULL) { /* MARU_EXIT_UNKNOWN */
         len = strlen(additional_msg);
         if (len >= JAVA_MAX_COMMAND_LENGTH) {
             len = JAVA_MAX_COMMAND_LENGTH - 1;
index 6a14d76..a22fd03 100644 (file)
@@ -1,7 +1,7 @@
 /**
+ * Transmit the framebuffer from shared memory by JNI
  *
- *
- * Copyright ( C ) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact:
  * GiWoong Kim <giwoong.kim@samsung.com>
 #include "org_tizen_emulator_skin_EmulatorShmSkin.h"
 
 #define MAXLEN 512
-#define SHMKEY 26099
 
 void *shared_memory = (void *)0;
 int shmid;
 
 
 JNIEXPORT jint JNICALL Java_org_tizen_emulator_skin_EmulatorShmSkin_shmget
-  (JNIEnv *env, jobject obj, jint vga_ram_size)
+    (JNIEnv *env, jobject obj, jint shmkey, jint vga_ram_size)
 {
-    void *temp;
-    int keyval;
-    shmid = shmget((key_t)SHMKEY, (size_t)MAXLEN, 0666 | IPC_CREAT);
-    if (shmid == -1) {
-           fprintf(stderr, "share.c: shmget failed\n");
-        exit(1);
-    }
-    
-    temp = shmat(shmid, (char*)0x0, 0);
-    if (temp == (void *)-1) {
-        fprintf(stderr, "share.c: shmat failed\n");
-        exit(1);
-    }
-    keyval = atoi(temp);
-    fprintf(stdout, "share.c: shared memory key = %d\n", keyval);
-    shmdt(temp);
+    fprintf(stdout, "share.c: shared memory key = %d\n", shmkey);
+    fflush(stdout);
 
-    shmid = shmget((key_t)keyval, (size_t)vga_ram_size, 0666 | IPC_CREAT);
+    shmid = shmget((key_t)shmkey, (size_t)vga_ram_size, 0666 | IPC_CREAT);
     if (shmid == -1) {
         fprintf(stderr, "share.c: shmget failed\n");
+        fflush(stderr);
         return 1;
     }
 
-    /* We now make the shared memory accessible to the program. */
+    /* We now make the shared memory accessible to the program */
     shared_memory = shmat(shmid, (void *)0, 0);
     if (shared_memory == (void *)-1) {
         fprintf(stderr, "share.c: shmat failed\n");
+        fflush(stderr);
         return 2;
     }
 
@@ -79,37 +66,42 @@ JNIEXPORT jint JNICALL Java_org_tizen_emulator_skin_EmulatorShmSkin_shmget
 }
 
 JNIEXPORT jint JNICALL Java_org_tizen_emulator_skin_EmulatorShmSkin_shmdt
-  (JNIEnv *env, jobject obj)
+    (JNIEnv *env, jobject obj)
 {
     /* Lastly, the shared memory is detached */
     if (shmdt(shared_memory) == -1) {
         fprintf(stderr, "share.c: shmdt failed\n");
+        fflush(stderr);
         perror("share.c: ");
         return 1;
     }
-/*    
+
+    /*
     if (shmctl(shmid, IPC_RMID, 0) == -1) {
         fprintf(stderr, "share.c: shmctl failed\n");
+        fflush(stderr);
         perror("share.c: ");
     }
-*/
+    */
+
     return 0;
 }
 
 JNIEXPORT jint JNICALL Java_org_tizen_emulator_skin_EmulatorShmSkin_getPixels
-  (JNIEnv *env, jobject obj, jintArray array)
+    (JNIEnv *env, jobject obj, jintArray array)
 {
     int i = 0;
     int len = (*env)->GetArrayLength(env, array);
     if (len <= 0) {
         fprintf(stderr, "share.c: get length failed\n");
+        fflush(stderr);
         return -1;
     }
 
     int *framebuffer = (int *)shared_memory;
 
     jint value = 0xFFFFFFFF;
-    for(i = 0; i < len; i++) {
+    for (i = 0; i < len; i++) {
         value = framebuffer[i];
         (*env)->SetIntArrayRegion(env, array, i, 1, &value); 
     }
index b904f08..418f443 100644 (file)
                 <keyMap>
                     <region left="159" top="552" width="54" height="54"/>
                     <eventInfo>
-                        <keyCode>101</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyCode>139</keyCode>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="362" top="487" width="15" height="70"/>
                     <eventInfo>
-                        <keyCode>103</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
@@ -31,7 +31,7 @@
                     <region left="362" top="63" width="15" height="70"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
@@ -39,7 +39,7 @@
                     <region left="362" top="140" width="15" height="70"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
@@ -58,7 +58,7 @@
                     <region left="552" top="167" width="54" height="54"/>
                     <eventInfo>
                         <keyCode>139</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
@@ -66,7 +66,7 @@
                     <region left="486" top="3" width="70" height="15"/>
                     <eventInfo>
                         <keyCode>116</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
@@ -74,7 +74,7 @@
                     <region left="63" top="3" width="70" height="15"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
@@ -82,7 +82,7 @@
                     <region left="139" top="3" width="70" height="15"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="167" top="14" width="54" height="54"/>
                     <eventInfo>
-                        <keyCode>101</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyCode>139</keyCode>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="3" top="64" width="15" height="70"/>
                     <eventInfo>
-                        <keyCode>103</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
                     <region left="3" top="488" width="15" height="70"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
                     <region left="3" top="412" width="15" height="70"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="14" top="159" width="54" height="54"/>
                     <eventInfo>
-                        <keyCode>101</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyCode>139</keyCode>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="64" top="362" width="70" height="15"/>
                     <eventInfo>
-                        <keyCode>103</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
                     <region left="488" top="362" width="70" height="15"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
                     <region left="412" top="362" width="70" height="15"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
index 61bed8f..34bd212 100644 (file)
@@ -15,7 +15,7 @@
                     <region left="238" top="887" width="74" height="74"/>
                     <eventInfo>
                         <keyCode>139</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
@@ -23,7 +23,7 @@
                     <region left="541" top="819" width="20" height="74"/>
                     <eventInfo>
                         <keyCode>116</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
@@ -31,7 +31,7 @@
                     <region left="541" top="81" width="20" height="74"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
@@ -39,7 +39,7 @@
                     <region left="541" top="167" width="20" height="74"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="887" top="249" width="74" height="74"/>
                     <eventInfo>
-                        <keyCode>101</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyCode>139</keyCode>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="818" top="2" width="74" height="20"/>
                     <eventInfo>
-                        <keyCode>103</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
@@ -74,7 +74,7 @@
                     <region left="80" top="2" width="74" height="20"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
@@ -82,7 +82,7 @@
                     <region left="165" top="2" width="74" height="20"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="249" top="14" width="74" height="74"/>
                     <eventInfo>
-                        <keyCode>101</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyCode>139</keyCode>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="2" top="84" width="20" height="74"/>
                     <eventInfo>
-                        <keyCode>103</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
                     <region left="2" top="821" width="20" height="74"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
                     <region left="2" top="735" width="20" height="74"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="15" top="239" width="74" height="74"/>
                     <eventInfo>
-                        <keyCode>101</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyCode>139</keyCode>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="84" top="539" width="74" height="20"/>
                     <eventInfo>
-                        <keyCode>103</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
                     <region left="822" top="539" width="74" height="20"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
                     <region left="735" top="539" width="74" height="20"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
index dc9f9a6..c2b2b0d 100644 (file)
@@ -15,7 +15,7 @@
                     <region left="310" top="1139" width="84" height="84"/>
                     <eventInfo>
                         <keyCode>139</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
@@ -23,7 +23,7 @@
                     <region left="690" top="1055" width="24" height="88"/>
                     <eventInfo>
                         <keyCode>116</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
@@ -31,7 +31,7 @@
                     <region left="690" top="101" width="24" height="88"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
@@ -39,7 +39,7 @@
                     <region left="690" top="194" width="24" height="88"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="1138" top="321" width="84" height="84"/>
                     <eventInfo>
-                        <keyCode>101</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyCode>139</keyCode>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="1054" top="1" width="88" height="24"/>
                     <eventInfo>
-                        <keyCode>103</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
@@ -74,7 +74,7 @@
                     <region left="99" top="1" width="88" height="24"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
@@ -82,7 +82,7 @@
                     <region left="194" top="1" width="88" height="24"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="320" top="24" width="84" height="84"/>
                     <eventInfo>
-                        <keyCode>101</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyCode>139</keyCode>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="1" top="106" width="24" height="88"/>
                     <eventInfo>
-                        <keyCode>103</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
                     <region left="1" top="1059" width="24" height="88"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
                     <region left="1" top="964" width="24" height="88"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="23" top="310" width="84" height="84"/>
                     <eventInfo>
-                        <keyCode>101</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyCode>139</keyCode>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="105" top="690" width="88" height="24"/>
                     <eventInfo>
-                        <keyCode>103</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
                     <region left="1058" top="690" width="88" height="24"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
                     <region left="965" top="690" width="88" height="24"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
index 0a72633..aa0c011 100644 (file)
@@ -15,7 +15,7 @@
                     <region left="390" top="1401" width="84" height="84"/>
                     <eventInfo>
                         <keyCode>139</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
@@ -23,7 +23,7 @@
                     <region left="841" top="1309" width="24" height="96"/>
                     <eventInfo>
                         <keyCode>116</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
@@ -31,7 +31,7 @@
                     <region left="841" top="108" width="24" height="96"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
@@ -39,7 +39,7 @@
                     <region left="841" top="219" width="24" height="96"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="1400" top="392" width="84" height="84"/>
                     <eventInfo>
-                        <keyCode>101</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyCode>139</keyCode>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="1308" top="2" width="96" height="24"/>
                     <eventInfo>
-                        <keyCode>103</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
@@ -74,7 +74,7 @@
                     <region left="108" top="2" width="96" height="24"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
@@ -82,7 +82,7 @@
                     <region left="217" top="2" width="96" height="24"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="390" top="30" width="84" height="84"/>
                     <eventInfo>
-                        <keyCode>101</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyCode>139</keyCode>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="2" top="110" width="24" height="96"/>
                     <eventInfo>
-                        <keyCode>103</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
                     <region left="2" top="1310" width="24" height="96"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
                     <region left="2" top="1200" width="24" height="96"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="28" top="391" width="84" height="84"/>
                     <eventInfo>
-                        <keyCode>101</keyCode>
-                        <keyName>HOME</keyName>
+                        <keyCode>139</keyCode>
+                        <keyName>Home</keyName>
                     </eventInfo>
                     <tooltip>Home</tooltip>
                 </keyMap>
                 <keyMap>
                     <region left="109" top="841" width="96" height="24"/>
                     <eventInfo>
-                        <keyCode>103</keyCode>
-                        <keyName>POWER</keyName>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
                     </eventInfo>
                     <tooltip>Power</tooltip>
                 </keyMap>
                     <region left="1309" top="841" width="96" height="24"/>
                     <eventInfo>
                         <keyCode>115</keyCode>
-                        <keyName>VOLUME_UP</keyName>
+                        <keyName>Volume +</keyName>
                     </eventInfo>
                     <tooltip>Volume +</tooltip>
                 </keyMap>
                     <region left="1199" top="841" width="96" height="24"/>
                     <eventInfo>
                         <keyCode>114</keyCode>
-                        <keyName>VOLUME_DOWN</keyName>
+                        <keyName>Volume -</keyName>
                     </eventInfo>
                     <tooltip>Volume -</tooltip>
                 </keyMap>
index 1718bab..6cd1bde 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * Emulator Skin Process
  *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact:
  * GiWoong Kim <giwoong.kim@samsung.com>
@@ -40,6 +40,7 @@ import org.eclipse.swt.graphics.PaletteData;
 import org.eclipse.swt.graphics.Transform;
 import org.eclipse.swt.widgets.Display;
 import org.tizen.emulator.skin.config.EmulatorConfig;
+import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants;
 import org.tizen.emulator.skin.exception.ScreenShotException;
 import org.tizen.emulator.skin.image.ImageRegistry.IconName;
 import org.tizen.emulator.skin.info.SkinInformation;
@@ -57,7 +58,7 @@ public class EmulatorShmSkin extends EmulatorSkin {
        public static final int COLOR_DEPTH = 32;
 
        /* define JNI functions */
-       public native int shmget(int size);
+       public native int shmget(int shmkey, int size);
        public native int shmdt();
        public native int getPixels(int[] array);
 
@@ -175,8 +176,13 @@ public class EmulatorShmSkin extends EmulatorSkin {
        public long initLayout() {
                super.initLayout();
 
+               /* base + 1 = sdb port */
+               /* base + 2 = shared memory key */
+               int shmkey = config.getArgInt(ArgsConstants.NET_BASE_PORT) + 2;
+               logger.info("shmkey = " + shmkey);
+
                /* initialize shared memory */
-               int result = shmget(
+               int result = shmget(shmkey,
                                currentState.getCurrentResolutionWidth() *
                                currentState.getCurrentResolutionHeight());
                logger.info("shmget native function returned " + result);
index 2393efa..e5f7f90 100644 (file)
@@ -181,7 +181,7 @@ public class EmulatorSkin {
        public CustomProgressBar bootingProgress;
        public ScreenShotDialog screenShotDialog;
 
-       protected SocketCommunicator communicator;
+       public SocketCommunicator communicator;
        private ShellListener shellListener;
        private MenuDetectListener shellMenuDetectListener;
 
@@ -843,7 +843,7 @@ public class EmulatorSkin {
                                if (SwtUtil.isWindowsPlatform() && disappearEvent) {
                                        disappearEvent = false;
                                        if (isMetaKey(e) && e.character != '\0') {
-                                               logger.info("send previous release : keycode=" + disappearKeycode +
+                                               logger.info("send disappear release : keycode=" + disappearKeycode +
                                                                ", stateMask=" + disappearStateMask +
                                                                ", keyLocation=" + disappearKeyLocation);
 
@@ -901,6 +901,17 @@ public class EmulatorSkin {
                                                                disappearStateMask = stateMask;
                                                                disappearKeyLocation = e.keyLocation;
                                                        } else {
+                                                               /* three or more keys were pressed
+                                                               at the same time */
+                                                               if (disappearEvent == true) {
+                                                                       logger.info("replace the disappearEvent : " +
+                                                                                       disappearKeycode + "->" + keyCode);
+
+                                                                       disappearKeycode = keyCode;
+                                                                       disappearStateMask = stateMask;
+                                                                       disappearKeyLocation = e.keyLocation;
+                                                               }
+
                                                                int previousKeyCode = previous.keyCode;
                                                                int previousStateMask = previous.stateMask;
 
@@ -991,7 +1002,7 @@ public class EmulatorSkin {
        private synchronized boolean addPressedKey(KeyEventData pressData) {
                for (KeyEventData data : pressedKeyEventList) {
                        if (data.keycode == pressData.keycode &&
-                                       data.stateMask == pressData.stateMask &&
+                                       //data.stateMask == pressData.stateMask &&
                                        data.keyLocation == pressData.keyLocation) {
                                return false;
                        }
@@ -1005,7 +1016,7 @@ public class EmulatorSkin {
 
                for (KeyEventData data : pressedKeyEventList) {
                        if (data.keycode == releaseData.keycode &&
-                                       data.stateMask == releaseData.stateMask &&
+                                       //data.stateMask == releaseData.stateMask &&
                                        data.keyLocation == releaseData.keyLocation) {
                                pressedKeyEventList.remove(data);
 
index d6f72d5..d93a1bd 100644 (file)
@@ -176,8 +176,11 @@ public class EmulatorSkinMain {
                        }
 
                        boolean skinPhoneShape = true;
-                       String skinInfoResolutionW = skinInfoProperties.getProperty(SkinInfoConstants.RESOLUTION_WIDTH);
-                       String skinInfoResolutionH = skinInfoProperties.getProperty(SkinInfoConstants.RESOLUTION_HEIGHT);
+                       String skinInfoResolutionW =
+                                       skinInfoProperties.getProperty(SkinInfoConstants.RESOLUTION_WIDTH);
+                       String skinInfoResolutionH =
+                                       skinInfoProperties.getProperty(SkinInfoConstants.RESOLUTION_HEIGHT);
+
                        if (skinInfoResolutionW.equalsIgnoreCase("all") ||
                                        skinInfoResolutionH.equalsIgnoreCase("all")) {
                                skinPhoneShape = false;
index f9f94d1..4f55a8c 100644 (file)
@@ -135,11 +135,11 @@ public class EmulatorSkinState {
                this.displayBounds = bounds;
        }
 
-       public synchronized boolean isUpdateDisplayBounds() {
+       public synchronized boolean isNeedToUpdateDisplay() {
                return updateDisplayBounds;
        }
 
-       public synchronized void setUpdateDisplayBounds(boolean needUpdate) {
+       public synchronized void setNeedToUpdateDisplay(boolean needUpdate) {
                this.updateDisplayBounds = needUpdate;
        }
 
index 6dce373..3048bd4 100644 (file)
@@ -103,14 +103,16 @@ public class EmulatorConfig {
        private Properties configProperties;
        private String skinPropertiesFilePath;
 
-       public EmulatorConfig( Map<String, String> args, EmulatorUI dbiContents, Properties skinProperties,
-                       String skinPropertiesFilePath, Properties configProperties ) {
+       public EmulatorConfig(Map<String, String> args,
+                       EmulatorUI dbiContents, Properties skinProperties,
+                       String skinPropertiesFilePath, Properties configProperties) {
                this.args = args;
                this.dbiContents = dbiContents;
                this.skinProperties = skinProperties;
                this.skinPropertiesFilePath = skinPropertiesFilePath;
                this.configProperties = configProperties;
-               if ( null == configProperties ) {
+
+               if (null == configProperties) {
                        this.configProperties = new Properties();
                }
        }
index fe317df..08e75c4 100644 (file)
@@ -48,6 +48,8 @@ import org.eclipse.swt.widgets.Shell;
 import org.tizen.emulator.skin.EmulatorSkin;
 import org.tizen.emulator.skin.EmulatorSkinState;
 import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
+import org.tizen.emulator.skin.comm.ICommunicator.SendCommand;
+import org.tizen.emulator.skin.comm.sock.data.DisplayStateData;
 import org.tizen.emulator.skin.config.EmulatorConfig;
 import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants;
 import org.tizen.emulator.skin.config.EmulatorConfig.SkinPropertiesConstants;
@@ -297,6 +299,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                /* custom window shape */
                trimPatchedShell(shell, currentState.getCurrentImage());
 
+               currentState.setNeedToUpdateDisplay(true);
                shell.redraw();
        }
 
@@ -363,6 +366,16 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                shellPaintListener = new PaintListener() {
                        @Override
                        public void paintControl(final PaintEvent e) {
+                               if (currentState.isNeedToUpdateDisplay() == true) {
+                                       currentState.setNeedToUpdateDisplay(false);
+
+                                       /* Let's do one more update for sdl display surface
+                                       while skipping of framebuffer drawing */
+                                       DisplayStateData lcdStateData = new DisplayStateData(
+                                                       currentState.getCurrentScale(), currentState.getCurrentRotationId());
+                                       skin.communicator.sendToQEMU(SendCommand.CHANGE_LCD_STATE, lcdStateData);
+                               }
+
                                /* general shell does not support native transparency,
                                 * so draw image with GC. */
                                if (currentState.getCurrentImage() != null) {
index 21eeeea..349d35c 100644 (file)
@@ -52,6 +52,7 @@ import org.tizen.emulator.skin.EmulatorSkinState;
 import org.tizen.emulator.skin.comm.ICommunicator.KeyEventType;
 import org.tizen.emulator.skin.comm.ICommunicator.SendCommand;
 import org.tizen.emulator.skin.comm.sock.SocketCommunicator;
+import org.tizen.emulator.skin.comm.sock.data.DisplayStateData;
 import org.tizen.emulator.skin.comm.sock.data.KeyEventData;
 import org.tizen.emulator.skin.config.EmulatorConfig;
 import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants;
@@ -183,8 +184,6 @@ public class PhoneShapeSkinComposer implements ISkinComposer {
                logger.info("lcd bounds : " + lcdBounds);
 
                currentState.setDisplayBounds(lcdBounds);
-               currentState.setUpdateDisplayBounds(true);
-               //lcdCanvas.setBounds(lcdBounds);
 
                /* arrange the skin image */
                Image tempImage = null;
@@ -232,6 +231,7 @@ public class PhoneShapeSkinComposer implements ISkinComposer {
                /* custom window shape */
                SkinUtil.trimShell(shell, currentState.getCurrentImage());
 
+               currentState.setNeedToUpdateDisplay(true);
                shell.redraw();
        }
 
@@ -271,9 +271,15 @@ public class PhoneShapeSkinComposer implements ISkinComposer {
                shellPaintListener = new PaintListener() {
                        @Override
                        public void paintControl(final PaintEvent e) {
-                               if (currentState.isUpdateDisplayBounds() == true) {
-                                       currentState.setUpdateDisplayBounds(false);
+                               if (currentState.isNeedToUpdateDisplay() == true) {
+                                       currentState.setNeedToUpdateDisplay(false);
                                        lcdCanvas.setBounds(currentState.getDisplayBounds());
+
+                                       /* Let's do one more update for sdl display surface
+                                       while skipping of framebuffer drawing */
+                                       DisplayStateData lcdStateData = new DisplayStateData(
+                                                       currentState.getCurrentScale(), currentState.getCurrentRotationId());
+                                       skin.communicator.sendToQEMU(SendCommand.CHANGE_LCD_STATE, lcdStateData);
                                }
 
                                /* general shell does not support native transparency,
index 24722f9..c795033 100644 (file)
@@ -59,7 +59,6 @@ MULTI_DEBUG_CHANNEL(qemu, skin_client);
 #define OPT_MAX_TOUCHPOINT "max.touchpoint"
 
 extern char tizen_target_path[];
-extern int tizen_base_port;
 
 static int skin_argc;
 static char** skin_argv;
@@ -94,7 +93,7 @@ static void* run_skin_client(void* arg)
     char buf_tizen_base_port[16];
     sprintf(buf_skin_server_port, "%d", skin_server_port);
     sprintf(buf_uid, "%d", uid);
-    sprintf(buf_tizen_base_port, "%d", tizen_base_port);
+    sprintf(buf_tizen_base_port, "%d", get_emul_vm_base_port());
 
 #ifdef CONFIG_WIN32
     // find java path in 64bit windows
@@ -118,11 +117,12 @@ static void* run_skin_client(void* arg)
     char* bin_dir = get_bin_path();
 #endif
     INFO("bin directory : %s\n", bin_dir);
+
     int maxtouchpoint = get_emul_max_touch_point();
     int len_maxtouchpoint;
-    if(maxtouchpoint > 9) {
+    if (maxtouchpoint > 9) {
         len_maxtouchpoint = 2;
-    }else {
+    } else {
         len_maxtouchpoint = 1;
     }
 
@@ -150,9 +150,9 @@ static void* run_skin_client(void* arg)
         OPT_SVR_PORT, skin_server_port,
         OPT_UID, uid,
         OPT_VM_PATH, vm_path,
-        OPT_NET_BASE_PORT, tizen_base_port,
+        OPT_NET_BASE_PORT, get_emul_vm_base_port(),
         OPT_MAX_TOUCHPOINT, maxtouchpoint,
-        argv );
+        argv);
 
     INFO("command for swt : %s\n", cmd);
 
@@ -261,10 +261,11 @@ int start_skin_client(int argc, char* argv[])
         } else {
             count++;
             INFO("sleep for ready. count:%d\n", count);
+
 #ifdef CONFIG_WIN32
-        Sleep(SKIN_SERVER_SLEEP_TIME);
+            Sleep(SKIN_SERVER_SLEEP_TIME);
 #else
-        usleep(1000 * SKIN_SERVER_SLEEP_TIME);
+            usleep(1000 * SKIN_SERVER_SLEEP_TIME);
 #endif
         }
 
index ffb1e2f..b6ade33 100644 (file)
@@ -58,7 +58,6 @@
 #if defined(CONFIG_USE_SHM) && defined(TARGET_I386)
 #include <sys/shm.h>
 int g_shmid;
-extern int port_shmid;
 #endif
 
 MULTI_DEBUG_CHANNEL(qemu, skin_operation);
@@ -80,11 +79,15 @@ extern pthread_mutex_t mutex_screenshot;
 extern pthread_cond_t cond_screenshot;
 
 extern int tizen_base_port;
+
 static void* run_timed_shutdown_thread(void* args);
-static void send_to_emuld(const char* request_type, int request_size, const char* send_buf, int buf_size);
+static void send_to_emuld(const char* request_type,
+    int request_size, const char* send_buf, int buf_size);
+
 
 void start_display(uint64 handle_id,
-    int lcd_size_width, int lcd_size_height, double scale_factor, short rotation_type)
+    int lcd_size_width, int lcd_size_height,
+    double scale_factor, short rotation_type)
 {
     INFO("start_display handle_id:%ld, lcd size:%dx%d, scale_factor:%f, rotation_type:%d\n",
         (long)handle_id, lcd_size_width, lcd_size_height, scale_factor, rotation_type);
@@ -358,7 +361,7 @@ QemuSurfaceInfo* get_screenshot_info(void)
     info->pixel_data = (unsigned char*) g_malloc0( length );
     if ( !info->pixel_data ) {
         g_free( info );
-        ERR( "Fail to malloc for pixel data.\n");
+        ERR("Fail to malloc for pixel data.\n");
         return NULL;
     }
 
@@ -371,8 +374,8 @@ QemuSurfaceInfo* get_screenshot_info(void)
 
     pthread_mutex_lock(&mutex_screenshot);
     MaruScreenshot* maru_screenshot = get_maru_screenshot();
-    if ( !maru_screenshot || maru_screenshot->isReady != 1) {
-        ERR( "maru screenshot is NULL or not ready.\n" );
+    if (!maru_screenshot || maru_screenshot->isReady != 1) {
+        ERR("maru screenshot is NULL or not ready.\n");
         memset(info->pixel_data, 0x00, length);
     } else {
         maru_screenshot->pixel_data = info->pixel_data;
@@ -490,6 +493,7 @@ void free_detail_info(DetailInfo* detail_info)
 void do_open_shell(void)
 {
     INFO("open shell\n");
+
     /* do nothing */
 }
 
@@ -535,50 +539,49 @@ void request_close(void)
 
 }
 
-void shutdown_qemu_gracefully( void ) {
-
+void shutdown_qemu_gracefully(void)
+{
     requested_shutdown_qemu_gracefully = 1;
 
     pthread_t thread_id;
-    if( 0 > pthread_create( &thread_id, NULL, run_timed_shutdown_thread, NULL ) ) {
-        ERR( "!!! Fail to create run_timed_shutdown_thread. shutdown qemu right now !!!\n"  );
+    if (0 > pthread_create(
+        &thread_id, NULL, run_timed_shutdown_thread, NULL)) {
+
+        ERR("!!! Fail to create run_timed_shutdown_thread. shutdown qemu right now !!!\n");
         qemu_system_shutdown_request();
     }
 
 }
 
-int is_requested_shutdown_qemu_gracefully( void ) {
+int is_requested_shutdown_qemu_gracefully(void)
+{
     return requested_shutdown_qemu_gracefully;
 }
 
-static void* run_timed_shutdown_thread( void* args ) {
-
-    send_to_emuld( "system\n\n\n\n", 10, "shutdown", 8 );
+static void* run_timed_shutdown_thread(void* args)
+{
+    send_to_emuld("system\n\n\n\n", 10, "shutdown", 8);
 
-    int sleep_interval_time = 1000; // milli-seconds
+    int sleep_interval_time = 1000; /* milli-seconds */
 
     int i;
-    for ( i = 0; i < TIMEOUT_FOR_SHUTDOWN; i++ ) {
+    for (i = 0; i < TIMEOUT_FOR_SHUTDOWN; i++) {
 #ifdef CONFIG_WIN32
-        Sleep( sleep_interval_time );
+        Sleep(sleep_interval_time);
 #else
-        usleep( sleep_interval_time * 1000 );
+        usleep(sleep_interval_time * 1000);
 #endif
-        // do not use logger to help user see log in console
-        fprintf( stdout, "Wait for shutdown qemu...%d\n", ( i + 1 ) );
+        /* do not use logger to help user see log in console */
+        fprintf(stdout, "Wait for shutdown qemu...%d\n", (i + 1));
     }
 
-    INFO( "Shutdown qemu !!!\n" );
+    INFO("Shutdown qemu !!!\n");
+
 #if defined(CONFIG_USE_SHM) && defined(TARGET_I386)
     if (shmctl(g_shmid, IPC_RMID, 0) == -1) {
         ERR("shmctl failed\n");
         perror("maruskin_operation.c:g_shmid: ");
     }
-
-    if (shmctl(port_shmid, IPC_RMID, 0) == -1) {
-        ERR("shmctl failed\n");
-        perror("maruskin_operation.c:port_shmid: ");
-    }
 #endif
 
     qemu_system_shutdown_request();
@@ -587,8 +590,9 @@ static void* run_timed_shutdown_thread( void* args ) {
 
 }
 
-static void send_to_emuld( const char* request_type, int request_size, const char* send_buf, int buf_size ) {
-
+static void send_to_emuld(const char* request_type,
+    int request_size, const char* send_buf, int buf_size)
+{
     int s = tcp_socket_outgoing( "127.0.0.1", (uint16_t) ( tizen_base_port + SDB_TCP_EMULD_INDEX ) );
 
     if ( s < 0 ) {