blob: 503951d1adc6e4379deb304d826ebce1d7ed021f [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 Sollenberger02456f02018-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",
Yangster-macba5bf0d2018-10-09 20:48:23 -070064 "libstatslog",
Colin Crossf6298102017-04-19 15:25:25 -070065 "libutils",
66 "libEGL",
67 "libGLESv2",
68 "libvulkan",
Colin Crossf6298102017-04-19 15:25:25 -070069 "libui",
70 "libgui",
John Reck915883b2017-05-03 10:27:20 -070071 "libprotobuf-cpp-lite",
Colin Crossf6298102017-04-19 15:25:25 -070072 "libharfbuzz_ng",
73 "libft2",
74 "libminikin",
75 "libandroidfw",
Yichi Chen9f959552018-03-29 21:21:54 +080076 "libcrypto",
Colin Crossf6298102017-04-19 15:25:25 -070077 ],
78 static_libs: [
Stan Ilievd495f432017-10-09 15:49:32 -040079 "libEGL_blobCache",
Colin Crossf6298102017-04-19 15:25:25 -070080 ],
81}
82
83cc_defaults {
84 name: "hwui_bugreport_font_cache_usage",
Colin Crossf6298102017-04-19 15:25:25 -070085 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",
Colin Crossf6298102017-04-19 15:25:25 -0700161 "hwui/Canvas.cpp",
162 "hwui/MinikinSkia.cpp",
163 "hwui/MinikinUtils.cpp",
164 "hwui/PaintImpl.cpp",
165 "hwui/Typeface.cpp",
166 "pipeline/skia/GLFunctorDrawable.cpp",
167 "pipeline/skia/LayerDrawable.cpp",
168 "pipeline/skia/RenderNodeDrawable.cpp",
169 "pipeline/skia/ReorderBarrierDrawables.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400170 "pipeline/skia/ShaderCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700171 "pipeline/skia/SkiaDisplayList.cpp",
Derek Sollenberger0057db22018-03-29 14:18:44 -0400172 "pipeline/skia/SkiaMemoryTracer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700173 "pipeline/skia/SkiaOpenGLPipeline.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700174 "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",
Stan Iliev11606ff2018-09-17 14:01:16 -0400179 "pipeline/skia/VkFunctorDrawable.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700180 "renderstate/RenderState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400181 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700182 "renderthread/CanvasContext.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700183 "renderthread/DrawFrameTask.cpp",
184 "renderthread/EglManager.cpp",
185 "renderthread/VulkanManager.cpp",
186 "renderthread/RenderProxy.cpp",
187 "renderthread/RenderTask.cpp",
188 "renderthread/RenderThread.cpp",
189 "renderthread/TimeLord.cpp",
190 "renderthread/Frame.cpp",
191 "service/GraphicsStatsService.cpp",
Stan Iliev564ca3e2018-09-04 22:00:00 +0000192 "surfacetexture/EGLConsumer.cpp",
193 "surfacetexture/ImageConsumer.cpp",
194 "surfacetexture/SurfaceTexture.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700195 "thread/TaskManager.cpp",
196 "utils/Blur.cpp",
197 "utils/Color.cpp",
198 "utils/GLUtils.cpp",
199 "utils/LinearAllocator.cpp",
200 "utils/StringUtils.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700201 "utils/VectorDrawableUtils.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700202 "AnimationContext.cpp",
203 "Animator.cpp",
204 "AnimatorManager.cpp",
John Reck9ce2bf72018-07-02 18:33:32 -0700205 "CanvasTransform.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700206 "DamageAccumulator.cpp",
207 "DeferredLayerUpdater.cpp",
208 "DeviceInfo.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700209 "FrameInfo.cpp",
210 "FrameInfoVisualizer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700211 "GpuMemoryTracker.cpp",
John Recke170fb62018-05-07 08:12:07 -0700212 "HardwareBitmapUploader.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700213 "Interpolator.cpp",
214 "JankTracker.cpp",
215 "Layer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700216 "LayerUpdateQueue.cpp",
217 "Matrix.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700218 "PathParser.cpp",
John Reck7075c792017-07-05 14:03:43 -0700219 "ProfileData.cpp",
John Reck34781b22017-07-05 16:39:36 -0700220 "ProfileDataContainer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700221 "Properties.cpp",
222 "PropertyValuesAnimatorSet.cpp",
223 "PropertyValuesHolder.cpp",
Stan Iliev1a025a72018-09-05 16:35:11 -0400224 "Readback.cpp",
John Reck8f45d4a2018-08-15 10:17:12 -0700225 "RecordingCanvas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700226 "RenderNode.cpp",
227 "RenderProperties.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700228 "SkiaCanvas.cpp",
John Reckbb3a3582018-09-26 11:21:08 -0700229 "TreeInfo.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700230 "VectorDrawable.cpp",
Kweku Adams228b6d22018-04-12 13:09:04 -0700231 "protos/graphicsstats.proto",
Colin Crossf6298102017-04-19 15:25:25 -0700232 ],
233
Kweku Adams228b6d22018-04-12 13:09:04 -0700234 proto: {
235 export_proto_headers: true,
236 },
237
Colin Crossf6298102017-04-19 15:25:25 -0700238 export_include_dirs: ["."],
239}
240
241cc_library {
242 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700243 defaults: [
244 "libhwui_defaults",
245
246 // Enables fine-grained GLES error checking
247 // If enabled, every GLES call is wrapped & error checked
248 // Has moderate overhead
John Reckbdc9f1b2018-09-14 15:22:35 -0700249 //"hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700250 ],
Colin Crossf6298102017-04-19 15:25:25 -0700251}
252
253// ------------------------
254// static library null gpu
255// ------------------------
256
257cc_library_static {
258 name: "libhwui_static_debug",
259 defaults: [
260 "libhwui_defaults",
261 "hwui_debug",
262 ],
263 cflags: ["-DHWUI_NULL_GPU"],
264 srcs: [
265 "debug/nullegl.cpp",
266 ],
Colin Crossf6298102017-04-19 15:25:25 -0700267}
268
269cc_defaults {
270 name: "hwui_test_defaults",
271 defaults: ["hwui_defaults"],
272 test_suites: ["device-tests"],
273 srcs: [
274 "tests/common/scenes/*.cpp",
275 "tests/common/LeakChecker.cpp",
276 "tests/common/TestListViewSceneBase.cpp",
277 "tests/common/TestContext.cpp",
278 "tests/common/TestScene.cpp",
279 "tests/common/TestUtils.cpp",
280 ],
281}
282
283// ------------------------
284// unit tests
285// ------------------------
286
287cc_test {
288 name: "hwui_unit_tests",
289 defaults: ["hwui_test_defaults"],
290
291 static_libs: [
292 "libgmock",
293 "libhwui_static_debug",
294 ],
Tej Singhbb8554a2018-01-26 11:59:14 -0800295 shared_libs: [
296 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800297 ],
Colin Crossf6298102017-04-19 15:25:25 -0700298 cflags: [
299 "-include debug/wrap_gles.h",
300 "-DHWUI_NULL_GPU",
301 ],
302
303 srcs: [
304 "tests/unit/main.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400305 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700306 "tests/unit/CanvasContextTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700307 "tests/unit/DamageAccumulatorTests.cpp",
308 "tests/unit/DeferredLayerUpdaterTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700309 "tests/unit/FatVectorTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700310 "tests/unit/GpuMemoryTrackerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700311 "tests/unit/GraphicsStatsServiceTests.cpp",
312 "tests/unit/LayerUpdateQueueTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700313 "tests/unit/LinearAllocatorTests.cpp",
314 "tests/unit/MatrixTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700315 "tests/unit/PathInterpolatorTests.cpp",
316 "tests/unit/RenderNodeDrawableTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700317 "tests/unit/RenderNodeTests.cpp",
318 "tests/unit/RenderPropertiesTests.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400319 "tests/unit/ShaderCacheTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700320 "tests/unit/SkiaBehaviorTests.cpp",
321 "tests/unit/SkiaDisplayListTests.cpp",
322 "tests/unit/SkiaPipelineTests.cpp",
323 "tests/unit/SkiaRenderPropertiesTests.cpp",
324 "tests/unit/SkiaCanvasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700325 "tests/unit/StringUtilsTests.cpp",
326 "tests/unit/TestUtilsTests.cpp",
John Reckf8441e62017-10-23 13:10:41 -0700327 "tests/unit/ThreadBaseTests.cpp",
328 "tests/unit/TypefaceTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700329 "tests/unit/VectorDrawableTests.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400330 "tests/unit/VectorDrawableAtlasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700331 ],
332}
333
334// ------------------------
335// Macro-bench app
336// ------------------------
337
338cc_benchmark {
339 name: "hwuimacro",
340 defaults: ["hwui_test_defaults"],
341
342 // set to libhwui_static_debug to skip actual GL commands
343 whole_static_libs: ["libhwui"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800344 shared_libs: [
345 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800346 ],
Colin Crossf6298102017-04-19 15:25:25 -0700347
348 srcs: [
349 "tests/macrobench/TestSceneRunner.cpp",
350 "tests/macrobench/main.cpp",
351 ],
352}
353
354// ------------------------
355// Micro-bench app
356// ---------------------
357
358cc_benchmark {
359 name: "hwuimicro",
360 defaults: ["hwui_test_defaults"],
361
362 cflags: [
363 "-include debug/wrap_gles.h",
364 "-DHWUI_NULL_GPU",
365 ],
366
367 whole_static_libs: ["libhwui_static_debug"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800368 shared_libs: [
369 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800370 ],
Colin Crossf6298102017-04-19 15:25:25 -0700371
372 srcs: [
373 "tests/microbench/main.cpp",
374 "tests/microbench/DisplayListCanvasBench.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700375 "tests/microbench/LinearAllocatorBench.cpp",
376 "tests/microbench/PathParserBench.cpp",
377 "tests/microbench/RenderNodeBench.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700378 "tests/microbench/TaskManagerBench.cpp",
379 ],
380}
Pirama Arumuga Nainarbc1e1772017-11-17 11:32:16 -0800381
382// ----------------------------------------
383// Phony target to build benchmarks for PGO
384// ----------------------------------------
385
386phony {
387 name: "pgo-targets-hwui",
388 required: [
389 "hwuimicro",
390 "hwuimacro",
391 ]
392}