blob: 6533eb9a2d876da1efff9e69763be9e5807511c1 [file] [log] [blame]
Colin Crossf6298102017-04-19 15:25:25 -07001cc_defaults {
2 name: "hwui_defaults",
3 defaults: [
4 "hwui_static_deps",
Pirama Arumuga Nainar0dfd4be2017-11-16 22:40:00 -08005 "skia_deps",
Colin Crossf6298102017-04-19 15:25:25 -07006 //"hwui_bugreport_font_cache_usage",
7 //"hwui_compile_for_perf",
Pirama Arumuga Nainar0dfd4be2017-11-16 22:40:00 -08008 "hwui_pgo",
Pirama Arumuga Nainarb7913e12018-03-09 00:03:57 +00009 "hwui_lto",
Colin Crossf6298102017-04-19 15:25:25 -070010 ],
11
John Reckf8441e62017-10-23 13:10:41 -070012 cpp_std: "c++17",
13
Colin Crossf6298102017-04-19 15:25:25 -070014 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 // TODO: Linear blending should be enabled by default, but we are
33 // TODO: making it an opt-in while it's a work in progress
34 //"-DANDROID_ENABLE_LINEAR_BLENDING",
35 ],
36
37 include_dirs: [
38 "external/skia/include/private",
39 "external/skia/src/core",
40 "external/skia/src/effects",
41 "external/skia/src/image",
42 "external/skia/src/utils",
Stan Iliev3310fb12017-03-23 16:56:51 -040043 "external/skia/src/gpu",
Derek Sollenberger0fba15b2018-05-30 18:08:57 -040044 "external/skia/src/shaders",
Colin Crossf6298102017-04-19 15:25:25 -070045 ],
46
47 product_variables: {
John Reck27294182018-07-11 11:21:09 -070048 eng: {
49 lto: {
50 never: true,
51 },
52 },
Colin Crossf6298102017-04-19 15:25:25 -070053 },
54}
55
56cc_defaults {
57 name: "hwui_static_deps",
58 shared_libs: [
59 "liblog",
60 "libcutils",
61 "libutils",
62 "libEGL",
63 "libGLESv2",
64 "libvulkan",
Colin Crossf6298102017-04-19 15:25:25 -070065 "libui",
66 "libgui",
John Reck915883b2017-05-03 10:27:20 -070067 "libprotobuf-cpp-lite",
Colin Crossf6298102017-04-19 15:25:25 -070068 "libharfbuzz_ng",
69 "libft2",
70 "libminikin",
71 "libandroidfw",
72 "libRScpp",
73 ],
74 static_libs: [
Stan Ilievd495f432017-10-09 15:49:32 -040075 "libEGL_blobCache",
Colin Crossf6298102017-04-19 15:25:25 -070076 ],
77}
78
79cc_defaults {
80 name: "hwui_bugreport_font_cache_usage",
81 srcs: ["font/FontCacheHistoryTracker.cpp"],
82 cflags: ["-DBUGREPORT_FONT_CACHE_USAGE"],
83}
84
85cc_defaults {
86 name: "hwui_compile_for_perf",
87 // TODO: Non-arm?
88 cflags: [
89 "-fno-omit-frame-pointer",
90 "-marm",
91 "-mapcs",
92 ],
93}
94
95cc_defaults {
96 name: "hwui_debug",
97 cflags: ["-include debug/wrap_gles.h"],
98 srcs: [
99 "debug/wrap_gles.cpp",
100 "debug/DefaultGlesDriver.cpp",
101 "debug/GlesErrorCheckWrapper.cpp",
102 "debug/GlesDriver.cpp",
103 "debug/FatalBaseDriver.cpp",
104 "debug/NullGlesDriver.cpp",
105 ],
106 include_dirs: ["frameworks/native/opengl/libs/GLES2"],
107}
108
109cc_defaults {
110 name: "hwui_enable_opengl_validation",
111 defaults: ["hwui_debug"],
112 cflags: ["-DDEBUG_OPENGL=3"],
Colin Crossf6298102017-04-19 15:25:25 -0700113 include_dirs: ["frameworks/native/opengl/libs/GLES2"],
114}
115
Pirama Arumuga Nainar0dfd4be2017-11-16 22:40:00 -0800116// Build libhwui with PGO by default.
117// Location of PGO profile data is defined in build/soong/cc/pgo.go
118// and is separate from hwui.
119// To turn it off, set ANDROID_PGO_NO_PROFILE_USE environment variable
120// or set enable_profile_use property to false.
121cc_defaults {
122 name: "hwui_pgo",
123
124 pgo: {
125 instrumentation: true,
126 profile_file: "hwui/hwui.profdata",
127 benchmarks: ["hwui"],
Zhizhou Yang58e1b782017-12-06 16:59:06 -0800128 enable_profile_use: true,
Pirama Arumuga Nainar0dfd4be2017-11-16 22:40:00 -0800129 },
130}
131
Zhizhou Yangf30f1122018-02-26 17:59:38 -0800132// Build hwui library with ThinLTO by default.
133cc_defaults {
134 name: "hwui_lto",
135 target: {
136 android: {
137 lto: {
138 thin: true,
139 },
140 },
141 },
142}
143
Colin Crossf6298102017-04-19 15:25:25 -0700144// ------------------------
145// library
146// ------------------------
147
148cc_defaults {
149 name: "libhwui_defaults",
150 defaults: ["hwui_defaults"],
Derek Sollenbergerd938e5a2017-07-24 09:42:07 -0400151
152 whole_static_libs: ["libskia"],
153
Colin Crossf6298102017-04-19 15:25:25 -0700154 srcs: [
Derek Sollenberger2d142132018-01-22 10:25:26 -0500155 "hwui/AnimatedImageDrawable.cpp",
Leon Scroggins III5b7f4262018-01-26 11:03:54 -0500156 "hwui/AnimatedImageThread.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700157 "hwui/Bitmap.cpp",
158 "font/CacheTexture.cpp",
159 "font/Font.cpp",
160 "hwui/Canvas.cpp",
161 "hwui/MinikinSkia.cpp",
162 "hwui/MinikinUtils.cpp",
163 "hwui/PaintImpl.cpp",
164 "hwui/Typeface.cpp",
165 "pipeline/skia/GLFunctorDrawable.cpp",
166 "pipeline/skia/LayerDrawable.cpp",
167 "pipeline/skia/RenderNodeDrawable.cpp",
168 "pipeline/skia/ReorderBarrierDrawables.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400169 "pipeline/skia/ShaderCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700170 "pipeline/skia/SkiaDisplayList.cpp",
Derek Sollenberger0057db22018-03-29 14:18:44 -0400171 "pipeline/skia/SkiaMemoryTracer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700172 "pipeline/skia/SkiaOpenGLPipeline.cpp",
173 "pipeline/skia/SkiaOpenGLReadback.cpp",
174 "pipeline/skia/SkiaPipeline.cpp",
175 "pipeline/skia/SkiaProfileRenderer.cpp",
176 "pipeline/skia/SkiaRecordingCanvas.cpp",
177 "pipeline/skia/SkiaVulkanPipeline.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400178 "pipeline/skia/VectorDrawableAtlas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700179 "renderstate/Blend.cpp",
180 "renderstate/MeshState.cpp",
181 "renderstate/OffscreenBufferPool.cpp",
182 "renderstate/PixelBufferState.cpp",
183 "renderstate/RenderState.cpp",
184 "renderstate/Scissor.cpp",
185 "renderstate/Stencil.cpp",
186 "renderstate/TextureState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400187 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700188 "renderthread/CanvasContext.cpp",
189 "renderthread/OpenGLPipeline.cpp",
190 "renderthread/DrawFrameTask.cpp",
191 "renderthread/EglManager.cpp",
192 "renderthread/VulkanManager.cpp",
193 "renderthread/RenderProxy.cpp",
194 "renderthread/RenderTask.cpp",
195 "renderthread/RenderThread.cpp",
196 "renderthread/TimeLord.cpp",
197 "renderthread/Frame.cpp",
198 "service/GraphicsStatsService.cpp",
199 "thread/TaskManager.cpp",
200 "utils/Blur.cpp",
201 "utils/Color.cpp",
202 "utils/GLUtils.cpp",
203 "utils/LinearAllocator.cpp",
204 "utils/StringUtils.cpp",
205 "utils/TestWindowContext.cpp",
206 "utils/VectorDrawableUtils.cpp",
207 "AmbientShadow.cpp",
208 "AnimationContext.cpp",
209 "Animator.cpp",
210 "AnimatorManager.cpp",
211 "BakedOpDispatcher.cpp",
212 "BakedOpRenderer.cpp",
213 "BakedOpState.cpp",
214 "Caches.cpp",
215 "CanvasState.cpp",
216 "ClipArea.cpp",
217 "DamageAccumulator.cpp",
218 "DeferredLayerUpdater.cpp",
219 "DeviceInfo.cpp",
220 "DisplayList.cpp",
221 "Extensions.cpp",
222 "FboCache.cpp",
223 "FontRenderer.cpp",
224 "FrameBuilder.cpp",
225 "FrameInfo.cpp",
226 "FrameInfoVisualizer.cpp",
227 "GammaFontRenderer.cpp",
228 "GlLayer.cpp",
229 "GlopBuilder.cpp",
230 "GpuMemoryTracker.cpp",
231 "GradientCache.cpp",
232 "Image.cpp",
233 "Interpolator.cpp",
234 "JankTracker.cpp",
235 "Layer.cpp",
236 "LayerBuilder.cpp",
237 "LayerUpdateQueue.cpp",
238 "Matrix.cpp",
239 "OpDumper.cpp",
240 "OpenGLReadback.cpp",
241 "Patch.cpp",
242 "PatchCache.cpp",
243 "PathCache.cpp",
244 "PathParser.cpp",
245 "PathTessellator.cpp",
246 "PixelBuffer.cpp",
John Reck7075c792017-07-05 14:03:43 -0700247 "ProfileData.cpp",
John Reck34781b22017-07-05 16:39:36 -0700248 "ProfileDataContainer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700249 "ProfileRenderer.cpp",
250 "Program.cpp",
251 "ProgramCache.cpp",
252 "Properties.cpp",
253 "PropertyValuesAnimatorSet.cpp",
254 "PropertyValuesHolder.cpp",
255 "RecordingCanvas.cpp",
256 "RenderBufferCache.cpp",
257 "RenderNode.cpp",
258 "RenderProperties.cpp",
259 "ResourceCache.cpp",
260 "ShadowTessellator.cpp",
261 "SkiaCanvas.cpp",
262 "SkiaCanvasProxy.cpp",
263 "SkiaShader.cpp",
264 "Snapshot.cpp",
265 "SpotShadow.cpp",
266 "TessellationCache.cpp",
267 "TextDropShadowCache.cpp",
268 "Texture.cpp",
269 "TextureCache.cpp",
270 "VectorDrawable.cpp",
271 "VkLayer.cpp",
Kweku Adams1856a4c2018-04-03 16:31:10 -0700272 "protos/graphicsstats.proto",
Colin Crossf6298102017-04-19 15:25:25 -0700273 "protos/hwui.proto",
274 ],
275
276 proto: {
277 export_proto_headers: true,
278 },
279
280 export_include_dirs: ["."],
Colin Cross3f8fd402017-04-20 12:20:20 -0700281 export_shared_lib_headers: ["libRScpp"],
Colin Crossf6298102017-04-19 15:25:25 -0700282}
283
284cc_library {
285 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700286 defaults: [
287 "libhwui_defaults",
288
289 // Enables fine-grained GLES error checking
290 // If enabled, every GLES call is wrapped & error checked
291 // Has moderate overhead
292 "hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700293 ],
Colin Crossf6298102017-04-19 15:25:25 -0700294}
295
296// ------------------------
297// static library null gpu
298// ------------------------
299
300cc_library_static {
301 name: "libhwui_static_debug",
302 defaults: [
303 "libhwui_defaults",
304 "hwui_debug",
305 ],
306 cflags: ["-DHWUI_NULL_GPU"],
307 srcs: [
308 "debug/nullegl.cpp",
309 ],
Colin Crossf6298102017-04-19 15:25:25 -0700310}
311
312cc_defaults {
313 name: "hwui_test_defaults",
314 defaults: ["hwui_defaults"],
315 test_suites: ["device-tests"],
316 srcs: [
317 "tests/common/scenes/*.cpp",
318 "tests/common/LeakChecker.cpp",
319 "tests/common/TestListViewSceneBase.cpp",
320 "tests/common/TestContext.cpp",
321 "tests/common/TestScene.cpp",
322 "tests/common/TestUtils.cpp",
323 ],
324}
325
326// ------------------------
327// unit tests
328// ------------------------
329
330cc_test {
331 name: "hwui_unit_tests",
332 defaults: ["hwui_test_defaults"],
333
334 static_libs: [
335 "libgmock",
336 "libhwui_static_debug",
337 ],
Tej Singhbb8554a2018-01-26 11:59:14 -0800338 shared_libs: [
339 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800340 ],
Colin Crossf6298102017-04-19 15:25:25 -0700341 cflags: [
342 "-include debug/wrap_gles.h",
343 "-DHWUI_NULL_GPU",
344 ],
345
346 srcs: [
347 "tests/unit/main.cpp",
348 "tests/unit/BakedOpDispatcherTests.cpp",
349 "tests/unit/BakedOpRendererTests.cpp",
350 "tests/unit/BakedOpStateTests.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400351 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700352 "tests/unit/CanvasContextTests.cpp",
353 "tests/unit/CanvasStateTests.cpp",
354 "tests/unit/ClipAreaTests.cpp",
355 "tests/unit/DamageAccumulatorTests.cpp",
356 "tests/unit/DeferredLayerUpdaterTests.cpp",
357 "tests/unit/DeviceInfoTests.cpp",
358 "tests/unit/FatVectorTests.cpp",
359 "tests/unit/FontRendererTests.cpp",
360 "tests/unit/FrameBuilderTests.cpp",
361 "tests/unit/GlopBuilderTests.cpp",
362 "tests/unit/GpuMemoryTrackerTests.cpp",
363 "tests/unit/GradientCacheTests.cpp",
364 "tests/unit/GraphicsStatsServiceTests.cpp",
365 "tests/unit/LayerUpdateQueueTests.cpp",
366 "tests/unit/LeakCheckTests.cpp",
367 "tests/unit/LinearAllocatorTests.cpp",
368 "tests/unit/MatrixTests.cpp",
369 "tests/unit/MeshStateTests.cpp",
370 "tests/unit/OffscreenBufferPoolTests.cpp",
371 "tests/unit/OpDumperTests.cpp",
372 "tests/unit/PathInterpolatorTests.cpp",
373 "tests/unit/RenderNodeDrawableTests.cpp",
374 "tests/unit/RecordingCanvasTests.cpp",
375 "tests/unit/RenderNodeTests.cpp",
376 "tests/unit/RenderPropertiesTests.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400377 "tests/unit/ShaderCacheTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700378 "tests/unit/SkiaBehaviorTests.cpp",
379 "tests/unit/SkiaDisplayListTests.cpp",
380 "tests/unit/SkiaPipelineTests.cpp",
381 "tests/unit/SkiaRenderPropertiesTests.cpp",
382 "tests/unit/SkiaCanvasTests.cpp",
383 "tests/unit/SnapshotTests.cpp",
384 "tests/unit/StringUtilsTests.cpp",
385 "tests/unit/TestUtilsTests.cpp",
386 "tests/unit/TextDropShadowCacheTests.cpp",
387 "tests/unit/TextureCacheTests.cpp",
John Reckf8441e62017-10-23 13:10:41 -0700388 "tests/unit/ThreadBaseTests.cpp",
389 "tests/unit/TypefaceTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700390 "tests/unit/VectorDrawableTests.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400391 "tests/unit/VectorDrawableAtlasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700392 ],
393}
394
395// ------------------------
396// Macro-bench app
397// ------------------------
398
399cc_benchmark {
400 name: "hwuimacro",
401 defaults: ["hwui_test_defaults"],
402
403 // set to libhwui_static_debug to skip actual GL commands
404 whole_static_libs: ["libhwui"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800405 shared_libs: [
406 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800407 ],
Colin Crossf6298102017-04-19 15:25:25 -0700408
409 srcs: [
410 "tests/macrobench/TestSceneRunner.cpp",
411 "tests/macrobench/main.cpp",
412 ],
413}
414
415// ------------------------
416// Micro-bench app
417// ---------------------
418
419cc_benchmark {
420 name: "hwuimicro",
421 defaults: ["hwui_test_defaults"],
422
423 cflags: [
424 "-include debug/wrap_gles.h",
425 "-DHWUI_NULL_GPU",
426 ],
427
428 whole_static_libs: ["libhwui_static_debug"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800429 shared_libs: [
430 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800431 ],
Colin Crossf6298102017-04-19 15:25:25 -0700432
433 srcs: [
434 "tests/microbench/main.cpp",
435 "tests/microbench/DisplayListCanvasBench.cpp",
436 "tests/microbench/FontBench.cpp",
437 "tests/microbench/FrameBuilderBench.cpp",
438 "tests/microbench/LinearAllocatorBench.cpp",
439 "tests/microbench/PathParserBench.cpp",
440 "tests/microbench/RenderNodeBench.cpp",
441 "tests/microbench/ShadowBench.cpp",
442 "tests/microbench/TaskManagerBench.cpp",
443 ],
444}
Pirama Arumuga Nainarbc1e1772017-11-17 11:32:16 -0800445
446// ----------------------------------------
447// Phony target to build benchmarks for PGO
448// ----------------------------------------
449
450phony {
451 name: "pgo-targets-hwui",
452 required: [
453 "hwuimicro",
454 "hwuimacro",
455 ]
456}