blob: 3b0abc3238cbd11f1f5817140a7c474b360b65af [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
Tej Singhbb8554a2018-01-26 11:59:14 -0800149 shared_libs: ["libstatslog"],
150
Derek Sollenbergerd938e5a2017-07-24 09:42:07 -0400151 whole_static_libs: ["libskia"],
152
Colin Crossf6298102017-04-19 15:25:25 -0700153 srcs: [
Derek Sollenberger2d142132018-01-22 10:25:26 -0500154 "hwui/AnimatedImageDrawable.cpp",
Leon Scroggins III5b7f4262018-01-26 11:03:54 -0500155 "hwui/AnimatedImageThread.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700156 "hwui/Bitmap.cpp",
157 "font/CacheTexture.cpp",
158 "font/Font.cpp",
159 "hwui/Canvas.cpp",
160 "hwui/MinikinSkia.cpp",
161 "hwui/MinikinUtils.cpp",
162 "hwui/PaintImpl.cpp",
163 "hwui/Typeface.cpp",
164 "pipeline/skia/GLFunctorDrawable.cpp",
165 "pipeline/skia/LayerDrawable.cpp",
166 "pipeline/skia/RenderNodeDrawable.cpp",
167 "pipeline/skia/ReorderBarrierDrawables.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400168 "pipeline/skia/ShaderCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700169 "pipeline/skia/SkiaDisplayList.cpp",
Derek Sollenberger0057db22018-03-29 14:18:44 -0400170 "pipeline/skia/SkiaMemoryTracer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700171 "pipeline/skia/SkiaOpenGLPipeline.cpp",
172 "pipeline/skia/SkiaOpenGLReadback.cpp",
173 "pipeline/skia/SkiaPipeline.cpp",
174 "pipeline/skia/SkiaProfileRenderer.cpp",
175 "pipeline/skia/SkiaRecordingCanvas.cpp",
176 "pipeline/skia/SkiaVulkanPipeline.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400177 "pipeline/skia/VectorDrawableAtlas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700178 "renderstate/Blend.cpp",
179 "renderstate/MeshState.cpp",
180 "renderstate/OffscreenBufferPool.cpp",
181 "renderstate/PixelBufferState.cpp",
182 "renderstate/RenderState.cpp",
183 "renderstate/Scissor.cpp",
184 "renderstate/Stencil.cpp",
185 "renderstate/TextureState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400186 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700187 "renderthread/CanvasContext.cpp",
188 "renderthread/OpenGLPipeline.cpp",
189 "renderthread/DrawFrameTask.cpp",
190 "renderthread/EglManager.cpp",
191 "renderthread/VulkanManager.cpp",
192 "renderthread/RenderProxy.cpp",
193 "renderthread/RenderTask.cpp",
194 "renderthread/RenderThread.cpp",
195 "renderthread/TimeLord.cpp",
196 "renderthread/Frame.cpp",
197 "service/GraphicsStatsService.cpp",
198 "thread/TaskManager.cpp",
199 "utils/Blur.cpp",
200 "utils/Color.cpp",
201 "utils/GLUtils.cpp",
202 "utils/LinearAllocator.cpp",
203 "utils/StringUtils.cpp",
204 "utils/TestWindowContext.cpp",
205 "utils/VectorDrawableUtils.cpp",
206 "AmbientShadow.cpp",
207 "AnimationContext.cpp",
208 "Animator.cpp",
209 "AnimatorManager.cpp",
210 "BakedOpDispatcher.cpp",
211 "BakedOpRenderer.cpp",
212 "BakedOpState.cpp",
213 "Caches.cpp",
214 "CanvasState.cpp",
215 "ClipArea.cpp",
216 "DamageAccumulator.cpp",
217 "DeferredLayerUpdater.cpp",
218 "DeviceInfo.cpp",
219 "DisplayList.cpp",
220 "Extensions.cpp",
221 "FboCache.cpp",
222 "FontRenderer.cpp",
223 "FrameBuilder.cpp",
224 "FrameInfo.cpp",
225 "FrameInfoVisualizer.cpp",
226 "GammaFontRenderer.cpp",
227 "GlLayer.cpp",
228 "GlopBuilder.cpp",
229 "GpuMemoryTracker.cpp",
230 "GradientCache.cpp",
231 "Image.cpp",
232 "Interpolator.cpp",
233 "JankTracker.cpp",
234 "Layer.cpp",
235 "LayerBuilder.cpp",
236 "LayerUpdateQueue.cpp",
237 "Matrix.cpp",
238 "OpDumper.cpp",
239 "OpenGLReadback.cpp",
240 "Patch.cpp",
241 "PatchCache.cpp",
242 "PathCache.cpp",
243 "PathParser.cpp",
244 "PathTessellator.cpp",
245 "PixelBuffer.cpp",
John Reck7075c792017-07-05 14:03:43 -0700246 "ProfileData.cpp",
John Reck34781b22017-07-05 16:39:36 -0700247 "ProfileDataContainer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700248 "ProfileRenderer.cpp",
249 "Program.cpp",
250 "ProgramCache.cpp",
251 "Properties.cpp",
252 "PropertyValuesAnimatorSet.cpp",
253 "PropertyValuesHolder.cpp",
254 "RecordingCanvas.cpp",
255 "RenderBufferCache.cpp",
256 "RenderNode.cpp",
257 "RenderProperties.cpp",
258 "ResourceCache.cpp",
259 "ShadowTessellator.cpp",
260 "SkiaCanvas.cpp",
261 "SkiaCanvasProxy.cpp",
262 "SkiaShader.cpp",
263 "Snapshot.cpp",
264 "SpotShadow.cpp",
265 "TessellationCache.cpp",
266 "TextDropShadowCache.cpp",
267 "Texture.cpp",
268 "TextureCache.cpp",
269 "VectorDrawable.cpp",
270 "VkLayer.cpp",
Kweku Adams228b6d22018-04-12 13:09:04 -0700271 "protos/graphicsstats.proto",
Colin Crossf6298102017-04-19 15:25:25 -0700272 ],
273
Kweku Adams228b6d22018-04-12 13:09:04 -0700274 proto: {
275 export_proto_headers: true,
276 },
277
Colin Crossf6298102017-04-19 15:25:25 -0700278 export_include_dirs: ["."],
Colin Cross3f8fd402017-04-20 12:20:20 -0700279 export_shared_lib_headers: ["libRScpp"],
Colin Crossf6298102017-04-19 15:25:25 -0700280}
281
282cc_library {
283 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700284 defaults: [
285 "libhwui_defaults",
286
287 // Enables fine-grained GLES error checking
288 // If enabled, every GLES call is wrapped & error checked
289 // Has moderate overhead
290 "hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700291 ],
Colin Crossf6298102017-04-19 15:25:25 -0700292}
293
294// ------------------------
295// static library null gpu
296// ------------------------
297
298cc_library_static {
299 name: "libhwui_static_debug",
300 defaults: [
301 "libhwui_defaults",
302 "hwui_debug",
303 ],
304 cflags: ["-DHWUI_NULL_GPU"],
305 srcs: [
306 "debug/nullegl.cpp",
307 ],
Colin Crossf6298102017-04-19 15:25:25 -0700308}
309
310cc_defaults {
311 name: "hwui_test_defaults",
312 defaults: ["hwui_defaults"],
313 test_suites: ["device-tests"],
314 srcs: [
315 "tests/common/scenes/*.cpp",
316 "tests/common/LeakChecker.cpp",
317 "tests/common/TestListViewSceneBase.cpp",
318 "tests/common/TestContext.cpp",
319 "tests/common/TestScene.cpp",
320 "tests/common/TestUtils.cpp",
321 ],
322}
323
324// ------------------------
325// unit tests
326// ------------------------
327
328cc_test {
329 name: "hwui_unit_tests",
330 defaults: ["hwui_test_defaults"],
331
332 static_libs: [
333 "libgmock",
334 "libhwui_static_debug",
335 ],
Tej Singhbb8554a2018-01-26 11:59:14 -0800336 shared_libs: [
337 "libmemunreachable",
338 "libstatslog",
339 ],
Colin Crossf6298102017-04-19 15:25:25 -0700340 cflags: [
341 "-include debug/wrap_gles.h",
342 "-DHWUI_NULL_GPU",
343 ],
344
345 srcs: [
346 "tests/unit/main.cpp",
347 "tests/unit/BakedOpDispatcherTests.cpp",
348 "tests/unit/BakedOpRendererTests.cpp",
349 "tests/unit/BakedOpStateTests.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400350 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700351 "tests/unit/CanvasContextTests.cpp",
352 "tests/unit/CanvasStateTests.cpp",
353 "tests/unit/ClipAreaTests.cpp",
354 "tests/unit/DamageAccumulatorTests.cpp",
355 "tests/unit/DeferredLayerUpdaterTests.cpp",
356 "tests/unit/DeviceInfoTests.cpp",
357 "tests/unit/FatVectorTests.cpp",
358 "tests/unit/FontRendererTests.cpp",
359 "tests/unit/FrameBuilderTests.cpp",
360 "tests/unit/GlopBuilderTests.cpp",
361 "tests/unit/GpuMemoryTrackerTests.cpp",
362 "tests/unit/GradientCacheTests.cpp",
363 "tests/unit/GraphicsStatsServiceTests.cpp",
364 "tests/unit/LayerUpdateQueueTests.cpp",
365 "tests/unit/LeakCheckTests.cpp",
366 "tests/unit/LinearAllocatorTests.cpp",
367 "tests/unit/MatrixTests.cpp",
368 "tests/unit/MeshStateTests.cpp",
369 "tests/unit/OffscreenBufferPoolTests.cpp",
370 "tests/unit/OpDumperTests.cpp",
371 "tests/unit/PathInterpolatorTests.cpp",
372 "tests/unit/RenderNodeDrawableTests.cpp",
373 "tests/unit/RecordingCanvasTests.cpp",
374 "tests/unit/RenderNodeTests.cpp",
375 "tests/unit/RenderPropertiesTests.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400376 "tests/unit/ShaderCacheTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700377 "tests/unit/SkiaBehaviorTests.cpp",
378 "tests/unit/SkiaDisplayListTests.cpp",
379 "tests/unit/SkiaPipelineTests.cpp",
380 "tests/unit/SkiaRenderPropertiesTests.cpp",
381 "tests/unit/SkiaCanvasTests.cpp",
382 "tests/unit/SnapshotTests.cpp",
383 "tests/unit/StringUtilsTests.cpp",
384 "tests/unit/TestUtilsTests.cpp",
385 "tests/unit/TextDropShadowCacheTests.cpp",
386 "tests/unit/TextureCacheTests.cpp",
John Reckf8441e62017-10-23 13:10:41 -0700387 "tests/unit/ThreadBaseTests.cpp",
388 "tests/unit/TypefaceTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700389 "tests/unit/VectorDrawableTests.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400390 "tests/unit/VectorDrawableAtlasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700391 ],
392}
393
394// ------------------------
395// Macro-bench app
396// ------------------------
397
398cc_benchmark {
399 name: "hwuimacro",
400 defaults: ["hwui_test_defaults"],
401
402 // set to libhwui_static_debug to skip actual GL commands
403 whole_static_libs: ["libhwui"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800404 shared_libs: [
405 "libmemunreachable",
406 "libstatslog",
407 ],
Colin Crossf6298102017-04-19 15:25:25 -0700408
409 srcs: [
410 "tests/macrobench/TestSceneRunner.cpp",
411 "tests/macrobench/main.cpp",
412 ],
413}
414
415// ------------------------
416// Micro-bench app
417// ---------------------
418
419cc_benchmark {
420 name: "hwuimicro",
421 defaults: ["hwui_test_defaults"],
422
423 cflags: [
424 "-include debug/wrap_gles.h",
425 "-DHWUI_NULL_GPU",
426 ],
427
428 whole_static_libs: ["libhwui_static_debug"],
Tej Singhbb8554a2018-01-26 11:59:14 -0800429 shared_libs: [
430 "libmemunreachable",
431 "libstatslog",
432 ],
Colin Crossf6298102017-04-19 15:25:25 -0700433
434 srcs: [
435 "tests/microbench/main.cpp",
436 "tests/microbench/DisplayListCanvasBench.cpp",
437 "tests/microbench/FontBench.cpp",
438 "tests/microbench/FrameBuilderBench.cpp",
439 "tests/microbench/LinearAllocatorBench.cpp",
440 "tests/microbench/PathParserBench.cpp",
441 "tests/microbench/RenderNodeBench.cpp",
442 "tests/microbench/ShadowBench.cpp",
443 "tests/microbench/TaskManagerBench.cpp",
444 ],
445}
Pirama Arumuga Nainarbc1e1772017-11-17 11:32:16 -0800446
447// ----------------------------------------
448// Phony target to build benchmarks for PGO
449// ----------------------------------------
450
451phony {
452 name: "pgo-targets-hwui",
453 required: [
454 "hwuimicro",
455 "hwuimacro",
456 ]
457}