aboutsummaryrefslogtreecommitdiffstats
path: root/vl-android.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-08-26 01:35:14 +0200
committerDavid 'Digit' Turner <digit@android.com>2011-08-29 17:02:17 +0200
commitcb88e79ecbd16dea5f2201fd12320db5945db83e (patch)
treea4f22e25a58723ae81cb9adc6a9a09e3f6a32a43 /vl-android.c
parent6a8b698fff4d328c2706776c1c09171cfadb8de4 (diff)
downloadexternal_qemu-cb88e79ecbd16dea5f2201fd12320db5945db83e.zip
external_qemu-cb88e79ecbd16dea5f2201fd12320db5945db83e.tar.gz
external_qemu-cb88e79ecbd16dea5f2201fd12320db5945db83e.tar.bz2
Add hw.gpu.enabled hardware property
This patch adds a new hardware property to enable GPU emulation (named hw.gpu.enabled). It is currently disabled by default. It also modifies the UI code to display the GL output properly inside the UI window. And sets the kernel parameter qemu.gles to either 0 or 1 to indicate to the guest system's GLES libraries whether to use GPU emulation or fallback to the software renderer. A future patch will also add auto-detection of desktop GL capabilities. For example, if the emulator is started on a headless server without an X11/GL display, hw.gpu.enabled will be forced to 'no', forcing the guest to use the software renderer. Another patch will allow to change the property from the command-line for debugging purpose. NOTE: If you want to test GPU emulation, change the default value of the property in android/avd/hardware-properties.ini from 'no' to 'yes'. You will need to run a ToT master AOSP tree with the following pending patches applied: https://review.source.android.com/25797 https://review.source.android.com/25154 https://review.source.android.com/25759 Change-Id: I1fa3512be24395244fd5068f2bf59ad54db5c7d5
Diffstat (limited to 'vl-android.c')
-rw-r--r--vl-android.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/vl-android.c b/vl-android.c
index 32b5eac..4c2a433 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -65,6 +65,7 @@
#include "android/display-core.h"
#include "android/utils/timezone.h"
#include "android/snapshot.h"
+#include "android/opengles.h"
#include "targphys.h"
#include "tcpdump.h"
@@ -3813,6 +3814,29 @@ 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.
+ */
+ {
+ 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);
+ } else {
+ dwarning("Could not initialize OpenglES emulation, using software renderer.");
+ }
+ }
+ if (gles_emul) {
+ stralloc_add_str(kernel_params, " qemu.gles=1");
+ } else {
+ stralloc_add_str(kernel_params, " qemu.gles=0");
+ }
+ }
+
/* We always force qemu=1 when running inside QEMU */
stralloc_add_str(kernel_params, " qemu=1");