blob: 24d819e93ff2a6b44bcf675a2d15bbdcaa0d43f3 [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
Tej Singhbb8554a2018-01-26 11:59:14 -0800137 shared_libs: ["libstatslog"],
138
Derek Sollenbergerd938e5a2017-07-24 09:42:07 -0400139 whole_static_libs: ["libskia"],
140
Colin Crossf6298102017-04-19 15:25:25 -0700141 srcs: [
Derek Sollenberger2d142132018-01-22 10:25:26 -0500142 "hwui/AnimatedImageDrawable.cpp",
Leon Scroggins III5b7f4262018-01-26 11:03:54 -0500143 "hwui/AnimatedImageThread.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700144 "hwui/Bitmap.cpp",
145 "font/CacheTexture.cpp",
146 "font/Font.cpp",
147 "hwui/Canvas.cpp",
148 "hwui/MinikinSkia.cpp",
149 "hwui/MinikinUtils.cpp",
150 "hwui/PaintImpl.cpp",
151 "hwui/Typeface.cpp",
152 "pipeline/skia/GLFunctorDrawable.cpp",
153 "pipeline/skia/LayerDrawable.cpp",
154 "pipeline/skia/RenderNodeDrawable.cpp",
155 "pipeline/skia/ReorderBarrierDrawables.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400156 "pipeline/skia/ShaderCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700157 "pipeline/skia/SkiaDisplayList.cpp",
158 "pipeline/skia/SkiaOpenGLPipeline.cpp",
159 "pipeline/skia/SkiaOpenGLReadback.cpp",
160 "pipeline/skia/SkiaPipeline.cpp",
161 "pipeline/skia/SkiaProfileRenderer.cpp",
162 "pipeline/skia/SkiaRecordingCanvas.cpp",
163 "pipeline/skia/SkiaVulkanPipeline.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400164 "pipeline/skia/VectorDrawableAtlas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700165 "renderstate/Blend.cpp",
166 "renderstate/MeshState.cpp",
167 "renderstate/OffscreenBufferPool.cpp",
168 "renderstate/PixelBufferState.cpp",
169 "renderstate/RenderState.cpp",
170 "renderstate/Scissor.cpp",
171 "renderstate/Stencil.cpp",
172 "renderstate/TextureState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400173 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700174 "renderthread/CanvasContext.cpp",
175 "renderthread/OpenGLPipeline.cpp",
176 "renderthread/DrawFrameTask.cpp",
177 "renderthread/EglManager.cpp",
178 "renderthread/VulkanManager.cpp",
179 "renderthread/RenderProxy.cpp",
180 "renderthread/RenderTask.cpp",
181 "renderthread/RenderThread.cpp",
182 "renderthread/TimeLord.cpp",
183 "renderthread/Frame.cpp",
184 "service/GraphicsStatsService.cpp",
185 "thread/TaskManager.cpp",
186 "utils/Blur.cpp",
187 "utils/Color.cpp",
188 "utils/GLUtils.cpp",
189 "utils/LinearAllocator.cpp",
190 "utils/StringUtils.cpp",
191 "utils/TestWindowContext.cpp",
192 "utils/VectorDrawableUtils.cpp",
193 "AmbientShadow.cpp",
194 "AnimationContext.cpp",
195 "Animator.cpp",
196 "AnimatorManager.cpp",
197 "BakedOpDispatcher.cpp",
198 "BakedOpRenderer.cpp",
199 "BakedOpState.cpp",
200 "Caches.cpp",
201 "CanvasState.cpp",
202 "ClipArea.cpp",
203 "DamageAccumulator.cpp",
204 "DeferredLayerUpdater.cpp",
205 "DeviceInfo.cpp",
206 "DisplayList.cpp",
207 "Extensions.cpp",
208 "FboCache.cpp",
209 "FontRenderer.cpp",
210 "FrameBuilder.cpp",
211 "FrameInfo.cpp",
212 "FrameInfoVisualizer.cpp",
213 "GammaFontRenderer.cpp",
214 "GlLayer.cpp",
215 "GlopBuilder.cpp",
216 "GpuMemoryTracker.cpp",
217 "GradientCache.cpp",
218 "Image.cpp",
219 "Interpolator.cpp",
220 "JankTracker.cpp",
221 "Layer.cpp",
222 "LayerBuilder.cpp",
223 "LayerUpdateQueue.cpp",
224 "Matrix.cpp",
225 "OpDumper.cpp",
226 "OpenGLReadback.cpp",
227 "Patch.cpp",
228 "PatchCache.cpp",
229 "PathCache.cpp",
230 "PathParser.cpp",
231 "PathTessellator.cpp",
232 "PixelBuffer.cpp",
John Reck7075c792017-07-05 14:03:43 -0700233 "ProfileData.cpp",
John Reck34781b22017-07-05 16:39:36 -0700234 "ProfileDataContainer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700235 "ProfileRenderer.cpp",
236 "Program.cpp",
237 "ProgramCache.cpp",
238 "Properties.cpp",
239 "PropertyValuesAnimatorSet.cpp",
240 "PropertyValuesHolder.cpp",
241 "RecordingCanvas.cpp",
242 "RenderBufferCache.cpp",
243 "RenderNode.cpp",
244 "RenderProperties.cpp",
245 "ResourceCache.cpp",
246 "ShadowTessellator.cpp",
247 "SkiaCanvas.cpp",
248 "SkiaCanvasProxy.cpp",
249 "SkiaShader.cpp",
250 "Snapshot.cpp",
251 "SpotShadow.cpp",
252 "TessellationCache.cpp",
253 "TextDropShadowCache.cpp",
254 "Texture.cpp",
255 "TextureCache.cpp",
256 "VectorDrawable.cpp",
257 "VkLayer.cpp",
258 "protos/hwui.proto",
259 ],
260
261 proto: {
262 export_proto_headers: true,
263 },
264
265 export_include_dirs: ["."],
Colin Cross3f8fd402017-04-20 12:20:20 -0700266 export_shared_lib_headers: ["libRScpp"],
Colin Crossf6298102017-04-19 15:25:25 -0700267}
268
269cc_library {
270 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700271 defaults: [
272 "libhwui_defaults",
273
274 // Enables fine-grained GLES error checking
275 // If enabled, every GLES call is wrapped & error checked
276 // Has moderate overhead
277 "hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700278 ],
Colin Crossf6298102017-04-19 15:25:25 -0700279}
280
281// ------------------------
282// static library null gpu
283// ------------------------
284
285cc_library_static {
286 name: "libhwui_static_debug",
287 defaults: [
288 "libhwui_defaults",
289 "hwui_debug",
290 ],
291 cflags: ["-DHWUI_NULL_GPU"],
292 srcs: [
293 "debug/nullegl.cpp",
294 ],
Colin Crossf6298102017-04-19 15:25:25 -0700295}
296
297cc_defaults {
298 name: "hwui_test_defaults",
299 defaults: ["hwui_defaults"],
300 test_suites: ["device-tests"],
301 srcs: [
302 "tests/common/scenes/*.cpp",
303 "tests/common/LeakChecker.cpp",
304 "tests/common/TestListViewSceneBase.cpp",
305 "tests/common/TestContext.cpp",
306 "tests/common/TestScene.cpp",
307 "tests/common/TestUtils.cpp",
308 ],
309}
310
311// ------------------------
312// unit tests
313// ------------------------
314
315cc_test {
316 name: "hwui_unit_tests",
317 defaults: ["hwui_test_defaults"],
318
319 static_libs: [
320 "libgmock",
321 "libhwui_static_debug",
322 ],
Tej Singhbb8554a2018-01-26 11:59:14 -0800323 shared_libs: [
324 "libmemunreachable",
325 "libstatslog",
326 ],
Colin Crossf6298102017-04-19 15:25:25 -0700327 cflags: [
328 "-include debug/wrap_gles.h",
329 "-DHWUI_NULL_GPU",
330 ],
331
332 srcs: [
333 "tests/unit/main.cpp",
334 "tests/unit/BakedOpDispatcherTests.cpp",
335 "tests/unit/BakedOpRendererTests.cpp",
336 "tests/unit/BakedOpStateTests.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400337 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700338 "tests/unit/CanvasContextTests.cpp",
339 "tests/unit/CanvasStateTests.cpp",
340 "tests/unit/ClipAreaTests.cpp",
341 "tests/unit/DamageAccumulatorTests.cpp",
342 "tests/unit/DeferredLayerUpdaterTests.cpp",
343 "tests/unit/DeviceInfoTests.cpp",
344 "tests/unit/FatVectorTests.cpp",
345 "tests/unit/FontRendererTests.cpp",
346 "tests/unit/FrameBuilderTests.cpp",
347 "tests/unit/GlopBuilderTests.cpp",
348 "tests/unit/GpuMemoryTrackerTests.cpp",
349 "tests/unit/GradientCacheTests.cpp",
350 "tests/unit/GraphicsStatsServiceTests.cpp",
351 "tests/unit/LayerUpdateQueueTests.cpp",
352 "tests/unit/LeakCheckTests.cpp",
353 "tests/unit/LinearAllocatorTests.cpp",
354 "tests/unit/MatrixTests.cpp",
355 "tests/unit/MeshStateTests.cpp",
356 "tests/unit/OffscreenBufferPoolTests.cpp",
357 "tests/unit/OpDumperTests.cpp",
358 "tests/unit/PathInterpolatorTests.cpp",
359 "tests/unit/RenderNodeDrawableTests.cpp",
360 "tests/unit/RecordingCanvasTests.cpp",
361 "tests/unit/RenderNodeTests.cpp",
362 "tests/unit/RenderPropertiesTests.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400363 "tests/unit/ShaderCacheTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700364 "tests/unit/SkiaBehaviorTests.cpp",
365 "tests/unit/SkiaDisplayListTests.cpp",
366 "tests/unit/SkiaPipelineTests.cpp",
367 "tests/unit/SkiaRenderPropertiesTests.cpp",
368 "tests/unit/SkiaCanvasTests.cpp",
369 "tests/unit/SnapshotTests.cpp",
370 "tests/unit/StringUtilsTests.cpp",
371 "tests/unit/TestUtilsTests.cpp",
372 "tests/unit/TextDropShadowCacheTests.cpp",
373 "tests/unit/TextureCacheTests.cpp",
John Reckf8441e62017-10-23 13:10:41 -0700374 "tests/unit/ThreadBaseTests.cpp",
375 "tests/unit/TypefaceTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700376 "tests/unit/VectorDrawableTests.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400377 "tests/unit/VectorDrawableAtlasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700378 ],
379}
380
381// ------------------------
382// Macro-bench app
383// ------------------------
384
385cc_benchmark {
386 name: "hwuimacro",
387 defaults: ["hwui_test_defaults"],
388
389 // set to libhwui_static_debug to skip actual GL commands
390 whole_static_libs: ["libhwui"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800391 shared_libs: [
392 "libmemunreachable",
393 "libstatslog",
394 ],
Colin Crossf6298102017-04-19 15:25:25 -0700395
396 srcs: [
397 "tests/macrobench/TestSceneRunner.cpp",
398 "tests/macrobench/main.cpp",
399 ],
400}
401
402// ------------------------
403// Micro-bench app
404// ---------------------
405
406cc_benchmark {
407 name: "hwuimicro",
408 defaults: ["hwui_test_defaults"],
409
410 cflags: [
411 "-include debug/wrap_gles.h",
412 "-DHWUI_NULL_GPU",
413 ],
414
415 whole_static_libs: ["libhwui_static_debug"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800416 shared_libs: [
417 "libmemunreachable",
418 "libstatslog",
419 ],
Colin Crossf6298102017-04-19 15:25:25 -0700420
421 srcs: [
422 "tests/microbench/main.cpp",
423 "tests/microbench/DisplayListCanvasBench.cpp",
424 "tests/microbench/FontBench.cpp",
425 "tests/microbench/FrameBuilderBench.cpp",
426 "tests/microbench/LinearAllocatorBench.cpp",
427 "tests/microbench/PathParserBench.cpp",
428 "tests/microbench/RenderNodeBench.cpp",
429 "tests/microbench/ShadowBench.cpp",
430 "tests/microbench/TaskManagerBench.cpp",
431 ],
432}
Pirama Arumuga Nainarbc1e1772017-11-17 11:32:16 -0800433
434// ----------------------------------------
435// Phony target to build benchmarks for PGO
436// ----------------------------------------
437
438phony {
439 name: "pgo-targets-hwui",
440 required: [
441 "hwuimicro",
442 "hwuimacro",
443 ]
444}