Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d0d7b76 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Ife42e95d,Ia9b621d3,I79c5c60c

* changes:
  SF: Replace MessageBase classes with LambdaMessage
  SF: Use consistent names for display IDs
  SF: Use std::map for DisplayDevice lookup
parents 55fc0028 8c001676
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -612,8 +612,8 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
    const Transform& tr = display->getTransform();
    const auto& viewport = display->getViewport();
    Region visible = tr.transform(visibleRegion.intersect(viewport));
    auto hwcId = display->getHwcDisplayId();
    auto& hwcInfo = getBE().mHwcLayers[hwcId];
    const auto displayId = display->getId();
    auto& hwcInfo = getBE().mHwcLayers[displayId];
    auto& hwcLayer = hwcInfo.layer;
    auto error = hwcLayer->setVisibleRegion(visible);
    if (error != HWC2::Error::None) {
@@ -631,7 +631,7 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& display) {

    // Sideband layers
    if (getBE().compositionInfo.hwc.sidebandStream.get()) {
        setCompositionType(hwcId, HWC2::Composition::Sideband);
        setCompositionType(displayId, HWC2::Composition::Sideband);
        ALOGV("[%s] Requesting Sideband composition", mName.string());
        error = hwcLayer->setSidebandStream(getBE().compositionInfo.hwc.sidebandStream->handle());
        if (error != HWC2::Error::None) {
@@ -645,10 +645,10 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
    // Device or Cursor layers
    if (mPotentialCursor) {
        ALOGV("[%s] Requesting Cursor composition", mName.string());
        setCompositionType(hwcId, HWC2::Composition::Cursor);
        setCompositionType(displayId, HWC2::Composition::Cursor);
    } else {
        ALOGV("[%s] Requesting Device composition", mName.string());
        setCompositionType(hwcId, HWC2::Composition::Device);
        setCompositionType(displayId, HWC2::Composition::Device);
    }

    ALOGV("setPerFrameData: dataspace = %d", mCurrentDataSpace);
@@ -667,8 +667,8 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& display) {

    uint32_t hwcSlot = 0;
    sp<GraphicBuffer> hwcBuffer;
    getBE().mHwcLayers[hwcId].bufferCache.getHwcBuffer(mActiveBufferSlot, mActiveBuffer, &hwcSlot,
                                                       &hwcBuffer);
    getBE().mHwcLayers[displayId].bufferCache.getHwcBuffer(mActiveBufferSlot, mActiveBuffer,
                                                           &hwcSlot, &hwcBuffer);

    auto acquireFence = mConsumer->getCurrentFence();
    error = hwcLayer->setBuffer(hwcSlot, hwcBuffer, acquireFence);
+3 −3
Original line number Diff line number Diff line
@@ -65,8 +65,8 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
    const Transform& tr = display->getTransform();
    const auto& viewport = display->getViewport();
    Region visible = tr.transform(visibleRegion.intersect(viewport));
    auto hwcId = display->getHwcDisplayId();
    auto& hwcInfo = getBE().mHwcLayers[hwcId];
    const auto displayId = display->getId();
    auto& hwcInfo = getBE().mHwcLayers[displayId];
    auto& hwcLayer = hwcInfo.layer;
    auto error = hwcLayer->setVisibleRegion(visible);
    if (error != HWC2::Error::None) {
@@ -75,7 +75,7 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
        visible.dump(LOG_TAG);
    }

    setCompositionType(hwcId, HWC2::Composition::SolidColor);
    setCompositionType(displayId, HWC2::Composition::SolidColor);

    error = hwcLayer->setDataspace(mCurrentDataSpace);
    if (error != HWC2::Error::None) {
+11 −11
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ RenderIntent getHwcRenderIntent(const std::vector<RenderIntent>& hwcIntents, Ren
DisplayDevice::DisplayDevice(
        const sp<SurfaceFlinger>& flinger,
        DisplayType type,
        int32_t hwcId,
        int32_t id,
        bool isSecure,
        const wp<IBinder>& displayToken,
        const sp<ANativeWindow>& nativeWindow,
@@ -232,7 +232,7 @@ DisplayDevice::DisplayDevice(
    : lastCompositionHadVisibleLayers(false),
      mFlinger(flinger),
      mType(type),
      mHwcDisplayId(hwcId),
      mId(id),
      mDisplayToken(displayToken),
      mNativeWindow(nativeWindow),
      mDisplaySurface(displaySurface),
@@ -301,9 +301,9 @@ DisplayDevice::DisplayDevice(
DisplayDevice::~DisplayDevice() = default;

void DisplayDevice::disconnect(HWComposer& hwc) {
    if (mHwcDisplayId >= 0) {
        hwc.disconnectDisplay(mHwcDisplayId);
        mHwcDisplayId = -1;
    if (mId >= 0) {
        hwc.disconnectDisplay(mId);
        mId = -1;
    }
}

@@ -347,8 +347,8 @@ status_t DisplayDevice::prepareFrame(HWComposer& hwc) {
    }

    DisplaySurface::CompositionType compositionType;
    bool hasClient = hwc.hasClientComposition(mHwcDisplayId);
    bool hasDevice = hwc.hasDeviceComposition(mHwcDisplayId);
    bool hasClient = hwc.hasClientComposition(mId);
    bool hasDevice = hwc.hasDeviceComposition(mId);
    if (hasClient && hasDevice) {
        compositionType = DisplaySurface::COMPOSITION_MIXED;
    } else if (hasClient) {
@@ -365,7 +365,7 @@ status_t DisplayDevice::prepareFrame(HWComposer& hwc) {
}

void DisplayDevice::swapBuffers(HWComposer& hwc) const {
    if (hwc.hasClientComposition(mHwcDisplayId) || hwc.hasFlipClientTargetRequest(mHwcDisplayId)) {
    if (hwc.hasClientComposition(mId) || hwc.hasFlipClientTargetRequest(mId)) {
        mSurface->swapBuffers();
    }

@@ -660,10 +660,10 @@ void DisplayDevice::dump(String8& result) const {
    const Transform& tr(mGlobalTransform);
    ANativeWindow* const window = mNativeWindow.get();
    result.appendFormat("+ DisplayDevice: %s\n", mDisplayName.c_str());
    result.appendFormat("   type=%x, hwcId=%d, layerStack=%u, (%4dx%4d), ANativeWindow=%p "
    result.appendFormat("   type=%x, ID=%d, layerStack=%u, (%4dx%4d), ANativeWindow=%p "
                        "(%d:%d:%d:%d), orient=%2d (type=%08x), "
                        "flips=%u, isSecure=%d, powerMode=%d, activeConfig=%d, numLayers=%zu\n",
                        mType, mHwcDisplayId, mLayerStack, mDisplayWidth, mDisplayHeight, window,
                        mType, mId, mLayerStack, mDisplayWidth, mDisplayHeight, window,
                        mSurface->queryRedSize(), mSurface->queryGreenSize(),
                        mSurface->queryBlueSize(), mSurface->queryAlphaSize(), mOrientation,
                        tr.getType(), getPageFlipCount(), mIsSecure, mPowerMode, mActiveConfig,
@@ -703,7 +703,7 @@ void DisplayDevice::addColorMode(
    const Dataspace dataspace = colorModeToDataspace(mode);
    const Dataspace hwcDataspace = colorModeToDataspace(hwcColorMode);

    ALOGV("DisplayDevice %d/%d: map (%s, %s) to (%s, %s, %s)", mType, mHwcDisplayId,
    ALOGV("DisplayDevice %d/%d: map (%s, %s) to (%s, %s, %s)", mType, mId,
          dataspaceDetails(static_cast<android_dataspace_t>(dataspace)).c_str(),
          decodeRenderIntent(intent).c_str(),
          dataspaceDetails(static_cast<android_dataspace_t>(hwcDataspace)).c_str(),
+3 −3
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ public:
    DisplayDevice(
            const sp<SurfaceFlinger>& flinger,
            DisplayType type,
            int32_t hwcId,
            int32_t id,
            bool isSecure,
            const wp<IBinder>& displayToken,
            const sp<ANativeWindow>& nativeWindow,
@@ -136,7 +136,7 @@ public:
    int32_t                 getDisplayType() const { return mType; }
    bool                    isPrimary() const { return mType == DISPLAY_PRIMARY; }
    bool                    isVirtual() const { return mType == DISPLAY_VIRTUAL; }
    int32_t                 getHwcDisplayId() const { return mHwcDisplayId; }
    int32_t                 getId() const { return mId; }
    const wp<IBinder>&      getDisplayToken() const { return mDisplayToken; }

    int32_t getSupportedPerFrameMetadata() const { return mSupportedPerFrameMetadata; }
@@ -226,7 +226,7 @@ private:
     */
    sp<SurfaceFlinger> mFlinger;
    DisplayType mType;
    int32_t mHwcDisplayId;
    int32_t mId;
    wp<IBinder> mDisplayToken;

    // ANativeWindow this display is rendering into
+4 −4
Original line number Diff line number Diff line
@@ -435,7 +435,7 @@ status_t HWComposer::prepare(DisplayDevice& display) {
    ATRACE_CALL();

    Mutex::Autolock _l(mDisplayLock);
    auto displayId = display.getHwcDisplayId();
    const auto displayId = display.getId();
    if (displayId == DisplayDevice::DISPLAY_ID_INVALID) {
        ALOGV("Skipping HWComposer prepare for non-HWC display");
        return NO_ERROR;
@@ -723,11 +723,11 @@ void HWComposer::disconnectDisplay(int displayId) {
        ++mRemainingHwcVirtualDisplays;
    }

    auto hwcId = displayData.hwcDisplay->getId();
    mHwcDisplaySlots.erase(hwcId);
    const auto hwcDisplayId = displayData.hwcDisplay->getId();
    mHwcDisplaySlots.erase(hwcDisplayId);
    displayData.reset();

    mHwcDevice->destroyDisplay(hwcId);
    mHwcDevice->destroyDisplay(hwcDisplayId);
}

status_t HWComposer::setOutputBuffer(int32_t displayId,
Loading