blob: 3323bce8b5ad8c5036eab73284fbd81686cf83c8 [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",
Colin Crossf6298102017-04-19 15:25:25 -07009 ],
10
John Reckf8441e62017-10-23 13:10:41 -070011 cpp_std: "c++17",
12
Colin Crossf6298102017-04-19 15:25:25 -070013 cflags: [
14 "-DEGL_EGLEXT_PROTOTYPES",
15 "-DGL_GLEXT_PROTOTYPES",
16 "-DATRACE_TAG=ATRACE_TAG_VIEW",
17 "-DLOG_TAG=\"OpenGLRenderer\"",
18 "-Wall",
19 "-Wno-unused-parameter",
20 "-Wunreachable-code",
21 "-Werror",
22 "-fvisibility=hidden",
23
24 // GCC false-positives on this warning, and since we -Werror that's
25 // a problem
26 "-Wno-free-nonheap-object",
27
28 // clang's warning is broken, see: https://llvm.org/bugs/show_bug.cgi?id=21629
29 "-Wno-missing-braces",
30
31 // TODO: Linear blending should be enabled by default, but we are
32 // TODO: making it an opt-in while it's a work in progress
33 //"-DANDROID_ENABLE_LINEAR_BLENDING",
34 ],
35
36 include_dirs: [
37 "external/skia/include/private",
38 "external/skia/src/core",
39 "external/skia/src/effects",
40 "external/skia/src/image",
41 "external/skia/src/utils",
Stan Iliev3310fb12017-03-23 16:56:51 -040042 "external/skia/src/gpu",
Colin Crossf6298102017-04-19 15:25:25 -070043 ],
44
45 product_variables: {
46 device_uses_hwc2: {
47 cflags: ["-DUSE_HWC2"],
48 },
49 },
50}
51
52cc_defaults {
53 name: "hwui_static_deps",
54 shared_libs: [
55 "liblog",
56 "libcutils",
57 "libutils",
58 "libEGL",
59 "libGLESv2",
60 "libvulkan",
Colin Crossf6298102017-04-19 15:25:25 -070061 "libui",
62 "libgui",
John Reck915883b2017-05-03 10:27:20 -070063 "libprotobuf-cpp-lite",
Colin Crossf6298102017-04-19 15:25:25 -070064 "libharfbuzz_ng",
65 "libft2",
66 "libminikin",
67 "libandroidfw",
68 "libRScpp",
69 ],
70 static_libs: [
71 "libplatformprotos",
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
Colin Crossf6298102017-04-19 15:25:25 -0700129// ------------------------
130// library
131// ------------------------
132
133cc_defaults {
134 name: "libhwui_defaults",
135 defaults: ["hwui_defaults"],
Derek Sollenbergerd938e5a2017-07-24 09:42:07 -0400136
137 whole_static_libs: ["libskia"],
138
Colin Crossf6298102017-04-19 15:25:25 -0700139 srcs: [
Derek Sollenberger2d142132018-01-22 10:25:26 -0500140 "hwui/AnimatedImageDrawable.cpp",
Leon Scroggins III5b7f4262018-01-26 11:03:54 -0500141 "hwui/AnimatedImageThread.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700142 "hwui/Bitmap.cpp",
143 "font/CacheTexture.cpp",
144 "font/Font.cpp",
145 "hwui/Canvas.cpp",
146 "hwui/MinikinSkia.cpp",
147 "hwui/MinikinUtils.cpp",
148 "hwui/PaintImpl.cpp",
149 "hwui/Typeface.cpp",
150 "pipeline/skia/GLFunctorDrawable.cpp",
151 "pipeline/skia/LayerDrawable.cpp",
152 "pipeline/skia/RenderNodeDrawable.cpp",
153 "pipeline/skia/ReorderBarrierDrawables.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400154 "pipeline/skia/ShaderCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700155 "pipeline/skia/SkiaDisplayList.cpp",
156 "pipeline/skia/SkiaOpenGLPipeline.cpp",
157 "pipeline/skia/SkiaOpenGLReadback.cpp",
158 "pipeline/skia/SkiaPipeline.cpp",
159 "pipeline/skia/SkiaProfileRenderer.cpp",
160 "pipeline/skia/SkiaRecordingCanvas.cpp",
161 "pipeline/skia/SkiaVulkanPipeline.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400162 "pipeline/skia/VectorDrawableAtlas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700163 "renderstate/Blend.cpp",
164 "renderstate/MeshState.cpp",
165 "renderstate/OffscreenBufferPool.cpp",
166 "renderstate/PixelBufferState.cpp",
167 "renderstate/RenderState.cpp",
168 "renderstate/Scissor.cpp",
169 "renderstate/Stencil.cpp",
170 "renderstate/TextureState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400171 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700172 "renderthread/CanvasContext.cpp",
173 "renderthread/OpenGLPipeline.cpp",
174 "renderthread/DrawFrameTask.cpp",
175 "renderthread/EglManager.cpp",
176 "renderthread/VulkanManager.cpp",
177 "renderthread/RenderProxy.cpp",
178 "renderthread/RenderTask.cpp",
179 "renderthread/RenderThread.cpp",
180 "renderthread/TimeLord.cpp",
181 "renderthread/Frame.cpp",
182 "service/GraphicsStatsService.cpp",
183 "thread/TaskManager.cpp",
184 "utils/Blur.cpp",
185 "utils/Color.cpp",
186 "utils/GLUtils.cpp",
187 "utils/LinearAllocator.cpp",
188 "utils/StringUtils.cpp",
189 "utils/TestWindowContext.cpp",
190 "utils/VectorDrawableUtils.cpp",
191 "AmbientShadow.cpp",
192 "AnimationContext.cpp",
193 "Animator.cpp",
194 "AnimatorManager.cpp",
195 "BakedOpDispatcher.cpp",
196 "BakedOpRenderer.cpp",
197 "BakedOpState.cpp",
198 "Caches.cpp",
199 "CanvasState.cpp",
200 "ClipArea.cpp",
201 "DamageAccumulator.cpp",
202 "DeferredLayerUpdater.cpp",
203 "DeviceInfo.cpp",
204 "DisplayList.cpp",
205 "Extensions.cpp",
206 "FboCache.cpp",
207 "FontRenderer.cpp",
208 "FrameBuilder.cpp",
209 "FrameInfo.cpp",
210 "FrameInfoVisualizer.cpp",
211 "GammaFontRenderer.cpp",
212 "GlLayer.cpp",
213 "GlopBuilder.cpp",
214 "GpuMemoryTracker.cpp",
215 "GradientCache.cpp",
216 "Image.cpp",
217 "Interpolator.cpp",
218 "JankTracker.cpp",
219 "Layer.cpp",
220 "LayerBuilder.cpp",
221 "LayerUpdateQueue.cpp",
222 "Matrix.cpp",
223 "OpDumper.cpp",
224 "OpenGLReadback.cpp",
225 "Patch.cpp",
226 "PatchCache.cpp",
227 "PathCache.cpp",
228 "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",
235 "ProgramCache.cpp",
236 "Properties.cpp",
237 "PropertyValuesAnimatorSet.cpp",
238 "PropertyValuesHolder.cpp",
239 "RecordingCanvas.cpp",
240 "RenderBufferCache.cpp",
241 "RenderNode.cpp",
242 "RenderProperties.cpp",
243 "ResourceCache.cpp",
244 "ShadowTessellator.cpp",
245 "SkiaCanvas.cpp",
246 "SkiaCanvasProxy.cpp",
247 "SkiaShader.cpp",
248 "Snapshot.cpp",
249 "SpotShadow.cpp",
250 "TessellationCache.cpp",
251 "TextDropShadowCache.cpp",
252 "Texture.cpp",
253 "TextureCache.cpp",
254 "VectorDrawable.cpp",
255 "VkLayer.cpp",
256 "protos/hwui.proto",
257 ],
258
259 proto: {
260 export_proto_headers: true,
261 },
262
263 export_include_dirs: ["."],
Colin Cross3f8fd402017-04-20 12:20:20 -0700264 export_shared_lib_headers: ["libRScpp"],
Colin Crossf6298102017-04-19 15:25:25 -0700265}
266
267cc_library {
268 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700269 defaults: [
270 "libhwui_defaults",
271
272 // Enables fine-grained GLES error checking
273 // If enabled, every GLES call is wrapped & error checked
274 // Has moderate overhead
275 "hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700276 ],
Colin Crossf6298102017-04-19 15:25:25 -0700277}
278
279// ------------------------
280// static library null gpu
281// ------------------------
282
283cc_library_static {
284 name: "libhwui_static_debug",
285 defaults: [
286 "libhwui_defaults",
287 "hwui_debug",
288 ],
289 cflags: ["-DHWUI_NULL_GPU"],
290 srcs: [
291 "debug/nullegl.cpp",
292 ],
Colin Crossf6298102017-04-19 15:25:25 -0700293}
294
295cc_defaults {
296 name: "hwui_test_defaults",
297 defaults: ["hwui_defaults"],
298 test_suites: ["device-tests"],
299 srcs: [
300 "tests/common/scenes/*.cpp",
301 "tests/common/LeakChecker.cpp",
302 "tests/common/TestListViewSceneBase.cpp",
303 "tests/common/TestContext.cpp",
304 "tests/common/TestScene.cpp",
305 "tests/common/TestUtils.cpp",
306 ],
307}
308
309// ------------------------
310// unit tests
311// ------------------------
312
313cc_test {
314 name: "hwui_unit_tests",
315 defaults: ["hwui_test_defaults"],
316
317 static_libs: [
318 "libgmock",
319 "libhwui_static_debug",
320 ],
321 shared_libs: ["libmemunreachable"],
322 cflags: [
323 "-include debug/wrap_gles.h",
324 "-DHWUI_NULL_GPU",
325 ],
326
327 srcs: [
328 "tests/unit/main.cpp",
329 "tests/unit/BakedOpDispatcherTests.cpp",
330 "tests/unit/BakedOpRendererTests.cpp",
331 "tests/unit/BakedOpStateTests.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400332 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700333 "tests/unit/CanvasContextTests.cpp",
334 "tests/unit/CanvasStateTests.cpp",
335 "tests/unit/ClipAreaTests.cpp",
336 "tests/unit/DamageAccumulatorTests.cpp",
337 "tests/unit/DeferredLayerUpdaterTests.cpp",
338 "tests/unit/DeviceInfoTests.cpp",
339 "tests/unit/FatVectorTests.cpp",
340 "tests/unit/FontRendererTests.cpp",
341 "tests/unit/FrameBuilderTests.cpp",
342 "tests/unit/GlopBuilderTests.cpp",
343 "tests/unit/GpuMemoryTrackerTests.cpp",
344 "tests/unit/GradientCacheTests.cpp",
345 "tests/unit/GraphicsStatsServiceTests.cpp",
346 "tests/unit/LayerUpdateQueueTests.cpp",
347 "tests/unit/LeakCheckTests.cpp",
348 "tests/unit/LinearAllocatorTests.cpp",
349 "tests/unit/MatrixTests.cpp",
350 "tests/unit/MeshStateTests.cpp",
351 "tests/unit/OffscreenBufferPoolTests.cpp",
352 "tests/unit/OpDumperTests.cpp",
353 "tests/unit/PathInterpolatorTests.cpp",
354 "tests/unit/RenderNodeDrawableTests.cpp",
355 "tests/unit/RecordingCanvasTests.cpp",
356 "tests/unit/RenderNodeTests.cpp",
357 "tests/unit/RenderPropertiesTests.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400358 "tests/unit/ShaderCacheTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700359 "tests/unit/SkiaBehaviorTests.cpp",
360 "tests/unit/SkiaDisplayListTests.cpp",
361 "tests/unit/SkiaPipelineTests.cpp",
362 "tests/unit/SkiaRenderPropertiesTests.cpp",
363 "tests/unit/SkiaCanvasTests.cpp",
364 "tests/unit/SnapshotTests.cpp",
365 "tests/unit/StringUtilsTests.cpp",
366 "tests/unit/TestUtilsTests.cpp",
367 "tests/unit/TextDropShadowCacheTests.cpp",
368 "tests/unit/TextureCacheTests.cpp",
John Reckf8441e62017-10-23 13:10:41 -0700369 "tests/unit/ThreadBaseTests.cpp",
370 "tests/unit/TypefaceTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700371 "tests/unit/VectorDrawableTests.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400372 "tests/unit/VectorDrawableAtlasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700373 ],
374}
375
376// ------------------------
377// Macro-bench app
378// ------------------------
379
380cc_benchmark {
381 name: "hwuimacro",
382 defaults: ["hwui_test_defaults"],
383
384 // set to libhwui_static_debug to skip actual GL commands
385 whole_static_libs: ["libhwui"],
386 shared_libs: ["libmemunreachable"],
387
388 srcs: [
389 "tests/macrobench/TestSceneRunner.cpp",
390 "tests/macrobench/main.cpp",
391 ],
392}
393
394// ------------------------
395// Micro-bench app
396// ---------------------
397
398cc_benchmark {
399 name: "hwuimicro",
400 defaults: ["hwui_test_defaults"],
401
402 cflags: [
403 "-include debug/wrap_gles.h",
404 "-DHWUI_NULL_GPU",
405 ],
406
407 whole_static_libs: ["libhwui_static_debug"],
408 shared_libs: ["libmemunreachable"],
409
410 srcs: [
411 "tests/microbench/main.cpp",
412 "tests/microbench/DisplayListCanvasBench.cpp",
413 "tests/microbench/FontBench.cpp",
414 "tests/microbench/FrameBuilderBench.cpp",
415 "tests/microbench/LinearAllocatorBench.cpp",
416 "tests/microbench/PathParserBench.cpp",
417 "tests/microbench/RenderNodeBench.cpp",
418 "tests/microbench/ShadowBench.cpp",
419 "tests/microbench/TaskManagerBench.cpp",
420 ],
421}
Pirama Arumuga Nainarbc1e1772017-11-17 11:32:16 -0800422
423// ----------------------------------------
424// Phony target to build benchmarks for PGO
425// ----------------------------------------
426
427phony {
428 name: "pgo-targets-hwui",
429 required: [
430 "hwuimicro",
431 "hwuimacro",
432 ]
433}