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

Commit 13631f3d authored by Romain Guy's avatar Romain Guy
Browse files

Add debug markers to OpenGLRenderer

These markers will be used to group the GL commands by View in the
OpenGL ES debugging tool. This will help correlate individual GL
calls to higher level components like Views.

Change-Id: I73607ba2e7224a80ac32527968261ee008f049c6
parent 275345b0
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -378,6 +378,12 @@ class GLES20Canvas extends HardwareCanvas {

    private static native int nGetDisplayListSize(int displayList);

    static void setDisplayListName(int displayList, String name) {
        nSetDisplayListName(displayList, name);
    }

    private static native void nSetDisplayListName(int displayList, String name);

    @Override
    public boolean drawDisplayList(DisplayList displayList, int width, int height, Rect dirty) {
        return nDrawDisplayList(mRenderer,
+8 −0
Original line number Diff line number Diff line
@@ -31,10 +31,17 @@ class GLES20DisplayList extends DisplayList {
    private GLES20RecordingCanvas mCanvas;
    private boolean mValid;

    // Used for debugging
    private final String mName;

    // The native display list will be destroyed when this object dies.
    // DO NOT overwrite this reference once it is set.
    private DisplayListFinalizer mFinalizer;

    GLES20DisplayList(String name) {
        mName = name;
    }

    int getNativeDisplayList() {
        if (!mValid || mFinalizer == null) {
            throw new IllegalStateException("The display list is not valid.");
@@ -75,6 +82,7 @@ class GLES20DisplayList extends DisplayList {
                mCanvas.end(mFinalizer.mNativeDisplayList);
            } else {
                mFinalizer = new DisplayListFinalizer(mCanvas.end(0));
                GLES20Canvas.setDisplayListName(mFinalizer.mNativeDisplayList, mName);
            }
            mCanvas.recycle();
            mCanvas = null;
+6 −3
Original line number Diff line number Diff line
@@ -283,9 +283,12 @@ public abstract class HardwareRenderer {
     * Creates a new display list that can be used to record batches of
     * drawing operations.
     * 
     * @param name The name of the display list, used for debugging purpose.
     *             May be null
     * 
     * @return A new display list.
     */
    public abstract DisplayList createDisplayList();
    public abstract DisplayList createDisplayList(String name);

    /**
     * Creates a new hardware layer. A hardware layer built by calling this
@@ -1094,8 +1097,8 @@ public abstract class HardwareRenderer {
        }

        @Override
        public DisplayList createDisplayList() {
            return new GLES20DisplayList();
        public DisplayList createDisplayList(String name) {
            return new GLES20DisplayList(name);
        }

        @Override
+2 −1
Original line number Diff line number Diff line
@@ -10374,7 +10374,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
            // we copy in child display lists into ours in drawChild()
            mRecreateDisplayList = true;
            if (mDisplayList == null) {
                mDisplayList = mAttachInfo.mHardwareRenderer.createDisplayList();
                final String name = getClass().getSimpleName();
                mDisplayList = mAttachInfo.mHardwareRenderer.createDisplayList(name);
                // If we're creating a new display list, make sure our parent gets invalidated
                // since they will need to recreate their display list to account for this
                // new child display list.
+1 −1
Original line number Diff line number Diff line
@@ -5022,7 +5022,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            if (mTextDisplayList == null || !mTextDisplayList.isValid() ||
                    !mTextDisplayListIsValid) {
                if (mTextDisplayList == null) {
                    mTextDisplayList = getHardwareRenderer().createDisplayList();
                    mTextDisplayList = getHardwareRenderer().createDisplayList("Text");
                }

                final HardwareCanvas hardwareCanvas = mTextDisplayList.start();
Loading