diff options
author | Vladimir Chtchetkine <vchtchetkine@google.com> | 2011-09-13 10:48:02 -0700 |
---|---|---|
committer | Vladimir Chtchetkine <vchtchetkine@google.com> | 2011-09-13 13:17:57 -0700 |
commit | ae0d8136ce0d3c39ca80c64763e633b86b0c5453 (patch) | |
tree | d915d4de2208fc2dfc58ab5a7bc83be066b5472a | |
parent | 4939812780883255043a09eceaf607263f30fde4 (diff) | |
download | external_qemu-ae0d8136ce0d3c39ca80c64763e633b86b0c5453.zip external_qemu-ae0d8136ce0d3c39ca80c64763e633b86b0c5453.tar.gz external_qemu-ae0d8136ce0d3c39ca80c64763e633b86b0c5453.tar.bz2 |
Add cmdline param to control fake camera emulation
- Enable / Disable fake camera
- Set fake camera facing direction: back, or front
Change-Id: Iab741a694daf2bf752e91e23df566a83ac7a97e7
-rw-r--r-- | android/avd/hardware-properties.ini | 8 | ||||
-rw-r--r-- | android/cmdline-options.h | 2 | ||||
-rw-r--r-- | android/help.c | 21 | ||||
-rw-r--r-- | android/main.c | 17 | ||||
-rw-r--r-- | vl-android.c | 7 |
5 files changed, 49 insertions, 6 deletions
diff --git a/android/avd/hardware-properties.ini b/android/avd/hardware-properties.ini index e7eb445..6a904d6 100644 --- a/android/avd/hardware-properties.ini +++ b/android/avd/hardware-properties.ini @@ -232,6 +232,14 @@ default = no abstract = GPU emulation description = Enable/Disable emulated OpenGLES GPU +# Fake camera support +# +name = hw.fakeCamera +type = string +default = back +abstract = Fake camera control +description = Must be 'back', if fake camera is facing back, 'front', if fake camera is facing front, or 'off' if fake camera is disabled. + # Maximum VM heap size # Higher values are required for high-dpi devices # Default will depend on RAM size. diff --git a/android/cmdline-options.h b/android/cmdline-options.h index de97516..3bc2197 100644 --- a/android/cmdline-options.h +++ b/android/cmdline-options.h @@ -156,6 +156,8 @@ OPT_PARAM( attach_core, "<console socket>", "attach to a running core process" ) OPT_PARAM( gpu, "<mode>", "set hardware OpenGLES emulation mode" ) +OPT_PARAM( fake_camera, "<mode>", "set fake camera emulation mode" ) + #undef CFG_FLAG #undef CFG_PARAM #undef OPT_FLAG diff --git a/android/help.c b/android/help.c index 63d7ca2..7f89376 100644 --- a/android/help.c +++ b/android/help.c @@ -1434,20 +1434,20 @@ help_gpu(stralloc_t* out) PRINTF( " Use -gpu <mode> to force the mode of hardware OpenGLES emulation.\n" " Valid values for <mode> are:\n\n" - + " on -> enable GPU emulation\n" " off -> disable GPU emulation\n" " auto -> automatic detection\n" " enabled -> same as 'on'\n" " disabled -> same as 'off'\n\n" - + " Note that enabling GPU emulation if the system image does not support it\n" " will prevent the proper display of the emulated framebuffer.\n\n" - + " You can always disable GPU emulation (i.e. '-gpu off'), and this will\n" " force the virtual device to use the slow software renderer instead.\n" " Note that OpenGLES 2.0 is _not_ supported by it.\n\n" - + " The 'auto' mode is the default. It will only enable GPU emulation if the\n" " virtual device supports it, and the host-side OpenGLES emulation library\n" " could be properly initialized (this can fail when you run the emulator\n" @@ -1456,6 +1456,19 @@ help_gpu(stralloc_t* out) ); } +static void +help_fake_camera(stralloc_t* out) +{ + PRINTF( + " Use -fake-camera <mode> to control fake camera emulation.\n" + " Valid values for <mode> are:\n\n" + + " off -> disable fake camera emulation\n" + " back -> fake camera is facing back\n" + " front -> fake camera is facing front\n\n" + ); +} + #define help_no_skin NULL #define help_netspeed help_shaper #define help_netdelay help_shaper diff --git a/android/main.c b/android/main.c index 0b1d64c..314779f 100644 --- a/android/main.c +++ b/android/main.c @@ -1072,9 +1072,9 @@ int main(int argc, char **argv) if (opts->gpu) { const char* gpu = opts->gpu; - if (!strcmp(gpu,"on") || !strcmp(gpu,"enabled")) { + if (!strcmp(gpu,"on") || !strcmp(gpu,"enable")) { hw->hw_gpu_enabled = 1; - } else if (!strcmp(gpu,"off") || !strcmp(gpu,"disabled")) { + } else if (!strcmp(gpu,"off") || !strcmp(gpu,"disable")) { hw->hw_gpu_enabled = 0; } else if (!strcmp(gpu,"auto")) { /* Nothing to do */ @@ -1085,6 +1085,19 @@ int main(int argc, char **argv) } } + if (opts->fake_camera) { + if (!strcmp(opts->fake_camera, "back") || + !strcmp(opts->fake_camera, "front") || + !strcmp(opts->fake_camera, "off")) { + hw->hw_fakeCamera = ASTRDUP(opts->fake_camera); + } else { + derror("Invalid value for -fake-camera <mode> parameter: %s\n", + opts->fake_camera); + derror("Valid values are: back, front, or off\n"); + exit(1); + } + } + /* physical memory is now in hw->hw_ramSize */ hw->avd_name = ASTRDUP(avdInfo_getName(avd)); diff --git a/vl-android.c b/vl-android.c index c02abd5..f657258 100644 --- a/vl-android.c +++ b/vl-android.c @@ -3734,6 +3734,13 @@ int main(int argc, char **argv, char **envp) /* Initialize OpenGLES emulation */ //android_hw_opengles_init(); + /* Initialize fake camera */ + if (android_hw->hw_fakeCamera) { + boot_property_add("qemu.sf.fake_camera", android_hw->hw_fakeCamera); + } else { + boot_property_add("qemu.sf.fake_camera", "back"); + } + if (android_op_cpu_delay) { char* end; long delay = strtol(android_op_cpu_delay, &end, 0); |