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

8 Comments:

Blogger YaronGo said...

Any chance I could get my hands on that image? I would like to develop for such a screen size but am not familiar with compiling the kernel.

4:57 AM  
Blogger Folded Toad said...

Well, rebuilding the Android Goldfish kernel is pretty easy. I have rebuilt it, but I don't have a drop-off site. If you can send me a pointer to one, I can drop it there.
I have tested this kernel on Android 2.0.1 (Eclair) Goldfish emulator and it works fine, but as noted before, its quite slow to initialize the first time started.
(Takes about 4 minutes!)

11:17 PM  
Anonymous Anonymous said...

I made the above changes in the android 2.0 source code and able to create 1024x600 screen size on emulator..

when I download android-2.1_r2 source code, in that I could not find kernel-headers folder, so not able to make the above changes.
I manually downloaded the kernel-headers using:
git clone git://android.git.kernel.org/platform/external/kernel-headers

and then made the changes but it did not worked.

Please help me as I need to create 1024x600 in android 2.1

Thanks,
Ajay

6:44 AM  
Anonymous Anonymous said...

can you upload it to rapidshare or megaupload or some other free hosting site... Is it possible to change these files from windows OS?

Thanks...

12:30 AM  
Anonymous Anonymous said...

Can't you achieve this by creating a new emulator with the required resolutions from AVD manager???

12:32 AM  
Anonymous Anonymous said...

Tried this on ics, still doesn't work. I'm setting the resolution to 1366x768, the same way you have listed above.

Did you have to rebuild the emulator binary?

Thanks.

12:25 PM  
Blogger Folded Toad said...

This hack was on android 2.1.
A lot of water has flowed under android since then, and I' m not surprised there are issues with it on android 4.0 (ics).
In fact this code was built on a 32-bit Linux system, and as you may know, building ics requires a 64-bit Linux system.
I currently don't have access to a 64-bit.

6:47 PM  
Blogger Erik Nijkamp said...

I'm trying to add true color support to the "goldfish" kernel. If by any chance you are willing to provide help or some hints, please let me know: erik.nijkamp@testobject.org

12:38 PM  

Post a Comment

<< Home