Friday, April 2, 2010

2-D Graphics Slowdown After Motorola Droid 2.1 Update

UPDATE: I have logged a bug in the Android database at Google Code. It's been assigned to a developer for inspection. If you'd like to follow the status of the bug, go here and vote for it by "starring" it.

Tesuji Games is nearing the release of its first "mobile toy" for the Android platform. Since the primary development phone around here is the Motorola Droid, I was excited to see Verizon begin rolling out the upgrade to Android 2.1 this week. Although I haven't yet received the upgrade, a friend has, and the results were...well, disappointing. Oh, I have no problem with the new features - they seem to work fine. And the live wallpapers? Very nice. My problem is with the performance of my application, which sees its framerate cut virtually in half when run on a Droid with 2.1.

Here is a video I made of two Droids running a test app I wrote to demonstrate the issue. (No, this isn't the eagerly anticipated debut release from Tesuji Games :-)



So what's going on? Both phones have virtually no other apps running (just what's necessary for the operating system to function). The test application is doing about as little as it possibly can do, at least from a game perspective. There is a loop that draws a black background bitmap, then the moving dot, and finally the text to display the frame rate statistics. Most games have a lot more work to do for each frame than this, so it would seem that the best frame rate one would consistently be able to achieve on a 2.1 Droid is 30 FPS. In case you are new to game design, that's not a particularly impressive number. 60 FPS is the accepted standard for smooth game play.

I did some digging with the Android debugging tools and found that there is indeed a difference in the CPU usage profile between the two phones. The process for the test app is called "org.lagtest". Check out these awesome pie charts (click for larger versions):

Droid with 2.0.1:


Droid with 2.1:


It looks as if on 2.0.1 the application is given more CPU to work with, and the "Idle" slice is smaller. (Why does Idle need so much time?) Still, the charts don't seem to explain the drastic difference in frame rate.

Just for grins, I snagged my wife's HTC Droid Eris with Android 1.5 to test on, much to her chagrin (At least she wasn't in the middle of composing an email):


Note that the Eris, which is significantly slower CPU than the Droid was still achieving 59 FPS consistently while running other apps such as email and weather, etc.

Anyway, if you want to check this out for yourself you can get the source code (as an Eclipse project ZIP) for the test application here.

If you just want to run the test on your phone, you can download the APK here.

If anyone has suggestions for a way around this, I'm all ears.

43 comments:

  1. So, you've misread this a bit. Idle doesn't "need time," per se. Idle is the amount of time that the CPU had nothing else to do. That probably means that your application was blocking on graphics I/O would be my guess.

    ReplyDelete
  2. I suspect that the scheduler issue I posted about here just got worse:
    http://groups.google.com/group/android-developers/browse_thread/thread/6f8e55045653f01d#

    My data suggests that it is things blocking for two frames on the double buffering that kills the performance.

    However, *why* the scheduler soaks up >16ms about 10% of the time is completely unknown.

    ReplyDelete
  3. Running the Cyanogen port (based on 2.1 code, with aosp patches) gives avg 58, min 30, max 62 after five minutes running.

    ReplyDelete
  4. @Andrew: Your test program uses OpenGL, which I'm happy to say, did not appear to get worse in the 2.1 Droid update. I did an OpenGL version of Phil's test program and it averages nearly 60fps even with the update. However I did still experience the occasional outliers that you mention in your posting.

    ReplyDelete
  5. Running ESE53 (Bugless Beast .9, Android 2.1) I am sitting at avg 57. Min=25, max=67. Will see what happens when he releases the ESE81 update.

    ReplyDelete
  6. This is interesting as I noticed a little more lag then I would normally receive when playing Gameboid today. I'm not sure if this is related (not a programmer/developer), but interesting.

    ReplyDelete
  7. Mine looked good, and maxed at 66 fps.

    ReplyDelete
  8. I get around 42 fps avg with the new 2.1, a lot better than your video. But, it's pretty wild and varies between high-50s (and I think even 60+) and down in the 20s, so I wouldn't exactly call it "good".

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. I downloaded the test to my phone, and I'm getting interesting results. I'm running AdamZ's Smoked Glass v6.0 ROM, which is based on the ERE53 2.1 firmware. His kernal allows overclocking up to 1.1 Ghz. I usually run my phone at 800 Mhz, and, when I ran this test at that processor speed, I got excellent results...the display stayed consistently at 60 fps, with a min of 27 and a max of 68.

    Then, I clocked my cpu down to 600 Mhz (close as I could get to the stock 550), re-ran the test, and immediately saw what this post is talking about. The display was consistently below 40 fps, with frequent momentary spikes to 60. The average was 37 fps.

    The part I'm unable to test is the un-upgraded phone (I've no desire to remove the ROM I'm running...it's smooth as silk and completely reliable). These results certainly are disappointing...hopefully Google / Moto will get a fix out for this soon. In the meantime, hopefully this will encourage more Droid users to learn more about their phones so that they can get the most out of them by rooting and installing one of the excellent alternative ROMs that are out there.

    ReplyDelete
  11. I downloaded and installed your test app and used it before and after the 2.1 update. Average before the update was 51 fps, and after is 39, on Moto Droid. Lucky for me I don't game much on it.

    ReplyDelete
  12. I just got my update this morning and I had read this post when it was first up. I was not looking forward to the lag. I was playing a couple games on 2.1 that I played a lot on 2.0.1 and they ran like crap. Well not crap, but there was a substantial amount of lag. Tested using your app and I've maxed at 67, and am averaging 41. Now mine is completely different than your vid, though, because i am constantly above 40 and a lot of the time in 50. Its not TOO bad, but there is a difference.

    ReplyDelete
  13. 2.1 is a lot slower for emulators, nesoid, snesoid, gearoid, c64 all ran without frameskip on 2.0.1 and on 2.1update1 they all stutter like crazy. back to 2.0.1 for me :)

    ReplyDelete
  14. Thanks for posting this. I upgraded to 2.1 this morning and ran your test program. Mine is running at 30fps for a short burst then 60fps. and its constantly (very quickly) switching back and forth between the two. I have noticed some slow down running other apps with 2.1

    ReplyDelete
  15. Any idea if the NexusOne has the same issue? Is this issue specific to the Droid 2.1 update, or is it common to 2.1 in general?

    ReplyDelete
  16. I am having the same problem around 38-40 fps i really want them to fix this problem because its extreamly annoying when its pretty much the first thing you see when use the phone

    ReplyDelete
  17. @Peter: This problem (at least currently) seems to be limited to the Motorola Droid with Android 2.1-update1. All tests show the Nexus One getting an average of near 60 fps.

    ReplyDelete
  18. My friend has a Nexus one, running 2.1. It does not have the issue with the low frame-rate. I tested my program side by side on the G1 (1.6) Droid (2.1) and Nexus One (2.1), the results make me want to cry - Both the G1 and Nexus One run at 60fps, the droid is crawling at 30~60 uneven speed. They screwed up something, that's sure.

    ReplyDelete
  19. Thanks for marking out the differences...sometimes it gets so long to read the changed features that some are unable to do it.Reading such reviews help.

    Xbox hard drive

    ReplyDelete
  20. Nice blog you have here...I wonder if you like online games then you must like car games...you can play car games at this site Car Games. Also, you can play more game sites at Bike Games, Online Games, Kissing Games , Driving Games, Truck Games, Dress Up Games, Games for Girls, Addicting Games and Girl Games.

    ReplyDelete
  21. DO YOU WANNA PLAY AND DOWNLOAD LATEST VERSION GAMES IN ONLINE AND GET PAID FOR HIGH RATINGS,SO GO AHEAD click here
    FOR MORE DETAILS AND OPEN FLOODGATES TO YOUR ONLINE INCOME.

    ALL THE BEST
    THANKQ.

    ReplyDelete
  22. That is very disappointing indeed...when you wait for something to launch in the market and eagerly with a lot of expectations and after that if it is a disappointment you feel horrible.
    Sidekick lx

    ReplyDelete
  23. http://knowledgebase-games.blogspot.com/

    ReplyDelete
  24. Comments are appreciated related to this post, If you're a fan of online Flash games and want to share your views feel free to comment. If you've got another more interesting free..flash games

    ReplyDelete
  25. I love your blog. This is a cool site and I wanted to post a little note to tell you, good job! Best wishes!!!
    Online games multiplayer

    ReplyDelete