您的位置:首页 > 移动开发 > Android开发

android/DisplayHotplug

2016-06-02 18:25 351 查看
This feature is implemented as part of android version 4.2.1 and onward. The implementation is given as part of android's Surfaceflinger and HWComposer.

The call flow chart of Surfaceflinger is given below #

Surfaceflinger
Updates #

Surfacefliger in android version 4.2.1 has the implementation differences from version 4.1. Surfaceflinger.cpp: 1. SurfaceFlinger::createSurface is replaced with SurfaceFlinger::createLayer,
which intenal gives the implementation of creating a layer of type Normal, Dim or Screenshot. After successful creation of layer, it return handle to the surface.

New
classes have been introduced #

class Fence?

class Region?

class GraphicBuffer?

Control
flow #

Surfaceflinger.cpp

|

Displaydevice.cpp

|

Framwbuffersurface.cpp

|

HWComposer.cpp

|

fb device

Function
call flow #

void SurfaceFlinger::onMessageReceived(int32_t what) {

ATRACE_CALL();

switch (what) {

case MessageQueue::INVALIDATE:

handleMessageTransaction();

handleMessageInvalidate();

signalRefresh();

break;

case MessageQueue::REFRESH:

handleMessageRefresh();

break;

}

}

The main functionality of composing, distributing and displaying the framebuffer would be taken place during the execution of the below functions

void SurfaceFlinger::handleMessageRefresh() {

ATRACE_CALL();

preComposition();

rebuildLayerStacks();

setUpHWComposer();

doDebugFlashRegions();

doComposition();

postComposition();

}

preComposition
#

rebuildLayerStacks#

computeVisibleRegions for each display, transparentRegion functionality has been updated.

setUpHWComposer
#

Creates hwc for each display device connected to the system. set the perframedata for each layer in layer list of display device

doDebugFlashRegions
#

To enable debugging of surfaceflinger doComposeSurfaces() compositionComplete()

doComposition
#

getDirtyRegion()

doDisplayComposition() → doComposeSurfaces()

compositionComplete()

postFramebuffer()

doComposeSurfaces
#

const Rect& bounds(hw->getBounds());

const Transform& tr(hw->getTransform());

const Rect scissor(tr.transform(hw->getViewport()));

CompositionTypes:

HWC_OVERLAY

HWC_FRAMEBUFFER

HWC_FRAMEBUFFER_TARGET
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: