blob: 813eae74a051cbb7d6896bc6e7f20884c970d291 [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 Nainar7184e282018-03-07 23:24:02 -08009 // Disable LTO temporarily. LTO does not seem to interact well with
10 // PGO profile-file updates and incremental builds in the build
11 // servers.
12 // "hwui_lto",
Colin Crossf6298102017-04-19 15:25:25 -070013 ],
14
John Reckf8441e62017-10-23 13:10:41 -070015 cpp_std: "c++17",
16
Colin Crossf6298102017-04-19 15:25:25 -070017 cflags: [
18 "-DEGL_EGLEXT_PROTOTYPES",
19 "-DGL_GLEXT_PROTOTYPES",
20 "-DATRACE_TAG=ATRACE_TAG_VIEW",
21 "-DLOG_TAG=\"OpenGLRenderer\"",
22 "-Wall",
23 "-Wno-unused-parameter",
24 "-Wunreachable-code",
25 "-Werror",
26 "-fvisibility=hidden",
27
28 // GCC false-positives on this warning, and since we -Werror that's
29 // a problem
30 "-Wno-free-nonheap-object",
31
32 // clang's warning is broken, see: https://llvm.org/bugs/show_bug.cgi?id=21629
33 "-Wno-missing-braces",
34
35 // TODO: Linear blending should be enabled by default, but we are
36 // TODO: making it an opt-in while it's a work in progress
37 //"-DANDROID_ENABLE_LINEAR_BLENDING",
38 ],
39
40 include_dirs: [
41 "external/skia/include/private",
42 "external/skia/src/core",
43 "external/skia/src/effects",
44 "external/skia/src/image",
45 "external/skia/src/utils",
Stan Iliev3310fb12017-03-23 16:56:51 -040046 "external/skia/src/gpu",
Colin Crossf6298102017-04-19 15:25:25 -070047 ],
48
49 product_variables: {
50 device_uses_hwc2: {
51 cflags: ["-DUSE_HWC2"],
52 },
53 },
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: [
75 "libplatformprotos",
Stan Ilievd495f432017-10-09 15:49:32 -040076 "libEGL_blobCache",
Colin Crossf6298102017-04-19 15:25:25 -070077 ],
78}
79
80cc_defaults {
81 name: "hwui_bugreport_font_cache_usage",
82 srcs: ["font/FontCacheHistoryTracker.cpp"],
83 cflags: ["-DBUGREPORT_FONT_CACHE_USAGE"],
84}
85
86cc_defaults {
87 name: "hwui_compile_for_perf",
88 // TODO: Non-arm?
89 cflags: [
90 "-fno-omit-frame-pointer",
91 "-marm",
92 "-mapcs",
93 ],
94}
95
96cc_defaults {
97 name: "hwui_debug",
98 cflags: ["-include debug/wrap_gles.h"],
99 srcs: [
100 "debug/wrap_gles.cpp",
101 "debug/DefaultGlesDriver.cpp",
102 "debug/GlesErrorCheckWrapper.cpp",
103 "debug/GlesDriver.cpp",
104 "debug/FatalBaseDriver.cpp",
105 "debug/NullGlesDriver.cpp",
106 ],
107 include_dirs: ["frameworks/native/opengl/libs/GLES2"],
108}
109
110cc_defaults {
111 name: "hwui_enable_opengl_validation",
112 defaults: ["hwui_debug"],
113 cflags: ["-DDEBUG_OPENGL=3"],
Colin Crossf6298102017-04-19 15:25:25 -0700114 include_dirs: ["frameworks/native/opengl/libs/GLES2"],
115}
116
Pirama Arumuga Nainar0dfd4be2017-11-16 22:40:00 -0800117// Build libhwui with PGO by default.
118// Location of PGO profile data is defined in build/soong/cc/pgo.go
119// and is separate from hwui.
120// To turn it off, set ANDROID_PGO_NO_PROFILE_USE environment variable
121// or set enable_profile_use property to false.
122cc_defaults {
123 name: "hwui_pgo",
124
125 pgo: {
126 instrumentation: true,
127 profile_file: "hwui/hwui.profdata",
128 benchmarks: ["hwui"],
Zhizhou Yang58e1b782017-12-06 16:59:06 -0800129 enable_profile_use: true,
Pirama Arumuga Nainar0dfd4be2017-11-16 22:40:00 -0800130 },
131}
132
Zhizhou Yangf30f1122018-02-26 17:59:38 -0800133// Build hwui library with ThinLTO by default.
134cc_defaults {
135 name: "hwui_lto",
136 target: {
137 android: {
138 lto: {
139 thin: true,
140 },
141 },
142 },
143}
144
Colin Crossf6298102017-04-19 15:25:25 -0700145// ------------------------
146// library
147// ------------------------
148
149cc_defaults {
150 name: "libhwui_defaults",
151 defaults: ["hwui_defaults"],
Derek Sollenbergerd938e5a2017-07-24 09:42:07 -0400152
Tej Singhbb8554a2018-01-26 11:59:14 -0800153 shared_libs: ["libstatslog"],
154
Derek Sollenbergerd938e5a2017-07-24 09:42:07 -0400155 whole_static_libs: ["libskia"],
156
Colin Crossf6298102017-04-19 15:25:25 -0700157 srcs: [
Derek Sollenberger2d142132018-01-22 10:25:26 -0500158 "hwui/AnimatedImageDrawable.cpp",
Leon Scroggins III5b7f4262018-01-26 11:03:54 -0500159 "hwui/AnimatedImageThread.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700160 "hwui/Bitmap.cpp",
161 "font/CacheTexture.cpp",
162 "font/Font.cpp",
163 "hwui/Canvas.cpp",
164 "hwui/MinikinSkia.cpp",
165 "hwui/MinikinUtils.cpp",
166 "hwui/PaintImpl.cpp",
167 "hwui/Typeface.cpp",
168 "pipeline/skia/GLFunctorDrawable.cpp",
169 "pipeline/skia/LayerDrawable.cpp",
170 "pipeline/skia/RenderNodeDrawable.cpp",
171 "pipeline/skia/ReorderBarrierDrawables.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400172 "pipeline/skia/ShaderCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700173 "pipeline/skia/SkiaDisplayList.cpp",
174 "pipeline/skia/SkiaOpenGLPipeline.cpp",
175 "pipeline/skia/SkiaOpenGLReadback.cpp",
176 "pipeline/skia/SkiaPipeline.cpp",
177 "pipeline/skia/SkiaProfileRenderer.cpp",
178 "pipeline/skia/SkiaRecordingCanvas.cpp",
179 "pipeline/skia/SkiaVulkanPipeline.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400180 "pipeline/skia/VectorDrawableAtlas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700181 "renderstate/Blend.cpp",
182 "renderstate/MeshState.cpp",
183 "renderstate/OffscreenBufferPool.cpp",
184 "renderstate/PixelBufferState.cpp",
185 "renderstate/RenderState.cpp",
186 "renderstate/Scissor.cpp",
187 "renderstate/Stencil.cpp",
188 "renderstate/TextureState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400189 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700190 "renderthread/CanvasContext.cpp",
191 "renderthread/OpenGLPipeline.cpp",
192 "renderthread/DrawFrameTask.cpp",
193 "renderthread/EglManager.cpp",
194 "renderthread/VulkanManager.cpp",
195 "renderthread/RenderProxy.cpp",
196 "renderthread/RenderTask.cpp",
197 "renderthread/RenderThread.cpp",
198 "renderthread/TimeLord.cpp",
199 "renderthread/Frame.cpp",
200 "service/GraphicsStatsService.cpp",
201 "thread/TaskManager.cpp",
202 "utils/Blur.cpp",
203 "utils/Color.cpp",
204 "utils/GLUtils.cpp",
205 "utils/LinearAllocator.cpp",
206 "utils/StringUtils.cpp",
207 "utils/TestWindowContext.cpp",
208 "utils/VectorDrawableUtils.cpp",
209 "AmbientShadow.cpp",
210 "AnimationContext.cpp",
211 "Animator.cpp",
212 "AnimatorManager.cpp",
213 "BakedOpDispatcher.cpp",
214 "BakedOpRenderer.cpp",
215 "BakedOpState.cpp",
216 "Caches.cpp",
217 "CanvasState.cpp",
218 "ClipArea.cpp",
219 "DamageAccumulator.cpp",
220 "DeferredLayerUpdater.cpp",
221 "DeviceInfo.cpp",
222 "DisplayList.cpp",
223 "Extensions.cpp",
224 "FboCache.cpp",
225 "FontRenderer.cpp",
226 "FrameBuilder.cpp",
227 "FrameInfo.cpp",
228 "FrameInfoVisualizer.cpp",
229 "GammaFontRenderer.cpp",
230 "GlLayer.cpp",
231 "GlopBuilder.cpp",
232 "GpuMemoryTracker.cpp",
233 "GradientCache.cpp",
234 "Image.cpp",
235 "Interpolator.cpp",
236 "JankTracker.cpp",
237 "Layer.cpp",
238 "LayerBuilder.cpp",
239 "LayerUpdateQueue.cpp",
240 "Matrix.cpp",
241 "OpDumper.cpp",
242 "OpenGLReadback.cpp",
243 "Patch.cpp",
244 "PatchCache.cpp",
245 "PathCache.cpp",
246 "PathParser.cpp",
247 "PathTessellator.cpp",
248 "PixelBuffer.cpp",
John Reck7075c792017-07-05 14:03:43 -0700249 "ProfileData.cpp",
John Reck34781b22017-07-05 16:39:36 -0700250 "ProfileDataContainer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700251 "ProfileRenderer.cpp",
252 "Program.cpp",
253 "ProgramCache.cpp",
254 "Properties.cpp",
255 "PropertyValuesAnimatorSet.cpp",
256 "PropertyValuesHolder.cpp",
257 "RecordingCanvas.cpp",
258 "RenderBufferCache.cpp",
259 "RenderNode.cpp",
260 "RenderProperties.cpp",
261 "ResourceCache.cpp",
262 "ShadowTessellator.cpp",
263 "SkiaCanvas.cpp",
264 "SkiaCanvasProxy.cpp",
265 "SkiaShader.cpp",
266 "Snapshot.cpp",
267 "SpotShadow.cpp",
268 "TessellationCache.cpp",
269 "TextDropShadowCache.cpp",
270 "Texture.cpp",
271 "TextureCache.cpp",
272 "VectorDrawable.cpp",
273 "VkLayer.cpp",
274 "protos/hwui.proto",
275 ],
276
277 proto: {
278 export_proto_headers: true,
279 },
280
281 export_include_dirs: ["."],
Colin Cross3f8fd402017-04-20 12:20:20 -0700282 export_shared_lib_headers: ["libRScpp"],
Colin Crossf6298102017-04-19 15:25:25 -0700283}
284
285cc_library {
286 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700287 defaults: [
288 "libhwui_defaults",
289
290 // Enables fine-grained GLES error checking
291 // If enabled, every GLES call is wrapped & error checked
292 // Has moderate overhead
293 "hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700294 ],
Colin Crossf6298102017-04-19 15:25:25 -0700295}
296
297// ------------------------
298// static library null gpu
299// ------------------------
300
301cc_library_static {
302 name: "libhwui_static_debug",
303 defaults: [
304 "libhwui_defaults",
305 "hwui_debug",
306 ],
307 cflags: ["-DHWUI_NULL_GPU"],
308 srcs: [
309 "debug/nullegl.cpp",
310 ],
Colin Crossf6298102017-04-19 15:25:25 -0700311}
312
313cc_defaults {
314 name: "hwui_test_defaults",
315 defaults: ["hwui_defaults"],
316 test_suites: ["device-tests"],
317 srcs: [
318 "tests/common/scenes/*.cpp",
319 "tests/common/LeakChecker.cpp",
320 "tests/common/TestListViewSceneBase.cpp",
321 "tests/common/TestContext.cpp",
322 "tests/common/TestScene.cpp",
323 "tests/common/TestUtils.cpp",
324 ],
325}
326
327// ------------------------
328// unit tests
329// ------------------------
330
331cc_test {
332 name: "hwui_unit_tests",
333 defaults: ["hwui_test_defaults"],
334
335 static_libs: [
336 "libgmock",
337 "libhwui_static_debug",
338 ],
Tej Singhbb8554a2018-01-26 11:59:14 -0800339 shared_libs: [
340 "libmemunreachable",
341 "libstatslog",
342 ],
Colin Crossf6298102017-04-19 15:25:25 -0700343 cflags: [
344 "-include debug/wrap_gles.h",
345 "-DHWUI_NULL_GPU",
346 ],
347
348 srcs: [
349 "tests/unit/main.cpp",
350 "tests/unit/BakedOpDispatcherTests.cpp",
351 "tests/unit/BakedOpRendererTests.cpp",
352 "tests/unit/BakedOpStateTests.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400353 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700354 "tests/unit/CanvasContextTests.cpp",
355 "tests/unit/CanvasStateTests.cpp",
356 "tests/unit/ClipAreaTests.cpp",
357 "tests/unit/DamageAccumulatorTests.cpp",
358 "tests/unit/DeferredLayerUpdaterTests.cpp",
359 "tests/unit/DeviceInfoTests.cpp",
360 "tests/unit/FatVectorTests.cpp",
361 "tests/unit/FontRendererTests.cpp",
362 "tests/unit/FrameBuilderTests.cpp",
363 "tests/unit/GlopBuilderTests.cpp",
364 "tests/unit/GpuMemoryTrackerTests.cpp",
365 "tests/unit/GradientCacheTests.cpp",
366 "tests/unit/GraphicsStatsServiceTests.cpp",
367 "tests/unit/LayerUpdateQueueTests.cpp",
368 "tests/unit/LeakCheckTests.cpp",
369 "tests/unit/LinearAllocatorTests.cpp",
370 "tests/unit/MatrixTests.cpp",
371 "tests/unit/MeshStateTests.cpp",
372 "tests/unit/OffscreenBufferPoolTests.cpp",
373 "tests/unit/OpDumperTests.cpp",
374 "tests/unit/PathInterpolatorTests.cpp",
375 "tests/unit/RenderNodeDrawableTests.cpp",
376 "tests/unit/RecordingCanvasTests.cpp",
377 "tests/unit/RenderNodeTests.cpp",
378 "tests/unit/RenderPropertiesTests.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400379 "tests/unit/ShaderCacheTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700380 "tests/unit/SkiaBehaviorTests.cpp",
381 "tests/unit/SkiaDisplayListTests.cpp",
382 "tests/unit/SkiaPipelineTests.cpp",
383 "tests/unit/SkiaRenderPropertiesTests.cpp",
384 "tests/unit/SkiaCanvasTests.cpp",
385 "tests/unit/SnapshotTests.cpp",
386 "tests/unit/StringUtilsTests.cpp",
387 "tests/unit/TestUtilsTests.cpp",
388 "tests/unit/TextDropShadowCacheTests.cpp",
389 "tests/unit/TextureCacheTests.cpp",
John Reckf8441e62017-10-23 13:10:41 -0700390 "tests/unit/ThreadBaseTests.cpp",
391 "tests/unit/TypefaceTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700392 "tests/unit/VectorDrawableTests.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400393 "tests/unit/VectorDrawableAtlasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700394 ],
395}
396
397// ------------------------
398// Macro-bench app
399// ------------------------
400
401cc_benchmark {
402 name: "hwuimacro",
403 defaults: ["hwui_test_defaults"],
404
405 // set to libhwui_static_debug to skip actual GL commands
406 whole_static_libs: ["libhwui"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800407 shared_libs: [
408 "libmemunreachable",
409 "libstatslog",
410 ],
Colin Crossf6298102017-04-19 15:25:25 -0700411
412 srcs: [
413 "tests/macrobench/TestSceneRunner.cpp",
414 "tests/macrobench/main.cpp",
415 ],
416}
417
418// ------------------------
419// Micro-bench app
420// ---------------------
421
422cc_benchmark {
423 name: "hwuimicro",
424 defaults: ["hwui_test_defaults"],
425
426 cflags: [
427 "-include debug/wrap_gles.h",
428 "-DHWUI_NULL_GPU",
429 ],
430
431 whole_static_libs: ["libhwui_static_debug"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800432 shared_libs: [
433 "libmemunreachable",
434 "libstatslog",
435 ],
Colin Crossf6298102017-04-19 15:25:25 -0700436
437 srcs: [
438 "tests/microbench/main.cpp",
439 "tests/microbench/DisplayListCanvasBench.cpp",
440 "tests/microbench/FontBench.cpp",
441 "tests/microbench/FrameBuilderBench.cpp",
442 "tests/microbench/LinearAllocatorBench.cpp",
443 "tests/microbench/PathParserBench.cpp",
444 "tests/microbench/RenderNodeBench.cpp",
445 "tests/microbench/ShadowBench.cpp",
446 "tests/microbench/TaskManagerBench.cpp",
447 ],
448}
Pirama Arumuga Nainarbc1e1772017-11-17 11:32:16 -0800449
450// ----------------------------------------
451// Phony target to build benchmarks for PGO
452// ----------------------------------------
453
454phony {
455 name: "pgo-targets-hwui",
456 required: [
457 "hwuimicro",
458 "hwuimacro",
459 ]
460}