android/DisplayHotplug

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值