blob: 1ad40ec686225fec4821ec1d8c4ae7b4c04c0083 [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/Blend.cpp",
174 "renderstate/MeshState.cpp",
175 "renderstate/OffscreenBufferPool.cpp",
176 "renderstate/PixelBufferState.cpp",
177 "renderstate/RenderState.cpp",
178 "renderstate/Scissor.cpp",
179 "renderstate/Stencil.cpp",
180 "renderstate/TextureState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400181 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700182 "renderthread/CanvasContext.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700183 "renderthread/DrawFrameTask.cpp",
184 "renderthread/EglManager.cpp",
185 "renderthread/VulkanManager.cpp",
186 "renderthread/RenderProxy.cpp",
187 "renderthread/RenderTask.cpp",
188 "renderthread/RenderThread.cpp",
189 "renderthread/TimeLord.cpp",
190 "renderthread/Frame.cpp",
191 "service/GraphicsStatsService.cpp",
192 "thread/TaskManager.cpp",
193 "utils/Blur.cpp",
194 "utils/Color.cpp",
195 "utils/GLUtils.cpp",
196 "utils/LinearAllocator.cpp",
197 "utils/StringUtils.cpp",
198 "utils/TestWindowContext.cpp",
199 "utils/VectorDrawableUtils.cpp",
200 "AmbientShadow.cpp",
201 "AnimationContext.cpp",
202 "Animator.cpp",
203 "AnimatorManager.cpp",
204 "BakedOpDispatcher.cpp",
205 "BakedOpRenderer.cpp",
206 "BakedOpState.cpp",
207 "Caches.cpp",
208 "CanvasState.cpp",
209 "ClipArea.cpp",
210 "DamageAccumulator.cpp",
211 "DeferredLayerUpdater.cpp",
212 "DeviceInfo.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700213 "FrameInfo.cpp",
214 "FrameInfoVisualizer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700215 "GlLayer.cpp",
216 "GlopBuilder.cpp",
217 "GpuMemoryTracker.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700218 "Image.cpp",
219 "Interpolator.cpp",
220 "JankTracker.cpp",
221 "Layer.cpp",
222 "LayerBuilder.cpp",
223 "LayerUpdateQueue.cpp",
224 "Matrix.cpp",
225 "OpDumper.cpp",
John Reck44627c22018-04-12 13:55:38 -0700226 "EglReadback.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700227 "Patch.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700228 "PathParser.cpp",
229 "PathTessellator.cpp",
230 "PixelBuffer.cpp",
John Reck7075c792017-07-05 14:03:43 -0700231 "ProfileData.cpp",
John Reck34781b22017-07-05 16:39:36 -0700232 "ProfileDataContainer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700233 "ProfileRenderer.cpp",
234 "Program.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700235 "Properties.cpp",
236 "PropertyValuesAnimatorSet.cpp",
237 "PropertyValuesHolder.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700238 "RenderNode.cpp",
239 "RenderProperties.cpp",
240 "ResourceCache.cpp",
241 "ShadowTessellator.cpp",
242 "SkiaCanvas.cpp",
243 "SkiaCanvasProxy.cpp",
244 "SkiaShader.cpp",
245 "Snapshot.cpp",
246 "SpotShadow.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700247 "Texture.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700248 "VectorDrawable.cpp",
249 "VkLayer.cpp",
Kweku Adams228b6d22018-04-12 13:09:04 -0700250 "protos/graphicsstats.proto",
Colin Crossf6298102017-04-19 15:25:25 -0700251 ],
252
Kweku Adams228b6d22018-04-12 13:09:04 -0700253 proto: {
254 export_proto_headers: true,
255 },
256
Colin Crossf6298102017-04-19 15:25:25 -0700257 export_include_dirs: ["."],
Colin Cross3f8fd402017-04-20 12:20:20 -0700258 export_shared_lib_headers: ["libRScpp"],
Colin Crossf6298102017-04-19 15:25:25 -0700259}
260
261cc_library {
262 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700263 defaults: [
264 "libhwui_defaults",
265
266 // Enables fine-grained GLES error checking
267 // If enabled, every GLES call is wrapped & error checked
268 // Has moderate overhead
269 "hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700270 ],
Colin Crossf6298102017-04-19 15:25:25 -0700271}
272
273// ------------------------
274// static library null gpu
275// ------------------------
276
277cc_library_static {
278 name: "libhwui_static_debug",
279 defaults: [
280 "libhwui_defaults",
281 "hwui_debug",
282 ],
283 cflags: ["-DHWUI_NULL_GPU"],
284 srcs: [
285 "debug/nullegl.cpp",
286 ],
Colin Crossf6298102017-04-19 15:25:25 -0700287}
288
289cc_defaults {
290 name: "hwui_test_defaults",
291 defaults: ["hwui_defaults"],
292 test_suites: ["device-tests"],
293 srcs: [
294 "tests/common/scenes/*.cpp",
295 "tests/common/LeakChecker.cpp",
296 "tests/common/TestListViewSceneBase.cpp",
297 "tests/common/TestContext.cpp",
298 "tests/common/TestScene.cpp",
299 "tests/common/TestUtils.cpp",
300 ],
301}
302
303// ------------------------
304// unit tests
305// ------------------------
306
307cc_test {
308 name: "hwui_unit_tests",
309 defaults: ["hwui_test_defaults"],
310
311 static_libs: [
312 "libgmock",
313 "libhwui_static_debug",
314 ],
Tej Singhbb8554a2018-01-26 11:59:14 -0800315 shared_libs: [
316 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800317 ],
Colin Crossf6298102017-04-19 15:25:25 -0700318 cflags: [
319 "-include debug/wrap_gles.h",
320 "-DHWUI_NULL_GPU",
321 ],
322
323 srcs: [
324 "tests/unit/main.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400325 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700326 "tests/unit/CanvasContextTests.cpp",
327 "tests/unit/CanvasStateTests.cpp",
328 "tests/unit/ClipAreaTests.cpp",
329 "tests/unit/DamageAccumulatorTests.cpp",
330 "tests/unit/DeferredLayerUpdaterTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700331 "tests/unit/FatVectorTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700332 "tests/unit/GpuMemoryTrackerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700333 "tests/unit/GraphicsStatsServiceTests.cpp",
334 "tests/unit/LayerUpdateQueueTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700335 "tests/unit/LinearAllocatorTests.cpp",
336 "tests/unit/MatrixTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700337 "tests/unit/OpDumperTests.cpp",
338 "tests/unit/PathInterpolatorTests.cpp",
339 "tests/unit/RenderNodeDrawableTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700340 "tests/unit/RenderNodeTests.cpp",
341 "tests/unit/RenderPropertiesTests.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400342 "tests/unit/ShaderCacheTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700343 "tests/unit/SkiaBehaviorTests.cpp",
344 "tests/unit/SkiaDisplayListTests.cpp",
345 "tests/unit/SkiaPipelineTests.cpp",
346 "tests/unit/SkiaRenderPropertiesTests.cpp",
347 "tests/unit/SkiaCanvasTests.cpp",
348 "tests/unit/SnapshotTests.cpp",
349 "tests/unit/StringUtilsTests.cpp",
350 "tests/unit/TestUtilsTests.cpp",
John Reckf8441e62017-10-23 13:10:41 -0700351 "tests/unit/ThreadBaseTests.cpp",
352 "tests/unit/TypefaceTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700353 "tests/unit/VectorDrawableTests.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400354 "tests/unit/VectorDrawableAtlasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700355 ],
356}
357
358// ------------------------
359// Macro-bench app
360// ------------------------
361
362cc_benchmark {
363 name: "hwuimacro",
364 defaults: ["hwui_test_defaults"],
365
366 // set to libhwui_static_debug to skip actual GL commands
367 whole_static_libs: ["libhwui"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800368 shared_libs: [
369 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800370 ],
Colin Crossf6298102017-04-19 15:25:25 -0700371
372 srcs: [
373 "tests/macrobench/TestSceneRunner.cpp",
374 "tests/macrobench/main.cpp",
375 ],
376}
377
378// ------------------------
379// Micro-bench app
380// ---------------------
381
382cc_benchmark {
383 name: "hwuimicro",
384 defaults: ["hwui_test_defaults"],
385
386 cflags: [
387 "-include debug/wrap_gles.h",
388 "-DHWUI_NULL_GPU",
389 ],
390
391 whole_static_libs: ["libhwui_static_debug"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800392 shared_libs: [
393 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800394 ],
Colin Crossf6298102017-04-19 15:25:25 -0700395
396 srcs: [
397 "tests/microbench/main.cpp",
398 "tests/microbench/DisplayListCanvasBench.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700399 "tests/microbench/LinearAllocatorBench.cpp",
400 "tests/microbench/PathParserBench.cpp",
401 "tests/microbench/RenderNodeBench.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700402 "tests/microbench/TaskManagerBench.cpp",
403 ],
404}
Pirama Arumuga Nainarbc1e1772017-11-17 11:32:16 -0800405
406// ----------------------------------------
407// Phony target to build benchmarks for PGO
408// ----------------------------------------
409
410phony {
411 name: "pgo-targets-hwui",
412 required: [
413 "hwuimicro",
414 "hwuimacro",
415 ]
416}