• XDA Forums have been migrated to XenForo. We are aware of several issues including missing threads, logins not working, and more. To discuss, use this thread.
  • If you are experiencing issues logging in, we moved to a new and more secure software and older account passwords were not able to be migrated. We recommend trying to reset your password, then contacting us if there are issues.

[ROM-AOSP] Unofficial CM10.1 (JB 4.2.2) [08/12 ICON DRAG FIX]

jonasl

New member
Nov 13, 2009
380
171
0
San Francisco, CA
TL;DR

There's a link to a flashable zip below, that will give you improved performance in certain situations such as the launcher.


Great work on the ROM!

However, the graphics performance in certain use cases can be better; specifically the hardware composer (HWC) could be used more often and more efficiently. Since I know a thing or two about this topic I felt like sharing some information as well as an improved version of the latest release.

One of the most common heavy scenarios for the composer is the launcher with status bar pulled down. That's because there are multiple big (full screen or even larger in case of wallpaper) surfaces to compose, including several blends.

As of cm-10.1-20130812-UNOFFICIAL-jem.zip, most of the composition for the launcher is done on the fairly low performing GPU. Apart from the GPU not being terribly efficient at composition tasks like this, using it for it means context switching away from rendering of the next frame (ie more things want to use the GPU = bad performance). This is where the hardware composer (HWC) comes in. It offloads the composition to dedicated hardware. OMAP's overlay engine is called DSS and there is also a 2D blitter on the OMAP 4470 SoC called GC320 (accessed through bltsville mentioned in the OP). The HWC module uses both in different scenarios.

Ideally we want to use DSS all the time, but it can only handle 4 layers, not all pixel formats, certain scalings and other things. It's also limited by a certain type of memory.
The 2D blitter has other constraints; memory alignment of surfaces to blend, scaling and rotation.
This is information that anyone can gather from code on omapzoom.

At any given time; this command will show the current state of the composer (output shortened):
Code:
$ adb shell dumpsys SurfaceFlinger
Hardware Composer state (version  1000000):
  mDebugForceFakeVSync=0
  Display[0] : 1920x1200, xdpi=254.000000, ydpi=254.000000, refresh=16684463
  numHwLayers=4, flags=00000000
    type    |  handle  |   hints  |   flags  | tr | blend |  format  |       source crop         |           frame           name 
------------+----------+----------+----------+----+-------+----------+---------------------------+--------------------------------
       GLES | 40024ee0 | 00000000 | 00000000 | 00 | 00100 | 00000002 | [ 1055,  434, 2975, 1524] | [    0,   38, 1920, 1128] com.android.systemui.ImageWallpaper
       GLES | 4170fe88 | 00000000 | 00000000 | 00 | 00105 | 00000005 | [    0,   38, 1920, 1128] | [    0,   38, 1920, 1128] com.cyanogenmod.trebuchet/com.cyanogenmod.trebuchet.Launcher
       GLES | 40c4c2e8 | 00000000 | 00000000 | 00 | 00105 | 00000005 | [    0,    0, 1920, 1200] | [    0,    0, 1920, 1200] StatusBar
        HWC | 41626cc8 | 00000003 | 00000000 | 00 | 00100 | 00000005 | [    0,    0, 1920,   72] | [    0, 1128, 1920, 1200] NavigationBar
Your output will be slightly different, this is an example. For best performance, we don't want to see any GLES layers (handled by GPU); the more HWC the better. The hint column tells you if DSS (00000001) or blitter (00000003) handled the HWC layer.

The relevant code was written for the Kindle UI running on ICS; it's not well tuned for AOSP/JB on OMAP. Let's make some simple modifications to try to change that!

#1 The wallpaper format in this case is RGBX_8888 (00000002). It's fairly common that it becomes this, but depends on how you've used the system and which wallpapers you've set. It could be 00000005 already on your device.
RGBX_8888 is not handled by DSS, so we tell the system to just request an opaque surface by default. The GPU driver will return a 00000005 surface that the system likes better. This change increases the chance that DSS can handle the wallpaper, and if not, makes it more blitter friendly.

frameworks/base:

Code:
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 6d5705d..e1f2149 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -186,7 +186,7 @@ public abstract class WallpaperService extends Service {
         
         final BaseSurfaceHolder mSurfaceHolder = new BaseSurfaceHolder() {
             {
-                mRequestedFormat = PixelFormat.RGBX_8888;
+                mRequestedFormat = PixelFormat.OPAQUE;
             }
 
             [user=439709]@override[/user]
Since we have some pretty severe memory constraints, the wallpaper can't be too big. This change also needs the kernel patch below. DSS needs memory called TILER1D, but we can't reserve too much. Let's limit the wallpaper width to 2100, which still looks OK.

device/amazon/jem:

Code:
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index 8dea2bf..63b2bd2 100644
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -214,4 +214,5 @@
     <!--  Maximum number of supported users -->
     <integer name="config_multiuserMaximumUsers">8</integer>
 
+    <integer name="config_wallpaperMaxWidth">2100</integer>
 </resources>
We should also increase the TILER1D allocation so that wallpaper, launcher, navigation bar and expanded status bar fits.


Code:
diff --git a/arch/arm/mach-omap2/board-bowser-panel.c b/arch/arm/mach-omap2/board-bowser-panel.c
index f1d4197..4aa917e 100644
--- a/arch/arm/mach-omap2/board-bowser-panel.c
+++ b/arch/arm/mach-omap2/board-bowser-panel.c
@@ -412,9 +412,29 @@ static struct platform_device *bowser_devices[] __initdata = {
 
 #endif  /*CONFIG_BACKLIGHT_LP855X*/
 
-//Allocate 27 MB for TILER1D slot size for WUXGA panel on JEM, total of 54 MB of TILER1D
+/*
+ Allocate 34 MB for TILER1D slot size for WUXGA panel on JEM, total of 68 MB of TILER1D
+
+ These values are based on stock AOSP tablet UI home screen. JB needs more than ICS
+ because behavior of pulled down status bar has changed.
+
+ Rough calculations:
+
+ Wallpaper:
+ 15120.00 KiB | 2000 (2016) x 1920
+
+ Launcher:
+ 8460.00 KiB | 1920 (1920) x 1128
+
+ StatusBar:
+ 9000.00 KiB | 1920 (1920) x 1200
+
+ NavigationBar:
+ 540.00 KiB | 1920 (1920) x   72
+
+ */
 static struct dsscomp_platform_data dsscomp_config_wuxga = {
-               .tiler1d_slotsz = ( SZ_16M + SZ_2M + SZ_8M + SZ_1M ),
+               .tiler1d_slotsz = ( (15 * SZ_1M) + (9 * SZ_1M) + (9 * SZ_1M) + (1 * SZ_1M) ),
 };
 
 #if defined(CONFIG_FB_OMAP2_NUM_FBS)
With a better pixel format for the wallpaper of limited size, and increased TILER1D allocation, DSS can now handle all surfaces when using the launcher:

Code:
Hardware Composer state (version  1000000):
  mDebugForceFakeVSync=0
  Display[0] : 1920x1200, xdpi=254.000000, ydpi=254.000000, refresh=16684463
  numHwLayers=4, flags=00000000
    type    |  handle  |   hints  |   flags  | tr | blend |  format  |       source crop         |           frame           name 
------------+----------+----------+----------+----+-------+----------+---------------------------+--------------------------------
        HWC | 400621c8 | 00000001 | 00000000 | 00 | 00100 | 00000005 | [   90,  434, 2010, 1524] | [    0,   38, 1920, 1128] com.android.systemui.ImageWallpaper
        HWC | 40062f08 | 00000001 | 00000000 | 00 | 00105 | 00000005 | [    0,   38, 1920, 1128] | [    0,   38, 1920, 1128] com.cyanogenmod.trebuchet/com.cyanogenmod.trebuchet.Launcher
        HWC | 400a0410 | 00000001 | 00000000 | 00 | 00105 | 00000005 | [    0,    0, 1920, 1200] | [    0,    0, 1920, 1200] StatusBar
        HWC | 40b5dc40 | 00000001 | 00000000 | 00 | 00100 | 00000005 | [    0,    0, 1920,   72] | [    0, 1128, 1920, 1200] NavigationBar
The result is that swiping is now equally smooth in all orientations (not the case originally due to internals I don't have time to explain in detail), and the status bar expands more smoothly. Try it at home screen and in app drawer in all 4 rotations. Launcher is not the only scenario helped by this but is the most obvious one. Any scenario with big surfaces to blend will be improved if it was limited by the TILER1D allocation.
The downside is a few less MBs of RAM available to Android, but is hardly noticeable.

zip: https://dl.dropboxusercontent.com/u/6778890/cm-10.1-20130812-jonasl-jem.zip

Flash, wipe cache, reboot. Based on cm-10.1-20130812-UNOFFICIAL-jem.zip with the mentioned changes.
I don't plan to maintain or support this version. It's not tested for stability. Changed values may need further tuning. It does however work well for me (tm). I hope these ideas will get picked up by others, but since I put it together for my own use I thought I might as well share.
 

mrbender666

New member
Apr 2, 2012
64
6
0
Turin
Hi,
First of all i want say a big thank you to Hashcode for porting cm on this tablet. I want report it working well and i sent you a beer by paypal some days ago :)


Then i want to report that i tried patch from jonasl but it doesn't work for me, just the first and the last item are managed by hwc and secon and the third remain gle that makes quite choppy the tablet i had to came back tothe original cm.


Bye
 

Hashcode

Senior Recognized Developer
Sep 3, 2011
3,428
23,730
0
TL;DR

There's a link to a flashable zip below, that will give you improved performance in certain situations such as the launcher.

...
I hope these ideas will get picked up by others, but since I put it together for my own use I thought I might as well share.
This is quite a fantastic write up with well thought out points and examples. Thank you.

I've been so busy catching up on other Android devices that I just haven't had time to dig into the graphic performance issues on Jem.

You mention your knowledge of HWC and GPU/GC320 integration.. I'm very curious where you picked this knowledge up. :)

The HWC code that we're using is based on the jb-mr1 branches of TI's omapzoom gits from around Dec 2012 (right before they swapped to the kernel 3.4 development). This is a link to a close point in the tree where our HWC matches up:
http://www.omapzoom.org/?p=platform...2;hb=35c0742669787fd71ee4c5d9a31884c7f170dc9f

For reference, here's the current HWC source (cm-10.2 branch):
https://github.com/CyanogenMod/android_device_amazon_omap4-common/tree/cm-10.2/hwc

I think your BEST point is the tiler1d memory allocation. It certainly needs to be raised as it was based on ICS allocations. I will also do some research on a setting for the WallpaperService but that change to the CM framework may be more difficult -- it has to go through review. And, I'd like to test that change a bit more to see if it's necessary once we limit the wallpaper size using the overlay.

My other thought was to finish merging in the new HWC code from omapzoom. They updated it a while back to API 1.1. And while there is certainly kernel 3.4 code in there now which will need to be adjusted it may be worth it.

I have a few questions and I'm always trying to learn more, so I may PM you with some questions if you don't mind.
 
Last edited:

civiksi

New member
Mar 14, 2011
290
69
0
Pemberton, NJ
I'm still having a problem with a lot of games not working. My son likes to play games on it and the ones he likes don't work. Real steel wont even start, A monster university game keeps rotating while you try to play it. I believe an iron man 3 game does the same thing. I recently went back to stock and it is HORRIBLE! But thats the only way he can play his games. Wondering if this is just a known prob.
 

Hashcode

Senior Recognized Developer
Sep 3, 2011
3,428
23,730
0
I'm still having a problem with a lot of games not working. My son likes to play games on it and the ones he likes don't work. Real steel wont even start, A monster university game keeps rotating while you try to play it. I believe an iron man 3 game does the same thing. I recently went back to stock and it is HORRIBLE! But thats the only way he can play his games. Wondering if this is just a known prob.
This is my only real focus on the ROM atm.

Once the odd rotation and game play issues are solved, i'll submit the device to CM for official status.

Sent from my XT926 using Tapatalk 2
 

civiksi

New member
Mar 14, 2011
290
69
0
Pemberton, NJ
This is my only real focus on the ROM atm.

Once the odd rotation and game play issues are solved, i'll submit the device to CM for official status.

Sent from my XT926 using Tapatalk 2
Thanks for the reply. I've been running this since you released it. Going back to stock is god awful. That and the sound not being loud is my only *****. But I know I have no place to complain. I would have sold this thing months ago if it wasn't for you. Damn you're doing a hell of a job!
 

daruiner

New member
Apr 6, 2011
25
5
0
Lincoln
Once the odd rotation and game play issues are solved, i'll submit the device to CM for official status.
I'm curious about the development process for CM. Once a device becomes official will more developers contribute to the process or will you still be the sole maintainer of this device's code line?

Thanks for all your hard work. The only reason I bought my KFHD 8.9 over something else is because I found this thread.

Sent from my SCH-I535 using xda app-developers app
 

brotbuexe

New member
Apr 16, 2009
493
130
0
I'm still having a problem with a lot of games not working. My son likes to play games on it and the ones he likes don't work. Real steel wont even start, A monster university game keeps rotating while you try to play it. I believe an iron man 3 game does the same thing. I recently went back to stock and it is HORRIBLE! But thats the only way he can play his games. Wondering if this is just a known prob.
The problem of games not starting could be related to them getting installed in /mnt/asec as default.
You could check with root explorer or inside titanium backup if you have it.
If this is the case you could try moving them to /data/app just by backup and restore (app only) with titanium backup.
I explained it a little more here: http://forum.xda-developers.com/showthread.php?p=45023505

A workaround for the rotation issue could be a Rotation Control appl like https://play.google.com/store/apps/details?id=nl.fameit.rotate&hl=de
 

smeitmeister

New member
Jul 13, 2013
29
5
0
USB OTG support

So, I'm not really happy with this current build.
...
4. Power driver is lacking a ton of features in my opinion. It does exactly what it's supposed to and nothing else. It detects a power source and turns on charging. We're missing the entire OTG implementation.
...
So I'm venting. :p I'll post later on my any direction changes I'm taking.
Hashcode, first and foremost, a big thank you for your work on these CM builds for KFHD.

Are there any plans on USB OTG support (or is there even more progression)? As a newb I really don't know what effort goes into this.

I would like to use the KFHD 8.9 with CM10.1 (or .2) with USB On-The-Go as a laptop replacement as well, hooking up with USB keyboards, mice, storage, charging, etc. For now, I go the Bluetooth way (with kb and mouse at least).
 

jeevas.v

New member
Jun 24, 2009
29
6
0
Hashcode, first and foremost, a big thank you for your work on these CM builds for KFHD.

Are there any plans on USB OTG support (or is there even more progression)? As a newb I really don't know what effort goes into this.

I would like to use the KFHD 8.9 with CM10.1 (or .2) with USB On-The-Go as a laptop replacement as well, hooking up with USB keyboards, mice, storage, charging, etc. For now, I go the Bluetooth way (with kb and mouse at least).
Is there any real evidence that the hardware is capable of Otg. Is there a 5v generator in the PCB? Is the otg detection line in the micro USB port wired to something? Without knowing any of these how can we expect something using software?

Sent from my Amazon Kindle Fire HD using xda app-developers app
 

Greek2me

New member
Jun 15, 2013
82
18
0
Chicago
I'm still having issues with booting up the tablet. The spinning, centered CM logo displays infinitely until I turn the tablet back off. I then need to clear the cache using TWRP in order to boot.
 

narse

New member
Dec 29, 2009
154
36
0
I'm still having issues with booting up the tablet. The spinning, centered CM logo displays infinitely until I turn the tablet back off. I then need to clear the cache using TWRP in order to boot.
I'm getting the same issue. Not sure when it started doing it though as I rarely shut the device down.
 

mwa3aan

New member
Oct 12, 2007
23
3
0
I am running the build from jonasl and the difference is incredible. It would be great if this could make its way into hascode's builds for cm 10.2 as well.

I went back to the 10.1 build from jonasl after trying the latest 10.2 build. After getting used to the ui perf on jonasl's build its hard to use the other builds.

Thanks for the great work everyone!!

Sent from my Amazon Kindle Fire HD using XDA Premium 4 mobile app
 
Last edited:

civiksi

New member
Mar 14, 2011
290
69
0
Pemberton, NJ
The problem of games not starting could be related to them getting installed in /mnt/asec as default.
You could check with root explorer or inside titanium backup if you have it.
If this is the case you could try moving them to /data/app just by backup and restore (app only) with titanium backup.
I explained it a little more here: http://forum.xda-developers.com/showthread.php?p=45023505

A workaround for the rotation issue could be a Rotation Control appl like https://play.google.com/store/apps/details?id=nl.fameit.rotate&hl=de
Restored my last backup of CM. The one specific game that wouldn't load now does. Don't know why and it was where it should be in /data/app. The rotation locker seemed to have fixed the random flip flopping of some games. Thanks for your help.
 
Last edited:
Our Apps
Get our official app! (coming soon)
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone