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

Commit b2a4b52e authored by Chet Haase's avatar Chet Haase
Browse files

Add ability for hierarchyviewer to output displaylist info

Clicking on a node in hierarchyviewer1 and hierarchyviewer2 and then
clicking the new "Dump DisplayList" button will cause the display
list for the selected node (including its children) to be output into
logcat.

Change-Id: Id32f62569ad1ab4d533bc62987f3a7390c1bb4e6
parent b969d2d9
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -261,6 +261,13 @@ class GLES20Canvas extends HardwareCanvas {
    private static native boolean nDrawDisplayList(int renderer, int displayList,
            int width, int height, Rect dirty);

    @Override
    void outputDisplayList(DisplayList displayList) {
        nOutputDisplayList(mRenderer, ((GLES20DisplayList) displayList).mNativeDisplayList);
    }

    private static native void nOutputDisplayList(int renderer, int displayList);

    ///////////////////////////////////////////////////////////////////////////
    // Hardware layer
    ///////////////////////////////////////////////////////////////////////////
+8 −0
Original line number Diff line number Diff line
@@ -63,6 +63,14 @@ public abstract class HardwareCanvas extends Canvas {
     */
    abstract boolean drawDisplayList(DisplayList displayList, int width, int height, Rect dirty);

    /**
     * Outputs the specified display list to the log. This method exists for use by
     * tools to output display lists for selected nodes to the log.
     *
     * @param displayList The display list to be logged.
     */
    abstract void outputDisplayList(DisplayList displayList);

    /**
     * Draws the specified layer onto this canvas.
     *
+8 −0
Original line number Diff line number Diff line
@@ -375,6 +375,7 @@ public class ViewDebug {
    private static final String REMOTE_COMMAND_REQUEST_LAYOUT = "REQUEST_LAYOUT";
    private static final String REMOTE_PROFILE = "PROFILE";
    private static final String REMOTE_COMMAND_CAPTURE_LAYERS = "CAPTURE_LAYERS";
    private static final String REMOTE_COMMAND_OUTPUT_DISPLAYLIST = "OUTPUT_DISPLAYLIST";

    private static HashMap<Class<?>, Field[]> sFieldsForClasses;
    private static HashMap<Class<?>, Method[]> sMethodsForClasses;
@@ -885,6 +886,8 @@ public class ViewDebug {
            final String[] params = parameters.split(" ");
            if (REMOTE_COMMAND_CAPTURE.equalsIgnoreCase(command)) {
                capture(view, clientStream, params[0]);
            } else if (REMOTE_COMMAND_OUTPUT_DISPLAYLIST.equalsIgnoreCase(command)) {
                outputDisplayList(view, params[0]);
            } else if (REMOTE_COMMAND_INVALIDATE.equalsIgnoreCase(command)) {
                invalidate(view, params[0]);
            } else if (REMOTE_COMMAND_REQUEST_LAYOUT.equalsIgnoreCase(command)) {
@@ -1156,6 +1159,11 @@ public class ViewDebug {
        }
    }

    private static void outputDisplayList(View root, String parameter) throws IOException {
        final View view = findView(root, parameter);
        view.getViewRoot().outputDisplayList(view);
    }

    private static void capture(View root, final OutputStream clientStream, String parameter)
            throws IOException {

+14 −0
Original line number Diff line number Diff line
@@ -1507,6 +1507,20 @@ public final class ViewRoot extends Handler implements ViewParent,
        }
    }

    /**
     * @hide
     */
    void outputDisplayList(View view) {
        if (mAttachInfo != null && mAttachInfo.mHardwareCanvas != null) {

            HardwareCanvas canvas = (HardwareCanvas) mAttachInfo.mHardwareCanvas;
            DisplayList displayList = view.getDisplayList();
            if (displayList != null) {
                canvas.outputDisplayList(displayList);
            }
        }
    }

    private void draw(boolean fullRedrawNeeded) {
        Surface surface = mSurface;
        if (surface == null || !surface.isValid()) {
+6 −1
Original line number Diff line number Diff line
@@ -519,6 +519,11 @@ static bool android_view_GLES20Canvas_drawDisplayList(JNIEnv* env,
    return redraw;
}

static void android_view_GLES20Canvas_outputDisplayList(JNIEnv* env,
        jobject clazz, OpenGLRenderer* renderer, DisplayList* displayList) {
    renderer->outputDisplayList(displayList);
}

// ----------------------------------------------------------------------------
// Layers
// ----------------------------------------------------------------------------
@@ -714,7 +719,7 @@ static JNINativeMethod gMethods[] = {
    { "nGetDisplayListRenderer", "(I)I",       (void*) android_view_GLES20Canvas_getDisplayListRenderer },
    { "nDrawDisplayList",        "(IIIILandroid/graphics/Rect;)Z",
                                               (void*) android_view_GLES20Canvas_drawDisplayList },

    { "nOutputDisplayList",      "(II)V",      (void*) android_view_GLES20Canvas_outputDisplayList },
    { "nInterrupt",              "(I)V",       (void*) android_view_GLES20Canvas_interrupt },
    { "nResume",                 "(I)V",       (void*) android_view_GLES20Canvas_resume },

Loading