Slashdot Mirror


The Care and Feeding of the Android GPU

bonch writes "Charles Ying argues that Android's UX architecture has serious technical issues because, unlike the iPhone and Windows 7, Android composites the interface in software to retain compatibility with lower-class devices. Additionally, Android runs Java bytecode during animation, and garbage collection blocks the drawing system. Google engineers dismiss the desire for hardware-accelerated compositing and cite more powerful hardware and an avoidance of temporary objects as a solution to the collection pauses, but Ying argues that will just lead to [a lower] average battery life compared to devices like the iPhone."

18 of 307 comments (clear)

  1. Re:Doesn't Optimizing for GPU Exacerbate Fragmenti by Desler · · Score: 3, Insightful

    There is this new thing called "conditional compilation" which allows one to include code that both optimizes for certain hardware and contains generic code that could work on all devices. I hear it's the new rage of how you make code work on multiple hardware and software platforms.

  2. Re:Doesn't Optimizing for GPU Exacerbate Fragmenti by RightSaidFred99 · · Score: 3

    Can anyone tell me why that AnandTech article from March is evidence that Windows Phone 7 has lapped Android? And why it just happened?

    He's talking about the fact that Windows Phone 7 has advanced GPU acceleration built in from the beginning in several facets of the environment. Android doesn't and it's a few years older.

    It certainly hasn't lapped it in terms of sales or momentum, but it could. Android has both the advantage and the curse of being more open and versatile - WP7 has the possibility of a more restrained set of hardware differences and can build in more low-level functionality.

  3. Re:Doesn't Optimizing for GPU Exacerbate Fragmenti by iluvcapra · · Score: 4, Insightful

    I don't know enough about the Android graphics API, but if it's designed properly it should be possible for the client to always call the same function and the underlying implementation to select the code path most optimized for the platform. Mac OS X has one CoreGraphics API, and it either composites on the GPU or on the CPU depending on what's available. I don't see why Amdroiid can't do the same.

    --
    Don't blame me, I voted for Baltar.
  4. Re:Java, the original sin by alen · · Score: 3, Informative

    until the iphone came around RIM and others would have low end, mid and high end devices with different hardware. i've even seen dumb phones run java. it allowed hardware makers to have a ton of devices out there for every niche and cut down on dev costs. Java was cool since you only write the app once.

    then the iPhone came and killed that model. the cost of the iphone is something like $2200 over 2 years. Droid is about the same. any other smartphone on AT&T or VZW will be within $200. i tell people to get the best phone they want since the cost is negligible over 2 years.

  5. Re:Doesn't Optimizing for GPU Exacerbate Fragmenti by bhcompy · · Score: 4, Insightful

    When you optimize to GPUs, you have to optimize to all GPUs. I realize there are common instruction sets but the main selling point of Android is its versatility. If I start coding for only Snapdragon processors with PowerVR GPUs because it has a better UX, then it sort of destroys any benefit I get from Android and I might as well code for iOS because I know what that hardware will always be. A lot of the benefits of Android applications being Java byte code completely independent of the hardware are overlooked in this proposition.

    You mean it's like a real, honest to goodness, computer operating system? Oh no! The horror! Guess you should stop making software for Windows, Linux, and OSX then, since the hardware can provided different capabilities for systems using the same operating system!

  6. Re:Doesn't Optimizing for GPU Exacerbate Fragmenti by TeknoHog · · Score: 4, Insightful

    Somebody should really invent a programming interface for graphics. You could use hardware or software rendering for the same code, or generally a mixture of both, depending on the capabilities. It could be called "open graphics library" or something.

    --
    Escher was the first MC and Giger invented the HR department.
  7. Re:Doesn't Optimizing for GPU Exacerbate Fragmenti by 0100010001010011 · · Score: 4, Interesting

    Debian seems to handle it just fine and (based on gcc) they're compiling for 14 different platforms* and 3 different kernels (linux, hurd, freebsd)

    Is it that difficult to setup a similar thing in the app store? "Oh it looks like you're running an ARMv5 and a PowerVR GPU. We'll give you this binary."

    Or, you do what Apple has always done with Fat Binaries. 68k to PPC. PPC to PPC64. PPC* to i386. i386 to x86_64. You could have one single fat binary that supported ppc, ppc64, i386 and x86_64. And it "Just worked". They were literally checkboxes in XCode. How many GPU and CPU solutions are there for the Android? This isn't low level Assembly code, it's compiled Java.

    *alpha amd64 armel hppa hurd-i386 i386 ia64 kfreebsd-amd64 kfreebsd-i386 m68k mips mipsel powerpc s390 sh4 sparc sparc64

  8. Feeding the what? by Big_Mamma · · Score: 4, Informative

    Let me tell you one thing about that: Java isn't the problem. In my definition of feeding the GPU: triangles/sec, fillrate and OpenGLES objects/sec, Java is just 10% behind a raw C benchmark like glbenchmark 1.1/2.0. They quoted 880kT/s, I managed 750kT/s in non native code. And to get that, you have to carefully feed the GPU with the right batch sizes, don't issue too many state changes, pack things interleaved in the video buffer, don't use dynamic point lights, etc etc. It isn't as bad as an NDS, but the Snapdragon GPU is quite hard to tame.

    The problem with using the GPU is that every context switch requires a complete reinitialization of the GL context, even on a PC, alt tabbing into and from fullscreen games takes ages - it's fine when specific applications which requires the speed use it directly, but it's not when going from one activity to another gives you a loading screen.

    Animation performance and touch responsiveness? Is that the best he can come up with for such a title? I have no idea what he's talking about, but scrolling the browser works just fine here on a not-so-recent HTC Desire. The only time things break down is when the garbage collector halts everything for a third of a second (see DDMS/logcat messages), and those pauses are reduced to sub 5ms in the new builds. That's tons more useful than rendering surfaces to quads and using OpenGL ES to draw them, and IMO, the Android team made the right decision.

  9. Re:Doesn't Optimizing for GPU Exacerbate Fragmenti by MobileTatsu-NJG · · Score: 4, Insightful

    That depends on the optimization and how that chipset actually handles throwing stuff on the screen. 'Optimize' may not just mean "format the data this certain way and it'll fly through the processors more quickly", it could also mean "use more polygons and lower-res textures because the chipset is better at moving verts around than filling texels". It doesn't matter that it's not low-level if it affects how the whole engine works.

    --

    "I like to lick butts!" by MobileTatsu-NJG (#32700246) (Score:5, Informative)

  10. Re:Doesn't Optimizing for GPU Exacerbate Fragmenti by TheRaven64 · · Score: 5, Insightful

    Add to that, you really don't need to optimise the code that you use for compositing on the GPU. A low-end mobile GPU can render something on the order of three million textured triangles per second. A typical mobile UI has a few dozen UI elements, with one texture and two triangles (one square) each. Even really crappy code is not going to come close to taxing the GPU. That's why we do compositing on the GPU - because it can run in its lowest-clocked mode and still provide fast performance, which lets you use the CPU for something else (or down-clock it too and save battery life).

    --
    I am TheRaven on Soylent News
  11. Re:Doesn't Optimizing for GPU Exacerbate Fragmenti by TopSpin · · Score: 4, Insightful

    massively different user experience on different devices

    consider: different user experience on massively different devices

    Why should it be otherwise? Should a quad-core i7 SLI provide exactly the same 'user experience' as an Atom netbook? Obviously not. It is not reasonable to expect the same results from increasingly diverse hardware. Android will be found on the lowest end freebee 'smart' phone China can make, while also appearing on the most outrageous hardware that doesn't present an immediate fire hazard. Where, exactly, was it written that the limits of one must apply to the other?

    This problem has been solved over and over again. An architecture must exist that provides fall-back software implementations of hardware accelerated functions. When some app performs poorly due to inadequate hardware the user may find some other preoccupation or upgrade to a sufficient device.

    What is the problem? At the moment it appears to be Google's obstinacy. This is a losing battle for them; they're creating a differentiating point among the manufacturers because the manufacturers can alter Android, including accelerating stuff with hardware. Marketing will then make claims about how xyz's Android is better than the other Androids because of xyz's special sauce (that may or may not port easily to some other collection of chips.) If the manufacturers don't the users will.

    Lets hope Google wises up and deals with the issue properly.

    --
    Lurking at the bottom of the gravity well, getting old
  12. Re:I've complained about this more times than i ca by Daniel+Phillips · · Score: 4, Funny

    Speaking as a former Googler, the smart people spin is somewhat overrated. Arrogant people is closer to the truth, and "smart" tends to mean "good at avoiding work".

    --
    Have you got your LWN subscription yet?
  13. Re:Lead to... as in the future? by h4rr4r · · Score: 3, Informative

    All the expensive devices uses capacitive screens, nice multitouch ones too.

    Resistive is usually the cheap kind.

  14. Re:Java, the original sin by Atzanteol · · Score: 3, Funny

    If one is incapable of writing Java/Dalvik code that runs well then I pitty the C code they will churn out.

    --
    "Ignorance more frequently begets confidence than does knowledge"

    - Charles Darwin
  15. Re:I've complained about this more times than i ca by Daniel+Phillips · · Score: 4, Interesting

    And you say that as an unbiased observer with no axe to grind, right? :-)

    Right. I still own all my Google shares. However I am now properly disillusioned about a number of Google myths, but don't trust me. Ask any Googler, former or otherwise. In the latter case, make sure to do it out of earshot of other Googlers.

    There are smart people at Google, and if they are really smart they learn early to keep their heads down. This seems to be the main sequence for large tech companies. Microsoft is far advanced on that path and Google seems more than a little determined to follow. The stack ranking system is nearly a carbon copy of Microsoft's, which in turn was copied from GE, and look how well that worked out. The result is inevitable degradation of the engineering culture. Now, warning about the negative consequences is not the same as axe grinding, quite the opposite.

    --
    Have you got your LWN subscription yet?
  16. Re:Java, the original sin by mattcasters · · Score: 3, Interesting

    Interesting theory. I've been working with Java since version 1.0 on devices as slow as an embedded 100Mhz device with 128MB RAM and I never remember GC taking seconds.

    Just because I'm curious I tried to push our Java application (Data integration engine) to use both CPUs at 100% and dump the Garbage Collection stats to disk. Here's a typical sample:

    133,091: [GC 30567K->10559K(60160K), 0,0052000 secs]
    133,447: [GC 34943K->10347K(64832K), 0,0036360 secs]
    133,873: [GC 39659K->10347K(63872K), 0,0028940 secs]
    134,286: [GC 38699K->10531K(63104K), 0,0033140 secs]
    134,674: [GC 37923K->10263K(61952K), 0,0019690 secs]
    135,072: [GC 36759K->10351K(61184K), 0,0024490 secs]
    135,462: [GC 36015K->10339K(60352K), 0,0022610 secs]
    135,797: [GC 35171K->10739K(59840K), 0,0039780 secs]
    136,134: [GC 34803K->10679K(59008K), 0,0033120 secs]
    136,479: [GC 33975K->10567K(58048K), 0,0029140 secs]
    136,801: [GC 33159K->10647K(57472K), 0,0026420 secs]

    Note that this is without incremental garbage collection enabled. It might be possible for graphics intensive applications to notice the fraction of a second of delay but something tells me that this just might not be the case.

    --
    News about the Kettle Open Source project: on my blog
  17. Java bytecode? by DragonWriter · · Score: 3, Informative

    Additionally, Android runs Java bytecode during animation

    Except in the real world, where Android uses a non-Java VM with its own bytecode, and doesn't run Java bytecode at all.

  18. Not about battery life by SoftwareArtist · · Score: 5, Interesting

    There's a myth going around that battery life is strongly affected by how efficient your code is. On most phone, it's simply not true. By far the biggest power drains are the screen and the radios (cellular, wifi, bluetooth). On Android, there's even a handy battery monitor built in that you can use to confirm this (Settings->About phone->Battery use). I can spend half an hour playing a high end, graphics intensive game (Hero of Sparta) on my Nexus One, and when I then check the battery use, I find that even while I was playing the screen and the cellular radio standby were still the dominant uses of power.

    --
    "I'm too busy to research this and form an educated opinion, but I do have time to tell everyone my uninformed opinion."