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

Commit ba65e2d2 authored by Chia-I Wu's avatar Chia-I Wu Committed by android-build-merger
Browse files

Merge "surfaceflinger: RenderIntent::COLORIMETRIC is no longer mandatory" into...

Merge "surfaceflinger: RenderIntent::COLORIMETRIC is no longer mandatory" into pi-dev am: 88fbd425
am: 5b73fc91

Change-Id: Ic4c279db388f9e38851a2aa33a587e97e909b542
parents 1d3c7f7d 5b73fc91
Loading
Loading
Loading
Loading
+20 −8
Original line number Diff line number Diff line
@@ -162,18 +162,20 @@ std::vector<RenderIntent> getRenderIntentCandidates(RenderIntent intent) {
        }
    }

    // add other HDR candidates when intent is HDR
    if (isHdr) {
        // add other HDR candidates when intent is HDR
        for (auto hdrIntent : sHdrRenderIntents) {
            if (hdrIntent != intent) {
                candidates.push_back(hdrIntent);
            }
        }
    } else {
        // add other SDR candidates when intent is SDR
        for (auto sdrIntent : sSdrRenderIntents) {
            if (sdrIntent != intent) {
                candidates.push_back(sdrIntent);
            }
        }

    // add COLORIMETRIC
    if (intent != RenderIntent::COLORIMETRIC) {
        candidates.push_back(RenderIntent::COLORIMETRIC);
    }

    return candidates;
@@ -726,14 +728,24 @@ void DisplayDevice::populateColorModes(
        }
    }

    // add known SDR combinations
    // add all known SDR combinations
    for (auto intent : sdrRenderIntents) {
        for (auto mode : sSdrColorModes) {
            addColorMode(hwcColorModes, mode, intent);
        }
    }

    // add known HDR combinations
    // collect all known HDR render intents
    std::unordered_set<RenderIntent> hdrRenderIntents(sHdrRenderIntents.begin(),
                                                      sHdrRenderIntents.end());
    iter = hwcColorModes.find(ColorMode::BT2100_PQ);
    if (iter != hwcColorModes.end()) {
        for (auto intent : iter->second) {
            hdrRenderIntents.insert(intent);
        }
    }

    // add all known HDR combinations
    for (auto intent : sHdrRenderIntents) {
        for (auto mode : sHdrColorModes) {
            addColorMode(hwcColorModes, mode, intent);
+9 −9
Original line number Diff line number Diff line
@@ -1930,27 +1930,27 @@ void SurfaceFlinger::pickColorMode(const sp<DisplayDevice>& displayDevice,
    Dataspace hdrDataSpace;
    Dataspace bestDataSpace = getBestDataspace(displayDevice, &hdrDataSpace);

    // respect hdrDataSpace only when there is modern HDR support
    const bool isHdr = hdrDataSpace != Dataspace::UNKNOWN &&
        displayDevice->hasModernHdrSupport(hdrDataSpace);
    if (isHdr) {
        bestDataSpace = hdrDataSpace;
    }

    RenderIntent intent;
    switch (mDisplayColorSetting) {
        case DisplayColorSetting::MANAGED:
        case DisplayColorSetting::UNMANAGED:
            intent = RenderIntent::COLORIMETRIC;
            intent = isHdr ? RenderIntent::TONE_MAP_COLORIMETRIC : RenderIntent::COLORIMETRIC;
            break;
        case DisplayColorSetting::ENHANCED:
            intent = RenderIntent::ENHANCE;
            intent = isHdr ? RenderIntent::TONE_MAP_ENHANCE : RenderIntent::ENHANCE;
            break;
        default: // vendor display color setting
            intent = static_cast<RenderIntent>(mDisplayColorSetting);
            break;
    }

    // respect hdrDataSpace only when there is modern HDR support
    if (hdrDataSpace != Dataspace::UNKNOWN && displayDevice->hasModernHdrSupport(hdrDataSpace)) {
        bestDataSpace = hdrDataSpace;
        intent = mDisplayColorSetting == DisplayColorSetting::ENHANCED ?
            RenderIntent::TONE_MAP_ENHANCE : RenderIntent::TONE_MAP_COLORIMETRIC;
    }

    displayDevice->getBestColorMode(bestDataSpace, intent, outDataSpace, outMode, outRenderIntent);
}