diff options
Diffstat (limited to 'vl-android.c')
-rw-r--r-- | vl-android.c | 84 |
1 files changed, 60 insertions, 24 deletions
diff --git a/vl-android.c b/vl-android.c index 8071052..1513541 100644 --- a/vl-android.c +++ b/vl-android.c @@ -55,6 +55,7 @@ #include "android/hw-pipe-net.h" #include "android/hw-qemud.h" #include "android/camera/camera-service.h" +#include "android/multitouch-port.h" #include "android/charmap.h" #include "android/globals.h" #include "android/utils/bufprint.h" @@ -67,6 +68,7 @@ #include "android/utils/timezone.h" #include "android/snapshot.h" #include "android/opengles.h" +#include "android/multitouch-screen.h" #include "targphys.h" #include "tcpdump.h" @@ -2269,7 +2271,7 @@ char *qemu_find_file(int type, const char *name) buf = qemu_find_file_with_subdir(data_dir, "../usr/share/pc-bios/", name); /* Finally, try this for standalone builds under external/qemu */ if (buf == NULL) - buf = qemu_find_file_with_subdir(data_dir, "../../../prebuilt/common/pc-bios/", name); + buf = qemu_find_file_with_subdir(data_dir, "../../../prebuilts/qemu-kernel/x86/pc-bios/", name); } #endif return buf; @@ -2380,7 +2382,7 @@ net_slirp_forward(const char *optarg) char *dst_net, *dst_mask, *dst_port; char *redirect_ip, *redirect_port; uint32_t dnet, dmask, rip; - unsigned short dlport, dhport, rport; + unsigned short dlport = 0, dhport = 0, rport; dst_net = strtok(p, ":"); @@ -2446,7 +2448,7 @@ slirp_allow(const char *optarg, u_int8_t proto) char *argument = strdup(optarg), *p = argument; char *dst_ip_str, *dst_port_str; uint32_t dst_ip; - unsigned short dst_lport, dst_hport; + unsigned short dst_lport = 0, dst_hport = 0; dst_ip_str = strtok(p, ":"); dst_port_str = strtok(NULL, ":"); @@ -3575,10 +3577,10 @@ int main(int argc, char **argv, char **envp) uint64_t sysBytes = android_hw->disk_systemPartition_size; if (sysBytes == 0) { - PANIC("Invalid system partition size: %" PRUd64, sysBytes); + PANIC("Invalid system partition size: %" PRIu64, sysBytes); } - snprintf(tmp,sizeof(tmp),"system,size=0x%" PRUx64, sysBytes); + snprintf(tmp,sizeof(tmp),"system,size=0x%" PRIx64, sysBytes); if (sysImage && *sysImage) { if (filelock_create(sysImage) == NULL) { @@ -3610,10 +3612,10 @@ int main(int argc, char **argv, char **envp) uint64_t dataBytes = android_hw->disk_dataPartition_size; if (dataBytes == 0) { - PANIC("Invalid data partition size: %" PRUd64, dataBytes); + PANIC("Invalid data partition size: %" PRIu64, dataBytes); } - snprintf(tmp,sizeof(tmp),"userdata,size=0x%" PRUx64, dataBytes); + snprintf(tmp,sizeof(tmp),"userdata,size=0x%" PRIx64, dataBytes); if (dataImage && *dataImage) { if (filelock_create(dataImage) == NULL) { @@ -3763,10 +3765,21 @@ int main(int argc, char **argv, char **envp) //android_hw_opengles_init(); /* Initialize fake camera */ - if (android_hw->hw_fakeCamera) { - boot_property_add("qemu.sf.fake_camera", android_hw->hw_fakeCamera); + if (strcmp(android_hw->hw_camera_back, "emulated") && + strcmp(android_hw->hw_camera_front, "emulated")) { + /* Fake camera is not used for camera emulation. */ + boot_property_add("qemu.sf.fake_camera", "none"); } else { - boot_property_add("qemu.sf.fake_camera", "back"); + /* Fake camera is used for at least one camera emulation. */ + if (!strcmp(android_hw->hw_camera_back, "emulated") && + !strcmp(android_hw->hw_camera_front, "emulated")) { + /* Fake camera is used for both, front and back camera emulation. */ + boot_property_add("qemu.sf.fake_camera", "both"); + } else if (!strcmp(android_hw->hw_camera_back, "emulated")) { + boot_property_add("qemu.sf.fake_camera", "back"); + } else { + boot_property_add("qemu.sf.fake_camera", "front"); + } } /* Initialize camera emulation. */ @@ -3833,7 +3846,7 @@ int main(int argc, char **argv, char **envp) const char* partPath = android_hw->disk_cachePartition_path; uint64_t partSize = android_hw->disk_cachePartition_size; - snprintf(tmp,sizeof(tmp),"cache,size=0x%" PRUx64, partSize); + snprintf(tmp,sizeof(tmp),"cache,size=0x%" PRIx64, partSize); if (partPath && *partPath && strcmp(partPath, "<temp>") != 0) { if (filelock_create(partPath) == NULL) { @@ -3854,23 +3867,40 @@ int main(int argc, char **argv, char **envp) nand_add_dev(tmp); } - /* qemu.gles will be read by the OpenGLES emulation libraries. - * If set to 0, the software GLES renderer will be used as a fallback. - * If the parameter is undefined, this means the system image runs - * inside an emulator that doesn't support GPU emulation at all. - */ + /* qemu.gles will be read by the OpenGL ES emulation libraries. + * If set to 0, the software GL ES renderer will be used as a fallback. + * If the parameter is undefined, this means the system image runs + * inside an emulator that doesn't support GPU emulation at all. + * + * We always start the GL ES renderer so we can gather stats on the + * underlying GL implementation. If GL ES acceleration is disabled, + * we just shut it down again once we have the strings. */ { - int gles_emul = 0; - - if (android_hw->hw_gpu_enabled) { - if (android_initOpenglesEmulation() == 0) { - gles_emul = 1; - android_startOpenglesRenderer(android_hw->hw_lcd_width, android_hw->hw_lcd_height); + int qemu_gles = 0; + + /* Set framebuffer change notification callback when starting + * GLES emulation. Currently only multi-touch emulation is + * interested in FB changes (to transmit them to the device), so + * the callback is set within MT emulation. */ + if (android_initOpenglesEmulation() == 0 && + android_startOpenglesRenderer(android_hw->hw_lcd_width, + android_hw->hw_lcd_height, + multitouch_opengles_fb_update, NULL) == 0) + { + android_getOpenglesHardwareStrings( + android_gl_vendor, sizeof(android_gl_vendor), + android_gl_renderer, sizeof(android_gl_renderer), + android_gl_version, sizeof(android_gl_version)); + if (android_hw->hw_gpu_enabled) { + qemu_gles = 1; } else { - dwarning("Could not initialize OpenglES emulation, using software renderer."); + android_stopOpenglesRenderer(); + qemu_gles = 0; } + } else { + dwarning("Could not initialize OpenglES emulation, using software renderer."); } - if (gles_emul) { + if (qemu_gles) { stralloc_add_str(kernel_params, " qemu.gles=1"); } else { stralloc_add_str(kernel_params, " qemu.gles=0"); @@ -4143,6 +4173,7 @@ int main(int argc, char **argv, char **envp) { int ret; + hax_set_ramsize(ram_size); ret = hax_init(smp_cpus); fprintf(stderr, "HAX is %s and emulator runs in %s mode\n", !ret ? "working" :"not working", !ret ? "fast virt" : "emulation"); @@ -4257,6 +4288,11 @@ int main(int argc, char **argv, char **envp) initrd_filename, cpu_model); + /* Initialize multi-touch emulation. */ + if (androidHwConfig_isScreenMultiTouch(android_hw)) { + mts_port_create(NULL); + } + stralloc_reset(kernel_params); stralloc_reset(kernel_config); } |