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

Commit b04f7e94 authored by Romain Guy's avatar Romain Guy
Browse files

Make it easier to enable dirty regions debugging

adb shell setprop hwui.debug_dirty_regions true

Change-Id: Ifd269c443f5257b1e9c4ea987b134dcf6231106c
parent 91ec0b72
Loading
Loading
Loading
Loading
+24 −10
Original line number Diff line number Diff line
@@ -109,8 +109,12 @@ public abstract class HardwareRenderer {

    /**
     * Turn on to draw dirty regions every other frame.
     *
     * Possible values:
     * "true", to enable dirty regions debugging
     * "false", to disable dirty regions debugging
     */
    private static final boolean DEBUG_DIRTY_REGION = false;
    static final String DEBUG_DIRTY_REGIONS_PROPERTY = "hwui.debug_dirty_regions";
    
    /**
     * A process can set this flag to false to prevent the use of hardware
@@ -492,6 +496,8 @@ public abstract class HardwareRenderer {
        final float[] mProfileData;
        int mProfileCurrentFrame = -PROFILE_FRAME_DATA_COUNT;
        
        final boolean mDebugDirtyRegions;

        final int mGlVersion;
        final boolean mTranslucent;

@@ -503,16 +509,18 @@ public abstract class HardwareRenderer {
            mGlVersion = glVersion;
            mTranslucent = translucent;
            
            final String vsyncProperty = SystemProperties.get(DISABLE_VSYNC_PROPERTY, "false");
            mVsyncDisabled = "true".equalsIgnoreCase(vsyncProperty);
            String property;

            property = SystemProperties.get(DISABLE_VSYNC_PROPERTY, "false");
            mVsyncDisabled = "true".equalsIgnoreCase(property);
            if (mVsyncDisabled) {
                Log.d(LOG_TAG, "Disabling v-sync");
            }

            //noinspection PointlessBooleanExpression,ConstantConditions
            if (!ViewDebug.DEBUG_LATENCY) {
                final String profileProperty = SystemProperties.get(PROFILE_PROPERTY, "false");
                mProfileEnabled = "true".equalsIgnoreCase(profileProperty);
                property = SystemProperties.get(PROFILE_PROPERTY, "false");
                mProfileEnabled = "true".equalsIgnoreCase(property);
                if (mProfileEnabled) {
                    Log.d(LOG_TAG, "Profiling hardware renderer");
                }
@@ -525,6 +533,12 @@ public abstract class HardwareRenderer {
            } else {
                mProfileData = null;
            }

            property = SystemProperties.get(DEBUG_DIRTY_REGIONS_PROPERTY, "false");
            mDebugDirtyRegions = "true".equalsIgnoreCase(property);
            if (mDebugDirtyRegions) {
                Log.d(LOG_TAG, "Debugging dirty regions");
            }
        }

        @Override
@@ -981,8 +995,12 @@ public abstract class HardwareRenderer {
                            // Shouldn't reach here
                            view.draw(canvas);
                        }
                    } finally {
                        callbacks.onHardwarePostDraw(canvas);
                        canvas.restoreToCount(saveCount);
                        view.mRecreateDisplayList = false;

                        if (DEBUG_DIRTY_REGION) {
                        if (mDebugDirtyRegions) {
                            if (mDebugPaint == null) {
                                mDebugPaint = new Paint();
                                mDebugPaint.setColor(0x7fff0000);
@@ -991,10 +1009,6 @@ public abstract class HardwareRenderer {
                                canvas.drawRect(dirty, mDebugPaint);
                            }
                        }
                    } finally {
                        callbacks.onHardwarePostDraw(canvas);
                        canvas.restoreToCount(saveCount);
                        view.mRecreateDisplayList = false;
                    }

                    onPostDraw();