Click on images to enlarge them

Monday, October 19, 2009

Android Emulator (Goldfish) Big-Screen Support


The Android emulator, for the "goldfish" platform, has limits on the size of screens it can emulate. Out of the box (actually the SDK) the largest screen support is around 800x600.

By tweeking the Goldfish kernel, I was able to emulate screen sizes up to 1366x768 (as shown in the screenshot). The required two kernel code adjustments: 1) increasing the framebuffer DMA size (CONSTISTENT_DMA_SIZE), and 2) increasing the DMA zone size (MAX_ORDER). Actually, if you usage is 1024x600 or below (common netbook size), then you only need to adjust the framebuffer DMA size.

In a perfect world, these hacked-in changes should be folded into the kernel configuration, e.g. Kconfig files, to allow ease in selecting and understanding. For example, the CONFIG_FORCE_MAX_ZONEORDER should be the perfered setter for MAX_ZONE, but Goldfish does not select this option.

As can be imagined, these changes have an impact on performance and so you'll want to run the emulator on a hefty system: 3Ghz processor, 2GB memory, and of course a good graphics adapter.

Below is a simple patch for these changes.
----------------------------------------------------------

diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h

index bf7c737..58127bc 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -114,7 +114,7 @@
* between 2MB and 14MB inclusive.
*/
#ifndef CONSISTENT_DMA_SIZE
-#define CONSISTENT_DMA_SIZE SZ_2M
+#define CONSISTENT_DMA_SIZE SZ_8M // android big-screens
#endif

/*
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 428328a..9e92b16 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -21,7 +21,7 @@

/* Free memory management - zoned buddy allocator. */
#ifndef CONFIG_FORCE_MAX_ZONEORDER
-#define MAX_ORDER 11
+#define MAX_ORDER 12 // android big-screen
#else
#define MAX_ORDER CONFIG_FORCE_MAX_ZONEORDER
#endif