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

Commit b42395e0 authored by Arun Kumar K.R's avatar Arun Kumar K.R
Browse files

SurfaceFlinger: Avoid HDR layers going to GPU.

HDR layers when fall back to GPU show differently due to
missing tonemapping in fall back path, hence avoid those
layers going to GPU.

Change-Id: I68072f9a04042fd011c53ecddf9ca22c1507fa12
Crs-fixed: 1094808
parent 6f4b8d2f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -145,6 +145,7 @@ ifeq ($(TARGET_USES_QCOM_BSP), true)
    LOCAL_SHARED_LIBRARIES += libqdutils
    LOCAL_SHARED_LIBRARIES += libqdMetaData
    LOCAL_CFLAGS += -DQTI_BSP
    LOCAL_CFLAGS += -DUSE_COLOR_METADATA
endif

LOCAL_MODULE := libsurfaceflinger
+27 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#ifdef QTI_BSP
#include <gralloc_priv.h>
#include <qdMetaData.h>
#include <color_metadata.h>
#include <hardware/display_defs.h>
#endif

@@ -162,6 +163,32 @@ bool ExLayer::isYuvLayer() const {
    return false;
}

bool ExLayer::isHDRLayer() const {
    const sp<GraphicBuffer>& activeBuffer(mActiveBuffer);
    if (activeBuffer != 0) {
#ifdef QTI_BSP
        ANativeWindowBuffer* buffer = activeBuffer->getNativeBuffer();
        if(buffer) {
            private_handle_t* hnd = static_cast<private_handle_t*>
                (const_cast<native_handle_t*>(buffer->handle));
            const MetaData_t *metaData = NULL;
            if (hnd) {
                metaData = reinterpret_cast<MetaData_t *>(hnd->base_metadata);
                if (metaData && (metaData->operation & COLOR_METADATA)) {
                    const ColorMetaData &colorData = metaData->color;
                    if (colorData.colorPrimaries == ColorPrimaries_BT2020 &&
                        (colorData.transfer == Transfer_SMPTE_ST2084 ||
                        colorData.transfer == Transfer_HLG)) {
                            return true;
                    }
                }
            }
        }
#endif
    }
    return false;
}

#ifndef USE_HWC2
void ExLayer::setPosition(const sp<const DisplayDevice>& hw,
                          HWComposer::HWCLayerInterface& layer, const State& state) {
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ public:
    virtual bool isIntOnly() const;
    virtual bool isSecureDisplay() const;
    virtual bool isYuvLayer() const;
    virtual bool isHDRLayer() const;
    virtual uint32_t getS3dFormat(const sp<const DisplayDevice>& hw) const;
    virtual void clearS3dFormat(const sp<const DisplayDevice>& hw) const;
#ifndef USE_HWC2
+7 −2
Original line number Diff line number Diff line
@@ -38,6 +38,12 @@
#include <utils/StopWatch.h>
#include <utils/Trace.h>

#ifdef QTI_BSP
#include <gralloc_priv.h>
#include <qdMetaData.h>
 #endif


#include <ui/GraphicBuffer.h>
#include <ui/PixelFormat.h>

@@ -933,8 +939,7 @@ void Layer::onDraw(const sp<const DisplayDevice>& hw, const Region& clip,
        // Go ahead and draw the buffer anyway; no matter what we do the screen
        // is probably going to have something visibly wrong.
    }

    bool blackOutLayer = isProtected() || (isSecure() && !hw->isSecure());
    bool blackOutLayer = isProtected() || (isSecure() && !hw->isSecure()) || isHDRLayer();

    RenderEngine& engine(mFlinger->getRenderEngine());

+1 −0
Original line number Diff line number Diff line
@@ -348,6 +348,7 @@ public:
    virtual bool isIntOnly() const { return false; }
    virtual bool isSecureDisplay() const { return false; }
    virtual bool isYuvLayer() const { return false; }
    virtual bool isHDRLayer() const { return false; }
#ifndef USE_HWC2
    virtual void setPosition(const sp<const DisplayDevice>& /*hw*/,
                             HWComposer::HWCLayerInterface& /*layer*/,