blob: 476d3f4115f7502e3d563ff7a99d18837640b72f [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 },
51 },
52}
53
54cc_defaults {
55 name: "hwui_static_deps",
56 shared_libs: [
57 "liblog",
58 "libcutils",
59 "libutils",
60 "libEGL",
61 "libGLESv2",
62 "libvulkan",
Colin Crossf6298102017-04-19 15:25:25 -070063 "libui",
64 "libgui",
John Reck915883b2017-05-03 10:27:20 -070065 "libprotobuf-cpp-lite",
Colin Crossf6298102017-04-19 15:25:25 -070066 "libharfbuzz_ng",
67 "libft2",
68 "libminikin",
69 "libandroidfw",
70 "libRScpp",
71 ],
72 static_libs: [
Stan Ilievd495f432017-10-09 15:49:32 -040073 "libEGL_blobCache",
Colin Crossf6298102017-04-19 15:25:25 -070074 ],
75}
76
77cc_defaults {
78 name: "hwui_bugreport_font_cache_usage",
Colin Crossf6298102017-04-19 15:25:25 -070079 cflags: ["-DBUGREPORT_FONT_CACHE_USAGE"],
80}
81
82cc_defaults {
83 name: "hwui_compile_for_perf",
84 // TODO: Non-arm?
85 cflags: [
86 "-fno-omit-frame-pointer",
87 "-marm",
88 "-mapcs",
89 ],
90}
91
92cc_defaults {
93 name: "hwui_debug",
94 cflags: ["-include debug/wrap_gles.h"],
95 srcs: [
96 "debug/wrap_gles.cpp",
97 "debug/DefaultGlesDriver.cpp",
98 "debug/GlesErrorCheckWrapper.cpp",
99 "debug/GlesDriver.cpp",
100 "debug/FatalBaseDriver.cpp",
101 "debug/NullGlesDriver.cpp",
102 ],
103 include_dirs: ["frameworks/native/opengl/libs/GLES2"],
104}
105
106cc_defaults {
107 name: "hwui_enable_opengl_validation",
108 defaults: ["hwui_debug"],
109 cflags: ["-DDEBUG_OPENGL=3"],
Colin Crossf6298102017-04-19 15:25:25 -0700110 include_dirs: ["frameworks/native/opengl/libs/GLES2"],
111}
112
Pirama Arumuga Nainar0dfd4be2017-11-16 22:40:00 -0800113// Build libhwui with PGO by default.
114// Location of PGO profile data is defined in build/soong/cc/pgo.go
115// and is separate from hwui.
116// To turn it off, set ANDROID_PGO_NO_PROFILE_USE environment variable
117// or set enable_profile_use property to false.
118cc_defaults {
119 name: "hwui_pgo",
120
121 pgo: {
122 instrumentation: true,
123 profile_file: "hwui/hwui.profdata",
124 benchmarks: ["hwui"],
Zhizhou Yang58e1b782017-12-06 16:59:06 -0800125 enable_profile_use: true,
Pirama Arumuga Nainar0dfd4be2017-11-16 22:40:00 -0800126 },
127}
128
Zhizhou Yangf30f1122018-02-26 17:59:38 -0800129// Build hwui library with ThinLTO by default.
130cc_defaults {
131 name: "hwui_lto",
132 target: {
133 android: {
134 lto: {
135 thin: true,
136 },
137 },
138 },
139}
140
Colin Crossf6298102017-04-19 15:25:25 -0700141// ------------------------
142// library
143// ------------------------
144
145cc_defaults {
146 name: "libhwui_defaults",
147 defaults: ["hwui_defaults"],
Derek Sollenbergerd938e5a2017-07-24 09:42:07 -0400148
149 whole_static_libs: ["libskia"],
150
Colin Crossf6298102017-04-19 15:25:25 -0700151 srcs: [
Derek Sollenberger2d142132018-01-22 10:25:26 -0500152 "hwui/AnimatedImageDrawable.cpp",
Leon Scroggins III5b7f4262018-01-26 11:03:54 -0500153 "hwui/AnimatedImageThread.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700154 "hwui/Bitmap.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700155 "hwui/Canvas.cpp",
156 "hwui/MinikinSkia.cpp",
157 "hwui/MinikinUtils.cpp",
158 "hwui/PaintImpl.cpp",
159 "hwui/Typeface.cpp",
160 "pipeline/skia/GLFunctorDrawable.cpp",
161 "pipeline/skia/LayerDrawable.cpp",
162 "pipeline/skia/RenderNodeDrawable.cpp",
163 "pipeline/skia/ReorderBarrierDrawables.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400164 "pipeline/skia/ShaderCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700165 "pipeline/skia/SkiaDisplayList.cpp",
Derek Sollenberger0057db22018-03-29 14:18:44 -0400166 "pipeline/skia/SkiaMemoryTracer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700167 "pipeline/skia/SkiaOpenGLPipeline.cpp",
168 "pipeline/skia/SkiaOpenGLReadback.cpp",
169 "pipeline/skia/SkiaPipeline.cpp",
170 "pipeline/skia/SkiaProfileRenderer.cpp",
171 "pipeline/skia/SkiaRecordingCanvas.cpp",
172 "pipeline/skia/SkiaVulkanPipeline.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400173 "pipeline/skia/VectorDrawableAtlas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700174 "renderstate/OffscreenBufferPool.cpp",
175 "renderstate/PixelBufferState.cpp",
176 "renderstate/RenderState.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700177 "renderstate/TextureState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400178 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700179 "renderthread/CanvasContext.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700180 "renderthread/DrawFrameTask.cpp",
181 "renderthread/EglManager.cpp",
182 "renderthread/VulkanManager.cpp",
183 "renderthread/RenderProxy.cpp",
184 "renderthread/RenderTask.cpp",
185 "renderthread/RenderThread.cpp",
186 "renderthread/TimeLord.cpp",
187 "renderthread/Frame.cpp",
188 "service/GraphicsStatsService.cpp",
189 "thread/TaskManager.cpp",
190 "utils/Blur.cpp",
191 "utils/Color.cpp",
192 "utils/GLUtils.cpp",
193 "utils/LinearAllocator.cpp",
194 "utils/StringUtils.cpp",
195 "utils/TestWindowContext.cpp",
196 "utils/VectorDrawableUtils.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700197 "AnimationContext.cpp",
198 "Animator.cpp",
199 "AnimatorManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700200 "Caches.cpp",
201 "CanvasState.cpp",
202 "ClipArea.cpp",
203 "DamageAccumulator.cpp",
204 "DeferredLayerUpdater.cpp",
205 "DeviceInfo.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700206 "FrameInfo.cpp",
207 "FrameInfoVisualizer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700208 "GlLayer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700209 "GpuMemoryTracker.cpp",
John Recke170fb62018-05-07 08:12:07 -0700210 "HardwareBitmapUploader.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700211 "Interpolator.cpp",
212 "JankTracker.cpp",
213 "Layer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700214 "LayerUpdateQueue.cpp",
215 "Matrix.cpp",
John Reck44627c22018-04-12 13:55:38 -0700216 "EglReadback.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700217 "PathParser.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700218 "PixelBuffer.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",
Colin Crossf6298102017-04-19 15:25:25 -0700224 "RenderNode.cpp",
225 "RenderProperties.cpp",
226 "ResourceCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700227 "SkiaCanvas.cpp",
228 "SkiaCanvasProxy.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700229 "Snapshot.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700230 "Texture.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700231 "VectorDrawable.cpp",
232 "VkLayer.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: ["."],
Colin Cross3f8fd402017-04-20 12:20:20 -0700241 export_shared_lib_headers: ["libRScpp"],
Colin Crossf6298102017-04-19 15:25:25 -0700242}
243
244cc_library {
245 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700246 defaults: [
247 "libhwui_defaults",
248
249 // Enables fine-grained GLES error checking
250 // If enabled, every GLES call is wrapped & error checked
251 // Has moderate overhead
252 "hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700253 ],
Colin Crossf6298102017-04-19 15:25:25 -0700254}
255
256// ------------------------
257// static library null gpu
258// ------------------------
259
260cc_library_static {
261 name: "libhwui_static_debug",
262 defaults: [
263 "libhwui_defaults",
264 "hwui_debug",
265 ],
266 cflags: ["-DHWUI_NULL_GPU"],
267 srcs: [
268 "debug/nullegl.cpp",
269 ],
Colin Crossf6298102017-04-19 15:25:25 -0700270}
271
272cc_defaults {
273 name: "hwui_test_defaults",
274 defaults: ["hwui_defaults"],
275 test_suites: ["device-tests"],
276 srcs: [
277 "tests/common/scenes/*.cpp",
278 "tests/common/LeakChecker.cpp",
279 "tests/common/TestListViewSceneBase.cpp",
280 "tests/common/TestContext.cpp",
281 "tests/common/TestScene.cpp",
282 "tests/common/TestUtils.cpp",
283 ],
284}
285
286// ------------------------
287// unit tests
288// ------------------------
289
290cc_test {
291 name: "hwui_unit_tests",
292 defaults: ["hwui_test_defaults"],
293
294 static_libs: [
295 "libgmock",
296 "libhwui_static_debug",
297 ],
Tej Singhbb8554a2018-01-26 11:59:14 -0800298 shared_libs: [
299 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800300 ],
Colin Crossf6298102017-04-19 15:25:25 -0700301 cflags: [
302 "-include debug/wrap_gles.h",
303 "-DHWUI_NULL_GPU",
304 ],
305
306 srcs: [
307 "tests/unit/main.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400308 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700309 "tests/unit/CanvasContextTests.cpp",
310 "tests/unit/CanvasStateTests.cpp",
311 "tests/unit/ClipAreaTests.cpp",
312 "tests/unit/DamageAccumulatorTests.cpp",
313 "tests/unit/DeferredLayerUpdaterTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700314 "tests/unit/FatVectorTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700315 "tests/unit/GpuMemoryTrackerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700316 "tests/unit/GraphicsStatsServiceTests.cpp",
317 "tests/unit/LayerUpdateQueueTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700318 "tests/unit/LinearAllocatorTests.cpp",
319 "tests/unit/MatrixTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700320 "tests/unit/PathInterpolatorTests.cpp",
321 "tests/unit/RenderNodeDrawableTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700322 "tests/unit/RenderNodeTests.cpp",
323 "tests/unit/RenderPropertiesTests.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400324 "tests/unit/ShaderCacheTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700325 "tests/unit/SkiaBehaviorTests.cpp",
326 "tests/unit/SkiaDisplayListTests.cpp",
327 "tests/unit/SkiaPipelineTests.cpp",
328 "tests/unit/SkiaRenderPropertiesTests.cpp",
329 "tests/unit/SkiaCanvasTests.cpp",
330 "tests/unit/SnapshotTests.cpp",
331 "tests/unit/StringUtilsTests.cpp",
332 "tests/unit/TestUtilsTests.cpp",
John Reckf8441e62017-10-23 13:10:41 -0700333 "tests/unit/ThreadBaseTests.cpp",
334 "tests/unit/TypefaceTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700335 "tests/unit/VectorDrawableTests.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400336 "tests/unit/VectorDrawableAtlasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700337 ],
338}
339
340// ------------------------
341// Macro-bench app
342// ------------------------
343
344cc_benchmark {
345 name: "hwuimacro",
346 defaults: ["hwui_test_defaults"],
347
348 // set to libhwui_static_debug to skip actual GL commands
349 whole_static_libs: ["libhwui"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800350 shared_libs: [
351 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800352 ],
Colin Crossf6298102017-04-19 15:25:25 -0700353
354 srcs: [
355 "tests/macrobench/TestSceneRunner.cpp",
356 "tests/macrobench/main.cpp",
357 ],
358}
359
360// ------------------------
361// Micro-bench app
362// ---------------------
363
364cc_benchmark {
365 name: "hwuimicro",
366 defaults: ["hwui_test_defaults"],
367
368 cflags: [
369 "-include debug/wrap_gles.h",
370 "-DHWUI_NULL_GPU",
371 ],
372
373 whole_static_libs: ["libhwui_static_debug"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800374 shared_libs: [
375 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800376 ],
Colin Crossf6298102017-04-19 15:25:25 -0700377
378 srcs: [
379 "tests/microbench/main.cpp",
380 "tests/microbench/DisplayListCanvasBench.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700381 "tests/microbench/LinearAllocatorBench.cpp",
382 "tests/microbench/PathParserBench.cpp",
383 "tests/microbench/RenderNodeBench.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700384 "tests/microbench/TaskManagerBench.cpp",
385 ],
386}
Pirama Arumuga Nainarbc1e1772017-11-17 11:32:16 -0800387
388// ----------------------------------------
389// Phony target to build benchmarks for PGO
390// ----------------------------------------
391
392phony {
393 name: "pgo-targets-hwui",
394 required: [
395 "hwuimicro",
396 "hwuimacro",
397 ]
398}