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

發佈了8 篇原創文章 · 獲贊 5 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章