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

Commit e3f62f84 authored by Ramkumar Radhakrishnan's avatar Ramkumar Radhakrishnan Committed by Manish Kumar
Browse files

sf: Override presentation layer with ext_only layer

Do not add presentation layer to the external list when external only
layer is present.

Change-Id: I46c8a85a572f88a2d4026c4026d99fd037b928be
(cherry picked from commit 9b39ac80890e77177427acec3f6e423085265491)
(cherry picked from commit d5be54b045571e0b9d139bd1022d922137c13bb9)
(cherry picked from commit a72ea507c0587031910e484d989ab32179a7ddfe)
parent f5fb2ed2
Loading
Loading
Loading
Loading
+32 −24
Original line number Diff line number Diff line
@@ -1015,14 +1015,13 @@ void SurfaceFlinger::rebuildLayerStacks() {
            const Rect bounds(hw->getBounds());
            int dpyId = hw->getHwcDisplayId();
            if (hw->canDraw()) {
                SurfaceFlinger::computeVisibleRegions(dpyId, currentLayers,
                SurfaceFlinger::computeVisibleRegions(dpyId, layers,
                        hw->getLayerStack(), dirtyRegion, opaqueRegion);

                const size_t count = layers.size();
                for (size_t i=0 ; i<count ; i++) {
                    const sp<Layer>& layer(layers[i]);
                    const Layer::State& s(layer->getDrawingState());
                    if (s.layerStack == hw->getLayerStack()) {
                    Region drawRegion(tr.transform(
                            layer->visibleNonTransparentRegion));
                    drawRegion.andSelf(bounds);
@@ -1031,7 +1030,6 @@ void SurfaceFlinger::rebuildLayerStacks() {
                    }
                }
            }
            }
            hw->setVisibleLayersSortedByZ(layersSortedByZ);
            hw->undefinedRegion.set(bounds);
            hw->undefinedRegion.subtractSelf(tr.transform(opaqueRegion));
@@ -1495,7 +1493,21 @@ void SurfaceFlinger::computeVisibleRegions(size_t dpy,

    outDirtyRegion.clear();
    bool bIgnoreLayers = false;
    int extOnlyLayerIndex = -1;
    size_t i = currentLayers.size();
#ifdef QCOM_BSP
    while (i--) {
        const sp<Layer>& layer = currentLayers[i];
        // iterate through the layer list to find ext_only layers and store
        // the index
        if ((dpy && layer->isExtOnly())) {
            bIgnoreLayers = true;
            extOnlyLayerIndex = i;
            break;
        }
    }
    i = currentLayers.size();
#endif
    while (i--) {
        const sp<Layer>& layer = currentLayers[i];

@@ -1503,35 +1515,31 @@ void SurfaceFlinger::computeVisibleRegions(size_t dpy,
        const Layer::State& s(layer->getDrawingState());

#ifdef QCOM_BSP
        if(bIgnoreLayers) {
            // Ignore all other layers except the layers marked as ext_only
            // by setting visible non transparent region empty.
            Region visibleNonTransRegion;
            visibleNonTransRegion.set(Rect(0,0));
            layer->setVisibleNonTransparentRegion(visibleNonTransRegion);
            continue;
        }
        // Only add the layer marked as "external_only" to external list and
        // only remove the layer marked as "external_only" from primary list
        // and do not add the layer marked as "internal_only" to external list
        if ((dpy && layer->isExtOnly())) {
            bIgnoreLayers = true;
        } else if(layer->isExtOnly() || (dpy && layer->isIntOnly())) {
            // Ignore only ext_only layers for primary by setting
            // visible non transparent region empty.
        if((bIgnoreLayers && extOnlyLayerIndex != (int)i) ||
           (!dpy && layer->isExtOnly()) ||
           (dpy && layer->isIntOnly())) {
            // Ignore all other layers except the layers marked as ext_only
            // by setting visible non transparent region empty.
            Region visibleNonTransRegion;
            visibleNonTransRegion.set(Rect(0,0));
            layer->setVisibleNonTransparentRegion(visibleNonTransRegion);
            continue;
        }
#endif

        // only consider the layers on the given later stack
        // Override layers created using presentation class by the layers having
        // ext_only flag enabled
        if (s.layerStack != layerStack && !bIgnoreLayers)
        if(s.layerStack != layerStack && !bIgnoreLayers) {
            // set the visible region as empty since we have removed the
            // layerstack check in rebuildLayerStack() function.
            Region visibleNonTransRegion;
            visibleNonTransRegion.set(Rect(0,0));
            layer->setVisibleNonTransparentRegion(visibleNonTransRegion);
            continue;

        }
        /*
         * opaqueRegion: area of a surface that is fully opaque.
         */