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

Commit dc0fe0d8 authored by Peiyong Lin's avatar Peiyong Lin Committed by android-build-merger
Browse files

Merge "[SurfaceFlinger] Respect HDR data space." into pi-dev

am: 3e273065

Change-Id: I0af8b67a045876cb0ea5cf7530161d08f1eaebca
parents 3c4c307c 3e273065
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -761,12 +761,12 @@ bool DisplayDevice::hasRenderIntent(RenderIntent intent) const {
    return iter != mColorModes.end() && iter->second.renderIntent == intent;
}

bool DisplayDevice::hasModernHdrSupport(Dataspace dataspace) const {
bool DisplayDevice::hasLegacyHdrSupport(Dataspace dataspace) const {
    if ((dataspace == Dataspace::BT2020_PQ && hasHDR10Support()) ||
        (dataspace == Dataspace::BT2020_HLG && hasHLGSupport())) {
        auto iter =
                mColorModes.find(getColorModeKey(dataspace, RenderIntent::TONE_MAP_COLORIMETRIC));
        return iter != mColorModes.end() && iter->second.dataspace == dataspace;
        return iter == mColorModes.end() || iter->second.dataspace != dataspace;
    }

    return false;
+3 −3
Original line number Diff line number Diff line
@@ -150,9 +150,9 @@ public:
    bool hasHLGSupport() const { return mHasHLG; }
    bool hasDolbyVisionSupport() const { return mHasDolbyVision; }

    // Return true if the corresponding color mode for the HDR dataspace is
    // supported.
    bool hasModernHdrSupport(ui::Dataspace dataspace) const;
    // Return true if the HDR dataspace is supported but
    // there is no corresponding color mode.
    bool hasLegacyHdrSupport(ui::Dataspace dataspace) const;

    // The returned HdrCapabilities is the combination of HDR capabilities from
    // hardware composer and RenderEngine. When the DisplayDevice supports wide
+2 −2
Original line number Diff line number Diff line
@@ -1932,9 +1932,9 @@ void SurfaceFlinger::pickColorMode(const sp<DisplayDevice>& displayDevice,
    Dataspace hdrDataSpace;
    Dataspace bestDataSpace = getBestDataspace(displayDevice, &hdrDataSpace);

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