android rendering using CPU but not GPU?

試著忘記壹切 提交于 2019-12-30 05:13:06

问题


It's really weird that in systrace tool when I saw the execution of drawing command and window composition by surfaceflinger, this is running on CPU but not on GPU. But as per google talk by Romain Guy, they told that this composition and execution of drawing commands are executed on GPU. My device having GPU, even then they are using CPU core. I think if CPU cores are free then it uses CPU core otherwise it uses GPU.


回答1:


There's three ways to do surface composition:

  1. Using "overlay" planes. Most recent devices will compose up to four planes as the pixels are being sent to the display. This is (usually) the most efficient way to do surface composition. It's required for DRM video, because there's currently no way for GLES to compose "secure" surfaces.
  2. On the GPU, using OpenGL ES. SurfaceFlinger will fall back to this if you have more than four planes to compose. It's also used for virtual displays and things like screenrecord. On some devices, if none of the surfaces have been updated in a bit, the hardware composer will use the GPU to compose the surfaces and then just display the single buffer. This is more bandwidth-efficient than overlay planes if nothing is changing (because you don't have to run through all the surfaces, which means you need less memory bandwidth, which means you can clock things lower, which means you can use less power).
  3. On the CPU. Nobody does this anymore.

What exactly it does varies between devices and has evolved over time. If you want to see exactly what it's doing, try adb shell dumpsys SurfaceFlinger. The hardware composer details (near the bottom) are the most interesting part. You may need to actively scroll something on the device display while running the command to avoid the GLES optimization.

I would guess that you're seeing is the prepare() and set() calls and buffer management, not actual pixel composition, in your systrace.

Update: there's a really nice write-up in this post.

Update 2: there's now an overview of the full system in the Android System-Level Graphics doc.



来源:https://stackoverflow.com/questions/20822309/android-rendering-using-cpu-but-not-gpu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!