From 9da935dd0c616cfd9072d11080a622320497dc9e Mon Sep 17 00:00:00 2001 From: David Turner Date: Mon, 12 Sep 2011 21:27:56 +0200 Subject: Add -gpu option to force GPU emulation By default, GPU emulation is still disabled. You can still try to force it with '-gpu on' for experimentation purpose (alternatively, you can define hw.gpu.enabled to 'true' in your AVD config.ini) Change-Id: I87efdf45337a80aeadd94b3922312b3f564c1608 --- android/cmdline-options.h | 2 ++ android/help.c | 27 +++++++++++++++++++++++++++ android/main.c | 15 +++++++++++++++ 3 files changed, 44 insertions(+) (limited to 'android') diff --git a/android/cmdline-options.h b/android/cmdline-options.h index b7d7bfa..de97516 100644 --- a/android/cmdline-options.h +++ b/android/cmdline-options.h @@ -154,6 +154,8 @@ OPT_PARAM( list_cores, "", "list running core process" ) OPT_PARAM( attach_core, "", "attach to a running core process" ) #endif // CONFIG_STANDALONE_UI +OPT_PARAM( gpu, "", "set hardware OpenGLES emulation mode" ) + #undef CFG_FLAG #undef CFG_PARAM #undef OPT_FLAG diff --git a/android/help.c b/android/help.c index cd5a3a6..63d7ca2 100644 --- a/android/help.c +++ b/android/help.c @@ -1428,6 +1428,33 @@ help_shared_net_id(stralloc_t* out) ); } +static void +help_gpu(stralloc_t* out) +{ + PRINTF( + " Use -gpu to force the mode of hardware OpenGLES emulation.\n" + " Valid values for 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" + " under certain restricted environments where the program can't access the\n" + " graphics sub-system (e.g. head-less servers).\n" + ); +} #define help_no_skin NULL #define help_netspeed help_shaper diff --git a/android/main.c b/android/main.c index 8fb9485..0b1d64c 100644 --- a/android/main.c +++ b/android/main.c @@ -1070,6 +1070,21 @@ int main(int argc, char **argv) args[n++] = opts->memcheck; } + if (opts->gpu) { + const char* gpu = opts->gpu; + if (!strcmp(gpu,"on") || !strcmp(gpu,"enabled")) { + hw->hw_gpu_enabled = 1; + } else if (!strcmp(gpu,"off") || !strcmp(gpu,"disabled")) { + hw->hw_gpu_enabled = 0; + } else if (!strcmp(gpu,"auto")) { + /* Nothing to do */ + } else { + derror("Invalid value for -gpu parameter: %s\n", gpu); + derror("Valid values are: on, off or auto\n"); + exit(1); + } + } + /* physical memory is now in hw->hw_ramSize */ hw->avd_name = ASTRDUP(avdInfo_getName(avd)); -- cgit v1.1