aboutsummaryrefslogtreecommitdiffstats
path: root/android/hw-pipe-net.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 /android/hw-pipe-net.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 'android/hw-pipe-net.c')
-rw-r--r--android/hw-pipe-net.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/android/hw-pipe-net.c b/android/hw-pipe-net.c
index dd8c8b1..8b8017d 100644
--- a/android/hw-pipe-net.c
+++ b/android/hw-pipe-net.c
@@ -23,6 +23,7 @@
#include "android/utils/panic.h"
#include "android/utils/system.h"
#include "android/async-utils.h"
+#include "android/opengles.h"
#include "android/looper.h"
#include "hw/goldfish_pipe.h"
@@ -454,7 +455,11 @@ static const GoldfishPipeFuncs netPipeUnix_funcs = {
};
#endif
-#define DEFAULT_OPENGLES_PORT 22468
+/* This is set to 1 in android_init_opengles() below, and tested
+ * by openglesPipe_init() to refuse a pipe connection if the function
+ * was never called.
+ */
+static int _opengles_init;
static void*
openglesPipe_init( void* hwpipe, void* _looper, const char* args )
@@ -462,8 +467,15 @@ openglesPipe_init( void* hwpipe, void* _looper, const char* args )
char temp[32];
NetPipe *pipe;
+ if (!_opengles_init) {
+ /* This should never happen, unless there is a bug in the
+ * emulator's initialization, or the system image. */
+ D("Trying to open the OpenGLES pipe without GPU emulation!");
+ return NULL;
+ }
+
/* For now, simply connect through tcp */
- snprintf(temp, sizeof temp, "%d", DEFAULT_OPENGLES_PORT);
+ snprintf(temp, sizeof temp, "%d", ANDROID_OPENGLES_BASE_PORT);
pipe = (NetPipe *)netPipe_initTcp(hwpipe, _looper, temp);
if (pipe != NULL) {
@@ -496,7 +508,6 @@ static const GoldfishPipeFuncs openglesPipe_funcs = {
netPipe_wakeOn,
};
-
void
android_net_pipes_init(void)
{
@@ -508,3 +519,13 @@ android_net_pipes_init(void)
#endif
goldfish_pipe_add_type( "opengles", looper, &openglesPipe_funcs );
}
+
+int
+android_init_opengles_pipes(void)
+{
+ /* TODO: Check that we can load and initialize the host emulation
+ * libraries, and return -1 in case of error.
+ */
+ _opengles_init = 1;
+ return 0;
+}