blob: 4c2a021836f0f897755547c3337fa1db5f4f3eb0 [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",
Colin Crossf6298102017-04-19 15:25:25 -070044 ],
45
46 product_variables: {
47 device_uses_hwc2: {
48 cflags: ["-DUSE_HWC2"],
49 },
50 },
51}
52
53cc_defaults {
54 name: "hwui_static_deps",
55 shared_libs: [
56 "liblog",
57 "libcutils",
58 "libutils",
59 "libEGL",
60 "libGLESv2",
61 "libvulkan",
Colin Crossf6298102017-04-19 15:25:25 -070062 "libui",
63 "libgui",
John Reck915883b2017-05-03 10:27:20 -070064 "libprotobuf-cpp-lite",
Colin Crossf6298102017-04-19 15:25:25 -070065 "libharfbuzz_ng",
66 "libft2",
67 "libminikin",
68 "libandroidfw",
69 "libRScpp",
70 ],
71 static_libs: [
Stan Ilievd495f432017-10-09 15:49:32 -040072 "libEGL_blobCache",
Colin Crossf6298102017-04-19 15:25:25 -070073 ],
74}
75
76cc_defaults {
77 name: "hwui_bugreport_font_cache_usage",
Colin Crossf6298102017-04-19 15:25:25 -070078 cflags: ["-DBUGREPORT_FONT_CACHE_USAGE"],
79}
80
81cc_defaults {
82 name: "hwui_compile_for_perf",
83 // TODO: Non-arm?
84 cflags: [
85 "-fno-omit-frame-pointer",
86 "-marm",
87 "-mapcs",
88 ],
89}
90
91cc_defaults {
92 name: "hwui_debug",
93 cflags: ["-include debug/wrap_gles.h"],
94 srcs: [
95 "debug/wrap_gles.cpp",
96 "debug/DefaultGlesDriver.cpp",
97 "debug/GlesErrorCheckWrapper.cpp",
98 "debug/GlesDriver.cpp",
99 "debug/FatalBaseDriver.cpp",
100 "debug/NullGlesDriver.cpp",
101 ],
102 include_dirs: ["frameworks/native/opengl/libs/GLES2"],
103}
104
105cc_defaults {
106 name: "hwui_enable_opengl_validation",
107 defaults: ["hwui_debug"],
108 cflags: ["-DDEBUG_OPENGL=3"],
Colin Crossf6298102017-04-19 15:25:25 -0700109 include_dirs: ["frameworks/native/opengl/libs/GLES2"],
110}
111
Pirama Arumuga Nainar0dfd4be2017-11-16 22:40:00 -0800112// Build libhwui with PGO by default.
113// Location of PGO profile data is defined in build/soong/cc/pgo.go
114// and is separate from hwui.
115// To turn it off, set ANDROID_PGO_NO_PROFILE_USE environment variable
116// or set enable_profile_use property to false.
117cc_defaults {
118 name: "hwui_pgo",
119
120 pgo: {
121 instrumentation: true,
122 profile_file: "hwui/hwui.profdata",
123 benchmarks: ["hwui"],
Zhizhou Yang58e1b782017-12-06 16:59:06 -0800124 enable_profile_use: true,
Pirama Arumuga Nainar0dfd4be2017-11-16 22:40:00 -0800125 },
126}
127
Zhizhou Yangf30f1122018-02-26 17:59:38 -0800128// Build hwui library with ThinLTO by default.
129cc_defaults {
130 name: "hwui_lto",
131 target: {
132 android: {
133 lto: {
134 thin: true,
135 },
136 },
137 },
138}
139
Colin Crossf6298102017-04-19 15:25:25 -0700140// ------------------------
141// library
142// ------------------------
143
144cc_defaults {
145 name: "libhwui_defaults",
146 defaults: ["hwui_defaults"],
Derek Sollenbergerd938e5a2017-07-24 09:42:07 -0400147
148 whole_static_libs: ["libskia"],
149
Colin Crossf6298102017-04-19 15:25:25 -0700150 srcs: [
Derek Sollenberger2d142132018-01-22 10:25:26 -0500151 "hwui/AnimatedImageDrawable.cpp",
Leon Scroggins III5b7f4262018-01-26 11:03:54 -0500152 "hwui/AnimatedImageThread.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700153 "hwui/Bitmap.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700154 "hwui/Canvas.cpp",
155 "hwui/MinikinSkia.cpp",
156 "hwui/MinikinUtils.cpp",
157 "hwui/PaintImpl.cpp",
158 "hwui/Typeface.cpp",
159 "pipeline/skia/GLFunctorDrawable.cpp",
160 "pipeline/skia/LayerDrawable.cpp",
161 "pipeline/skia/RenderNodeDrawable.cpp",
162 "pipeline/skia/ReorderBarrierDrawables.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400163 "pipeline/skia/ShaderCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700164 "pipeline/skia/SkiaDisplayList.cpp",
Derek Sollenberger0057db22018-03-29 14:18:44 -0400165 "pipeline/skia/SkiaMemoryTracer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700166 "pipeline/skia/SkiaOpenGLPipeline.cpp",
167 "pipeline/skia/SkiaOpenGLReadback.cpp",
168 "pipeline/skia/SkiaPipeline.cpp",
169 "pipeline/skia/SkiaProfileRenderer.cpp",
170 "pipeline/skia/SkiaRecordingCanvas.cpp",
171 "pipeline/skia/SkiaVulkanPipeline.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400172 "pipeline/skia/VectorDrawableAtlas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700173 "renderstate/OffscreenBufferPool.cpp",
174 "renderstate/PixelBufferState.cpp",
175 "renderstate/RenderState.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700176 "renderstate/TextureState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400177 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700178 "renderthread/CanvasContext.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700179 "renderthread/DrawFrameTask.cpp",
180 "renderthread/EglManager.cpp",
181 "renderthread/VulkanManager.cpp",
182 "renderthread/RenderProxy.cpp",
183 "renderthread/RenderTask.cpp",
184 "renderthread/RenderThread.cpp",
185 "renderthread/TimeLord.cpp",
186 "renderthread/Frame.cpp",
187 "service/GraphicsStatsService.cpp",
188 "thread/TaskManager.cpp",
189 "utils/Blur.cpp",
190 "utils/Color.cpp",
191 "utils/GLUtils.cpp",
192 "utils/LinearAllocator.cpp",
193 "utils/StringUtils.cpp",
194 "utils/TestWindowContext.cpp",
195 "utils/VectorDrawableUtils.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700196 "AnimationContext.cpp",
197 "Animator.cpp",
198 "AnimatorManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700199 "Caches.cpp",
200 "CanvasState.cpp",
201 "ClipArea.cpp",
202 "DamageAccumulator.cpp",
203 "DeferredLayerUpdater.cpp",
204 "DeviceInfo.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700205 "FrameInfo.cpp",
206 "FrameInfoVisualizer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700207 "GlLayer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700208 "GpuMemoryTracker.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700209 "Interpolator.cpp",
210 "JankTracker.cpp",
211 "Layer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700212 "LayerUpdateQueue.cpp",
213 "Matrix.cpp",
John Reck44627c22018-04-12 13:55:38 -0700214 "EglReadback.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700215 "PathParser.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700216 "PixelBuffer.cpp",
John Reck7075c792017-07-05 14:03:43 -0700217 "ProfileData.cpp",
John Reck34781b22017-07-05 16:39:36 -0700218 "ProfileDataContainer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700219 "Properties.cpp",
220 "PropertyValuesAnimatorSet.cpp",
221 "PropertyValuesHolder.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700222 "RenderNode.cpp",
223 "RenderProperties.cpp",
224 "ResourceCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700225 "SkiaCanvas.cpp",
226 "SkiaCanvasProxy.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700227 "Snapshot.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700228 "Texture.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700229 "VectorDrawable.cpp",
230 "VkLayer.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: ["."],
Colin Cross3f8fd402017-04-20 12:20:20 -0700239 export_shared_lib_headers: ["libRScpp"],
Colin Crossf6298102017-04-19 15:25:25 -0700240}
241
242cc_library {
243 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700244 defaults: [
245 "libhwui_defaults",
246
247 // Enables fine-grained GLES error checking
248 // If enabled, every GLES call is wrapped & error checked
249 // Has moderate overhead
250 "hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700251 ],
Colin Crossf6298102017-04-19 15:25:25 -0700252}
253
254// ------------------------
255// static library null gpu
256// ------------------------
257
258cc_library_static {
259 name: "libhwui_static_debug",
260 defaults: [
261 "libhwui_defaults",
262 "hwui_debug",
263 ],
264 cflags: ["-DHWUI_NULL_GPU"],
265 srcs: [
266 "debug/nullegl.cpp",
267 ],
Colin Crossf6298102017-04-19 15:25:25 -0700268}
269
270cc_defaults {
271 name: "hwui_test_defaults",
272 defaults: ["hwui_defaults"],
273 test_suites: ["device-tests"],
274 srcs: [
275 "tests/common/scenes/*.cpp",
276 "tests/common/LeakChecker.cpp",
277 "tests/common/TestListViewSceneBase.cpp",
278 "tests/common/TestContext.cpp",
279 "tests/common/TestScene.cpp",
280 "tests/common/TestUtils.cpp",
281 ],
282}
283
284// ------------------------
285// unit tests
286// ------------------------
287
288cc_test {
289 name: "hwui_unit_tests",
290 defaults: ["hwui_test_defaults"],
291
292 static_libs: [
293 "libgmock",
294 "libhwui_static_debug",
295 ],
Tej Singhbb8554a2018-01-26 11:59:14 -0800296 shared_libs: [
297 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800298 ],
Colin Crossf6298102017-04-19 15:25:25 -0700299 cflags: [
300 "-include debug/wrap_gles.h",
301 "-DHWUI_NULL_GPU",
302 ],
303
304 srcs: [
305 "tests/unit/main.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400306 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700307 "tests/unit/CanvasContextTests.cpp",
308 "tests/unit/CanvasStateTests.cpp",
309 "tests/unit/ClipAreaTests.cpp",
310 "tests/unit/DamageAccumulatorTests.cpp",
311 "tests/unit/DeferredLayerUpdaterTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700312 "tests/unit/FatVectorTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700313 "tests/unit/GpuMemoryTrackerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700314 "tests/unit/GraphicsStatsServiceTests.cpp",
315 "tests/unit/LayerUpdateQueueTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700316 "tests/unit/LinearAllocatorTests.cpp",
317 "tests/unit/MatrixTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700318 "tests/unit/PathInterpolatorTests.cpp",
319 "tests/unit/RenderNodeDrawableTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700320 "tests/unit/RenderNodeTests.cpp",
321 "tests/unit/RenderPropertiesTests.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400322 "tests/unit/ShaderCacheTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700323 "tests/unit/SkiaBehaviorTests.cpp",
324 "tests/unit/SkiaDisplayListTests.cpp",
325 "tests/unit/SkiaPipelineTests.cpp",
326 "tests/unit/SkiaRenderPropertiesTests.cpp",
327 "tests/unit/SkiaCanvasTests.cpp",
328 "tests/unit/SnapshotTests.cpp",
329 "tests/unit/StringUtilsTests.cpp",
330 "tests/unit/TestUtilsTests.cpp",
John Reckf8441e62017-10-23 13:10:41 -0700331 "tests/unit/ThreadBaseTests.cpp",
332 "tests/unit/TypefaceTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700333 "tests/unit/VectorDrawableTests.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400334 "tests/unit/VectorDrawableAtlasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700335 ],
336}
337
338// ------------------------
339// Macro-bench app
340// ------------------------
341
342cc_benchmark {
343 name: "hwuimacro",
344 defaults: ["hwui_test_defaults"],
345
346 // set to libhwui_static_debug to skip actual GL commands
347 whole_static_libs: ["libhwui"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800348 shared_libs: [
349 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800350 ],
Colin Crossf6298102017-04-19 15:25:25 -0700351
352 srcs: [
353 "tests/macrobench/TestSceneRunner.cpp",
354 "tests/macrobench/main.cpp",
355 ],
356}
357
358// ------------------------
359// Micro-bench app
360// ---------------------
361
362cc_benchmark {
363 name: "hwuimicro",
364 defaults: ["hwui_test_defaults"],
365
366 cflags: [
367 "-include debug/wrap_gles.h",
368 "-DHWUI_NULL_GPU",
369 ],
370
371 whole_static_libs: ["libhwui_static_debug"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800372 shared_libs: [
373 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800374 ],
Colin Crossf6298102017-04-19 15:25:25 -0700375
376 srcs: [
377 "tests/microbench/main.cpp",
378 "tests/microbench/DisplayListCanvasBench.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700379 "tests/microbench/LinearAllocatorBench.cpp",
380 "tests/microbench/PathParserBench.cpp",
381 "tests/microbench/RenderNodeBench.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700382 "tests/microbench/TaskManagerBench.cpp",
383 ],
384}
Pirama Arumuga Nainarbc1e1772017-11-17 11:32:16 -0800385
386// ----------------------------------------
387// Phony target to build benchmarks for PGO
388// ----------------------------------------
389
390phony {
391 name: "pgo-targets-hwui",
392 required: [
393 "hwuimicro",
394 "hwuimacro",
395 ]
396}