UNDERSTANDING ANDROID GRAPHIC- SURFACEFLINGER (IV)
2016-06-01 11:45
525 查看
Having known that BufferQueue exposes the APIs for consuming surface frame while implementing BnGraphicBufferProducer, we
continue our attempt to demystify surface compositions and rendering with an examination of a few more classes with respect to surface composing.
SurfaceFlingerConsumer and GLConsumer class
Defined in framework/native/services/surfaceflinger/SurfaceFlingerConsumer.h, and framework/native/include/gui/GLConsumer.h,SurfaceFlingerConsumer and GLConsumer are
the core classes to fetch the current buffer from BufferQueue to bind to a surface layer specific GL texture. GLConsumer uses
GLES functions to conduct the operation while SurfaceFlingerConsumer is a wrapper around it to safeguard the operation.
The main APIs in SurfaceFlingerConsumerare updateTexImage()
and bindTextureImage().
Note that a surface frame will be drawn to the display frame buffer as a GL texture and GLConsumer inherits from ConsumerBase.
Layer Class
It has been known that when a SurfaceComposerClient::createSurface is invoked, Client in
SurfaceFlinger posts a MessageCreateLayer toSurfaceFlinger which
in turn calls SurfaceFlinger::createLayer() create aLayer instance
to service the remote Surface instance.
Applying a lazy initialization, Layer delays until first reference to instantiate a BufferQueue object
and SurfaceFlingerConsumercorresponding to the remote Surface object;
meanwhile Layer links the BufferQueue object
to SurfaceFlingerConsumer object and register itself as SurfaceFlingerConsumer::FrameAvailableListener listener
among other procedures.
When Surface::queueBuffer() is invoked, BufferQueue::queueBuffer()
and Layer::onFrameAvailable() call ensue ,as we elaborated in post SurfaceFlinger(III).
Subsequently , the Layer::draw() and Layer::onDraw() will be called to run SurfaceFlingerConsumer::bindTextureImage()
andLayer::drawWithOpenGL() to FramebufferSurface current
frame buffer.
continue our attempt to demystify surface compositions and rendering with an examination of a few more classes with respect to surface composing.
SurfaceFlingerConsumer and GLConsumer class
Defined in framework/native/services/surfaceflinger/SurfaceFlingerConsumer.h, and framework/native/include/gui/GLConsumer.h,SurfaceFlingerConsumer and GLConsumer are
the core classes to fetch the current buffer from BufferQueue to bind to a surface layer specific GL texture. GLConsumer uses
GLES functions to conduct the operation while SurfaceFlingerConsumer is a wrapper around it to safeguard the operation.
The main APIs in SurfaceFlingerConsumerare updateTexImage()
and bindTextureImage().
Note that a surface frame will be drawn to the display frame buffer as a GL texture and GLConsumer inherits from ConsumerBase.
Layer Class
It has been known that when a SurfaceComposerClient::createSurface is invoked, Client in
SurfaceFlinger posts a MessageCreateLayer toSurfaceFlinger which
in turn calls SurfaceFlinger::createLayer() create aLayer instance
to service the remote Surface instance.
Applying a lazy initialization, Layer delays until first reference to instantiate a BufferQueue object
and SurfaceFlingerConsumercorresponding to the remote Surface object;
meanwhile Layer links the BufferQueue object
to SurfaceFlingerConsumer object and register itself as SurfaceFlingerConsumer::FrameAvailableListener listener
among other procedures.
When Surface::queueBuffer() is invoked, BufferQueue::queueBuffer()
and Layer::onFrameAvailable() call ensue ,as we elaborated in post SurfaceFlinger(III).
Subsequently , the Layer::draw() and Layer::onDraw() will be called to run SurfaceFlingerConsumer::bindTextureImage()
andLayer::drawWithOpenGL() to FramebufferSurface current
frame buffer.
相关文章推荐
- Android根据网址获取网页源码并抓取相应字段
- PullScollToRefreshView scrollView GridView的嵌套
- UNDERSTANDING ANDROID GRAPHICS INTERNALS – SURFACEFLINGER (I)
- android日常使用积累
- UNDERSTANDING ANDROID GRAPHICS INTERNALS -SURFACEFLINGER(V)
- android 手势识别代码
- Android解决NDK not configured问题
- 初识android内存的一些解决方案
- Android动画 - Vector Animation
- Android是最牛的
- android实现仿QQ登陆界面的多账号保存
- 最近AndroidStudio遇到了好几次奇怪的问题,程序正确,调试就是运行错误
- Android开发中单用户登录的逻辑
- Android应用更新自动检测下载
- Android NDK开发之Hello-JNI!
- Android Studio 使用 OpenCV 的配置方法
- 【android】:android文件读写
- 安卓中AlarmManager结合广播的使用
- 一个Notification 进度条插件(android,NJS实现,直接就可使用)
- Android源代码编译