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

Commit f5fb2ed2 authored by Saurabh Shah's avatar Saurabh Shah Committed by Manish Kumar
Browse files

Surface: Fix gralloc flags conflicting values.

Due to some custom code, unwanted flags (HW) got added with SW flags.
Restrict the flags to custom ones.

Change-Id: I2ab1c75eef4d6d16f0dd7d43aff3c7377486801a
(cherry picked from commit d9b9e1510418e5babf54f34ed8a81cbc368f521e)
(cherry picked from commit 947e0802d55a70aef4c32875f4ddfd2c30576bce)
(cherry picked from commit 4d3419b9185e8f57ff811cf7b14782902c66172f)
parent d6eecf50
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ LOCAL_SHARED_LIBRARIES := \

# Executed only on QCOM BSPs
ifeq ($(TARGET_USES_QCOM_BSP),true)
    LOCAL_C_INCLUDES += hardware/qcom/display/libgralloc
    LOCAL_CFLAGS += -DQCOM_BSP
endif

+13 −2
Original line number Diff line number Diff line
@@ -34,6 +34,10 @@

#include <private/gui/ComposerService.h>

#ifdef QCOM_BSP
#include <gralloc_priv.h>
#endif

namespace android {

Surface::Surface(
@@ -757,8 +761,15 @@ status_t Surface::lock(
            return err;
        }
        // we're intending to do software rendering from this point
        setUsage(mReqUsage | GRALLOC_USAGE_SW_READ_OFTEN |
        // Do not overwrite the mReqUsage flag which was set by the client
#ifdef QCOM_BSP
        setUsage(mReqUsage & GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY |
                mReqUsage & GRALLOC_USAGE_PRIVATE_INTERNAL_ONLY |
                    GRALLOC_USAGE_SW_READ_OFTEN |
                    GRALLOC_USAGE_SW_WRITE_OFTEN);
#else
        setUsage(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN);
#endif
    }

    ANativeWindowBuffer* out;