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

Commit 4c9b6123 authored by Ramkumar Radhakrishnan's avatar Ramkumar Radhakrishnan Committed by Linux Build Service Account
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
parent af92c01e
Loading
Loading
Loading
Loading
+31 −24
Original line number Original line Diff line number Diff line
@@ -898,7 +898,6 @@ void SurfaceFlinger::rebuildLayerStacks() {
                for (size_t i=0 ; i<count ; i++) {
                for (size_t i=0 ; i<count ; i++) {
                    const sp<Layer>& layer(currentLayers[i]);
                    const sp<Layer>& layer(currentLayers[i]);
                    const Layer::State& s(layer->drawingState());
                    const Layer::State& s(layer->drawingState());
                    if (s.layerStack == hw->getLayerStack()) {
                    Region drawRegion(tr.transform(
                    Region drawRegion(tr.transform(
                            layer->visibleNonTransparentRegion));
                            layer->visibleNonTransparentRegion));
                    drawRegion.andSelf(bounds);
                    drawRegion.andSelf(bounds);
@@ -907,7 +906,6 @@ void SurfaceFlinger::rebuildLayerStacks() {
                    }
                    }
                }
                }
            }
            }
            }
            hw->setVisibleLayersSortedByZ(layersSortedByZ);
            hw->setVisibleLayersSortedByZ(layersSortedByZ);
            hw->undefinedRegion.set(bounds);
            hw->undefinedRegion.set(bounds);
            hw->undefinedRegion.subtractSelf(tr.transform(opaqueRegion));
            hw->undefinedRegion.subtractSelf(tr.transform(opaqueRegion));
@@ -1366,43 +1364,52 @@ void SurfaceFlinger::computeVisibleRegions(size_t dpy,


    outDirtyRegion.clear();
    outDirtyRegion.clear();
    bool bIgnoreLayers = false;
    bool bIgnoreLayers = false;
    int extOnlyLayerIndex = -1;
    size_t i = currentLayers.size();
    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--) {
    while (i--) {
        const sp<Layer>& layer = currentLayers[i];
        const sp<Layer>& layer = currentLayers[i];


        // start with the whole surface at its current location
        // start with the whole surface at its current location
        const Layer::State& s(layer->drawingState());
        const Layer::State& s(layer->drawingState());

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

        // only consider the layers on the given later stack
        // only consider the layers on the given later stack
        // Override layers created using presentation class by the layers having
        // Override layers created using presentation class by the layers having
        // ext_only flag enabled
        // 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;
            continue;

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