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

Commit 6897f770 authored by Saurabh Dubey's avatar Saurabh Dubey Committed by Bruno Martins
Browse files

SF: Add support for 64 bit consumer usage flag

Change consumer usage query calls to get 64 bit flags.
Make modifications to accomodate 64 bit flags.

Change-Id: I55c0811cb58dca791ed1b3a70d2de876aeac042c
CRs-Fixed: 2223978
parent e2069e25
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -110,11 +110,9 @@ void DisplayUtils::initVDSInstance(HWComposer & hwc, int32_t hwcDisplayId,
    }
}

bool DisplayUtils::canAllocateHwcDisplayIdForVDS(int usage) {
    // on android builds with QTI_BSP disabled,
    // we should allocate hwc display id for virtual display.
    int flag_mask_pvt_wfd = 0xffffffff;
    int flag_mask_hw_video = 0xffffffff;
bool DisplayUtils::canAllocateHwcDisplayIdForVDS(uint64_t usage) {
    uint64_t flag_mask_pvt_wfd = ~0;
    uint64_t flag_mask_hw_video = ~0;
    char value[PROPERTY_VALUE_MAX] = {};
    property_get("vendor.display.vds_allow_hwc", value, "0");
    int allowHwcForVDS = atoi(value);
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ class DisplayUtils {
            sp<IGraphicBufferProducer> &producer, sp<IGraphicBufferProducer> bqProducer,
            sp<IGraphicBufferConsumer> bqConsumer, String8 currentStateDisplayName,
            bool currentStateIsSecure);
    bool canAllocateHwcDisplayIdForVDS(int usage);
    bool canAllocateHwcDisplayIdForVDS(uint64_t usage);
    bool skipColorLayer(const char* layerType);
    DisplayUtils();
  private:
+2 −2
Original line number Diff line number Diff line
@@ -47,12 +47,12 @@ ExVirtualDisplaySurface::ExVirtualDisplaySurface(HWComposer& hwc, int32_t dispId
        bool secure)
:   VirtualDisplaySurface(hwc, dispId, sink, bqProducer, bqConsumer, name),
   mSecure(secure) {
   sink->query(NATIVE_WINDOW_CONSUMER_USAGE_BITS, &mSinkUsage);
   sink->getConsumerUsage(&mSinkUsage);
   mSinkUsage |= GRALLOC_USAGE_HW_COMPOSER;
   setOutputUsage(mSinkUsage);

    if (HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED == mOutputFormat) {
        int sinkUsage = (mSinkUsage & GRALLOC_USAGE_HW_VIDEO_ENCODER);
        uint64_t sinkUsage = (mSinkUsage & GRALLOC_USAGE_HW_VIDEO_ENCODER);
        sinkUsage |= (mSinkUsage & GRALLOC_USAGE_PRIVATE_WFD);

        if (!sinkUsage) {
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ private:
    virtual status_t beginFrame(bool mustRecompose);
    virtual void setOutputUsage(uint64_t flag);
    bool mSecure;
    int mSinkUsage;
    uint64_t mSinkUsage;
};

}; // namespace android
+2 −3
Original line number Diff line number Diff line
@@ -2560,10 +2560,9 @@ void SurfaceFlinger::processDisplayChangesLocked() {
                            if (maxVirtualDisplaySize == 0 ||
                                 ( (uint64_t)width <= maxVirtualDisplaySize &&
                                 (uint64_t)height <= maxVirtualDisplaySize)) {
                                int usage = 0;
                                uint64_t usage = 0;
                                // Replace with native_window_get_consumer_usage ?
                                status = state.surface->query(
                                         NATIVE_WINDOW_CONSUMER_USAGE_BITS, &usage);
                                status = state.surface->getConsumerUsage(&usage);
                                ALOGW_IF(status != NO_ERROR, "Unable to query usage (%d)", status);
                                if ( (status == NO_ERROR) &&
                                     displayUtils->canAllocateHwcDisplayIdForVDS(usage)) {