blob: fb8274426b164f9afdb4a1b2bbc5195fdfd05c1b [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: {
48 device_uses_hwc2: {
49 cflags: ["-DUSE_HWC2"],
50 },
John Reck27294182018-07-11 11:21:09 -070051 eng: {
52 lto: {
53 never: true,
54 },
55 },
Colin Crossf6298102017-04-19 15:25:25 -070056 },
57}
58
59cc_defaults {
60 name: "hwui_static_deps",
61 shared_libs: [
62 "liblog",
63 "libcutils",
64 "libutils",
65 "libEGL",
66 "libGLESv2",
67 "libvulkan",
Colin Crossf6298102017-04-19 15:25:25 -070068 "libui",
69 "libgui",
John Reck915883b2017-05-03 10:27:20 -070070 "libprotobuf-cpp-lite",
Colin Crossf6298102017-04-19 15:25:25 -070071 "libharfbuzz_ng",
72 "libft2",
73 "libminikin",
74 "libandroidfw",
75 "libRScpp",
76 ],
77 static_libs: [
Stan Ilievd495f432017-10-09 15:49:32 -040078 "libEGL_blobCache",
Colin Crossf6298102017-04-19 15:25:25 -070079 ],
80}
81
82cc_defaults {
83 name: "hwui_bugreport_font_cache_usage",
84 srcs: ["font/FontCacheHistoryTracker.cpp"],
85 cflags: ["-DBUGREPORT_FONT_CACHE_USAGE"],
86}
87
88cc_defaults {
89 name: "hwui_compile_for_perf",
90 // TODO: Non-arm?
91 cflags: [
92 "-fno-omit-frame-pointer",
93 "-marm",
94 "-mapcs",
95 ],
96}
97
98cc_defaults {
99 name: "hwui_debug",
100 cflags: ["-include debug/wrap_gles.h"],
101 srcs: [
102 "debug/wrap_gles.cpp",
103 "debug/DefaultGlesDriver.cpp",
104 "debug/GlesErrorCheckWrapper.cpp",
105 "debug/GlesDriver.cpp",
106 "debug/FatalBaseDriver.cpp",
107 "debug/NullGlesDriver.cpp",
108 ],
109 include_dirs: ["frameworks/native/opengl/libs/GLES2"],
110}
111
112cc_defaults {
113 name: "hwui_enable_opengl_validation",
114 defaults: ["hwui_debug"],
115 cflags: ["-DDEBUG_OPENGL=3"],
Colin Crossf6298102017-04-19 15:25:25 -0700116 include_dirs: ["frameworks/native/opengl/libs/GLES2"],
117}
118
Pirama Arumuga Nainar0dfd4be2017-11-16 22:40:00 -0800119// Build libhwui with PGO by default.
120// Location of PGO profile data is defined in build/soong/cc/pgo.go
121// and is separate from hwui.
122// To turn it off, set ANDROID_PGO_NO_PROFILE_USE environment variable
123// or set enable_profile_use property to false.
124cc_defaults {
125 name: "hwui_pgo",
126
127 pgo: {
128 instrumentation: true,
129 profile_file: "hwui/hwui.profdata",
130 benchmarks: ["hwui"],
Zhizhou Yang58e1b782017-12-06 16:59:06 -0800131 enable_profile_use: true,
Pirama Arumuga Nainar0dfd4be2017-11-16 22:40:00 -0800132 },
133}
134
Zhizhou Yangf30f1122018-02-26 17:59:38 -0800135// Build hwui library with ThinLTO by default.
136cc_defaults {
137 name: "hwui_lto",
138 target: {
139 android: {
140 lto: {
141 thin: true,
142 },
143 },
144 },
145}
146
Colin Crossf6298102017-04-19 15:25:25 -0700147// ------------------------
148// library
149// ------------------------
150
151cc_defaults {
152 name: "libhwui_defaults",
153 defaults: ["hwui_defaults"],
Derek Sollenbergerd938e5a2017-07-24 09:42:07 -0400154
155 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",
Derek Sollenberger0057db22018-03-29 14:18:44 -0400174 "pipeline/skia/SkiaMemoryTracer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700175 "pipeline/skia/SkiaOpenGLPipeline.cpp",
176 "pipeline/skia/SkiaOpenGLReadback.cpp",
177 "pipeline/skia/SkiaPipeline.cpp",
178 "pipeline/skia/SkiaProfileRenderer.cpp",
179 "pipeline/skia/SkiaRecordingCanvas.cpp",
180 "pipeline/skia/SkiaVulkanPipeline.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400181 "pipeline/skia/VectorDrawableAtlas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700182 "renderstate/Blend.cpp",
183 "renderstate/MeshState.cpp",
184 "renderstate/OffscreenBufferPool.cpp",
185 "renderstate/PixelBufferState.cpp",
186 "renderstate/RenderState.cpp",
187 "renderstate/Scissor.cpp",
188 "renderstate/Stencil.cpp",
189 "renderstate/TextureState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400190 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700191 "renderthread/CanvasContext.cpp",
192 "renderthread/OpenGLPipeline.cpp",
193 "renderthread/DrawFrameTask.cpp",
194 "renderthread/EglManager.cpp",
195 "renderthread/VulkanManager.cpp",
196 "renderthread/RenderProxy.cpp",
197 "renderthread/RenderTask.cpp",
198 "renderthread/RenderThread.cpp",
199 "renderthread/TimeLord.cpp",
200 "renderthread/Frame.cpp",
201 "service/GraphicsStatsService.cpp",
202 "thread/TaskManager.cpp",
203 "utils/Blur.cpp",
204 "utils/Color.cpp",
205 "utils/GLUtils.cpp",
206 "utils/LinearAllocator.cpp",
207 "utils/StringUtils.cpp",
208 "utils/TestWindowContext.cpp",
209 "utils/VectorDrawableUtils.cpp",
210 "AmbientShadow.cpp",
211 "AnimationContext.cpp",
212 "Animator.cpp",
213 "AnimatorManager.cpp",
214 "BakedOpDispatcher.cpp",
215 "BakedOpRenderer.cpp",
216 "BakedOpState.cpp",
217 "Caches.cpp",
218 "CanvasState.cpp",
219 "ClipArea.cpp",
220 "DamageAccumulator.cpp",
221 "DeferredLayerUpdater.cpp",
222 "DeviceInfo.cpp",
223 "DisplayList.cpp",
224 "Extensions.cpp",
225 "FboCache.cpp",
226 "FontRenderer.cpp",
227 "FrameBuilder.cpp",
228 "FrameInfo.cpp",
229 "FrameInfoVisualizer.cpp",
230 "GammaFontRenderer.cpp",
231 "GlLayer.cpp",
232 "GlopBuilder.cpp",
233 "GpuMemoryTracker.cpp",
234 "GradientCache.cpp",
235 "Image.cpp",
236 "Interpolator.cpp",
237 "JankTracker.cpp",
238 "Layer.cpp",
239 "LayerBuilder.cpp",
240 "LayerUpdateQueue.cpp",
241 "Matrix.cpp",
242 "OpDumper.cpp",
243 "OpenGLReadback.cpp",
244 "Patch.cpp",
245 "PatchCache.cpp",
246 "PathCache.cpp",
247 "PathParser.cpp",
248 "PathTessellator.cpp",
249 "PixelBuffer.cpp",
John Reck7075c792017-07-05 14:03:43 -0700250 "ProfileData.cpp",
John Reck34781b22017-07-05 16:39:36 -0700251 "ProfileDataContainer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700252 "ProfileRenderer.cpp",
253 "Program.cpp",
254 "ProgramCache.cpp",
255 "Properties.cpp",
256 "PropertyValuesAnimatorSet.cpp",
257 "PropertyValuesHolder.cpp",
258 "RecordingCanvas.cpp",
259 "RenderBufferCache.cpp",
260 "RenderNode.cpp",
261 "RenderProperties.cpp",
262 "ResourceCache.cpp",
263 "ShadowTessellator.cpp",
264 "SkiaCanvas.cpp",
265 "SkiaCanvasProxy.cpp",
266 "SkiaShader.cpp",
267 "Snapshot.cpp",
268 "SpotShadow.cpp",
269 "TessellationCache.cpp",
270 "TextDropShadowCache.cpp",
271 "Texture.cpp",
272 "TextureCache.cpp",
273 "VectorDrawable.cpp",
274 "VkLayer.cpp",
Kweku Adams1856a4c2018-04-03 16:31:10 -0700275 "protos/graphicsstats.proto",
Colin Crossf6298102017-04-19 15:25:25 -0700276 "protos/hwui.proto",
277 ],
278
279 proto: {
280 export_proto_headers: true,
281 },
282
283 export_include_dirs: ["."],
Colin Cross3f8fd402017-04-20 12:20:20 -0700284 export_shared_lib_headers: ["libRScpp"],
Colin Crossf6298102017-04-19 15:25:25 -0700285}
286
287cc_library {
288 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700289 defaults: [
290 "libhwui_defaults",
291
292 // Enables fine-grained GLES error checking
293 // If enabled, every GLES call is wrapped & error checked
294 // Has moderate overhead
295 "hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700296 ],
Colin Crossf6298102017-04-19 15:25:25 -0700297}
298
299// ------------------------
300// static library null gpu
301// ------------------------
302
303cc_library_static {
304 name: "libhwui_static_debug",
305 defaults: [
306 "libhwui_defaults",
307 "hwui_debug",
308 ],
309 cflags: ["-DHWUI_NULL_GPU"],
310 srcs: [
311 "debug/nullegl.cpp",
312 ],
Colin Crossf6298102017-04-19 15:25:25 -0700313}
314
315cc_defaults {
316 name: "hwui_test_defaults",
317 defaults: ["hwui_defaults"],
318 test_suites: ["device-tests"],
319 srcs: [
320 "tests/common/scenes/*.cpp",
321 "tests/common/LeakChecker.cpp",
322 "tests/common/TestListViewSceneBase.cpp",
323 "tests/common/TestContext.cpp",
324 "tests/common/TestScene.cpp",
325 "tests/common/TestUtils.cpp",
326 ],
327}
328
329// ------------------------
330// unit tests
331// ------------------------
332
333cc_test {
334 name: "hwui_unit_tests",
335 defaults: ["hwui_test_defaults"],
336
337 static_libs: [
338 "libgmock",
339 "libhwui_static_debug",
340 ],
Tej Singhbb8554a2018-01-26 11:59:14 -0800341 shared_libs: [
342 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800343 ],
Colin Crossf6298102017-04-19 15:25:25 -0700344 cflags: [
345 "-include debug/wrap_gles.h",
346 "-DHWUI_NULL_GPU",
347 ],
348
349 srcs: [
350 "tests/unit/main.cpp",
351 "tests/unit/BakedOpDispatcherTests.cpp",
352 "tests/unit/BakedOpRendererTests.cpp",
353 "tests/unit/BakedOpStateTests.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400354 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700355 "tests/unit/CanvasContextTests.cpp",
356 "tests/unit/CanvasStateTests.cpp",
357 "tests/unit/ClipAreaTests.cpp",
358 "tests/unit/DamageAccumulatorTests.cpp",
359 "tests/unit/DeferredLayerUpdaterTests.cpp",
360 "tests/unit/DeviceInfoTests.cpp",
361 "tests/unit/FatVectorTests.cpp",
362 "tests/unit/FontRendererTests.cpp",
363 "tests/unit/FrameBuilderTests.cpp",
364 "tests/unit/GlopBuilderTests.cpp",
365 "tests/unit/GpuMemoryTrackerTests.cpp",
366 "tests/unit/GradientCacheTests.cpp",
367 "tests/unit/GraphicsStatsServiceTests.cpp",
368 "tests/unit/LayerUpdateQueueTests.cpp",
369 "tests/unit/LeakCheckTests.cpp",
370 "tests/unit/LinearAllocatorTests.cpp",
371 "tests/unit/MatrixTests.cpp",
372 "tests/unit/MeshStateTests.cpp",
373 "tests/unit/OffscreenBufferPoolTests.cpp",
374 "tests/unit/OpDumperTests.cpp",
375 "tests/unit/PathInterpolatorTests.cpp",
376 "tests/unit/RenderNodeDrawableTests.cpp",
377 "tests/unit/RecordingCanvasTests.cpp",
378 "tests/unit/RenderNodeTests.cpp",
379 "tests/unit/RenderPropertiesTests.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400380 "tests/unit/ShaderCacheTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700381 "tests/unit/SkiaBehaviorTests.cpp",
382 "tests/unit/SkiaDisplayListTests.cpp",
383 "tests/unit/SkiaPipelineTests.cpp",
384 "tests/unit/SkiaRenderPropertiesTests.cpp",
385 "tests/unit/SkiaCanvasTests.cpp",
386 "tests/unit/SnapshotTests.cpp",
387 "tests/unit/StringUtilsTests.cpp",
388 "tests/unit/TestUtilsTests.cpp",
389 "tests/unit/TextDropShadowCacheTests.cpp",
390 "tests/unit/TextureCacheTests.cpp",
John Reckf8441e62017-10-23 13:10:41 -0700391 "tests/unit/ThreadBaseTests.cpp",
392 "tests/unit/TypefaceTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700393 "tests/unit/VectorDrawableTests.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400394 "tests/unit/VectorDrawableAtlasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700395 ],
396}
397
398// ------------------------
399// Macro-bench app
400// ------------------------
401
402cc_benchmark {
403 name: "hwuimacro",
404 defaults: ["hwui_test_defaults"],
405
406 // set to libhwui_static_debug to skip actual GL commands
407 whole_static_libs: ["libhwui"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800408 shared_libs: [
409 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800410 ],
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",
Tej Singhbb8554a2018-01-26 11:59:14 -0800434 ],
Colin Crossf6298102017-04-19 15:25:25 -0700435
436 srcs: [
437 "tests/microbench/main.cpp",
438 "tests/microbench/DisplayListCanvasBench.cpp",
439 "tests/microbench/FontBench.cpp",
440 "tests/microbench/FrameBuilderBench.cpp",
441 "tests/microbench/LinearAllocatorBench.cpp",
442 "tests/microbench/PathParserBench.cpp",
443 "tests/microbench/RenderNodeBench.cpp",
444 "tests/microbench/ShadowBench.cpp",
445 "tests/microbench/TaskManagerBench.cpp",
446 ],
447}
Pirama Arumuga Nainarbc1e1772017-11-17 11:32:16 -0800448
449// ----------------------------------------
450// Phony target to build benchmarks for PGO
451// ----------------------------------------
452
453phony {
454 name: "pgo-targets-hwui",
455 required: [
456 "hwuimicro",
457 "hwuimacro",
458 ]
459}