Sounds to me like the mystery is solved. Romain explained how calling drawLine is faster on the CPU, and suggested a way to change the code to make it more GPU-friendly. In other words, no, the code is not well-optimized _for GPU rendering_. Perini explained drawLine gives better-looking results, and at 60 FPS, the software-rendering performance seems to be adequate. In other words, the code is well-optimized _for CPU rendering_. Ok, now we can understand what's going on with this particular application. Success!
On Mon, Jan 16, 2012 at 9:14 PM, sblantipodi <[email protected]> wrote: > As I saied the same code runs great on every feature phones from JP5 > to JP7 and newer. > SAME CODE means that I converted the JavaME calls to android one, we > are talking about exactly the same code. > We are talking about 100-180MHz phone and Is this your answer? > The app isn't well optimized? > > You are talking about drawLines() over the drawLine(), should we > abandon antialiasing to draw some > lines on a 1.2GHz smartphone? (drawLines() does not support > antialiasing) > > Don't you think that the problem is somewhere else? > > On 16 Gen, 20:45, Romain Guy <[email protected]> wrote: >> There is nothing magical about hardware acceleration. It is perfectly >> possible to write code that runs faster on the CPU that on the GPU. >> For instance, an app that does dozens or hundreds of calls to >> Canvas.drawLine() per frame is likely to perform worse on the GPU. The >> reason in this particular example is that every call to drawLine() >> will generate a rendering instruction for the GPU, which is very >> expensive. It is much more efficient to use drawLines() (plural) to >> batch all the lines in a single rendering instruction. There are many >> other things that can make a GPU perform poorly: overdraw, too many >> different textures or shaders, etc. >> >> I just tried the app you linked to on a Galaxy Nexus and it performs >> roughly the same with or without hardware acceleration. From looking >> at its UI it seems it's doing a lot of custom drawing and I'm sure it >> could be optimized to be more GPU friendly. >> >> Also the amount of RAM and the speed of the CPU have little to do with >> how well an app will perform on the GPU. >> >> On Mon, Jan 16, 2012 at 10:41 AM, sblantipodi >> >> >> >> >> >> >> >> >> >> <[email protected]> wrote: >> > Just to add some more data. >> > This simple app can render its UI at 60FPS on Galaxy Nexus running >> > stock 4.0.2 with HW ACC is OFF. >> >https://market.android.com/details?id=MortgageCalculatorPRO.DPsoftwar... >> >> > Simply enable hardware acceleration and the framerate drops from 10FPS >> > to 30FPS. >> > As I repeat all the UI is drawn using drawLine() drawRect() >> > drawRoundRect() and StaticLayout to draw a correctly wrapped text. >> > Simple apps using simple UI runs slow on a 1.2GHz CPU with 1GB of RAM. >> >> > Is there any reason to justify this aside from the fact that it must >> > be some problem in the hw acceleration implementation? >> >> > -- >> > You received this message because you are subscribed to the Google >> > Groups "Android Developers" group. >> > To post to this group, send email to [email protected] >> > To unsubscribe from this group, send email to >> > [email protected] >> > For more options, visit this group at >> >http://groups.google.com/group/android-developers?hl=en >> >> -- >> Romain Guy >> Android framework engineer >> [email protected] > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

