blob: 065b822b50adaef1313098178e87ec52ba0ebb9c [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",
78 srcs: ["font/FontCacheHistoryTracker.cpp"],
79 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",
155 "font/CacheTexture.cpp",
156 "font/Font.cpp",
157 "hwui/Canvas.cpp",
158 "hwui/MinikinSkia.cpp",
159 "hwui/MinikinUtils.cpp",
160 "hwui/PaintImpl.cpp",
161 "hwui/Typeface.cpp",
162 "pipeline/skia/GLFunctorDrawable.cpp",
163 "pipeline/skia/LayerDrawable.cpp",
164 "pipeline/skia/RenderNodeDrawable.cpp",
165 "pipeline/skia/ReorderBarrierDrawables.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400166 "pipeline/skia/ShaderCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700167 "pipeline/skia/SkiaDisplayList.cpp",
Derek Sollenberger0057db22018-03-29 14:18:44 -0400168 "pipeline/skia/SkiaMemoryTracer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700169 "pipeline/skia/SkiaOpenGLPipeline.cpp",
170 "pipeline/skia/SkiaOpenGLReadback.cpp",
171 "pipeline/skia/SkiaPipeline.cpp",
172 "pipeline/skia/SkiaProfileRenderer.cpp",
173 "pipeline/skia/SkiaRecordingCanvas.cpp",
174 "pipeline/skia/SkiaVulkanPipeline.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400175 "pipeline/skia/VectorDrawableAtlas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700176 "renderstate/Blend.cpp",
177 "renderstate/MeshState.cpp",
178 "renderstate/OffscreenBufferPool.cpp",
179 "renderstate/PixelBufferState.cpp",
180 "renderstate/RenderState.cpp",
181 "renderstate/Scissor.cpp",
182 "renderstate/Stencil.cpp",
183 "renderstate/TextureState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400184 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700185 "renderthread/CanvasContext.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700186 "renderthread/DrawFrameTask.cpp",
187 "renderthread/EglManager.cpp",
188 "renderthread/VulkanManager.cpp",
189 "renderthread/RenderProxy.cpp",
190 "renderthread/RenderTask.cpp",
191 "renderthread/RenderThread.cpp",
192 "renderthread/TimeLord.cpp",
193 "renderthread/Frame.cpp",
194 "service/GraphicsStatsService.cpp",
195 "thread/TaskManager.cpp",
196 "utils/Blur.cpp",
197 "utils/Color.cpp",
198 "utils/GLUtils.cpp",
199 "utils/LinearAllocator.cpp",
200 "utils/StringUtils.cpp",
201 "utils/TestWindowContext.cpp",
202 "utils/VectorDrawableUtils.cpp",
203 "AmbientShadow.cpp",
204 "AnimationContext.cpp",
205 "Animator.cpp",
206 "AnimatorManager.cpp",
207 "BakedOpDispatcher.cpp",
208 "BakedOpRenderer.cpp",
209 "BakedOpState.cpp",
210 "Caches.cpp",
211 "CanvasState.cpp",
212 "ClipArea.cpp",
213 "DamageAccumulator.cpp",
214 "DeferredLayerUpdater.cpp",
215 "DeviceInfo.cpp",
216 "DisplayList.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700217 "FboCache.cpp",
218 "FontRenderer.cpp",
219 "FrameBuilder.cpp",
220 "FrameInfo.cpp",
221 "FrameInfoVisualizer.cpp",
222 "GammaFontRenderer.cpp",
223 "GlLayer.cpp",
224 "GlopBuilder.cpp",
225 "GpuMemoryTracker.cpp",
226 "GradientCache.cpp",
227 "Image.cpp",
228 "Interpolator.cpp",
229 "JankTracker.cpp",
230 "Layer.cpp",
231 "LayerBuilder.cpp",
232 "LayerUpdateQueue.cpp",
233 "Matrix.cpp",
234 "OpDumper.cpp",
John Reck44627c22018-04-12 13:55:38 -0700235 "EglReadback.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700236 "Patch.cpp",
237 "PatchCache.cpp",
238 "PathCache.cpp",
239 "PathParser.cpp",
240 "PathTessellator.cpp",
241 "PixelBuffer.cpp",
John Reck7075c792017-07-05 14:03:43 -0700242 "ProfileData.cpp",
John Reck34781b22017-07-05 16:39:36 -0700243 "ProfileDataContainer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700244 "ProfileRenderer.cpp",
245 "Program.cpp",
246 "ProgramCache.cpp",
247 "Properties.cpp",
248 "PropertyValuesAnimatorSet.cpp",
249 "PropertyValuesHolder.cpp",
250 "RecordingCanvas.cpp",
251 "RenderBufferCache.cpp",
252 "RenderNode.cpp",
253 "RenderProperties.cpp",
254 "ResourceCache.cpp",
255 "ShadowTessellator.cpp",
256 "SkiaCanvas.cpp",
257 "SkiaCanvasProxy.cpp",
258 "SkiaShader.cpp",
259 "Snapshot.cpp",
260 "SpotShadow.cpp",
261 "TessellationCache.cpp",
262 "TextDropShadowCache.cpp",
263 "Texture.cpp",
264 "TextureCache.cpp",
265 "VectorDrawable.cpp",
266 "VkLayer.cpp",
Kweku Adams228b6d22018-04-12 13:09:04 -0700267 "protos/graphicsstats.proto",
Colin Crossf6298102017-04-19 15:25:25 -0700268 ],
269
Kweku Adams228b6d22018-04-12 13:09:04 -0700270 proto: {
271 export_proto_headers: true,
272 },
273
Colin Crossf6298102017-04-19 15:25:25 -0700274 export_include_dirs: ["."],
Colin Cross3f8fd402017-04-20 12:20:20 -0700275 export_shared_lib_headers: ["libRScpp"],
Colin Crossf6298102017-04-19 15:25:25 -0700276}
277
278cc_library {
279 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700280 defaults: [
281 "libhwui_defaults",
282
283 // Enables fine-grained GLES error checking
284 // If enabled, every GLES call is wrapped & error checked
285 // Has moderate overhead
286 "hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700287 ],
Colin Crossf6298102017-04-19 15:25:25 -0700288}
289
290// ------------------------
291// static library null gpu
292// ------------------------
293
294cc_library_static {
295 name: "libhwui_static_debug",
296 defaults: [
297 "libhwui_defaults",
298 "hwui_debug",
299 ],
300 cflags: ["-DHWUI_NULL_GPU"],
301 srcs: [
302 "debug/nullegl.cpp",
303 ],
Colin Crossf6298102017-04-19 15:25:25 -0700304}
305
306cc_defaults {
307 name: "hwui_test_defaults",
308 defaults: ["hwui_defaults"],
309 test_suites: ["device-tests"],
310 srcs: [
311 "tests/common/scenes/*.cpp",
312 "tests/common/LeakChecker.cpp",
313 "tests/common/TestListViewSceneBase.cpp",
314 "tests/common/TestContext.cpp",
315 "tests/common/TestScene.cpp",
316 "tests/common/TestUtils.cpp",
317 ],
318}
319
320// ------------------------
321// unit tests
322// ------------------------
323
324cc_test {
325 name: "hwui_unit_tests",
326 defaults: ["hwui_test_defaults"],
327
328 static_libs: [
329 "libgmock",
330 "libhwui_static_debug",
331 ],
Tej Singhbb8554a2018-01-26 11:59:14 -0800332 shared_libs: [
333 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800334 ],
Colin Crossf6298102017-04-19 15:25:25 -0700335 cflags: [
336 "-include debug/wrap_gles.h",
337 "-DHWUI_NULL_GPU",
338 ],
339
340 srcs: [
341 "tests/unit/main.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400342 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700343 "tests/unit/CanvasContextTests.cpp",
344 "tests/unit/CanvasStateTests.cpp",
345 "tests/unit/ClipAreaTests.cpp",
346 "tests/unit/DamageAccumulatorTests.cpp",
347 "tests/unit/DeferredLayerUpdaterTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700348 "tests/unit/FatVectorTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700349 "tests/unit/GpuMemoryTrackerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700350 "tests/unit/GraphicsStatsServiceTests.cpp",
351 "tests/unit/LayerUpdateQueueTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700352 "tests/unit/LinearAllocatorTests.cpp",
353 "tests/unit/MatrixTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700354 "tests/unit/OpDumperTests.cpp",
355 "tests/unit/PathInterpolatorTests.cpp",
356 "tests/unit/RenderNodeDrawableTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700357 "tests/unit/RenderNodeTests.cpp",
358 "tests/unit/RenderPropertiesTests.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400359 "tests/unit/ShaderCacheTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700360 "tests/unit/SkiaBehaviorTests.cpp",
361 "tests/unit/SkiaDisplayListTests.cpp",
362 "tests/unit/SkiaPipelineTests.cpp",
363 "tests/unit/SkiaRenderPropertiesTests.cpp",
364 "tests/unit/SkiaCanvasTests.cpp",
365 "tests/unit/SnapshotTests.cpp",
366 "tests/unit/StringUtilsTests.cpp",
367 "tests/unit/TestUtilsTests.cpp",
John Reckf8441e62017-10-23 13:10:41 -0700368 "tests/unit/ThreadBaseTests.cpp",
369 "tests/unit/TypefaceTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700370 "tests/unit/VectorDrawableTests.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400371 "tests/unit/VectorDrawableAtlasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700372 ],
373}
374
375// ------------------------
376// Macro-bench app
377// ------------------------
378
379cc_benchmark {
380 name: "hwuimacro",
381 defaults: ["hwui_test_defaults"],
382
383 // set to libhwui_static_debug to skip actual GL commands
384 whole_static_libs: ["libhwui"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800385 shared_libs: [
386 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800387 ],
Colin Crossf6298102017-04-19 15:25:25 -0700388
389 srcs: [
390 "tests/macrobench/TestSceneRunner.cpp",
391 "tests/macrobench/main.cpp",
392 ],
393}
394
395// ------------------------
396// Micro-bench app
397// ---------------------
398
399cc_benchmark {
400 name: "hwuimicro",
401 defaults: ["hwui_test_defaults"],
402
403 cflags: [
404 "-include debug/wrap_gles.h",
405 "-DHWUI_NULL_GPU",
406 ],
407
408 whole_static_libs: ["libhwui_static_debug"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800409 shared_libs: [
410 "libmemunreachable",
Tej Singhbb8554a2018-01-26 11:59:14 -0800411 ],
Colin Crossf6298102017-04-19 15:25:25 -0700412
413 srcs: [
414 "tests/microbench/main.cpp",
415 "tests/microbench/DisplayListCanvasBench.cpp",
416 "tests/microbench/FontBench.cpp",
417 "tests/microbench/FrameBuilderBench.cpp",
418 "tests/microbench/LinearAllocatorBench.cpp",
419 "tests/microbench/PathParserBench.cpp",
420 "tests/microbench/RenderNodeBench.cpp",
421 "tests/microbench/ShadowBench.cpp",
422 "tests/microbench/TaskManagerBench.cpp",
423 ],
424}
Pirama Arumuga Nainarbc1e1772017-11-17 11:32:16 -0800425
426// ----------------------------------------
427// Phony target to build benchmarks for PGO
428// ----------------------------------------
429
430phony {
431 name: "pgo-targets-hwui",
432 required: [
433 "hwuimicro",
434 "hwuimacro",
435 ]
436}