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

Commit fc330a6b authored by Wei Zou's avatar Wei Zou Committed by toastcfh
Browse files

frameworks/base: Update dirty region feature for current surface

In HardwareRender module, when a surface is made to current, check to turn on the
"dirty region" feature if it is enabled. This is to ensure current surface has
preserved-buffer swap enabled if the "dirty region" feature is on.

Change-Id: I4878238955a0adcd714e42b46bbbe9011283db28
parent ea52d7e0
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -456,6 +456,8 @@ public abstract class HardwareRenderer {
        }

        boolean mDirtyRegionsEnabled;
        boolean mUpdateDirtyRegions;

        final boolean mVsyncDisabled;

        final int mGlVersion;
@@ -690,6 +692,12 @@ public abstract class HardwareRenderer {
            
            initCaches();

            enableDirtyRegions();

            return mEglContext.getGL();
        }

        private void enableDirtyRegions() {
            // If mDirtyRegions is set, this means we have an EGL configuration
            // with EGL_SWAP_BEHAVIOR_PRESERVED_BIT set
            if (sDirtyRegions) {
@@ -705,8 +713,6 @@ public abstract class HardwareRenderer {
                // configuration (see RENDER_DIRTY_REGIONS)
                mDirtyRegionsEnabled = GLES20Canvas.isBackBufferPreserved();
            }

            return mEglContext.getGL();
        }

        abstract void initCaches();
@@ -760,6 +766,9 @@ public abstract class HardwareRenderer {
                if (!createSurface(holder)) {
                    return;
                }

                mUpdateDirtyRegions = true;

                if (mCanvas != null) {
                    setEnabled(true);
                }
@@ -930,6 +939,10 @@ public abstract class HardwareRenderer {
                    fallback(true);
                    return SURFACE_STATE_ERROR;
                } else {
                    if (mUpdateDirtyRegions) {
                        enableDirtyRegions();
                        mUpdateDirtyRegions = false;
                    }
                    return SURFACE_STATE_UPDATED;
                }
            }