blob: 59760ab0a20f6e2684a64b11a91efb149da69ef9 [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",
75 "libRScpp",
76 ],
77 static_libs: [
Stan Ilievd495f432017-10-09 15:49:32 -040078 "libEGL_blobCache",
Colin Crossf6298102017-04-19 15:25:25 -070079 ],
80}
81
82cc_defaults {
83 name: "hwui_bugreport_font_cache_usage",
Colin Crossf6298102017-04-19 15:25:25 -070084 cflags: ["-DBUGREPORT_FONT_CACHE_USAGE"],
85}
86
87cc_defaults {
88 name: "hwui_compile_for_perf",
89 // TODO: Non-arm?
90 cflags: [
91 "-fno-omit-frame-pointer",
92 "-marm",
93 "-mapcs",
94 ],
95}
96
97cc_defaults {
98 name: "hwui_debug",
99 cflags: ["-include debug/wrap_gles.h"],
100 srcs: [
101 "debug/wrap_gles.cpp",
102 "debug/DefaultGlesDriver.cpp",
103 "debug/GlesErrorCheckWrapper.cpp",
104 "debug/GlesDriver.cpp",
105 "debug/FatalBaseDriver.cpp",
106 "debug/NullGlesDriver.cpp",
107 ],
108 include_dirs: ["frameworks/native/opengl/libs/GLES2"],
109}
110
111cc_defaults {
112 name: "hwui_enable_opengl_validation",
113 defaults: ["hwui_debug"],
114 cflags: ["-DDEBUG_OPENGL=3"],
Colin Crossf6298102017-04-19 15:25:25 -0700115 include_dirs: ["frameworks/native/opengl/libs/GLES2"],
116}
117
Pirama Arumuga Nainar0dfd4be2017-11-16 22:40:00 -0800118// Build libhwui with PGO by default.
119// Location of PGO profile data is defined in build/soong/cc/pgo.go
120// and is separate from hwui.
121// To turn it off, set ANDROID_PGO_NO_PROFILE_USE environment variable
122// or set enable_profile_use property to false.
123cc_defaults {
124 name: "hwui_pgo",
125
126 pgo: {
127 instrumentation: true,
128 profile_file: "hwui/hwui.profdata",
129 benchmarks: ["hwui"],
Zhizhou Yang58e1b782017-12-06 16:59:06 -0800130 enable_profile_use: true,
Pirama Arumuga Nainar0dfd4be2017-11-16 22:40:00 -0800131 },
132}
133
Zhizhou Yangf30f1122018-02-26 17:59:38 -0800134// Build hwui library with ThinLTO by default.
135cc_defaults {
136 name: "hwui_lto",
137 target: {
138 android: {
139 lto: {
140 thin: true,
141 },
142 },
143 },
144}
145
Colin Crossf6298102017-04-19 15:25:25 -0700146// ------------------------
147// library
148// ------------------------
149
150cc_defaults {
151 name: "libhwui_defaults",
152 defaults: ["hwui_defaults"],
Derek Sollenbergerd938e5a2017-07-24 09:42:07 -0400153
154 whole_static_libs: ["libskia"],
155
Colin Crossf6298102017-04-19 15:25:25 -0700156 srcs: [
Derek Sollenberger2d142132018-01-22 10:25:26 -0500157 "hwui/AnimatedImageDrawable.cpp",
Leon Scroggins III5b7f4262018-01-26 11:03:54 -0500158 "hwui/AnimatedImageThread.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700159 "hwui/Bitmap.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700160 "hwui/Canvas.cpp",
161 "hwui/MinikinSkia.cpp",
162 "hwui/MinikinUtils.cpp",
163 "hwui/PaintImpl.cpp",
164 "hwui/Typeface.cpp",
165 "pipeline/skia/GLFunctorDrawable.cpp",
166 "pipeline/skia/LayerDrawable.cpp",
167 "pipeline/skia/RenderNodeDrawable.cpp",
168 "pipeline/skia/ReorderBarrierDrawables.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400169 "pipeline/skia/ShaderCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700170 "pipeline/skia/SkiaDisplayList.cpp",
Derek Sollenberger0057db22018-03-29 14:18:44 -0400171 "pipeline/skia/SkiaMemoryTracer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700172 "pipeline/skia/SkiaOpenGLPipeline.cpp",
173 "pipeline/skia/SkiaOpenGLReadback.cpp",
174 "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",
Colin Crossf6298102017-04-19 15:25:25 -0700179 "renderstate/PixelBufferState.cpp",
180 "renderstate/RenderState.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700181 "renderstate/TextureState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400182 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700183 "renderthread/CanvasContext.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700184 "renderthread/DrawFrameTask.cpp",
185 "renderthread/EglManager.cpp",
186 "renderthread/VulkanManager.cpp",
187 "renderthread/RenderProxy.cpp",
188 "renderthread/RenderTask.cpp",
189 "renderthread/RenderThread.cpp",
190 "renderthread/TimeLord.cpp",
191 "renderthread/Frame.cpp",
192 "service/GraphicsStatsService.cpp",
193 "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 "Caches.cpp",
205 "CanvasState.cpp",
John Reck9ce2bf72018-07-02 18:33:32 -0700206 "CanvasTransform.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700207 "ClipArea.cpp",
208 "DamageAccumulator.cpp",
209 "DeferredLayerUpdater.cpp",
210 "DeviceInfo.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700211 "FrameInfo.cpp",
212 "FrameInfoVisualizer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700213 "GlLayer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700214 "GpuMemoryTracker.cpp",
John Recke170fb62018-05-07 08:12:07 -0700215 "HardwareBitmapUploader.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700216 "Interpolator.cpp",
217 "JankTracker.cpp",
218 "Layer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700219 "LayerUpdateQueue.cpp",
220 "Matrix.cpp",
John Reck44627c22018-04-12 13:55:38 -0700221 "EglReadback.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700222 "PathParser.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700223 "PixelBuffer.cpp",
John Reck7075c792017-07-05 14:03:43 -0700224 "ProfileData.cpp",
John Reck34781b22017-07-05 16:39:36 -0700225 "ProfileDataContainer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700226 "Properties.cpp",
227 "PropertyValuesAnimatorSet.cpp",
228 "PropertyValuesHolder.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700229 "RenderNode.cpp",
230 "RenderProperties.cpp",
231 "ResourceCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700232 "SkiaCanvas.cpp",
233 "SkiaCanvasProxy.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700234 "Snapshot.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700235 "Texture.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700236 "VectorDrawable.cpp",
237 "VkLayer.cpp",
Kweku Adams228b6d22018-04-12 13:09:04 -0700238 "protos/graphicsstats.proto",
Colin Crossf6298102017-04-19 15:25:25 -0700239 ],
240
Kweku Adams228b6d22018-04-12 13:09:04 -0700241 proto: {
242 export_proto_headers: true,
243 },
244
Colin Crossf6298102017-04-19 15:25:25 -0700245 export_include_dirs: ["."],
Colin Cross3f8fd402017-04-20 12:20:20 -0700246 export_shared_lib_headers: ["libRScpp"],
Colin Crossf6298102017-04-19 15:25:25 -0700247}
248
249cc_library {
250 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700251 defaults: [
252 "libhwui_defaults",
253
254 // Enables fine-grained GLES error checking
255 // If enabled, every GLES call is wrapped & error checked
256 // Has moderate overhead
257 "hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700258 ],
Colin Crossf6298102017-04-19 15:25:25 -0700259}
260
261// ------------------------
262// static library null gpu
263// ------------------------
264
265cc_library_static {
266 name: "libhwui_static_debug",
267 defaults: [
268 "libhwui_defaults",
269 "hwui_debug",
270 ],
271 cflags: ["-DHWUI_NULL_GPU"],
272 srcs: [
273 "debug/nullegl.cpp",
274 ],
Colin Crossf6298102017-04-19 15:25:25 -0700275}
276
277cc_defaults {
278 name: "hwui_test_defaults",
279 defaults: ["hwui_defaults"],
280 test_suites: ["device-tests"],
281 srcs: [
282 "tests/common/scenes/*.cpp",
283 "tests/common/LeakChecker.cpp",
284 "tests/common/TestListViewSceneBase.cpp",
285 "tests/common/TestContext.cpp",
286 "tests/common/TestScene.cpp",
287 "tests/common/TestUtils.cpp",
288 ],
289}
290
291// ------------------------
292// unit tests
293// ------------------------
294
295cc_test {
296 name: "hwui_unit_tests",
297 defaults: ["hwui_test_defaults"],
298
299 static_libs: [
300 "libgmock",
301 "libhwui_static_debug",
302 ],
Tej Singhbb8554a2018-01-26 11:59:14 -0800303 shared_libs: [
304 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800305 ],
Colin Crossf6298102017-04-19 15:25:25 -0700306 cflags: [
307 "-include debug/wrap_gles.h",
308 "-DHWUI_NULL_GPU",
309 ],
310
311 srcs: [
312 "tests/unit/main.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400313 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700314 "tests/unit/CanvasContextTests.cpp",
315 "tests/unit/CanvasStateTests.cpp",
316 "tests/unit/ClipAreaTests.cpp",
317 "tests/unit/DamageAccumulatorTests.cpp",
318 "tests/unit/DeferredLayerUpdaterTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700319 "tests/unit/FatVectorTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700320 "tests/unit/GpuMemoryTrackerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700321 "tests/unit/GraphicsStatsServiceTests.cpp",
322 "tests/unit/LayerUpdateQueueTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700323 "tests/unit/LinearAllocatorTests.cpp",
324 "tests/unit/MatrixTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700325 "tests/unit/PathInterpolatorTests.cpp",
326 "tests/unit/RenderNodeDrawableTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700327 "tests/unit/RenderNodeTests.cpp",
328 "tests/unit/RenderPropertiesTests.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400329 "tests/unit/ShaderCacheTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700330 "tests/unit/SkiaBehaviorTests.cpp",
331 "tests/unit/SkiaDisplayListTests.cpp",
332 "tests/unit/SkiaPipelineTests.cpp",
333 "tests/unit/SkiaRenderPropertiesTests.cpp",
334 "tests/unit/SkiaCanvasTests.cpp",
335 "tests/unit/SnapshotTests.cpp",
336 "tests/unit/StringUtilsTests.cpp",
337 "tests/unit/TestUtilsTests.cpp",
John Reckf8441e62017-10-23 13:10:41 -0700338 "tests/unit/ThreadBaseTests.cpp",
339 "tests/unit/TypefaceTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700340 "tests/unit/VectorDrawableTests.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400341 "tests/unit/VectorDrawableAtlasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700342 ],
343}
344
345// ------------------------
346// Macro-bench app
347// ------------------------
348
349cc_benchmark {
350 name: "hwuimacro",
351 defaults: ["hwui_test_defaults"],
352
353 // set to libhwui_static_debug to skip actual GL commands
354 whole_static_libs: ["libhwui"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800355 shared_libs: [
356 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800357 ],
Colin Crossf6298102017-04-19 15:25:25 -0700358
359 srcs: [
360 "tests/macrobench/TestSceneRunner.cpp",
361 "tests/macrobench/main.cpp",
362 ],
363}
364
365// ------------------------
366// Micro-bench app
367// ---------------------
368
369cc_benchmark {
370 name: "hwuimicro",
371 defaults: ["hwui_test_defaults"],
372
373 cflags: [
374 "-include debug/wrap_gles.h",
375 "-DHWUI_NULL_GPU",
376 ],
377
378 whole_static_libs: ["libhwui_static_debug"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800379 shared_libs: [
380 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800381 ],
Colin Crossf6298102017-04-19 15:25:25 -0700382
383 srcs: [
384 "tests/microbench/main.cpp",
385 "tests/microbench/DisplayListCanvasBench.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700386 "tests/microbench/LinearAllocatorBench.cpp",
387 "tests/microbench/PathParserBench.cpp",
388 "tests/microbench/RenderNodeBench.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700389 "tests/microbench/TaskManagerBench.cpp",
390 ],
391}
Pirama Arumuga Nainarbc1e1772017-11-17 11:32:16 -0800392
393// ----------------------------------------
394// Phony target to build benchmarks for PGO
395// ----------------------------------------
396
397phony {
398 name: "pgo-targets-hwui",
399 required: [
400 "hwuimicro",
401 "hwuimacro",
402 ]
403}