blob: 0db779906545e46d871bdbd315285564041e5409 [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/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",
John Recke170fb62018-05-07 08:12:07 -0700209 "HardwareBitmapUploader.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700210 "Interpolator.cpp",
211 "JankTracker.cpp",
212 "Layer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700213 "LayerUpdateQueue.cpp",
214 "Matrix.cpp",
John Reck44627c22018-04-12 13:55:38 -0700215 "EglReadback.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700216 "PathParser.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700217 "PixelBuffer.cpp",
John Reck7075c792017-07-05 14:03:43 -0700218 "ProfileData.cpp",
John Reck34781b22017-07-05 16:39:36 -0700219 "ProfileDataContainer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700220 "Properties.cpp",
221 "PropertyValuesAnimatorSet.cpp",
222 "PropertyValuesHolder.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700223 "RenderNode.cpp",
224 "RenderProperties.cpp",
225 "ResourceCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700226 "SkiaCanvas.cpp",
227 "SkiaCanvasProxy.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700228 "Snapshot.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700229 "Texture.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700230 "VectorDrawable.cpp",
231 "VkLayer.cpp",
Kweku Adams228b6d22018-04-12 13:09:04 -0700232 "protos/graphicsstats.proto",
Colin Crossf6298102017-04-19 15:25:25 -0700233 ],
234
Kweku Adams228b6d22018-04-12 13:09:04 -0700235 proto: {
236 export_proto_headers: true,
237 },
238
Colin Crossf6298102017-04-19 15:25:25 -0700239 export_include_dirs: ["."],
Colin Cross3f8fd402017-04-20 12:20:20 -0700240 export_shared_lib_headers: ["libRScpp"],
Colin Crossf6298102017-04-19 15:25:25 -0700241}
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}