aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-02-10 10:14:22 -0800
committerAndroid Code Review <code-review@android.com>2011-02-10 10:14:22 -0800
commit0f3c53e0c91c6561e05a866e7de70768fcae7478 (patch)
tree3deeee5792eb4cf2b148a224177bed8ed5f7e9cc
parent275e12444dafe934b8502829d72acbb17e9c50cd (diff)
parent2507cab8a78fb609461a2b9cc4708bab60fc53a4 (diff)
downloadexternal_qemu-0f3c53e0c91c6561e05a866e7de70768fcae7478.zip
external_qemu-0f3c53e0c91c6561e05a866e7de70768fcae7478.tar.gz
external_qemu-0f3c53e0c91c6561e05a866e7de70768fcae7478.tar.bz2
Merge "Get rid of -android-gui core option."
-rw-r--r--android/avd/hardware-properties.ini17
-rw-r--r--android/avd/hw-config-defs.h21
-rw-r--r--android/main-common.c48
-rw-r--r--android/main-common.h2
-rw-r--r--android/main-ui.c2
-rw-r--r--android/main.c2
-rw-r--r--qemu-options.hx4
-rw-r--r--vl-android.c104
8 files changed, 118 insertions, 82 deletions
diff --git a/android/avd/hardware-properties.ini b/android/avd/hardware-properties.ini
index 8e5cc41..79263a1 100644
--- a/android/avd/hardware-properties.ini
+++ b/android/avd/hardware-properties.ini
@@ -136,6 +136,23 @@ type = diskSize
abstract = Cache partition size
default = 66MB
+# LCD width
+name = hw.lcd.width
+type = integer
+default = 320
+abstract = LCD pixel width
+
+name = hw.lcd.height
+type = integer
+default = 640
+abstract = LCD pixel height
+
+name = hw.lcd.depth
+type = integer
+default = 16
+abstract = LCD color depth
+description = Must be 16 or 32. Color bit depth of emulated framebuffer.
+
# LCD density
name = hw.lcd.density
type = integer
diff --git a/android/avd/hw-config-defs.h b/android/avd/hw-config-defs.h
index 9602a4a..8d58478 100644
--- a/android/avd/hw-config-defs.h
+++ b/android/avd/hw-config-defs.h
@@ -137,6 +137,27 @@ HWCFG_DISKSIZE(
"")
HWCFG_INT(
+ hw_lcd_width,
+ "hw.lcd.width",
+ 320,
+ "LCD pixel width",
+ "")
+
+HWCFG_INT(
+ hw_lcd_height,
+ "hw.lcd.height",
+ 640,
+ "LCD pixel height",
+ "")
+
+HWCFG_INT(
+ hw_lcd_depth,
+ "hw.lcd.depth",
+ 16,
+ "LCD color depth",
+ "Must be 16 or 32. Color bit depth of emulated framebuffer.")
+
+HWCFG_INT(
hw_lcd_density,
"hw.lcd.density",
160,
diff --git a/android/main-common.c b/android/main-common.c
index bb07943..e11662c 100644
--- a/android/main-common.c
+++ b/android/main-common.c
@@ -341,6 +341,7 @@ void
parse_skin_files(const char* skinDirPath,
const char* skinName,
AndroidOptions* opts,
+ AndroidHwConfig* hwConfig,
AConfig* *skinConfig,
char* *skinPath)
{
@@ -433,6 +434,53 @@ FOUND_SKIN:
skin_network_delay = aconfig_str(n, "delay", 0);
}
+ /* extract framebuffer information from the skin.
+ *
+ * for version 1 of the skin format, they are in the top-level
+ * 'display' element.
+ *
+ * for version 2 of the skin format, they are under parts.device.display
+ */
+ n = aconfig_find(root, "display");
+ if (n == NULL) {
+ n = aconfig_find(root, "parts");
+ if (n != NULL) {
+ n = aconfig_find(root, "device");
+ if (n != NULL) {
+ n = aconfig_find(root, "display");
+ }
+ }
+ }
+
+ if (n != NULL) {
+ int width = aconfig_int(n, "width", hwConfig->hw_lcd_width);
+ int height = aconfig_int(n, "height", hwConfig->hw_lcd_height);
+ int depth = aconfig_int(n, "bpp", hwConfig->hw_lcd_depth);
+
+ if (width > 0 && height > 0) {
+ /* The emulated framebuffer wants sizes that are multiples of 4 */
+ if (((width|height) & 3) != 0) {
+ width = (width+3) & ~3;
+ height = (height+3) & ~3;
+ D("adjusting LCD dimensions to (%dx%dx)", width, height);
+ }
+
+ /* only depth values of 16 and 32 are correct. 16 is the default. */
+ if (depth != 32 && depth != 16) {
+ depth = 16;
+ D("adjusting LCD bit depth to %d", depth);
+ }
+
+ hwConfig->hw_lcd_width = width;
+ hwConfig->hw_lcd_height = height;
+ hwConfig->hw_lcd_depth = depth;
+ }
+ else {
+ D("ignoring invalid skin LCD dimensions (%dx%dx%d)",
+ width, height, depth);
+ }
+ }
+
*skinConfig = root;
*skinPath = strdup(path);
return;
diff --git a/android/main-common.h b/android/main-common.h
index c5131df..88ebb70 100644
--- a/android/main-common.h
+++ b/android/main-common.h
@@ -16,6 +16,7 @@
#include "android/cmdline-option.h"
#include "android/skin/keyset.h"
#include "android/config.h"
+#include "android/avd/hw-config.h"
/* Common routines used by both android/main.c and android/main-ui.c */
@@ -45,6 +46,7 @@ extern const char* skin_network_delay;
void parse_skin_files(const char* skinDirPath,
const char* skinName,
AndroidOptions* opts,
+ AndroidHwConfig* hwConfig,
AConfig* *skinConfig,
char* *skinPath);
diff --git a/android/main-ui.c b/android/main-ui.c
index e422d9a..373f13d 100644
--- a/android/main-ui.c
+++ b/android/main-ui.c
@@ -876,7 +876,7 @@ int main(int argc, char **argv)
user_config_init();
- parse_skin_files(opts->skindir, opts->skin, opts,
+ parse_skin_files(opts->skindir, opts->skin, opts, hw,
&skinConfig, &skinPath);
if (!opts->netspeed) {
diff --git a/android/main.c b/android/main.c
index 14e1ced..4e2bc42 100644
--- a/android/main.c
+++ b/android/main.c
@@ -667,7 +667,7 @@ int main(int argc, char **argv)
user_config_init();
- parse_skin_files(opts->skindir, opts->skin, opts,
+ parse_skin_files(opts->skindir, opts->skin, opts, hw,
&skinConfig, &skinPath);
if (!opts->netspeed) {
diff --git a/qemu-options.hx b/qemu-options.hx
index baae81b..56800cd 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1631,10 +1631,6 @@ DEF("charmap", HAS_ARG, QEMU_OPTION_charmap, \
"-charmap <file>"
" use specific key character map\n")
-DEF("android-gui", HAS_ARG, QEMU_OPTION_android_gui, \
- "-android-gui width=<width>,height=<height>,bpp=<bits per pixel>"
- " width, height, and bits per pixel for the graphic console\n")
-
DEF("android-hw", HAS_ARG, QEMU_OPTION_android_hw, \
"-android-hw <file> read hardware initialization from ini file\n")
diff --git a/vl-android.c b/vl-android.c
index caef03d..3b71469 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -338,9 +338,6 @@ extern char* op_http_proxy;
// Path to the file containing specific key character map.
char* op_charmap_file = NULL;
-/* Framebuffer dimensions, passed with -android-gui option. */
-char* android_op_gui = NULL;
-
/* Path to hardware initialization file passed with -android-hw option. */
char* android_op_hwini = NULL;
@@ -509,42 +506,6 @@ static void default_ioport_writel(void *opaque, uint32_t address, uint32_t data)
#endif
}
-/* Parses -android-gui command line option, extracting width, height and bits
- * per pixel parameters for the GUI console used in this session of the
- * emulator. -android-gui option contains exactly three comma-separated positive
- * integer numbers in strict order: width goes first, width goes next, and bits
- * per pixel goes third. This routine verifies that format and return 0 if all
- * three numbers were extracted, or -1 if string format was incorrect for that
- * option. Note that this routine does not verify that extracted values are
- * correct!
- */
-static int
-parse_androig_gui_option(const char* op, int* width, int* height, int* bpp)
-{
- char val[128];
-
- if (get_param_value(val, 128, "width", op)) {
- *width = strtol(val, NULL, 0);
- } else {
- fprintf(stderr, "option -android-gui is missing width parameter\n");
- return -1;
- }
- if (get_param_value(val, 128, "height", op)) {
- *height = strtol(val, NULL, 0);
- } else {
- fprintf(stderr, "option -android-gui is missing height parameter\n");
- return -1;
- }
- if (get_param_value(val, 128, "bpp", op)) {
- *bpp = strtol(val, NULL, 0);
- } else {
- fprintf(stderr, "option -android-gui is missing bpp parameter\n");
- return -1;
- }
-
- return 0;
-}
-
/***********************************************************/
void hw_error(const char *fmt, ...)
{
@@ -3706,9 +3667,7 @@ int main(int argc, char **argv, char **envp)
#endif
CPUState *env;
int show_vnc_port = 0;
-#ifdef CONFIG_STANDALONE_CORE
IniFile* hw_ini = NULL;
-#endif // CONFIG_STANDALONE_CORE
/* Container for the kernel initialization parameters collected in this
* routine. */
char kernel_cmdline_append[1024];
@@ -4508,10 +4467,6 @@ int main(int argc, char **argv, char **envp)
op_charmap_file = (char*)optarg;
break;
- case QEMU_OPTION_android_gui:
- android_op_gui = (char*)optarg;
- break;
-
case QEMU_OPTION_android_hw:
android_op_hwini = (char*)optarg;
break;
@@ -4608,17 +4563,6 @@ int main(int argc, char **argv, char **envp)
}
}
- /* Parse GUI option early, so when we init framebuffer in goldfish we have
- * saved display parameters. */
- if (android_op_gui) {
- if (parse_androig_gui_option(android_op_gui,
- &android_display_width,
- &android_display_height,
- &android_display_bpp)) {
- PANIC("Unable to parse -android-gui parameter: %s", android_op_gui);
- }
- }
-
/* Initialize character map. */
if (android_charmap_setup(op_charmap_file)) {
if (op_charmap_file) {
@@ -4641,20 +4585,33 @@ int main(int argc, char **argv, char **envp)
data_dir = CONFIG_QEMU_SHAREDIR;
}
-#ifdef CONFIG_STANDALONE_CORE
- /* Initialize hardware configuration. */
- if (android_op_hwini) {
- hw_ini = iniFile_newFromFile(android_op_hwini);
- if (hw_ini == NULL) {
+ if (!android_op_hwini) {
+ PANIC("Missing -android-hw <file> option!");
+ }
+ hw_ini = iniFile_newFromFile(android_op_hwini);
+ if (hw_ini == NULL) {
PANIC("Could not find %s file.", android_op_hwini);
- }
- } else {
- hw_ini = iniFile_newFromMemory("", 0);
}
-
androidHwConfig_read(android_hw, hw_ini);
iniFile_free(hw_ini);
-#endif // CONFIG_STANDALONE_CORE
+
+ {
+ int width = android_hw->hw_lcd_width;
+ int height = android_hw->hw_lcd_height;
+ int depth = android_hw->hw_lcd_depth;
+
+ /* A bit of sanity checking */
+ if (width <= 0 || height <= 0 ||
+ (depth != 16 && depth != 32) ||
+ (((width|height) & 3) != 0) )
+ {
+ PANIC("Invalid display configuration (%d,%d,%d)",
+ width, height, depth);
+ }
+ android_display_width = width;
+ android_display_height = height;
+ android_display_bpp = depth;
+ }
#ifdef CONFIG_NAND_LIMITS
/* Init nand stuff. */
@@ -5199,16 +5156,11 @@ int main(int argc, char **argv, char **envp)
/* just use the first displaystate for the moment */
ds = get_displaystate();
- if (android_op_gui) {
- /* Initialize display from the command line parameters. */
- android_display_reset(ds,
- android_display_width,
- android_display_height,
- android_display_bpp);
- } else {
- /* By default, use 320x480x16 */
- android_display_reset(ds, 320, 480, 16);
- }
+ /* Initialize display from the command line parameters. */
+ android_display_reset(ds,
+ android_display_width,
+ android_display_height,
+ android_display_bpp);
if (display_type == DT_DEFAULT) {
#if defined(CONFIG_SDL) || defined(CONFIG_COCOA)