1 cc_defaults { 2 name: "hwui_defaults", 3 defaults: [ 4 "hwui_static_deps", 5 "skia_deps", 6 //"hwui_bugreport_font_cache_usage", 7 //"hwui_compile_for_perf", 8 "hwui_pgo", 9 "hwui_lto", 10 ], 11 12 cpp_std: "experimental", 13 14 cflags: [ 15 "-DEGL_EGLEXT_PROTOTYPES", 16 "-DGL_GLEXT_PROTOTYPES", 17 "-DATRACE_TAG=ATRACE_TAG_VIEW", 18 "-DLOG_TAG=\"OpenGLRenderer\"", 19 "-Wall", 20 "-Wno-unused-parameter", 21 "-Wunreachable-code", 22 "-Werror", 23 "-fvisibility=hidden", 24 25 // GCC false-positives on this warning, and since we -Werror that's 26 // a problem 27 "-Wno-free-nonheap-object", 28 29 // clang's warning is broken, see: https://llvm.org/bugs/show_bug.cgi?id=21629 30 "-Wno-missing-braces", 31 ], 32 33 include_dirs: [ 34 "external/skia/include/private", 35 "external/skia/src/core", 36 "external/skia/src/effects", 37 "external/skia/src/image", 38 "external/skia/src/utils", 39 "external/skia/src/gpu", 40 "external/skia/src/shaders", 41 ], 42 43 product_variables: { 44 eng: { 45 lto: { 46 never: true, 47 }, 48 }, 49 }, 50 } 51 52 cc_defaults { 53 name: "hwui_static_deps", 54 shared_libs: [ 55 "liblog", 56 "libcutils", 57 "libstatslog", 58 "libutils", 59 "libEGL", 60 "libGLESv1_CM", 61 "libGLESv2", 62 "libGLESv3", 63 "libvulkan", 64 "libui", 65 "libgui", 66 "libprotobuf-cpp-lite", 67 "libharfbuzz_ng", 68 "libft2", 69 "libminikin", 70 "libandroidfw", 71 "libcrypto", 72 "libsync", 73 ], 74 static_libs: [ 75 "libEGL_blobCache", 76 ], 77 } 78 79 cc_defaults { 80 name: "hwui_bugreport_font_cache_usage", 81 cflags: ["-DBUGREPORT_FONT_CACHE_USAGE"], 82 } 83 84 cc_defaults { 85 name: "hwui_compile_for_perf", 86 // TODO: Non-arm? 87 cflags: [ 88 "-fno-omit-frame-pointer", 89 "-marm", 90 "-mapcs", 91 ], 92 } 93 94 cc_defaults { 95 name: "hwui_debug", 96 cflags: ["-include debug/wrap_gles.h"], 97 srcs: [ 98 "debug/wrap_gles.cpp", 99 "debug/DefaultGlesDriver.cpp", 100 "debug/GlesErrorCheckWrapper.cpp", 101 "debug/GlesDriver.cpp", 102 "debug/FatalBaseDriver.cpp", 103 "debug/NullGlesDriver.cpp", 104 ], 105 include_dirs: ["frameworks/native/opengl/libs/GLES2"], 106 } 107 108 cc_defaults { 109 name: "hwui_enable_opengl_validation", 110 defaults: ["hwui_debug"], 111 cflags: ["-DDEBUG_OPENGL=3"], 112 include_dirs: ["frameworks/native/opengl/libs/GLES2"], 113 } 114 115 // Build libhwui with PGO by default. 116 // Location of PGO profile data is defined in build/soong/cc/pgo.go 117 // and is separate from hwui. 118 // To turn it off, set ANDROID_PGO_NO_PROFILE_USE environment variable 119 // or set enable_profile_use property to false. 120 cc_defaults { 121 name: "hwui_pgo", 122 123 pgo: { 124 instrumentation: true, 125 profile_file: "hwui/hwui.profdata", 126 benchmarks: ["hwui"], 127 enable_profile_use: true, 128 }, 129 } 130 131 // Build hwui library with ThinLTO by default. 132 cc_defaults { 133 name: "hwui_lto", 134 target: { 135 android: { 136 lto: { 137 thin: true, 138 }, 139 }, 140 }, 141 } 142 143 // ------------------------ 144 // library 145 // ------------------------ 146 147 cc_defaults { 148 name: "libhwui_defaults", 149 defaults: ["hwui_defaults"], 150 151 whole_static_libs: ["libskia"], 152 153 srcs: [ 154 "hwui/AnimatedImageDrawable.cpp", 155 "hwui/AnimatedImageThread.cpp", 156 "hwui/Bitmap.cpp", 157 "hwui/Canvas.cpp", 158 "hwui/MinikinSkia.cpp", 159 "hwui/MinikinUtils.cpp", 160 "hwui/PaintImpl.cpp", 161 "hwui/Typeface.cpp", 162 "pipeline/skia/GLFunctorDrawable.cpp", 163 "pipeline/skia/LayerDrawable.cpp", 164 "pipeline/skia/RenderNodeDrawable.cpp", 165 "pipeline/skia/ReorderBarrierDrawables.cpp", 166 "pipeline/skia/ShaderCache.cpp", 167 "pipeline/skia/SkiaDisplayList.cpp", 168 "pipeline/skia/SkiaMemoryTracer.cpp", 169 "pipeline/skia/SkiaOpenGLPipeline.cpp", 170 "pipeline/skia/SkiaPipeline.cpp", 171 "pipeline/skia/SkiaProfileRenderer.cpp", 172 "pipeline/skia/SkiaRecordingCanvas.cpp", 173 "pipeline/skia/SkiaVulkanPipeline.cpp", 174 "pipeline/skia/VectorDrawableAtlas.cpp", 175 "pipeline/skia/VkFunctorDrawable.cpp", 176 "pipeline/skia/VkInteropFunctorDrawable.cpp", 177 "renderstate/RenderState.cpp", 178 "renderthread/CacheManager.cpp", 179 "renderthread/CanvasContext.cpp", 180 "renderthread/DrawFrameTask.cpp", 181 "renderthread/EglManager.cpp", 182 "renderthread/ReliableSurface.cpp", 183 "renderthread/VulkanManager.cpp", 184 "renderthread/VulkanSurface.cpp", 185 "renderthread/RenderProxy.cpp", 186 "renderthread/RenderTask.cpp", 187 "renderthread/RenderThread.cpp", 188 "renderthread/TimeLord.cpp", 189 "renderthread/Frame.cpp", 190 "service/GraphicsStatsService.cpp", 191 "surfacetexture/EGLConsumer.cpp", 192 "surfacetexture/ImageConsumer.cpp", 193 "surfacetexture/SurfaceTexture.cpp", 194 "thread/CommonPool.cpp", 195 "utils/Blur.cpp", 196 "utils/Color.cpp", 197 "utils/GLUtils.cpp", 198 "utils/LinearAllocator.cpp", 199 "utils/StringUtils.cpp", 200 "utils/VectorDrawableUtils.cpp", 201 "AnimationContext.cpp", 202 "Animator.cpp", 203 "AnimatorManager.cpp", 204 "CanvasTransform.cpp", 205 "DamageAccumulator.cpp", 206 "DeferredLayerUpdater.cpp", 207 "DeviceInfo.cpp", 208 "FrameInfo.cpp", 209 "FrameInfoVisualizer.cpp", 210 "GpuMemoryTracker.cpp", 211 "HardwareBitmapUploader.cpp", 212 "HWUIProperties.sysprop", 213 "Interpolator.cpp", 214 "JankTracker.cpp", 215 "Layer.cpp", 216 "LayerUpdateQueue.cpp", 217 "Matrix.cpp", 218 "PathParser.cpp", 219 "ProfileData.cpp", 220 "ProfileDataContainer.cpp", 221 "Properties.cpp", 222 "PropertyValuesAnimatorSet.cpp", 223 "PropertyValuesHolder.cpp", 224 "Readback.cpp", 225 "RecordingCanvas.cpp", 226 "RenderNode.cpp", 227 "RenderProperties.cpp", 228 "SkiaCanvas.cpp", 229 "TreeInfo.cpp", 230 "WebViewFunctorManager.cpp", 231 "VectorDrawable.cpp", 232 "protos/graphicsstats.proto", 233 ], 234 235 // Allow implicit fallthroughs in HardwareBitmapUploader.cpp until they are fixed. 236 cflags: ["-Wno-implicit-fallthrough"], 237 238 proto: { 239 export_proto_headers: true, 240 }, 241 242 export_include_dirs: ["."], 243 } 244 245 cc_library { 246 name: "libhwui", 247 defaults: [ 248 "libhwui_defaults", 249 250 // Enables fine-grained GLES error checking 251 // If enabled, every GLES call is wrapped & error checked 252 // Has moderate overhead 253 //"hwui_enable_opengl_validation", 254 ], 255 } 256 257 // ------------------------ 258 // static library null gpu 259 // ------------------------ 260 261 cc_library_static { 262 name: "libhwui_static_debug", 263 defaults: [ 264 "libhwui_defaults", 265 "hwui_debug", 266 ], 267 cflags: ["-DHWUI_NULL_GPU"], 268 srcs: [ 269 "debug/nullegl.cpp", 270 ], 271 } 272 273 cc_defaults { 274 name: "hwui_test_defaults", 275 defaults: ["hwui_defaults"], 276 test_suites: ["device-tests"], 277 srcs: [ 278 "tests/common/scenes/*.cpp", 279 "tests/common/LeakChecker.cpp", 280 "tests/common/TestListViewSceneBase.cpp", 281 "tests/common/TestContext.cpp", 282 "tests/common/TestScene.cpp", 283 "tests/common/TestUtils.cpp", 284 ], 285 } 286 287 // ------------------------ 288 // unit tests 289 // ------------------------ 290 291 cc_test { 292 name: "hwui_unit_tests", 293 defaults: ["hwui_test_defaults"], 294 295 static_libs: [ 296 "libgmock", 297 "libhwui_static_debug", 298 ], 299 shared_libs: [ 300 "libmemunreachable", 301 ], 302 cflags: [ 303 "-include debug/wrap_gles.h", 304 "-DHWUI_NULL_GPU", 305 ], 306 307 srcs: [ 308 "tests/unit/main.cpp", 309 "tests/unit/CacheManagerTests.cpp", 310 "tests/unit/CanvasContextTests.cpp", 311 "tests/unit/CommonPoolTests.cpp", 312 "tests/unit/DamageAccumulatorTests.cpp", 313 "tests/unit/DeferredLayerUpdaterTests.cpp", 314 "tests/unit/FatVectorTests.cpp", 315 "tests/unit/GpuMemoryTrackerTests.cpp", 316 "tests/unit/GraphicsStatsServiceTests.cpp", 317 "tests/unit/LayerUpdateQueueTests.cpp", 318 "tests/unit/LinearAllocatorTests.cpp", 319 "tests/unit/MatrixTests.cpp", 320 "tests/unit/PathInterpolatorTests.cpp", 321 "tests/unit/RenderNodeDrawableTests.cpp", 322 "tests/unit/RenderNodeTests.cpp", 323 "tests/unit/RenderPropertiesTests.cpp", 324 "tests/unit/RenderThreadTests.cpp", 325 "tests/unit/ShaderCacheTests.cpp", 326 "tests/unit/SkiaBehaviorTests.cpp", 327 "tests/unit/SkiaDisplayListTests.cpp", 328 "tests/unit/SkiaPipelineTests.cpp", 329 "tests/unit/SkiaRenderPropertiesTests.cpp", 330 "tests/unit/SkiaCanvasTests.cpp", 331 "tests/unit/StringUtilsTests.cpp", 332 "tests/unit/TestUtilsTests.cpp", 333 "tests/unit/ThreadBaseTests.cpp", 334 "tests/unit/TypefaceTests.cpp", 335 "tests/unit/VectorDrawableTests.cpp", 336 "tests/unit/VectorDrawableAtlasTests.cpp", 337 "tests/unit/WebViewFunctorManagerTests.cpp", 338 ], 339 } 340 341 // ------------------------ 342 // Macro-bench app 343 // ------------------------ 344 345 cc_benchmark { 346 name: "hwuimacro", 347 defaults: ["hwui_test_defaults"], 348 349 // set to libhwui_static_debug to skip actual GL commands 350 whole_static_libs: ["libhwui"], 351 shared_libs: [ 352 "libmemunreachable", 353 ], 354 355 srcs: [ 356 "tests/macrobench/TestSceneRunner.cpp", 357 "tests/macrobench/main.cpp", 358 ], 359 } 360 361 // ------------------------ 362 // Micro-bench app 363 // --------------------- 364 365 cc_benchmark { 366 name: "hwuimicro", 367 defaults: ["hwui_test_defaults"], 368 369 cflags: [ 370 "-include debug/wrap_gles.h", 371 "-DHWUI_NULL_GPU", 372 ], 373 374 whole_static_libs: ["libhwui_static_debug"], 375 shared_libs: [ 376 "libmemunreachable", 377 ], 378 379 srcs: [ 380 "tests/microbench/main.cpp", 381 "tests/microbench/DisplayListCanvasBench.cpp", 382 "tests/microbench/LinearAllocatorBench.cpp", 383 "tests/microbench/PathParserBench.cpp", 384 "tests/microbench/RenderNodeBench.cpp", 385 ], 386 } 387 388 // ---------------------------------------- 389 // Phony target to build benchmarks for PGO 390 // ---------------------------------------- 391 392 phony { 393 name: "pgo-targets-hwui", 394 required: [ 395 "hwuimicro", 396 "hwuimacro", 397 ] 398 } 399