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

Commit 5fb19b1c authored by Ramkumar Radhakrishnan's avatar Ramkumar Radhakrishnan Committed by Steve Kondik
Browse files

sf: Validate display device id and disable dirtyrect composition

1. Add validation check for display device id to prevent out of bound
   array access.
2. Disable Dirty rect composition feature for GPU by default

Change-Id: I4976468bb156fff197c8c38fe680e10512b4feb5
parent 33053923
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -1533,6 +1533,8 @@ HWComposer::DisplayData::~DisplayData() {
#ifdef QCOM_BSP
//======================== GPU TiledRect/DR changes =====================
bool HWComposer::areVisibleRegionsOverlapping(int32_t id ) {
    if (!mHwc || uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id))
        return false;
    const Vector< sp<Layer> >& currentLayers  =
            mFlinger->getLayerSortedByZForHwcDisplay(id);
    size_t count = currentLayers.size();
@@ -1550,6 +1552,8 @@ bool HWComposer::areVisibleRegionsOverlapping(int32_t id ) {
}

bool HWComposer::needsScaling(int32_t id) {
    if (!mHwc || uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id))
        return false;
    DisplayData& disp(mDisplayData[id]);
    for (size_t i=0; i<disp.list->numHwLayers-1; i++) {
        int dst_w, dst_h, src_w, src_h;
@@ -1575,6 +1579,8 @@ bool HWComposer::needsScaling(int32_t id) {
}

void HWComposer::computeUnionDirtyRect(int32_t id, Rect& unionDirtyRect) {
    if (!mHwc || uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id))
        return;
    const Vector< sp<Layer> >& currentLayers =
            mFlinger->getLayerSortedByZForHwcDisplay(id);
    size_t count = currentLayers.size();
@@ -1607,6 +1613,8 @@ void HWComposer::computeUnionDirtyRect(int32_t id, Rect& unionDirtyRect) {
}

bool HWComposer::isGeometryChanged(int32_t id) {
    if (!mHwc || uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id))
        return false;
    DisplayData& disp(mDisplayData[id]);
    return ( disp.list->flags & HWC_GEOMETRY_CHANGED );
}
@@ -1615,8 +1623,10 @@ bool HWComposer::isGeometryChanged(int32_t id) {
 * 2. if overlapping visible regions present.
 * 3. Compute a Union Dirty Rect to operate on. */
bool HWComposer::canUseTiledDR(int32_t id, Rect& unionDr ){
    bool status = true;
    if (!mHwc || uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id))
        return false;

    bool status = true;
    if (isGeometryChanged(id)) {
        ALOGD_IF(GPUTILERECT_DEBUG, "GPUTileRect : geometrychanged, disable");
        status = false;
+1 −1
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ SurfaceFlinger::SurfaceFlinger()
        }
    }
#ifdef QCOM_BSP
    property_get("debug.sf.gpu_comp_tiling", value, "1");
    property_get("debug.sf.gpu_comp_tiling", value, "0");
    mGpuTileRenderEnable = atoi(value) ? true : false;
    if(mGpuTileRenderEnable)
       ALOGV("DirtyRect optimization enabled for FULL GPU Composition");