/* 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
#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
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[] = {
.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)
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
}
+* 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
-Version: 1.5.12
+Version: 1.5.24
Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
Source: emulator
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
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 \
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
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 \
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
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);
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;
#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;
}
return;
}
- LOG("ecs_monitor_puts: %s", str);
for(;;) {
c = *str++;
if (c == '\0')
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);
}
}
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);
clii->cs->mon->error = NULL;
}
- ecs_json_emitter(clii, type, QOBJECT(qmp));
+ ecs_json_emitter(clii, QOBJECT(qmp));
QDECREF(qmp);
}
}
-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;
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);
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.");
return;
}
- type_name = qdict_get_str(qobject_to_qdict(obj), COMMANDS_TYPE);
-
handle_qmp_command(clii, type_name, get_data_object(obj));
}
{
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.");
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) {
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);
}
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);
}
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);
}
}
}
}
+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;
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;
}
#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);
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)
{
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)
{
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;
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;
int get_emul_num_lock_state(void)
{
- return _emul_state.qemu_num_lock;
+ return _emul_state.qemu_num_lock;
}
+
int lcd_size_h;
int sdl_bpp;
int max_touch_point;
- //TODO:
+ int vm_base_port;
+ /* add here */
} EmulatorConfigInfo;
typedef struct EmulatorConfigState {
MultiTouchState qemu_mts;
int qemu_caps_lock;
int qemu_num_lock;
- //TODO:
+ /* add here */
} EmulatorConfigState;
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);
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);
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);
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),
/* 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);
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;
}
}
/* 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);
/* 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)
#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);
#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;
#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
/*
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;
"glXGetVisualFromFBConfig\0"
"glXIsDirect\0"
"glXCreatePixmap\0"
+"glXDestroyPixmap\0"
+"glXCreatePbuffer\n"
+"glXDestroyPbuffer\n"
"\0"
};
if ( surface->context )
{
- if ( free_flags) /* light-weight context */
+ if ( free_flags ) /* light-weight context */
g_free(surface->context);
}
surface->context = context;
}
/* 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;
#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);
if ( surface->context )
{
- if ( free_flags ) /* light-weight context */
+ if (free_flags) /* light-weight context */
g_free(surface->context);
}
surface->context = context;
}
/* 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);
* 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
#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 */
/*
#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_ */
* 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
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);
}
ERR("shmctl failed\n");
perror("maru_vga: ");
}
-
- if (shmctl(port_shmid, IPC_RMID, 0) == -1) {
- ERR("temp shmctl failed\n");
- perror("maru_vga: ");
- }
}
#endif
--- /dev/null
+/*\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
--- /dev/null
+/*\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
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");
}
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);
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);
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 */
/* register keyboard handler */
qemu_add_kbd_event_handler(virtio_keyboard_event, vkbd);
-
+
return &vkbd->vdev;
}
#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;
};
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 {
ClientGLXDrawable *client_drawable;
int type; /* window, pixmap or pbuffer */
int ready;
- int status;
+ int status;
int ref;
QTAILQ_ENTRY(QGloSurface) next;
} QGloSurface;
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];
QTAILQ_FOREACH(qsurface, &state->qsurfaces, next) {
if(qsurface->client_drawable == client_drawable) {
state->current_qsurface = qsurface;
- qsurface->glstate = state;
+ qsurface->glstate = state;
return 1;
}
}
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*));
#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;
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)
}
}
+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)
{
}
}
- if ( i >= MAX_PIXMAP_TEXTURE )
- return 0;
+ return 0;
}
static ClientGLXDrawable find_pixmap_texture(GLState *state,
*/
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
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;
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;
}
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:
}
}
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:
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);
}
}
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;
}
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;
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:
#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:
{ 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[] =
/* 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.. */
""
};
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;
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;
/**
+ * 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;
}
}
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);
}
<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>
<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>
<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>
<region left="552" top="167" width="54" height="54"/>
<eventInfo>
<keyCode>139</keyCode>
- <keyName>HOME</keyName>
+ <keyName>Home</keyName>
</eventInfo>
<tooltip>Home</tooltip>
</keyMap>
<region left="486" top="3" width="70" height="15"/>
<eventInfo>
<keyCode>116</keyCode>
- <keyName>POWER</keyName>
+ <keyName>Power</keyName>
</eventInfo>
<tooltip>Power</tooltip>
</keyMap>
<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>
<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>
<region left="238" top="887" width="74" height="74"/>
<eventInfo>
<keyCode>139</keyCode>
- <keyName>HOME</keyName>
+ <keyName>Home</keyName>
</eventInfo>
<tooltip>Home</tooltip>
</keyMap>
<region left="541" top="819" width="20" height="74"/>
<eventInfo>
<keyCode>116</keyCode>
- <keyName>POWER</keyName>
+ <keyName>Power</keyName>
</eventInfo>
<tooltip>Power</tooltip>
</keyMap>
<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>
<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>
<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>
<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>
<region left="310" top="1139" width="84" height="84"/>
<eventInfo>
<keyCode>139</keyCode>
- <keyName>HOME</keyName>
+ <keyName>Home</keyName>
</eventInfo>
<tooltip>Home</tooltip>
</keyMap>
<region left="690" top="1055" width="24" height="88"/>
<eventInfo>
<keyCode>116</keyCode>
- <keyName>POWER</keyName>
+ <keyName>Power</keyName>
</eventInfo>
<tooltip>Power</tooltip>
</keyMap>
<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>
<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>
<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>
<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>
<region left="390" top="1401" width="84" height="84"/>
<eventInfo>
<keyCode>139</keyCode>
- <keyName>HOME</keyName>
+ <keyName>Home</keyName>
</eventInfo>
<tooltip>Home</tooltip>
</keyMap>
<region left="841" top="1309" width="24" height="96"/>
<eventInfo>
<keyCode>116</keyCode>
- <keyName>POWER</keyName>
+ <keyName>Power</keyName>
</eventInfo>
<tooltip>Power</tooltip>
</keyMap>
<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>
<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>
<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>
<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>
/**
* 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>
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;
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);
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);
public CustomProgressBar bootingProgress;
public ScreenShotDialog screenShotDialog;
- protected SocketCommunicator communicator;
+ public SocketCommunicator communicator;
private ShellListener shellListener;
private MenuDetectListener shellMenuDetectListener;
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);
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;
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;
}
for (KeyEventData data : pressedKeyEventList) {
if (data.keycode == releaseData.keycode &&
- data.stateMask == releaseData.stateMask &&
+ //data.stateMask == releaseData.stateMask &&
data.keyLocation == releaseData.keyLocation) {
pressedKeyEventList.remove(data);
}
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;
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;
}
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();
}
}
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;
/* custom window shape */
trimPatchedShell(shell, currentState.getCurrentImage());
+ currentState.setNeedToUpdateDisplay(true);
shell.redraw();
}
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) {
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;
logger.info("lcd bounds : " + lcdBounds);
currentState.setDisplayBounds(lcdBounds);
- currentState.setUpdateDisplayBounds(true);
- //lcdCanvas.setBounds(lcdBounds);
/* arrange the skin image */
Image tempImage = null;
/* custom window shape */
SkinUtil.trimShell(shell, currentState.getCurrentImage());
+ currentState.setNeedToUpdateDisplay(true);
shell.redraw();
}
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,
#define OPT_MAX_TOUCHPOINT "max.touchpoint"
extern char tizen_target_path[];
-extern int tizen_base_port;
static int skin_argc;
static char** skin_argv;
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
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;
}
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);
} 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
}
#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);
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);
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;
}
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;
void do_open_shell(void)
{
INFO("open shell\n");
+
/* do nothing */
}
}
-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();
}
-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 ) {