diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/hwui/Android.bp | 386 | ||||
| -rw-r--r-- | libs/hwui/Android.mk | 384 | ||||
| -rw-r--r-- | libs/hwui/Glop.h | 1 | ||||
| -rw-r--r-- | libs/hwui/GlopBuilder.cpp | 1 | ||||
| -rw-r--r-- | libs/hwui/JankTracker.cpp | 1 | ||||
| -rw-r--r-- | libs/hwui/ProgramCache.cpp | 31 | ||||
| -rw-r--r-- | libs/hwui/hwui_static_deps.mk | 33 | ||||
| -rw-r--r-- | libs/hwui/renderstate/RenderState.cpp | 32 | ||||
| -rw-r--r-- | libs/hwui/tests/unit/BakedOpDispatcherTests.cpp | 2 | ||||
| -rw-r--r-- | libs/input/Android.bp | 44 | ||||
| -rw-r--r-- | libs/input/Android.mk | 54 |
11 files changed, 475 insertions, 494 deletions
diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp new file mode 100644 index 000000000000..ae4eabf94d07 --- /dev/null +++ b/libs/hwui/Android.bp @@ -0,0 +1,386 @@ +cc_defaults { + name: "hwui_defaults", + defaults: [ + "hwui_static_deps", + + //"hwui_bugreport_font_cache_usage", + //"hwui_compile_for_perf", + + // Enables fine-grained GLES error checking + // If enabled, every GLES call is wrapped & error checked + // Has moderate overhead + //"hwui_enable_opengl-validation", + ], + + cflags: [ + "-DEGL_EGLEXT_PROTOTYPES", + "-DGL_GLEXT_PROTOTYPES", + "-DATRACE_TAG=ATRACE_TAG_VIEW", + "-DLOG_TAG=\"OpenGLRenderer\"", + "-Wall", + "-Wno-unused-parameter", + "-Wunreachable-code", + "-Werror", + "-fvisibility=hidden", + + // GCC false-positives on this warning, and since we -Werror that's + // a problem + "-Wno-free-nonheap-object", + + // clang's warning is broken, see: https://llvm.org/bugs/show_bug.cgi?id=21629 + "-Wno-missing-braces", + + // TODO: Linear blending should be enabled by default, but we are + // TODO: making it an opt-in while it's a work in progress + //"-DANDROID_ENABLE_LINEAR_BLENDING", + ], + + include_dirs: [ + "external/skia/include/private", + "external/skia/src/core", + "external/skia/src/effects", + "external/skia/src/image", + "external/skia/src/utils", + ], + + product_variables: { + device_uses_hwc2: { + cflags: ["-DUSE_HWC2"], + }, + }, +} + +cc_defaults { + name: "hwui_static_deps", + shared_libs: [ + "liblog", + "libcutils", + "libutils", + "libEGL", + "libGLESv2", + "libvulkan", + "libskia", + "libui", + "libgui", + "libprotobuf-cpp-full", + "libharfbuzz_ng", + "libft2", + "libminikin", + "libandroidfw", + "libRScpp", + ], + static_libs: [ + "libplatformprotos", + ], +} + +cc_defaults { + name: "hwui_bugreport_font_cache_usage", + srcs: ["font/FontCacheHistoryTracker.cpp"], + cflags: ["-DBUGREPORT_FONT_CACHE_USAGE"], +} + +cc_defaults { + name: "hwui_compile_for_perf", + // TODO: Non-arm? + cflags: [ + "-fno-omit-frame-pointer", + "-marm", + "-mapcs", + ], +} + +cc_defaults { + name: "hwui_debug", + cflags: ["-include debug/wrap_gles.h"], + srcs: [ + "debug/wrap_gles.cpp", + "debug/DefaultGlesDriver.cpp", + "debug/GlesErrorCheckWrapper.cpp", + "debug/GlesDriver.cpp", + "debug/FatalBaseDriver.cpp", + "debug/NullGlesDriver.cpp", + ], + include_dirs: ["frameworks/native/opengl/libs/GLES2"], +} + +cc_defaults { + name: "hwui_enable_opengl_validation", + defaults: ["hwui_debug"], + cflags: ["-DDEBUG_OPENGL=3"], + srcs: ["debug/wrap_gles.cpp"], + include_dirs: ["frameworks/native/opengl/libs/GLES2"], +} + +// ------------------------ +// library +// ------------------------ + +cc_defaults { + name: "libhwui_defaults", + defaults: ["hwui_defaults"], + srcs: [ + "hwui/Bitmap.cpp", + "font/CacheTexture.cpp", + "font/Font.cpp", + "hwui/Canvas.cpp", + "hwui/MinikinSkia.cpp", + "hwui/MinikinUtils.cpp", + "hwui/PaintImpl.cpp", + "hwui/Typeface.cpp", + "pipeline/skia/GLFunctorDrawable.cpp", + "pipeline/skia/LayerDrawable.cpp", + "pipeline/skia/RenderNodeDrawable.cpp", + "pipeline/skia/ReorderBarrierDrawables.cpp", + "pipeline/skia/SkiaDisplayList.cpp", + "pipeline/skia/SkiaOpenGLPipeline.cpp", + "pipeline/skia/SkiaOpenGLReadback.cpp", + "pipeline/skia/SkiaPipeline.cpp", + "pipeline/skia/SkiaProfileRenderer.cpp", + "pipeline/skia/SkiaRecordingCanvas.cpp", + "pipeline/skia/SkiaVulkanPipeline.cpp", + "renderstate/Blend.cpp", + "renderstate/MeshState.cpp", + "renderstate/OffscreenBufferPool.cpp", + "renderstate/PixelBufferState.cpp", + "renderstate/RenderState.cpp", + "renderstate/Scissor.cpp", + "renderstate/Stencil.cpp", + "renderstate/TextureState.cpp", + "renderthread/CanvasContext.cpp", + "renderthread/OpenGLPipeline.cpp", + "renderthread/DrawFrameTask.cpp", + "renderthread/EglManager.cpp", + "renderthread/VulkanManager.cpp", + "renderthread/RenderProxy.cpp", + "renderthread/RenderTask.cpp", + "renderthread/RenderThread.cpp", + "renderthread/TimeLord.cpp", + "renderthread/Frame.cpp", + "service/GraphicsStatsService.cpp", + "thread/TaskManager.cpp", + "utils/Blur.cpp", + "utils/Color.cpp", + "utils/GLUtils.cpp", + "utils/LinearAllocator.cpp", + "utils/StringUtils.cpp", + "utils/TestWindowContext.cpp", + "utils/VectorDrawableUtils.cpp", + "AmbientShadow.cpp", + "AnimationContext.cpp", + "Animator.cpp", + "AnimatorManager.cpp", + "BakedOpDispatcher.cpp", + "BakedOpRenderer.cpp", + "BakedOpState.cpp", + "Caches.cpp", + "CanvasState.cpp", + "ClipArea.cpp", + "DamageAccumulator.cpp", + "DeferredLayerUpdater.cpp", + "DeviceInfo.cpp", + "DisplayList.cpp", + "Extensions.cpp", + "FboCache.cpp", + "FontRenderer.cpp", + "FrameBuilder.cpp", + "FrameInfo.cpp", + "FrameInfoVisualizer.cpp", + "GammaFontRenderer.cpp", + "GlLayer.cpp", + "GlopBuilder.cpp", + "GpuMemoryTracker.cpp", + "GradientCache.cpp", + "Image.cpp", + "Interpolator.cpp", + "JankTracker.cpp", + "Layer.cpp", + "LayerBuilder.cpp", + "LayerUpdateQueue.cpp", + "Matrix.cpp", + "OpDumper.cpp", + "OpenGLReadback.cpp", + "Patch.cpp", + "PatchCache.cpp", + "PathCache.cpp", + "PathParser.cpp", + "PathTessellator.cpp", + "PixelBuffer.cpp", + "ProfileRenderer.cpp", + "Program.cpp", + "ProgramCache.cpp", + "Properties.cpp", + "PropertyValuesAnimatorSet.cpp", + "PropertyValuesHolder.cpp", + "RecordingCanvas.cpp", + "RenderBufferCache.cpp", + "RenderNode.cpp", + "RenderProperties.cpp", + "ResourceCache.cpp", + "ShadowTessellator.cpp", + "SkiaCanvas.cpp", + "SkiaCanvasProxy.cpp", + "SkiaShader.cpp", + "Snapshot.cpp", + "SpotShadow.cpp", + "TessellationCache.cpp", + "TextDropShadowCache.cpp", + "Texture.cpp", + "TextureCache.cpp", + "VectorDrawable.cpp", + "VkLayer.cpp", + "protos/hwui.proto", + ], + + proto: { + export_proto_headers: true, + }, + + export_include_dirs: ["."], + export_shared_lib_headers: ["libRScpp"], +} + +cc_library { + name: "libhwui", + defaults: ["libhwui_defaults"], +} + +// ------------------------ +// static library null gpu +// ------------------------ + +cc_library_static { + name: "libhwui_static_debug", + defaults: [ + "libhwui_defaults", + "hwui_debug", + ], + cflags: ["-DHWUI_NULL_GPU"], + srcs: [ + "debug/nullegl.cpp", + ], +} + +cc_defaults { + name: "hwui_test_defaults", + defaults: ["hwui_defaults"], + srcs: [ + "tests/common/scenes/*.cpp", + "tests/common/LeakChecker.cpp", + "tests/common/TestListViewSceneBase.cpp", + "tests/common/TestContext.cpp", + "tests/common/TestScene.cpp", + "tests/common/TestUtils.cpp", + ], +} + +// ------------------------ +// unit tests +// ------------------------ + +cc_test { + name: "hwui_unit_tests", + defaults: ["hwui_test_defaults"], + + static_libs: [ + "libgmock", + "libhwui_static_debug", + ], + shared_libs: ["libmemunreachable"], + cflags: [ + "-include debug/wrap_gles.h", + "-DHWUI_NULL_GPU", + ], + + srcs: [ + "tests/unit/main.cpp", + "tests/unit/BakedOpDispatcherTests.cpp", + "tests/unit/BakedOpRendererTests.cpp", + "tests/unit/BakedOpStateTests.cpp", + "tests/unit/BitmapTests.cpp", + "tests/unit/CanvasContextTests.cpp", + "tests/unit/CanvasStateTests.cpp", + "tests/unit/ClipAreaTests.cpp", + "tests/unit/DamageAccumulatorTests.cpp", + "tests/unit/DeferredLayerUpdaterTests.cpp", + "tests/unit/DeviceInfoTests.cpp", + "tests/unit/FatVectorTests.cpp", + "tests/unit/FontRendererTests.cpp", + "tests/unit/FrameBuilderTests.cpp", + "tests/unit/GlopBuilderTests.cpp", + "tests/unit/GpuMemoryTrackerTests.cpp", + "tests/unit/GradientCacheTests.cpp", + "tests/unit/GraphicsStatsServiceTests.cpp", + "tests/unit/LayerUpdateQueueTests.cpp", + "tests/unit/LeakCheckTests.cpp", + "tests/unit/LinearAllocatorTests.cpp", + "tests/unit/MatrixTests.cpp", + "tests/unit/MeshStateTests.cpp", + "tests/unit/OffscreenBufferPoolTests.cpp", + "tests/unit/OpDumperTests.cpp", + "tests/unit/PathInterpolatorTests.cpp", + "tests/unit/RenderNodeDrawableTests.cpp", + "tests/unit/RecordingCanvasTests.cpp", + "tests/unit/RenderNodeTests.cpp", + "tests/unit/RenderPropertiesTests.cpp", + "tests/unit/SkiaBehaviorTests.cpp", + "tests/unit/SkiaDisplayListTests.cpp", + "tests/unit/SkiaPipelineTests.cpp", + "tests/unit/SkiaRenderPropertiesTests.cpp", + "tests/unit/SkiaCanvasTests.cpp", + "tests/unit/SnapshotTests.cpp", + "tests/unit/StringUtilsTests.cpp", + "tests/unit/TestUtilsTests.cpp", + "tests/unit/TextDropShadowCacheTests.cpp", + "tests/unit/TextureCacheTests.cpp", + "tests/unit/TypefaceTests.cpp", + "tests/unit/VectorDrawableTests.cpp", + ], +} + +// ------------------------ +// Macro-bench app +// ------------------------ + +cc_benchmark { + name: "hwuimacro", + defaults: ["hwui_test_defaults"], + + // set to libhwui_static_debug to skip actual GL commands + whole_static_libs: ["libhwui"], + shared_libs: ["libmemunreachable"], + + srcs: [ + "tests/macrobench/TestSceneRunner.cpp", + "tests/macrobench/main.cpp", + ], +} + +// ------------------------ +// Micro-bench app +// --------------------- + +cc_benchmark { + name: "hwuimicro", + defaults: ["hwui_test_defaults"], + + cflags: [ + "-include debug/wrap_gles.h", + "-DHWUI_NULL_GPU", + ], + + whole_static_libs: ["libhwui_static_debug"], + shared_libs: ["libmemunreachable"], + + srcs: [ + "tests/microbench/main.cpp", + "tests/microbench/DisplayListCanvasBench.cpp", + "tests/microbench/FontBench.cpp", + "tests/microbench/FrameBuilderBench.cpp", + "tests/microbench/LinearAllocatorBench.cpp", + "tests/microbench/PathParserBench.cpp", + "tests/microbench/RenderNodeBench.cpp", + "tests/microbench/ShadowBench.cpp", + "tests/microbench/TaskManagerBench.cpp", + ], +} diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk deleted file mode 100644 index 030e8456f01c..000000000000 --- a/libs/hwui/Android.mk +++ /dev/null @@ -1,384 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk - -BUGREPORT_FONT_CACHE_USAGE := false - -# Enables fine-grained GLES error checking -# If set to true, every GLES call is wrapped & error checked -# Has moderate overhead -HWUI_ENABLE_OPENGL_VALIDATION := false - -hwui_src_files := \ - hwui/Bitmap.cpp \ - font/CacheTexture.cpp \ - font/Font.cpp \ - hwui/Canvas.cpp \ - hwui/MinikinSkia.cpp \ - hwui/MinikinUtils.cpp \ - hwui/PaintImpl.cpp \ - hwui/Typeface.cpp \ - pipeline/skia/GLFunctorDrawable.cpp \ - pipeline/skia/LayerDrawable.cpp \ - pipeline/skia/RenderNodeDrawable.cpp \ - pipeline/skia/ReorderBarrierDrawables.cpp \ - pipeline/skia/SkiaDisplayList.cpp \ - pipeline/skia/SkiaOpenGLPipeline.cpp \ - pipeline/skia/SkiaOpenGLReadback.cpp \ - pipeline/skia/SkiaPipeline.cpp \ - pipeline/skia/SkiaProfileRenderer.cpp \ - pipeline/skia/SkiaRecordingCanvas.cpp \ - pipeline/skia/SkiaVulkanPipeline.cpp \ - renderstate/Blend.cpp \ - renderstate/MeshState.cpp \ - renderstate/OffscreenBufferPool.cpp \ - renderstate/PixelBufferState.cpp \ - renderstate/RenderState.cpp \ - renderstate/Scissor.cpp \ - renderstate/Stencil.cpp \ - renderstate/TextureState.cpp \ - renderthread/CanvasContext.cpp \ - renderthread/OpenGLPipeline.cpp \ - renderthread/DrawFrameTask.cpp \ - renderthread/EglManager.cpp \ - renderthread/VulkanManager.cpp \ - renderthread/RenderProxy.cpp \ - renderthread/RenderTask.cpp \ - renderthread/RenderThread.cpp \ - renderthread/TimeLord.cpp \ - renderthread/Frame.cpp \ - service/GraphicsStatsService.cpp \ - thread/TaskManager.cpp \ - utils/Blur.cpp \ - utils/Color.cpp \ - utils/GLUtils.cpp \ - utils/LinearAllocator.cpp \ - utils/StringUtils.cpp \ - utils/TestWindowContext.cpp \ - utils/VectorDrawableUtils.cpp \ - AmbientShadow.cpp \ - AnimationContext.cpp \ - Animator.cpp \ - AnimatorManager.cpp \ - BakedOpDispatcher.cpp \ - BakedOpRenderer.cpp \ - BakedOpState.cpp \ - Caches.cpp \ - CanvasState.cpp \ - ClipArea.cpp \ - DamageAccumulator.cpp \ - DeferredLayerUpdater.cpp \ - DeviceInfo.cpp \ - DisplayList.cpp \ - Extensions.cpp \ - FboCache.cpp \ - FontRenderer.cpp \ - FrameBuilder.cpp \ - FrameInfo.cpp \ - FrameInfoVisualizer.cpp \ - GammaFontRenderer.cpp \ - GlLayer.cpp \ - GlopBuilder.cpp \ - GpuMemoryTracker.cpp \ - GradientCache.cpp \ - Image.cpp \ - Interpolator.cpp \ - JankTracker.cpp \ - Layer.cpp \ - LayerBuilder.cpp \ - LayerUpdateQueue.cpp \ - Matrix.cpp \ - OpDumper.cpp \ - OpenGLReadback.cpp \ - Patch.cpp \ - PatchCache.cpp \ - PathCache.cpp \ - PathParser.cpp \ - PathTessellator.cpp \ - PixelBuffer.cpp \ - ProfileRenderer.cpp \ - Program.cpp \ - ProgramCache.cpp \ - Properties.cpp \ - PropertyValuesAnimatorSet.cpp \ - PropertyValuesHolder.cpp \ - RecordingCanvas.cpp \ - RenderBufferCache.cpp \ - RenderNode.cpp \ - RenderProperties.cpp \ - ResourceCache.cpp \ - ShadowTessellator.cpp \ - SkiaCanvas.cpp \ - SkiaCanvasProxy.cpp \ - SkiaShader.cpp \ - Snapshot.cpp \ - SpotShadow.cpp \ - TessellationCache.cpp \ - TextDropShadowCache.cpp \ - Texture.cpp \ - TextureCache.cpp \ - VectorDrawable.cpp \ - VkLayer.cpp \ - protos/hwui.proto - -hwui_test_common_src_files := \ - $(call all-cpp-files-under, tests/common/scenes) \ - tests/common/LeakChecker.cpp \ - tests/common/TestListViewSceneBase.cpp \ - tests/common/TestContext.cpp \ - tests/common/TestScene.cpp \ - tests/common/TestUtils.cpp - -hwui_debug_common_src_files := \ - debug/wrap_gles.cpp \ - debug/DefaultGlesDriver.cpp \ - debug/GlesErrorCheckWrapper.cpp \ - debug/GlesDriver.cpp \ - debug/FatalBaseDriver.cpp \ - debug/NullGlesDriver.cpp - -hwui_cflags := \ - -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES \ - -DATRACE_TAG=ATRACE_TAG_VIEW -DLOG_TAG=\"OpenGLRenderer\" \ - -Wall -Wno-unused-parameter -Wunreachable-code -Werror - -ifeq ($(TARGET_USES_HWC2),true) - hwui_cflags += -DUSE_HWC2 -endif - -# TODO: Linear blending should be enabled by default, but we are -# TODO: making it an opt-in while it's a work in progress -# TODO: The final test should be: -# TODO: ifneq ($(TARGET_ENABLE_LINEAR_BLENDING),false) -ifeq ($(TARGET_ENABLE_LINEAR_BLENDING),true) - hwui_cflags += -DANDROID_ENABLE_LINEAR_BLENDING -endif - -# GCC false-positives on this warning, and since we -Werror that's -# a problem -hwui_cflags += -Wno-free-nonheap-object - -# clang's warning is broken, see: https://llvm.org/bugs/show_bug.cgi?id=21629 -hwui_cflags += -Wno-missing-braces - -ifeq (true, $(BUGREPORT_FONT_CACHE_USAGE)) - hwui_src_files += \ - font/FontCacheHistoryTracker.cpp - hwui_cflags += -DBUGREPORT_FONT_CACHE_USAGE -endif - -ifndef HWUI_COMPILE_SYMBOLS - hwui_cflags += -fvisibility=hidden -endif - -ifdef HWUI_COMPILE_FOR_PERF - # TODO: Non-arm? - 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/include/private \ - external/skia/src/core \ - external/skia/src/effects \ - external/skia/src/image \ - external/skia/src/utils \ - external/icu/icu4c/source/common \ - external/harfbuzz_ng/src \ - external/freetype/include - -# enable RENDERSCRIPT -hwui_c_includes += \ - $(call intermediates-dir-for,STATIC_LIBRARIES,TARGET,) \ - frameworks/rs/cpp \ - frameworks/rs - -# ------------------------ -# static library -# ------------------------ - -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := STATIC_LIBRARIES -LOCAL_MODULE := libhwui_static -LOCAL_CFLAGS := $(hwui_cflags) -LOCAL_SRC_FILES := $(hwui_src_files) - -ifeq (true, $(HWUI_ENABLE_OPENGL_VALIDATION)) - LOCAL_CFLAGS += -include debug/wrap_gles.h - LOCAL_CFLAGS += -DDEBUG_OPENGL=3 - LOCAL_SRC_FILES += $(hwui_debug_common_src_files) -endif - -LOCAL_C_INCLUDES := $(hwui_c_includes) $(call hwui_proto_include) -LOCAL_EXPORT_C_INCLUDE_DIRS := \ - $(LOCAL_PATH) \ - $(call hwui_proto_include) - -include $(LOCAL_PATH)/hwui_static_deps.mk -include $(BUILD_STATIC_LIBRARY) - -# ------------------------ -# static library null gpu -# ------------------------ - -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := STATIC_LIBRARIES -LOCAL_MODULE := libhwui_static_debug -LOCAL_CFLAGS := \ - $(hwui_cflags) \ - -include debug/wrap_gles.h \ - -DHWUI_NULL_GPU -LOCAL_SRC_FILES := \ - $(hwui_src_files) \ - $(hwui_debug_common_src_files) \ - debug/nullegl.cpp -LOCAL_C_INCLUDES := $(hwui_c_includes) $(call hwui_proto_include) -LOCAL_EXPORT_C_INCLUDE_DIRS := \ - $(LOCAL_PATH) \ - $(call hwui_proto_include) - -include $(LOCAL_PATH)/hwui_static_deps.mk -include $(BUILD_STATIC_LIBRARY) - -# ------------------------ -# shared library -# ------------------------ - -include $(CLEAR_VARS) - -LOCAL_MODULE_CLASS := SHARED_LIBRARIES -LOCAL_MODULE := libhwui -LOCAL_WHOLE_STATIC_LIBRARIES := libhwui_static -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) - -include $(LOCAL_PATH)/hwui_static_deps.mk -include $(BUILD_SHARED_LIBRARY) - -# ------------------------ -# unit tests -# ------------------------ - -include $(CLEAR_VARS) - -LOCAL_MODULE := hwui_unit_tests -LOCAL_MODULE_TAGS := tests -LOCAL_STATIC_LIBRARIES := libgmock libhwui_static_debug -LOCAL_SHARED_LIBRARIES := libmemunreachable -LOCAL_CFLAGS := \ - $(hwui_cflags) \ - -include debug/wrap_gles.h \ - -DHWUI_NULL_GPU -LOCAL_C_INCLUDES := $(hwui_c_includes) - -LOCAL_SRC_FILES += \ - $(hwui_test_common_src_files) \ - tests/unit/main.cpp \ - tests/unit/BakedOpDispatcherTests.cpp \ - tests/unit/BakedOpRendererTests.cpp \ - tests/unit/BakedOpStateTests.cpp \ - tests/unit/BitmapTests.cpp \ - tests/unit/CanvasContextTests.cpp \ - tests/unit/CanvasStateTests.cpp \ - tests/unit/ClipAreaTests.cpp \ - tests/unit/DamageAccumulatorTests.cpp \ - tests/unit/DeferredLayerUpdaterTests.cpp \ - tests/unit/DeviceInfoTests.cpp \ - tests/unit/FatVectorTests.cpp \ - tests/unit/FontRendererTests.cpp \ - tests/unit/FrameBuilderTests.cpp \ - tests/unit/GlopBuilderTests.cpp \ - tests/unit/GpuMemoryTrackerTests.cpp \ - tests/unit/GradientCacheTests.cpp \ - tests/unit/GraphicsStatsServiceTests.cpp \ - tests/unit/LayerUpdateQueueTests.cpp \ - tests/unit/LeakCheckTests.cpp \ - tests/unit/LinearAllocatorTests.cpp \ - tests/unit/MatrixTests.cpp \ - tests/unit/MeshStateTests.cpp \ - tests/unit/OffscreenBufferPoolTests.cpp \ - tests/unit/OpDumperTests.cpp \ - tests/unit/PathInterpolatorTests.cpp \ - tests/unit/RenderNodeDrawableTests.cpp \ - tests/unit/RecordingCanvasTests.cpp \ - tests/unit/RenderNodeTests.cpp \ - tests/unit/RenderPropertiesTests.cpp \ - tests/unit/SkiaBehaviorTests.cpp \ - tests/unit/SkiaDisplayListTests.cpp \ - tests/unit/SkiaPipelineTests.cpp \ - tests/unit/SkiaRenderPropertiesTests.cpp \ - tests/unit/SkiaCanvasTests.cpp \ - tests/unit/SnapshotTests.cpp \ - tests/unit/StringUtilsTests.cpp \ - tests/unit/TestUtilsTests.cpp \ - tests/unit/TextDropShadowCacheTests.cpp \ - tests/unit/TextureCacheTests.cpp \ - tests/unit/TypefaceTests.cpp \ - tests/unit/VectorDrawableTests.cpp \ - -include $(LOCAL_PATH)/hwui_static_deps.mk -include $(BUILD_NATIVE_TEST) - -# ------------------------ -# Macro-bench app -# ------------------------ - -include $(CLEAR_VARS) - -LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/local/tmp -LOCAL_MODULE:= hwuimacro -LOCAL_MODULE_TAGS := tests -LOCAL_MULTILIB := both -LOCAL_CFLAGS := $(hwui_cflags) -LOCAL_C_INCLUDES := $(hwui_c_includes) - -# set to libhwui_static_debug to skip actual GL commands -LOCAL_WHOLE_STATIC_LIBRARIES := libhwui_static -LOCAL_SHARED_LIBRARIES := libmemunreachable - -LOCAL_SRC_FILES += \ - $(hwui_test_common_src_files) \ - tests/macrobench/TestSceneRunner.cpp \ - tests/macrobench/main.cpp - -include $(LOCAL_PATH)/hwui_static_deps.mk -include $(BUILD_NATIVE_BENCHMARK) - -# ------------------------ -# Micro-bench app -# --------------------- -include $(CLEAR_VARS) - -LOCAL_MODULE:= hwuimicro -LOCAL_MODULE_TAGS := tests -LOCAL_CFLAGS := \ - $(hwui_cflags) \ - -include debug/wrap_gles.h \ - -DHWUI_NULL_GPU - -LOCAL_C_INCLUDES := $(hwui_c_includes) - -LOCAL_WHOLE_STATIC_LIBRARIES := libhwui_static_debug -LOCAL_SHARED_LIBRARIES := libmemunreachable - -LOCAL_SRC_FILES += \ - $(hwui_test_common_src_files) \ - tests/microbench/main.cpp \ - tests/microbench/DisplayListCanvasBench.cpp \ - tests/microbench/FontBench.cpp \ - tests/microbench/FrameBuilderBench.cpp \ - tests/microbench/LinearAllocatorBench.cpp \ - tests/microbench/PathParserBench.cpp \ - tests/microbench/RenderNodeBench.cpp \ - tests/microbench/ShadowBench.cpp \ - tests/microbench/TaskManagerBench.cpp - - -include $(LOCAL_PATH)/hwui_static_deps.mk -include $(BUILD_NATIVE_BENCHMARK) diff --git a/libs/hwui/Glop.h b/libs/hwui/Glop.h index 34c7934db198..e91c08d5a351 100644 --- a/libs/hwui/Glop.h +++ b/libs/hwui/Glop.h @@ -110,6 +110,7 @@ public: } vertices; int elementCount; + int vertexCount; // only used for meshes (for glDrawRangeElements) TextureVertex mappedVertices[4]; } mesh; diff --git a/libs/hwui/GlopBuilder.cpp b/libs/hwui/GlopBuilder.cpp index 931a55a70fd8..2e9a6e895d8a 100644 --- a/libs/hwui/GlopBuilder.cpp +++ b/libs/hwui/GlopBuilder.cpp @@ -199,6 +199,7 @@ GlopBuilder& GlopBuilder::setMeshVertexBuffer(const VertexBuffer& vertexBuffer) alphaVertex ? kAlphaVertexStride : kVertexStride }; mOutGlop->mesh.elementCount = indices ? vertexBuffer.getIndexCount() : vertexBuffer.getVertexCount(); + mOutGlop->mesh.vertexCount = vertexBuffer.getVertexCount(); // used for glDrawRangeElements() return *this; } diff --git a/libs/hwui/JankTracker.cpp b/libs/hwui/JankTracker.cpp index 8126d57a3a79..028d9f756fb7 100644 --- a/libs/hwui/JankTracker.cpp +++ b/libs/hwui/JankTracker.cpp @@ -291,7 +291,6 @@ void JankTracker::addFrame(const FrameInfo& frame) { / kSlowFrameBucketIntervalMs; framebucket = std::min(framebucket, static_cast<uint32_t>(mData->slowFrameCounts.size() - 1)); - framebucket = std::max(framebucket, 0u); mData->slowFrameCounts[framebucket]++; } diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp index d0f0949d5e78..8cc0aa7b414c 100644 --- a/libs/hwui/ProgramCache.cpp +++ b/libs/hwui/ProgramCache.cpp @@ -58,7 +58,9 @@ const char* gVS_Header_Uniforms_HasBitmap = "uniform mat4 textureTransform;\n" "uniform mediump vec2 textureDimension;\n"; const char* gVS_Header_Uniforms_HasRoundRectClip = - "uniform mat4 roundRectInvTransform;\n"; + "uniform mat4 roundRectInvTransform;\n" + "uniform mediump vec4 roundRectInnerRectLTWH;\n" + "uniform mediump float roundRectRadius;\n"; const char* gVS_Header_Varyings_HasTexture = "varying vec2 outTexCoords;\n"; const char* gVS_Header_Varyings_HasColors = @@ -81,7 +83,7 @@ const char* gVS_Header_Varyings_HasGradient[6] = { "varying highp vec2 sweep;\n", }; const char* gVS_Header_Varyings_HasRoundRectClip = - "varying highp vec2 roundRectPos;\n"; + "varying mediump vec2 roundRectPos;\n"; const char* gVS_Main = "\nvoid main(void) {\n"; const char* gVS_Main_OutTexCoords = @@ -113,7 +115,7 @@ const char* gVS_Main_VertexAlpha = " alpha = vtxAlpha;\n"; const char* gVS_Main_HasRoundRectClip = - " roundRectPos = (roundRectInvTransform * transformedPosition).xy;\n"; + " roundRectPos = ((roundRectInvTransform * transformedPosition).xy / roundRectRadius) - roundRectInnerRectLTWH.xy;\n"; const char* gVS_Footer = "}\n\n"; @@ -158,8 +160,8 @@ const char* gFS_Uniforms_ColorOp[3] = { }; const char* gFS_Uniforms_HasRoundRectClip = - "uniform vec4 roundRectInnerRectLTRB;\n" - "uniform float roundRectRadius;\n"; + "uniform mediump vec4 roundRectInnerRectLTWH;\n" + "uniform mediump float roundRectRadius;\n"; const char* gFS_Uniforms_ColorSpaceConversion = // TODO: Should we use a 3D LUT to combine the matrix and transfer functions? @@ -431,15 +433,18 @@ const char* gFS_Main_ApplyColorOp[3] = { " fragColor = blendColors(colorBlend, fragColor);\n" }; -// Note: LTRB -> xyzw +// Note: LTWH (left top width height) -> xyzw +// roundRectPos is now divided by roundRectRadius in vertex shader +// after we also subtract roundRectInnerRectLTWH.xy from roundRectPos const char* gFS_Main_FragColor_HasRoundRectClip = - " mediump vec2 fragToLT = roundRectInnerRectLTRB.xy - roundRectPos;\n" - " mediump vec2 fragFromRB = roundRectPos - roundRectInnerRectLTRB.zw;\n" - - // divide + multiply by 128 to avoid falling out of range in length() function - " mediump vec2 dist = max(max(fragToLT, fragFromRB), vec2(0.0, 0.0)) / 128.0;\n" - " mediump float linearDist = roundRectRadius - (length(dist) * 128.0);\n" - " gl_FragColor *= clamp(linearDist, 0.0, 1.0);\n"; + " mediump vec2 fragToLT = -roundRectPos;\n" + " mediump vec2 fragFromRB = roundRectPos - roundRectInnerRectLTWH.zw;\n" + + // since distance is divided by radius, it's in [0;1] so precision is not an issue + // this also lets us clamp(0.0, 1.0) instead of max() which is cheaper on GPUs + " mediump vec2 dist = clamp(max(fragToLT, fragFromRB), 0.0, 1.0);\n" + " mediump float linearDist = clamp(roundRectRadius - (length(dist) * roundRectRadius), 0.0, 1.0);\n" + " gl_FragColor *= linearDist;\n"; const char* gFS_Main_DebugHighlight = " gl_FragColor.rgb = vec3(0.0, gl_FragColor.a, 0.0);\n"; diff --git a/libs/hwui/hwui_static_deps.mk b/libs/hwui/hwui_static_deps.mk deleted file mode 100644 index 8826cfcc3100..000000000000 --- a/libs/hwui/hwui_static_deps.mk +++ /dev/null @@ -1,33 +0,0 @@ -############################################################################### -# -# -# This file contains the shared and static dependencies needed by any target -# that attempts to statically link HWUI (i.e. libhwui_static build target). This -# file should be included by any target that lists libhwui_static as a -# dependency. -# -# This is a workaround for the fact that the build system does not add these -# transitive dependencies when it attempts to link libhwui_static into another -# library. -# -############################################################################### - -LOCAL_SHARED_LIBRARIES += \ - liblog \ - libcutils \ - libutils \ - libEGL \ - libGLESv2 \ - libvulkan \ - libskia \ - libui \ - libgui \ - libprotobuf-cpp-full \ - libharfbuzz_ng \ - libft2 \ - libminikin \ - libandroidfw \ - libRScpp - -LOCAL_STATIC_LIBRARIES += \ - libplatformprotos diff --git a/libs/hwui/renderstate/RenderState.cpp b/libs/hwui/renderstate/RenderState.cpp index ed96d49bbc15..2c92924cc12c 100644 --- a/libs/hwui/renderstate/RenderState.cpp +++ b/libs/hwui/renderstate/RenderState.cpp @@ -296,14 +296,20 @@ void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix) { // TODO: avoid query, and cache values (or RRCS ptr) in program const RoundRectClipState* state = glop.roundRectClipState; const Rect& innerRect = state->innerRect; - glUniform4f(fill.program->getUniform("roundRectInnerRectLTRB"), - innerRect.left, innerRect.top, - innerRect.right, innerRect.bottom); - glUniformMatrix4fv(fill.program->getUniform("roundRectInvTransform"), - 1, GL_FALSE, &state->matrix.data[0]); // add half pixel to round out integer rect space to cover pixel centers float roundedOutRadius = state->radius + 0.5f; + + // Divide by the radius to simplify the calculations in the fragment shader + // roundRectPos is also passed from vertex shader relative to top/left & radius + glUniform4f(fill.program->getUniform("roundRectInnerRectLTWH"), + innerRect.left / roundedOutRadius, innerRect.top / roundedOutRadius, + (innerRect.right - innerRect.left) / roundedOutRadius, + (innerRect.bottom - innerRect.top) / roundedOutRadius); + + glUniformMatrix4fv(fill.program->getUniform("roundRectInvTransform"), + 1, GL_FALSE, &state->matrix.data[0]); + glUniform1f(fill.program->getUniform("roundRectRadius"), roundedOutRadius); } @@ -420,18 +426,28 @@ void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix) { const GLbyte* vertexData = static_cast<const GLbyte*>(vertices.position); while (elementsCount > 0) { GLsizei drawCount = std::min(elementsCount, (GLsizei) kMaxNumberOfQuads * 6); + GLsizei vertexCount = (drawCount / 6) * 4; meshState().bindPositionVertexPointer(vertexData, vertices.stride); if (vertices.attribFlags & VertexAttribFlags::TextureCoord) { meshState().bindTexCoordsVertexPointer( vertexData + kMeshTextureOffset, vertices.stride); } - glDrawElements(mesh.primitiveMode, drawCount, GL_UNSIGNED_SHORT, nullptr); + if (mCaches->extensions().getMajorGlVersion() >= 3) { + glDrawRangeElements(mesh.primitiveMode, 0, vertexCount-1, drawCount, GL_UNSIGNED_SHORT, nullptr); + } else { + glDrawElements(mesh.primitiveMode, drawCount, GL_UNSIGNED_SHORT, nullptr); + } elementsCount -= drawCount; - vertexData += (drawCount / 6) * 4 * vertices.stride; + vertexData += vertexCount * vertices.stride; } } else if (indices.bufferObject || indices.indices) { - glDrawElements(mesh.primitiveMode, mesh.elementCount, GL_UNSIGNED_SHORT, indices.indices); + if (mCaches->extensions().getMajorGlVersion() >= 3) { + // use glDrawRangeElements to reduce CPU overhead (otherwise the driver has to determine the min/max index values) + glDrawRangeElements(mesh.primitiveMode, 0, mesh.vertexCount-1, mesh.elementCount, GL_UNSIGNED_SHORT, indices.indices); + } else { + glDrawElements(mesh.primitiveMode, mesh.elementCount, GL_UNSIGNED_SHORT, indices.indices); + } } else { glDrawArrays(mesh.primitiveMode, 0, mesh.elementCount); } diff --git a/libs/hwui/tests/unit/BakedOpDispatcherTests.cpp b/libs/hwui/tests/unit/BakedOpDispatcherTests.cpp index 9a3b81cc0138..c46592c8867a 100644 --- a/libs/hwui/tests/unit/BakedOpDispatcherTests.cpp +++ b/libs/hwui/tests/unit/BakedOpDispatcherTests.cpp @@ -118,7 +118,7 @@ RENDERTHREAD_OPENGL_PIPELINE_TEST(BakedOpDispatcher, onLayerOp_bufferless) { layerPaint.setAlpha(128); OffscreenBuffer* buffer = nullptr; // no providing a buffer, should hit rect fallback case LayerOp op(Rect(10, 10), Matrix4::identity(), nullptr, &layerPaint, &buffer); - testUnmergedGlopDispatch(renderThread, &op, [&renderThread] (const Glop& glop) { + testUnmergedGlopDispatch(renderThread, &op, [] (const Glop& glop) { ADD_FAILURE() << "Nothing should happen"; }, 0); } diff --git a/libs/input/Android.bp b/libs/input/Android.bp new file mode 100644 index 000000000000..43107064332e --- /dev/null +++ b/libs/input/Android.bp @@ -0,0 +1,44 @@ +// Copyright (C) 2010 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +cc_library_shared { + name: "libinputservice", + + srcs: [ + "PointerController.cpp", + "SpriteController.cpp", + ], + + shared_libs: [ + "libcutils", + "liblog", + "libutils", + "libskia", + "libgui", + "libui", + "libinput", + "libinputflinger", + "libnativewindow", + ], + + include_dirs: ["frameworks/native/services"], + + cflags: [ + "-Wall", + "-Werror", + "-Wunused", + "-Wunreachable-code", + ], + +} diff --git a/libs/input/Android.mk b/libs/input/Android.mk deleted file mode 100644 index e8242751ba5c..000000000000 --- a/libs/input/Android.mk +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (C) 2010 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= \ - PointerController.cpp \ - SpriteController.cpp - -LOCAL_SHARED_LIBRARIES := \ - libcutils \ - liblog \ - libutils \ - libskia \ - libgui \ - libui \ - libinput \ - libinputflinger \ - libnativewindow - -LOCAL_C_INCLUDES := \ - frameworks/native/services - - -LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code - -LOCAL_MODULE:= libinputservice - -LOCAL_MODULE_TAGS := optional - -include $(BUILD_SHARED_LIBRARY) - - -# Include subdirectory makefiles -# ============================================================ - -# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework -# team really wants is to build the stuff defined by this makefile. -ifeq (,$(ONE_SHOT_MAKEFILE)) -include $(call first-makefiles-under,$(LOCAL_PATH)) -endif |