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

Commit 868c5ca1 authored by Dan Stoza's avatar Dan Stoza Committed by Android (Google) Code Review
Browse files

Merge changes I7f7d4e0a,Ie966e37d into nyc-mr1-dev

* changes:
  HWC2: Check all displays for client composition
  HWC2: Kill logspam for non-HWC virtual displays
parents 1740304a bfbffeb4
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -467,6 +467,10 @@ status_t HWComposer::prepare(DisplayDevice& displayDevice) {

    Mutex::Autolock _l(mDisplayLock);
    auto displayId = displayDevice.getHwcDisplayId();
    if (displayId == DisplayDevice::DISPLAY_ID_INVALID) {
        ALOGV("Skipping HWComposer prepare for non-HWC display");
        return NO_ERROR;
    }
    if (!isValidDisplay(displayId)) {
        return BAD_INDEX;
    }
@@ -560,6 +564,11 @@ status_t HWComposer::prepare(DisplayDevice& displayDevice) {
}

bool HWComposer::hasDeviceComposition(int32_t displayId) const {
    if (displayId == DisplayDevice::DISPLAY_ID_INVALID) {
        // Displays without a corresponding HWC display are never composed by
        // the device
        return false;
    }
    if (!isValidDisplay(displayId)) {
        ALOGE("hasDeviceComposition: Invalid display %d", displayId);
        return false;
@@ -568,6 +577,11 @@ bool HWComposer::hasDeviceComposition(int32_t displayId) const {
}

bool HWComposer::hasClientComposition(int32_t displayId) const {
    if (displayId == DisplayDevice::DISPLAY_ID_INVALID) {
        // Displays without a corresponding HWC display are always composed by
        // the client
        return true;
    }
    if (!isValidDisplay(displayId)) {
        ALOGE("hasClientComposition: Invalid display %d", displayId);
        return true;
+6 −1
Original line number Diff line number Diff line
@@ -1058,8 +1058,13 @@ void Layer::setCompositionType(int32_t hwcId, HWC2::Composition type,
}

HWC2::Composition Layer::getCompositionType(int32_t hwcId) const {
    if (hwcId == DisplayDevice::DISPLAY_ID_INVALID) {
        // If we're querying the composition type for a display that does not
        // have a HWC counterpart, then it will always be Client
        return HWC2::Composition::Client;
    }
    if (mHwcLayers.count(hwcId) == 0) {
        ALOGE("getCompositionType called without a valid HWC layer");
        ALOGE("getCompositionType called with an invalid HWC layer");
        return HWC2::Composition::Invalid;
    }
    return mHwcLayers.at(hwcId).compositionType;
+7 −1
Original line number Diff line number Diff line
@@ -1063,7 +1063,13 @@ void SurfaceFlinger::handleMessageRefresh() {
    postComposition(refreshStartTime);

    mPreviousPresentFence = mHwc->getRetireFence(HWC_DISPLAY_PRIMARY);
    mHadClientComposition = mHwc->hasClientComposition(HWC_DISPLAY_PRIMARY);

    mHadClientComposition = false;
    for (size_t displayId = 0; displayId < mDisplays.size(); ++displayId) {
        const sp<DisplayDevice>& displayDevice = mDisplays[displayId];
        mHadClientComposition = mHadClientComposition ||
                mHwc->hasClientComposition(displayDevice->getHwcDisplayId());
    }

    // Release any buffers which were replaced this frame
    for (auto& layer : mLayersWithQueuedFrames) {