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

Commit e248bd1b authored by John Reck's avatar John Reck
Browse files

Serializing display lists

This is a WIP prototype

Change-Id: Id4bfcf2b7bf905221c3734b7b6887c9b2efd37e6
parent c0877bb0
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -407,6 +407,10 @@ public class ThreadedRenderer extends HardwareRenderer {
        nRegisterAnimatingRenderNode(mRootNode.mNativeRenderNode, animator.mNativeRenderNode);
    }

    public void serializeDisplayListTree() {
        nSerializeDisplayListTree(mNativeProxy);
    }

    @Override
    protected void finalize() throws Throwable {
        try {
@@ -532,6 +536,8 @@ public class ThreadedRenderer extends HardwareRenderer {
    private static native void nStopDrawing(long nativeProxy);
    private static native void nNotifyFramePending(long nativeProxy);

    private static native void nSerializeDisplayListTree(long nativeProxy);

    private static native void nDumpProfileInfo(long nativeProxy, FileDescriptor fd,
            @DumpFlags int dumpFlags);
    private static native void nDumpProfileData(byte[] data, FileDescriptor fd);
+3 −0
Original line number Diff line number Diff line
@@ -2276,6 +2276,9 @@ public final class ViewRootImpl implements ViewParent,
     */
    void outputDisplayList(View view) {
        view.mRenderNode.output();
        if (mAttachInfo.mHardwareRenderer != null) {
            ((ThreadedRenderer)mAttachInfo.mHardwareRenderer).serializeDisplayListTree();
        }
    }

    /**
+7 −0
Original line number Diff line number Diff line
@@ -418,6 +418,12 @@ static void android_view_ThreadedRenderer_notifyFramePending(JNIEnv* env, jobjec
    proxy->notifyFramePending();
}

static void android_view_ThreadedRenderer_serializeDisplayListTree(JNIEnv* env, jobject clazz,
        jlong proxyPtr) {
    RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr);
    proxy->serializeDisplayListTree();
}

static void android_view_ThreadedRenderer_dumpProfileInfo(JNIEnv* env, jobject clazz,
        jlong proxyPtr, jobject javaFileDescriptor, jint dumpFlags) {
    RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr);
@@ -483,6 +489,7 @@ static JNINativeMethod gMethods[] = {
    { "nFence", "(J)V", (void*) android_view_ThreadedRenderer_fence },
    { "nStopDrawing", "(J)V", (void*) android_view_ThreadedRenderer_stopDrawing },
    { "nNotifyFramePending", "(J)V", (void*) android_view_ThreadedRenderer_notifyFramePending },
    { "nSerializeDisplayListTree", "(J)V", (void*) android_view_ThreadedRenderer_serializeDisplayListTree },
    { "nDumpProfileInfo", "(JLjava/io/FileDescriptor;I)V", (void*) android_view_ThreadedRenderer_dumpProfileInfo },
    { "nDumpProfileData", "([BLjava/io/FileDescriptor;)V", (void*) android_view_ThreadedRenderer_dumpProfileData },
    { "setupShadersDiskCache", "(Ljava/lang/String;)V",
+16 −4
Original line number Diff line number Diff line
@@ -75,7 +75,8 @@ hwui_src_files := \
    TessellationCache.cpp \
    TextDropShadowCache.cpp \
    Texture.cpp \
    TextureCache.cpp
    TextureCache.cpp \
    protos/hwui.proto

hwui_cflags := \
    -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES \
@@ -92,6 +93,12 @@ ifdef HWUI_COMPILE_FOR_PERF
    hwui_cflags += -fno-omit-frame-pointer -marm -mapcs
endif

# This has to be lazy-resolved because it depends on the LOCAL_MODULE_CLASS
# which varies depending on what is being built
define hwui_proto_include
$(call local-generated-sources-dir)/proto/$(LOCAL_PATH)
endef

hwui_c_includes += \
    external/skia/src/core

@@ -104,6 +111,7 @@ hwui_shared_libraries := \
    libskia \
    libui \
    libgui \
    libprotobuf-cpp-lite \

ifneq (false,$(ANDROID_ENABLE_RENDERSCRIPT))
    hwui_cflags += -DANDROID_ENABLE_RENDERSCRIPT
@@ -126,7 +134,8 @@ LOCAL_MODULE := libhwui_static
LOCAL_SHARED_LIBRARIES := $(hwui_shared_libraries)
LOCAL_CFLAGS := $(hwui_cflags)
LOCAL_SRC_FILES := $(hwui_src_files)
LOCAL_C_INCLUDES := $(hwui_c_includes)
LOCAL_C_INCLUDES := $(hwui_c_includes) $(call hwui_proto_include)
LOCAL_EXPORT_C_INCLUDE_DIRS := $(hwui_c_includes) $(call hwui_proto_include)

include $(BUILD_STATIC_LIBRARY)

@@ -153,7 +162,6 @@ LOCAL_MODULE := hwui_unit_tests
LOCAL_MODULE_TAGS := tests
LOCAL_SHARED_LIBRARIES := $(hwui_shared_libraries)
LOCAL_STATIC_LIBRARIES := libhwui_static
LOCAL_C_INCLUDES := $(hwui_c_includes)
LOCAL_CFLAGS := $(hwui_cflags)

LOCAL_SRC_FILES += \
@@ -172,16 +180,20 @@ include $(CLEAR_VARS)
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/local/tmp
LOCAL_MODULE:= hwuitest
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MULTILIB := both
LOCAL_MODULE_STEM_32 := hwuitest
LOCAL_MODULE_STEM_64 := hwuitest64
LOCAL_SHARED_LIBRARIES := $(hwui_shared_libraries)
LOCAL_CFLAGS := $(hwui_cflags)
LOCAL_C_INCLUDES := $(hwui_c_includes)

HWUI_NULL_GPU := false

ifeq (true, $(HWUI_NULL_GPU))
    # Only need to specify the includes if we are not linking against
    # libhwui_static as libhwui_static exports the appropriate includes
    LOCAL_C_INCLUDES := $(hwui_c_includes) $(call hwui_proto_include)

    LOCAL_SRC_FILES := \
        $(hwui_src_files) \
        tests/nullegl.cpp \
+19 −7
Original line number Diff line number Diff line
@@ -26,6 +26,13 @@ namespace uirenderer {

class Outline {
public:
    enum class Type {
        None = 0,
        Empty = 1,
        ConvexPath = 2,
        RoundRect = 3
    };

    Outline()
            : mShouldClip(false)
            , mType(Type::None)
@@ -122,14 +129,19 @@ public:
        return &mPath;
    }

private:
    enum class Type {
        None = 0,
        Empty = 1,
        ConvexPath = 2,
        RoundRect = 3
    };
    Type getType() const {
        return mType;
    }

    const Rect& getBounds() const {
        return mBounds;
    }

    float getRadius() const {
        return mRadius;
    }

private:
    bool mShouldClip;
    Type mType;
    Rect mBounds;
Loading