blob: b7ffb5d9dc2e694f8c3e18165ac1f38875ff3769 [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",
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",
Colin Crossf6298102017-04-19 15:25:25 -070075 ],
76 static_libs: [
Stan Ilievd495f432017-10-09 15:49:32 -040077 "libEGL_blobCache",
Colin Crossf6298102017-04-19 15:25:25 -070078 ],
79}
80
81cc_defaults {
82 name: "hwui_bugreport_font_cache_usage",
Colin Crossf6298102017-04-19 15:25:25 -070083 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
153 whole_static_libs: ["libskia"],
154
Colin Crossf6298102017-04-19 15:25:25 -0700155 srcs: [
Derek Sollenberger2d142132018-01-22 10:25:26 -0500156 "hwui/AnimatedImageDrawable.cpp",
Leon Scroggins III5b7f4262018-01-26 11:03:54 -0500157 "hwui/AnimatedImageThread.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700158 "hwui/Bitmap.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700159 "hwui/Canvas.cpp",
160 "hwui/MinikinSkia.cpp",
161 "hwui/MinikinUtils.cpp",
162 "hwui/PaintImpl.cpp",
163 "hwui/Typeface.cpp",
164 "pipeline/skia/GLFunctorDrawable.cpp",
165 "pipeline/skia/LayerDrawable.cpp",
166 "pipeline/skia/RenderNodeDrawable.cpp",
167 "pipeline/skia/ReorderBarrierDrawables.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400168 "pipeline/skia/ShaderCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700169 "pipeline/skia/SkiaDisplayList.cpp",
Derek Sollenberger0057db22018-03-29 14:18:44 -0400170 "pipeline/skia/SkiaMemoryTracer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700171 "pipeline/skia/SkiaOpenGLPipeline.cpp",
172 "pipeline/skia/SkiaOpenGLReadback.cpp",
173 "pipeline/skia/SkiaPipeline.cpp",
174 "pipeline/skia/SkiaProfileRenderer.cpp",
175 "pipeline/skia/SkiaRecordingCanvas.cpp",
176 "pipeline/skia/SkiaVulkanPipeline.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400177 "pipeline/skia/VectorDrawableAtlas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700178 "renderstate/RenderState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400179 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700180 "renderthread/CanvasContext.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700181 "renderthread/DrawFrameTask.cpp",
182 "renderthread/EglManager.cpp",
183 "renderthread/VulkanManager.cpp",
184 "renderthread/RenderProxy.cpp",
185 "renderthread/RenderTask.cpp",
186 "renderthread/RenderThread.cpp",
187 "renderthread/TimeLord.cpp",
188 "renderthread/Frame.cpp",
189 "service/GraphicsStatsService.cpp",
Stan Ilievc8e22a62018-08-14 13:30:17 -0400190 "surfacetexture/EGLConsumer.cpp",
191 "surfacetexture/ImageConsumer.cpp",
192 "surfacetexture/SurfaceTexture.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700193 "thread/TaskManager.cpp",
194 "utils/Blur.cpp",
195 "utils/Color.cpp",
196 "utils/GLUtils.cpp",
197 "utils/LinearAllocator.cpp",
198 "utils/StringUtils.cpp",
199 "utils/TestWindowContext.cpp",
200 "utils/VectorDrawableUtils.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700201 "AnimationContext.cpp",
202 "Animator.cpp",
203 "AnimatorManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700204 "CanvasState.cpp",
John Reck9ce2bf72018-07-02 18:33:32 -0700205 "CanvasTransform.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700206 "ClipArea.cpp",
207 "DamageAccumulator.cpp",
208 "DeferredLayerUpdater.cpp",
209 "DeviceInfo.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700210 "FrameInfo.cpp",
211 "FrameInfoVisualizer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700212 "GpuMemoryTracker.cpp",
John Recke170fb62018-05-07 08:12:07 -0700213 "HardwareBitmapUploader.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700214 "Interpolator.cpp",
215 "JankTracker.cpp",
216 "Layer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700217 "LayerUpdateQueue.cpp",
218 "Matrix.cpp",
John Reck44627c22018-04-12 13:55:38 -0700219 "EglReadback.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700220 "PathParser.cpp",
John Reck7075c792017-07-05 14:03:43 -0700221 "ProfileData.cpp",
John Reck34781b22017-07-05 16:39:36 -0700222 "ProfileDataContainer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700223 "Properties.cpp",
224 "PropertyValuesAnimatorSet.cpp",
225 "PropertyValuesHolder.cpp",
John Reck8f45d4a2018-08-15 10:17:12 -0700226 "RecordingCanvas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700227 "RenderNode.cpp",
228 "RenderProperties.cpp",
229 "ResourceCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700230 "SkiaCanvas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700231 "Snapshot.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700232 "VectorDrawable.cpp",
Kweku Adams228b6d22018-04-12 13:09:04 -0700233 "protos/graphicsstats.proto",
Colin Crossf6298102017-04-19 15:25:25 -0700234 ],
235
Kweku Adams228b6d22018-04-12 13:09:04 -0700236 proto: {
237 export_proto_headers: true,
238 },
239
Colin Crossf6298102017-04-19 15:25:25 -0700240 export_include_dirs: ["."],
241}
242
243cc_library {
244 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700245 defaults: [
246 "libhwui_defaults",
247
248 // Enables fine-grained GLES error checking
249 // If enabled, every GLES call is wrapped & error checked
250 // Has moderate overhead
251 "hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700252 ],
Colin Crossf6298102017-04-19 15:25:25 -0700253}
254
255// ------------------------
256// static library null gpu
257// ------------------------
258
259cc_library_static {
260 name: "libhwui_static_debug",
261 defaults: [
262 "libhwui_defaults",
263 "hwui_debug",
264 ],
265 cflags: ["-DHWUI_NULL_GPU"],
266 srcs: [
267 "debug/nullegl.cpp",
268 ],
Colin Crossf6298102017-04-19 15:25:25 -0700269}
270
271cc_defaults {
272 name: "hwui_test_defaults",
273 defaults: ["hwui_defaults"],
274 test_suites: ["device-tests"],
275 srcs: [
276 "tests/common/scenes/*.cpp",
277 "tests/common/LeakChecker.cpp",
278 "tests/common/TestListViewSceneBase.cpp",
279 "tests/common/TestContext.cpp",
280 "tests/common/TestScene.cpp",
281 "tests/common/TestUtils.cpp",
282 ],
283}
284
285// ------------------------
286// unit tests
287// ------------------------
288
289cc_test {
290 name: "hwui_unit_tests",
291 defaults: ["hwui_test_defaults"],
292
293 static_libs: [
294 "libgmock",
295 "libhwui_static_debug",
296 ],
Tej Singhbb8554a2018-01-26 11:59:14 -0800297 shared_libs: [
298 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800299 ],
Colin Crossf6298102017-04-19 15:25:25 -0700300 cflags: [
301 "-include debug/wrap_gles.h",
302 "-DHWUI_NULL_GPU",
303 ],
304
305 srcs: [
306 "tests/unit/main.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400307 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700308 "tests/unit/CanvasContextTests.cpp",
309 "tests/unit/CanvasStateTests.cpp",
310 "tests/unit/ClipAreaTests.cpp",
311 "tests/unit/DamageAccumulatorTests.cpp",
312 "tests/unit/DeferredLayerUpdaterTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700313 "tests/unit/FatVectorTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700314 "tests/unit/GpuMemoryTrackerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700315 "tests/unit/GraphicsStatsServiceTests.cpp",
316 "tests/unit/LayerUpdateQueueTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700317 "tests/unit/LinearAllocatorTests.cpp",
318 "tests/unit/MatrixTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700319 "tests/unit/PathInterpolatorTests.cpp",
320 "tests/unit/RenderNodeDrawableTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700321 "tests/unit/RenderNodeTests.cpp",
322 "tests/unit/RenderPropertiesTests.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400323 "tests/unit/ShaderCacheTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700324 "tests/unit/SkiaBehaviorTests.cpp",
325 "tests/unit/SkiaDisplayListTests.cpp",
326 "tests/unit/SkiaPipelineTests.cpp",
327 "tests/unit/SkiaRenderPropertiesTests.cpp",
328 "tests/unit/SkiaCanvasTests.cpp",
329 "tests/unit/SnapshotTests.cpp",
330 "tests/unit/StringUtilsTests.cpp",
331 "tests/unit/TestUtilsTests.cpp",
John Reckf8441e62017-10-23 13:10:41 -0700332 "tests/unit/ThreadBaseTests.cpp",
333 "tests/unit/TypefaceTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700334 "tests/unit/VectorDrawableTests.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400335 "tests/unit/VectorDrawableAtlasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700336 ],
337}
338
339// ------------------------
340// Macro-bench app
341// ------------------------
342
343cc_benchmark {
344 name: "hwuimacro",
345 defaults: ["hwui_test_defaults"],
346
347 // set to libhwui_static_debug to skip actual GL commands
348 whole_static_libs: ["libhwui"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800349 shared_libs: [
350 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800351 ],
Colin Crossf6298102017-04-19 15:25:25 -0700352
353 srcs: [
354 "tests/macrobench/TestSceneRunner.cpp",
355 "tests/macrobench/main.cpp",
356 ],
357}
358
359// ------------------------
360// Micro-bench app
361// ---------------------
362
363cc_benchmark {
364 name: "hwuimicro",
365 defaults: ["hwui_test_defaults"],
366
367 cflags: [
368 "-include debug/wrap_gles.h",
369 "-DHWUI_NULL_GPU",
370 ],
371
372 whole_static_libs: ["libhwui_static_debug"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800373 shared_libs: [
374 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800375 ],
Colin Crossf6298102017-04-19 15:25:25 -0700376
377 srcs: [
378 "tests/microbench/main.cpp",
379 "tests/microbench/DisplayListCanvasBench.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700380 "tests/microbench/LinearAllocatorBench.cpp",
381 "tests/microbench/PathParserBench.cpp",
382 "tests/microbench/RenderNodeBench.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700383 "tests/microbench/TaskManagerBench.cpp",
384 ],
385}
Pirama Arumuga Nainarbc1e1772017-11-17 11:32:16 -0800386
387// ----------------------------------------
388// Phony target to build benchmarks for PGO
389// ----------------------------------------
390
391phony {
392 name: "pgo-targets-hwui",
393 required: [
394 "hwuimicro",
395 "hwuimacro",
396 ]
397}