Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 1 | cc_defaults { |
| 2 | name: "hwui_defaults", |
| 3 | defaults: [ |
| 4 | "hwui_static_deps", |
Derek Sollenberger | d938e5a | 2017-07-24 09:42:07 -0400 | [diff] [blame] | 5 | "skia_deps" |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 6 | //"hwui_bugreport_font_cache_usage", |
| 7 | //"hwui_compile_for_perf", |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 8 | ], |
| 9 | |
John Reck | f8441e6 | 2017-10-23 13:10:41 -0700 | [diff] [blame] | 10 | cpp_std: "c++17", |
| 11 | |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 12 | cflags: [ |
| 13 | "-DEGL_EGLEXT_PROTOTYPES", |
| 14 | "-DGL_GLEXT_PROTOTYPES", |
| 15 | "-DATRACE_TAG=ATRACE_TAG_VIEW", |
| 16 | "-DLOG_TAG=\"OpenGLRenderer\"", |
| 17 | "-Wall", |
| 18 | "-Wno-unused-parameter", |
| 19 | "-Wunreachable-code", |
| 20 | "-Werror", |
| 21 | "-fvisibility=hidden", |
| 22 | |
| 23 | // GCC false-positives on this warning, and since we -Werror that's |
| 24 | // a problem |
| 25 | "-Wno-free-nonheap-object", |
| 26 | |
| 27 | // clang's warning is broken, see: https://llvm.org/bugs/show_bug.cgi?id=21629 |
| 28 | "-Wno-missing-braces", |
| 29 | |
| 30 | // TODO: Linear blending should be enabled by default, but we are |
| 31 | // TODO: making it an opt-in while it's a work in progress |
| 32 | //"-DANDROID_ENABLE_LINEAR_BLENDING", |
| 33 | ], |
| 34 | |
| 35 | include_dirs: [ |
| 36 | "external/skia/include/private", |
| 37 | "external/skia/src/core", |
| 38 | "external/skia/src/effects", |
| 39 | "external/skia/src/image", |
| 40 | "external/skia/src/utils", |
Stan Iliev | 3310fb1 | 2017-03-23 16:56:51 -0400 | [diff] [blame] | 41 | "external/skia/src/gpu", |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 42 | ], |
| 43 | |
| 44 | product_variables: { |
| 45 | device_uses_hwc2: { |
| 46 | cflags: ["-DUSE_HWC2"], |
| 47 | }, |
| 48 | }, |
| 49 | } |
| 50 | |
| 51 | cc_defaults { |
| 52 | name: "hwui_static_deps", |
| 53 | shared_libs: [ |
| 54 | "liblog", |
| 55 | "libcutils", |
| 56 | "libutils", |
| 57 | "libEGL", |
| 58 | "libGLESv2", |
| 59 | "libvulkan", |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 60 | "libui", |
| 61 | "libgui", |
John Reck | 915883b | 2017-05-03 10:27:20 -0700 | [diff] [blame] | 62 | "libprotobuf-cpp-lite", |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 63 | "libharfbuzz_ng", |
| 64 | "libft2", |
| 65 | "libminikin", |
| 66 | "libandroidfw", |
| 67 | "libRScpp", |
| 68 | ], |
| 69 | static_libs: [ |
| 70 | "libplatformprotos", |
| 71 | ], |
| 72 | } |
| 73 | |
| 74 | cc_defaults { |
| 75 | name: "hwui_bugreport_font_cache_usage", |
| 76 | srcs: ["font/FontCacheHistoryTracker.cpp"], |
| 77 | cflags: ["-DBUGREPORT_FONT_CACHE_USAGE"], |
| 78 | } |
| 79 | |
| 80 | cc_defaults { |
| 81 | name: "hwui_compile_for_perf", |
| 82 | // TODO: Non-arm? |
| 83 | cflags: [ |
| 84 | "-fno-omit-frame-pointer", |
| 85 | "-marm", |
| 86 | "-mapcs", |
| 87 | ], |
| 88 | } |
| 89 | |
| 90 | cc_defaults { |
| 91 | name: "hwui_debug", |
| 92 | cflags: ["-include debug/wrap_gles.h"], |
| 93 | srcs: [ |
| 94 | "debug/wrap_gles.cpp", |
| 95 | "debug/DefaultGlesDriver.cpp", |
| 96 | "debug/GlesErrorCheckWrapper.cpp", |
| 97 | "debug/GlesDriver.cpp", |
| 98 | "debug/FatalBaseDriver.cpp", |
| 99 | "debug/NullGlesDriver.cpp", |
| 100 | ], |
| 101 | include_dirs: ["frameworks/native/opengl/libs/GLES2"], |
| 102 | } |
| 103 | |
| 104 | cc_defaults { |
| 105 | name: "hwui_enable_opengl_validation", |
| 106 | defaults: ["hwui_debug"], |
| 107 | cflags: ["-DDEBUG_OPENGL=3"], |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 108 | include_dirs: ["frameworks/native/opengl/libs/GLES2"], |
| 109 | } |
| 110 | |
| 111 | // ------------------------ |
| 112 | // library |
| 113 | // ------------------------ |
| 114 | |
| 115 | cc_defaults { |
| 116 | name: "libhwui_defaults", |
| 117 | defaults: ["hwui_defaults"], |
Derek Sollenberger | d938e5a | 2017-07-24 09:42:07 -0400 | [diff] [blame] | 118 | |
| 119 | whole_static_libs: ["libskia"], |
| 120 | |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 121 | srcs: [ |
| 122 | "hwui/Bitmap.cpp", |
| 123 | "font/CacheTexture.cpp", |
| 124 | "font/Font.cpp", |
| 125 | "hwui/Canvas.cpp", |
| 126 | "hwui/MinikinSkia.cpp", |
| 127 | "hwui/MinikinUtils.cpp", |
| 128 | "hwui/PaintImpl.cpp", |
| 129 | "hwui/Typeface.cpp", |
| 130 | "pipeline/skia/GLFunctorDrawable.cpp", |
| 131 | "pipeline/skia/LayerDrawable.cpp", |
| 132 | "pipeline/skia/RenderNodeDrawable.cpp", |
| 133 | "pipeline/skia/ReorderBarrierDrawables.cpp", |
| 134 | "pipeline/skia/SkiaDisplayList.cpp", |
| 135 | "pipeline/skia/SkiaOpenGLPipeline.cpp", |
| 136 | "pipeline/skia/SkiaOpenGLReadback.cpp", |
| 137 | "pipeline/skia/SkiaPipeline.cpp", |
| 138 | "pipeline/skia/SkiaProfileRenderer.cpp", |
| 139 | "pipeline/skia/SkiaRecordingCanvas.cpp", |
| 140 | "pipeline/skia/SkiaVulkanPipeline.cpp", |
Stan Iliev | 3310fb1 | 2017-03-23 16:56:51 -0400 | [diff] [blame] | 141 | "pipeline/skia/VectorDrawableAtlas.cpp", |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 142 | "renderstate/Blend.cpp", |
| 143 | "renderstate/MeshState.cpp", |
| 144 | "renderstate/OffscreenBufferPool.cpp", |
| 145 | "renderstate/PixelBufferState.cpp", |
| 146 | "renderstate/RenderState.cpp", |
| 147 | "renderstate/Scissor.cpp", |
| 148 | "renderstate/Stencil.cpp", |
| 149 | "renderstate/TextureState.cpp", |
Derek Sollenberger | f9e45d1 | 2017-06-01 13:07:39 -0400 | [diff] [blame] | 150 | "renderthread/CacheManager.cpp", |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 151 | "renderthread/CanvasContext.cpp", |
| 152 | "renderthread/OpenGLPipeline.cpp", |
| 153 | "renderthread/DrawFrameTask.cpp", |
| 154 | "renderthread/EglManager.cpp", |
| 155 | "renderthread/VulkanManager.cpp", |
| 156 | "renderthread/RenderProxy.cpp", |
| 157 | "renderthread/RenderTask.cpp", |
| 158 | "renderthread/RenderThread.cpp", |
| 159 | "renderthread/TimeLord.cpp", |
| 160 | "renderthread/Frame.cpp", |
| 161 | "service/GraphicsStatsService.cpp", |
| 162 | "thread/TaskManager.cpp", |
| 163 | "utils/Blur.cpp", |
| 164 | "utils/Color.cpp", |
| 165 | "utils/GLUtils.cpp", |
| 166 | "utils/LinearAllocator.cpp", |
| 167 | "utils/StringUtils.cpp", |
| 168 | "utils/TestWindowContext.cpp", |
| 169 | "utils/VectorDrawableUtils.cpp", |
| 170 | "AmbientShadow.cpp", |
| 171 | "AnimationContext.cpp", |
| 172 | "Animator.cpp", |
| 173 | "AnimatorManager.cpp", |
| 174 | "BakedOpDispatcher.cpp", |
| 175 | "BakedOpRenderer.cpp", |
| 176 | "BakedOpState.cpp", |
| 177 | "Caches.cpp", |
| 178 | "CanvasState.cpp", |
| 179 | "ClipArea.cpp", |
| 180 | "DamageAccumulator.cpp", |
| 181 | "DeferredLayerUpdater.cpp", |
| 182 | "DeviceInfo.cpp", |
| 183 | "DisplayList.cpp", |
| 184 | "Extensions.cpp", |
| 185 | "FboCache.cpp", |
| 186 | "FontRenderer.cpp", |
| 187 | "FrameBuilder.cpp", |
| 188 | "FrameInfo.cpp", |
| 189 | "FrameInfoVisualizer.cpp", |
| 190 | "GammaFontRenderer.cpp", |
| 191 | "GlLayer.cpp", |
| 192 | "GlopBuilder.cpp", |
| 193 | "GpuMemoryTracker.cpp", |
| 194 | "GradientCache.cpp", |
| 195 | "Image.cpp", |
| 196 | "Interpolator.cpp", |
| 197 | "JankTracker.cpp", |
| 198 | "Layer.cpp", |
| 199 | "LayerBuilder.cpp", |
| 200 | "LayerUpdateQueue.cpp", |
| 201 | "Matrix.cpp", |
| 202 | "OpDumper.cpp", |
| 203 | "OpenGLReadback.cpp", |
| 204 | "Patch.cpp", |
| 205 | "PatchCache.cpp", |
| 206 | "PathCache.cpp", |
| 207 | "PathParser.cpp", |
| 208 | "PathTessellator.cpp", |
| 209 | "PixelBuffer.cpp", |
John Reck | 7075c79 | 2017-07-05 14:03:43 -0700 | [diff] [blame] | 210 | "ProfileData.cpp", |
John Reck | 34781b2 | 2017-07-05 16:39:36 -0700 | [diff] [blame] | 211 | "ProfileDataContainer.cpp", |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 212 | "ProfileRenderer.cpp", |
| 213 | "Program.cpp", |
| 214 | "ProgramCache.cpp", |
| 215 | "Properties.cpp", |
| 216 | "PropertyValuesAnimatorSet.cpp", |
| 217 | "PropertyValuesHolder.cpp", |
| 218 | "RecordingCanvas.cpp", |
| 219 | "RenderBufferCache.cpp", |
| 220 | "RenderNode.cpp", |
| 221 | "RenderProperties.cpp", |
| 222 | "ResourceCache.cpp", |
| 223 | "ShadowTessellator.cpp", |
| 224 | "SkiaCanvas.cpp", |
| 225 | "SkiaCanvasProxy.cpp", |
| 226 | "SkiaShader.cpp", |
| 227 | "Snapshot.cpp", |
| 228 | "SpotShadow.cpp", |
| 229 | "TessellationCache.cpp", |
| 230 | "TextDropShadowCache.cpp", |
| 231 | "Texture.cpp", |
| 232 | "TextureCache.cpp", |
| 233 | "VectorDrawable.cpp", |
| 234 | "VkLayer.cpp", |
| 235 | "protos/hwui.proto", |
| 236 | ], |
| 237 | |
| 238 | proto: { |
| 239 | export_proto_headers: true, |
| 240 | }, |
| 241 | |
| 242 | export_include_dirs: ["."], |
Colin Cross | 3f8fd40 | 2017-04-20 12:20:20 -0700 | [diff] [blame] | 243 | export_shared_lib_headers: ["libRScpp"], |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | cc_library { |
| 247 | name: "libhwui", |
Chris Craik | d17b63c | 2017-06-01 10:45:36 -0700 | [diff] [blame] | 248 | defaults: [ |
| 249 | "libhwui_defaults", |
| 250 | |
| 251 | // Enables fine-grained GLES error checking |
| 252 | // If enabled, every GLES call is wrapped & error checked |
| 253 | // Has moderate overhead |
| 254 | "hwui_enable_opengl_validation", |
Zhizhou Yang | 17371ec | 2017-10-13 11:42:13 -0700 | [diff] [blame] | 255 | ], |
| 256 | |
| 257 | // Build libhwui with PGO by default. |
| 258 | // Location of PGO profile data is defined in build/soong/cc/pgo.go |
| 259 | // and is separate from hwui. |
Zhizhou Yang | ded6035 | 2017-10-17 13:37:00 -0700 | [diff] [blame] | 260 | // To turn it off, set ANDROID_PGO_NO_PROFILE_USE environment variable |
| 261 | // or set enable_profile_use property to false. |
Zhizhou Yang | 17371ec | 2017-10-13 11:42:13 -0700 | [diff] [blame] | 262 | pgo: { |
| 263 | instrumentation: true, |
| 264 | profile_file: "hwui/hwui.profdata", |
| 265 | benchmarks: ["hwui"], |
Zhizhou Yang | ded6035 | 2017-10-17 13:37:00 -0700 | [diff] [blame] | 266 | enable_profile_use: false, |
Zhizhou Yang | 17371ec | 2017-10-13 11:42:13 -0700 | [diff] [blame] | 267 | }, |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 268 | } |
| 269 | |
| 270 | // ------------------------ |
| 271 | // static library null gpu |
| 272 | // ------------------------ |
| 273 | |
| 274 | cc_library_static { |
| 275 | name: "libhwui_static_debug", |
| 276 | defaults: [ |
| 277 | "libhwui_defaults", |
| 278 | "hwui_debug", |
| 279 | ], |
| 280 | cflags: ["-DHWUI_NULL_GPU"], |
| 281 | srcs: [ |
| 282 | "debug/nullegl.cpp", |
| 283 | ], |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | cc_defaults { |
| 287 | name: "hwui_test_defaults", |
| 288 | defaults: ["hwui_defaults"], |
| 289 | test_suites: ["device-tests"], |
| 290 | srcs: [ |
| 291 | "tests/common/scenes/*.cpp", |
| 292 | "tests/common/LeakChecker.cpp", |
| 293 | "tests/common/TestListViewSceneBase.cpp", |
| 294 | "tests/common/TestContext.cpp", |
| 295 | "tests/common/TestScene.cpp", |
| 296 | "tests/common/TestUtils.cpp", |
| 297 | ], |
| 298 | } |
| 299 | |
| 300 | // ------------------------ |
| 301 | // unit tests |
| 302 | // ------------------------ |
| 303 | |
| 304 | cc_test { |
| 305 | name: "hwui_unit_tests", |
| 306 | defaults: ["hwui_test_defaults"], |
| 307 | |
| 308 | static_libs: [ |
| 309 | "libgmock", |
| 310 | "libhwui_static_debug", |
| 311 | ], |
| 312 | shared_libs: ["libmemunreachable"], |
| 313 | cflags: [ |
| 314 | "-include debug/wrap_gles.h", |
| 315 | "-DHWUI_NULL_GPU", |
| 316 | ], |
| 317 | |
| 318 | srcs: [ |
| 319 | "tests/unit/main.cpp", |
| 320 | "tests/unit/BakedOpDispatcherTests.cpp", |
| 321 | "tests/unit/BakedOpRendererTests.cpp", |
| 322 | "tests/unit/BakedOpStateTests.cpp", |
Derek Sollenberger | f9e45d1 | 2017-06-01 13:07:39 -0400 | [diff] [blame] | 323 | "tests/unit/CacheManagerTests.cpp", |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 324 | "tests/unit/CanvasContextTests.cpp", |
| 325 | "tests/unit/CanvasStateTests.cpp", |
| 326 | "tests/unit/ClipAreaTests.cpp", |
| 327 | "tests/unit/DamageAccumulatorTests.cpp", |
| 328 | "tests/unit/DeferredLayerUpdaterTests.cpp", |
| 329 | "tests/unit/DeviceInfoTests.cpp", |
| 330 | "tests/unit/FatVectorTests.cpp", |
| 331 | "tests/unit/FontRendererTests.cpp", |
| 332 | "tests/unit/FrameBuilderTests.cpp", |
| 333 | "tests/unit/GlopBuilderTests.cpp", |
| 334 | "tests/unit/GpuMemoryTrackerTests.cpp", |
| 335 | "tests/unit/GradientCacheTests.cpp", |
| 336 | "tests/unit/GraphicsStatsServiceTests.cpp", |
| 337 | "tests/unit/LayerUpdateQueueTests.cpp", |
| 338 | "tests/unit/LeakCheckTests.cpp", |
| 339 | "tests/unit/LinearAllocatorTests.cpp", |
| 340 | "tests/unit/MatrixTests.cpp", |
| 341 | "tests/unit/MeshStateTests.cpp", |
| 342 | "tests/unit/OffscreenBufferPoolTests.cpp", |
| 343 | "tests/unit/OpDumperTests.cpp", |
| 344 | "tests/unit/PathInterpolatorTests.cpp", |
| 345 | "tests/unit/RenderNodeDrawableTests.cpp", |
| 346 | "tests/unit/RecordingCanvasTests.cpp", |
| 347 | "tests/unit/RenderNodeTests.cpp", |
| 348 | "tests/unit/RenderPropertiesTests.cpp", |
| 349 | "tests/unit/SkiaBehaviorTests.cpp", |
| 350 | "tests/unit/SkiaDisplayListTests.cpp", |
| 351 | "tests/unit/SkiaPipelineTests.cpp", |
| 352 | "tests/unit/SkiaRenderPropertiesTests.cpp", |
| 353 | "tests/unit/SkiaCanvasTests.cpp", |
| 354 | "tests/unit/SnapshotTests.cpp", |
| 355 | "tests/unit/StringUtilsTests.cpp", |
| 356 | "tests/unit/TestUtilsTests.cpp", |
| 357 | "tests/unit/TextDropShadowCacheTests.cpp", |
| 358 | "tests/unit/TextureCacheTests.cpp", |
John Reck | f8441e6 | 2017-10-23 13:10:41 -0700 | [diff] [blame] | 359 | "tests/unit/ThreadBaseTests.cpp", |
| 360 | "tests/unit/TypefaceTests.cpp", |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 361 | "tests/unit/VectorDrawableTests.cpp", |
Stan Iliev | 3310fb1 | 2017-03-23 16:56:51 -0400 | [diff] [blame] | 362 | "tests/unit/VectorDrawableAtlasTests.cpp", |
Colin Cross | f629810 | 2017-04-19 15:25:25 -0700 | [diff] [blame] | 363 | ], |
| 364 | } |
| 365 | |
| 366 | // ------------------------ |
| 367 | // Macro-bench app |
| 368 | // ------------------------ |
| 369 | |
| 370 | cc_benchmark { |
| 371 | name: "hwuimacro", |
| 372 | defaults: ["hwui_test_defaults"], |
| 373 | |
| 374 | // set to libhwui_static_debug to skip actual GL commands |
| 375 | whole_static_libs: ["libhwui"], |
| 376 | shared_libs: ["libmemunreachable"], |
| 377 | |
| 378 | srcs: [ |
| 379 | "tests/macrobench/TestSceneRunner.cpp", |
| 380 | "tests/macrobench/main.cpp", |
| 381 | ], |
| 382 | } |
| 383 | |
| 384 | // ------------------------ |
| 385 | // Micro-bench app |
| 386 | // --------------------- |
| 387 | |
| 388 | cc_benchmark { |
| 389 | name: "hwuimicro", |
| 390 | defaults: ["hwui_test_defaults"], |
| 391 | |
| 392 | cflags: [ |
| 393 | "-include debug/wrap_gles.h", |
| 394 | "-DHWUI_NULL_GPU", |
| 395 | ], |
| 396 | |
| 397 | whole_static_libs: ["libhwui_static_debug"], |
| 398 | shared_libs: ["libmemunreachable"], |
| 399 | |
| 400 | srcs: [ |
| 401 | "tests/microbench/main.cpp", |
| 402 | "tests/microbench/DisplayListCanvasBench.cpp", |
| 403 | "tests/microbench/FontBench.cpp", |
| 404 | "tests/microbench/FrameBuilderBench.cpp", |
| 405 | "tests/microbench/LinearAllocatorBench.cpp", |
| 406 | "tests/microbench/PathParserBench.cpp", |
| 407 | "tests/microbench/RenderNodeBench.cpp", |
| 408 | "tests/microbench/ShadowBench.cpp", |
| 409 | "tests/microbench/TaskManagerBench.cpp", |
| 410 | ], |
| 411 | } |