how to show an image without surfaceflinger on android

China☆狼群 提交于 2019-12-12 01:45:49

问题


How to draw some stuff before surfacefligner start on android?

In this situation, it's some kind of traditional Linux with framebuffer device, so directly access framebuffer should be OK.

How about to use HWComposer directly and how about to use egl directly?


回答1:


If SurfaceFlinger isn't running, you can just open the framebuffer device and write to it (assuming you're on a device that has a framebuffer device).

For an example of this, see the implementation of the "recovery" UI. The key file there is minui/graphics.c. The current implementation relies on libpixelflinger.

Using OpenGL ES / EGL will be a bit more tricky. Some of the early GLES tests, such as San Angeles, use the FramebufferWindow class, but that uses a fair bit of the framework. (FWIW, an upcoming release is expected to deprecate FramebufferWindow and switch the OpenGL tests that use them to a new library that talks to SurfaceFlinger.)

Update: the upcoming release happened, and you can see the replacement for FramebufferWindow ("WindowSurface") here.

If SurfaceFlinger isn't running you can talk to HardwareComposer directly, using the internal interface. There are some old tests that exercise it, but I don't know if they still work. The code in SurfaceFlinger is probably a better example at this point. Only one process can open HardwareComposer at a time, so SurfaceFlinger must not be running.



来源:https://stackoverflow.com/questions/23691541/how-to-show-an-image-without-surfaceflinger-on-android

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