blob: 17f9b7cd62fcef272810a0b4cc59b2965a79765a [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",
Colin Crossf6298102017-04-19 15:25:25 -0700141 "hwui/Bitmap.cpp",
142 "font/CacheTexture.cpp",
143 "font/Font.cpp",
144 "hwui/Canvas.cpp",
145 "hwui/MinikinSkia.cpp",
146 "hwui/MinikinUtils.cpp",
147 "hwui/PaintImpl.cpp",
148 "hwui/Typeface.cpp",
149 "pipeline/skia/GLFunctorDrawable.cpp",
150 "pipeline/skia/LayerDrawable.cpp",
151 "pipeline/skia/RenderNodeDrawable.cpp",
152 "pipeline/skia/ReorderBarrierDrawables.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400153 "pipeline/skia/ShaderCache.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700154 "pipeline/skia/SkiaDisplayList.cpp",
155 "pipeline/skia/SkiaOpenGLPipeline.cpp",
156 "pipeline/skia/SkiaOpenGLReadback.cpp",
157 "pipeline/skia/SkiaPipeline.cpp",
158 "pipeline/skia/SkiaProfileRenderer.cpp",
159 "pipeline/skia/SkiaRecordingCanvas.cpp",
160 "pipeline/skia/SkiaVulkanPipeline.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400161 "pipeline/skia/VectorDrawableAtlas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700162 "renderstate/Blend.cpp",
163 "renderstate/MeshState.cpp",
164 "renderstate/OffscreenBufferPool.cpp",
165 "renderstate/PixelBufferState.cpp",
166 "renderstate/RenderState.cpp",
167 "renderstate/Scissor.cpp",
168 "renderstate/Stencil.cpp",
169 "renderstate/TextureState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400170 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700171 "renderthread/CanvasContext.cpp",
172 "renderthread/OpenGLPipeline.cpp",
173 "renderthread/DrawFrameTask.cpp",
174 "renderthread/EglManager.cpp",
175 "renderthread/VulkanManager.cpp",
176 "renderthread/RenderProxy.cpp",
177 "renderthread/RenderTask.cpp",
178 "renderthread/RenderThread.cpp",
179 "renderthread/TimeLord.cpp",
180 "renderthread/Frame.cpp",
181 "service/GraphicsStatsService.cpp",
182 "thread/TaskManager.cpp",
183 "utils/Blur.cpp",
184 "utils/Color.cpp",
185 "utils/GLUtils.cpp",
186 "utils/LinearAllocator.cpp",
187 "utils/StringUtils.cpp",
188 "utils/TestWindowContext.cpp",
189 "utils/VectorDrawableUtils.cpp",
190 "AmbientShadow.cpp",
191 "AnimationContext.cpp",
192 "Animator.cpp",
193 "AnimatorManager.cpp",
194 "BakedOpDispatcher.cpp",
195 "BakedOpRenderer.cpp",
196 "BakedOpState.cpp",
197 "Caches.cpp",
198 "CanvasState.cpp",
199 "ClipArea.cpp",
200 "DamageAccumulator.cpp",
201 "DeferredLayerUpdater.cpp",
202 "DeviceInfo.cpp",
203 "DisplayList.cpp",
204 "Extensions.cpp",
205 "FboCache.cpp",
206 "FontRenderer.cpp",
207 "FrameBuilder.cpp",
208 "FrameInfo.cpp",
209 "FrameInfoVisualizer.cpp",
210 "GammaFontRenderer.cpp",
211 "GlLayer.cpp",
212 "GlopBuilder.cpp",
213 "GpuMemoryTracker.cpp",
214 "GradientCache.cpp",
215 "Image.cpp",
216 "Interpolator.cpp",
217 "JankTracker.cpp",
218 "Layer.cpp",
219 "LayerBuilder.cpp",
220 "LayerUpdateQueue.cpp",
221 "Matrix.cpp",
222 "OpDumper.cpp",
223 "OpenGLReadback.cpp",
224 "Patch.cpp",
225 "PatchCache.cpp",
226 "PathCache.cpp",
227 "PathParser.cpp",
228 "PathTessellator.cpp",
229 "PixelBuffer.cpp",
John Reck7075c792017-07-05 14:03:43 -0700230 "ProfileData.cpp",
John Reck34781b22017-07-05 16:39:36 -0700231 "ProfileDataContainer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700232 "ProfileRenderer.cpp",
233 "Program.cpp",
234 "ProgramCache.cpp",
235 "Properties.cpp",
236 "PropertyValuesAnimatorSet.cpp",
237 "PropertyValuesHolder.cpp",
238 "RecordingCanvas.cpp",
239 "RenderBufferCache.cpp",
240 "RenderNode.cpp",
241 "RenderProperties.cpp",
242 "ResourceCache.cpp",
243 "ShadowTessellator.cpp",
244 "SkiaCanvas.cpp",
245 "SkiaCanvasProxy.cpp",
246 "SkiaShader.cpp",
247 "Snapshot.cpp",
248 "SpotShadow.cpp",
249 "TessellationCache.cpp",
250 "TextDropShadowCache.cpp",
251 "Texture.cpp",
252 "TextureCache.cpp",
253 "VectorDrawable.cpp",
254 "VkLayer.cpp",
255 "protos/hwui.proto",
256 ],
257
258 proto: {
259 export_proto_headers: true,
260 },
261
262 export_include_dirs: ["."],
Colin Cross3f8fd402017-04-20 12:20:20 -0700263 export_shared_lib_headers: ["libRScpp"],
Colin Crossf6298102017-04-19 15:25:25 -0700264}
265
266cc_library {
267 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700268 defaults: [
269 "libhwui_defaults",
270
271 // Enables fine-grained GLES error checking
272 // If enabled, every GLES call is wrapped & error checked
273 // Has moderate overhead
274 "hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700275 ],
Colin Crossf6298102017-04-19 15:25:25 -0700276}
277
278// ------------------------
279// static library null gpu
280// ------------------------
281
282cc_library_static {
283 name: "libhwui_static_debug",
284 defaults: [
285 "libhwui_defaults",
286 "hwui_debug",
287 ],
288 cflags: ["-DHWUI_NULL_GPU"],
289 srcs: [
290 "debug/nullegl.cpp",
291 ],
Colin Crossf6298102017-04-19 15:25:25 -0700292}
293
294cc_defaults {
295 name: "hwui_test_defaults",
296 defaults: ["hwui_defaults"],
297 test_suites: ["device-tests"],
298 srcs: [
299 "tests/common/scenes/*.cpp",
300 "tests/common/LeakChecker.cpp",
301 "tests/common/TestListViewSceneBase.cpp",
302 "tests/common/TestContext.cpp",
303 "tests/common/TestScene.cpp",
304 "tests/common/TestUtils.cpp",
305 ],
306}
307
308// ------------------------
309// unit tests
310// ------------------------
311
312cc_test {
313 name: "hwui_unit_tests",
314 defaults: ["hwui_test_defaults"],
315
316 static_libs: [
317 "libgmock",
318 "libhwui_static_debug",
319 ],
320 shared_libs: ["libmemunreachable"],
321 cflags: [
322 "-include debug/wrap_gles.h",
323 "-DHWUI_NULL_GPU",
324 ],
325
326 srcs: [
327 "tests/unit/main.cpp",
328 "tests/unit/BakedOpDispatcherTests.cpp",
329 "tests/unit/BakedOpRendererTests.cpp",
330 "tests/unit/BakedOpStateTests.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400331 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700332 "tests/unit/CanvasContextTests.cpp",
333 "tests/unit/CanvasStateTests.cpp",
334 "tests/unit/ClipAreaTests.cpp",
335 "tests/unit/DamageAccumulatorTests.cpp",
336 "tests/unit/DeferredLayerUpdaterTests.cpp",
337 "tests/unit/DeviceInfoTests.cpp",
338 "tests/unit/FatVectorTests.cpp",
339 "tests/unit/FontRendererTests.cpp",
340 "tests/unit/FrameBuilderTests.cpp",
341 "tests/unit/GlopBuilderTests.cpp",
342 "tests/unit/GpuMemoryTrackerTests.cpp",
343 "tests/unit/GradientCacheTests.cpp",
344 "tests/unit/GraphicsStatsServiceTests.cpp",
345 "tests/unit/LayerUpdateQueueTests.cpp",
346 "tests/unit/LeakCheckTests.cpp",
347 "tests/unit/LinearAllocatorTests.cpp",
348 "tests/unit/MatrixTests.cpp",
349 "tests/unit/MeshStateTests.cpp",
350 "tests/unit/OffscreenBufferPoolTests.cpp",
351 "tests/unit/OpDumperTests.cpp",
352 "tests/unit/PathInterpolatorTests.cpp",
353 "tests/unit/RenderNodeDrawableTests.cpp",
354 "tests/unit/RecordingCanvasTests.cpp",
355 "tests/unit/RenderNodeTests.cpp",
356 "tests/unit/RenderPropertiesTests.cpp",
Stan Ilievd495f432017-10-09 15:49:32 -0400357 "tests/unit/ShaderCacheTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700358 "tests/unit/SkiaBehaviorTests.cpp",
359 "tests/unit/SkiaDisplayListTests.cpp",
360 "tests/unit/SkiaPipelineTests.cpp",
361 "tests/unit/SkiaRenderPropertiesTests.cpp",
362 "tests/unit/SkiaCanvasTests.cpp",
363 "tests/unit/SnapshotTests.cpp",
364 "tests/unit/StringUtilsTests.cpp",
365 "tests/unit/TestUtilsTests.cpp",
366 "tests/unit/TextDropShadowCacheTests.cpp",
367 "tests/unit/TextureCacheTests.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"],
385 shared_libs: ["libmemunreachable"],
386
387 srcs: [
388 "tests/macrobench/TestSceneRunner.cpp",
389 "tests/macrobench/main.cpp",
390 ],
391}
392
393// ------------------------
394// Micro-bench app
395// ---------------------
396
397cc_benchmark {
398 name: "hwuimicro",
399 defaults: ["hwui_test_defaults"],
400
401 cflags: [
402 "-include debug/wrap_gles.h",
403 "-DHWUI_NULL_GPU",
404 ],
405
406 whole_static_libs: ["libhwui_static_debug"],
407 shared_libs: ["libmemunreachable"],
408
409 srcs: [
410 "tests/microbench/main.cpp",
411 "tests/microbench/DisplayListCanvasBench.cpp",
412 "tests/microbench/FontBench.cpp",
413 "tests/microbench/FrameBuilderBench.cpp",
414 "tests/microbench/LinearAllocatorBench.cpp",
415 "tests/microbench/PathParserBench.cpp",
416 "tests/microbench/RenderNodeBench.cpp",
417 "tests/microbench/ShadowBench.cpp",
418 "tests/microbench/TaskManagerBench.cpp",
419 ],
420}
Pirama Arumuga Nainarbc1e1772017-11-17 11:32:16 -0800421
422// ----------------------------------------
423// Phony target to build benchmarks for PGO
424// ----------------------------------------
425
426phony {
427 name: "pgo-targets-hwui",
428 required: [
429 "hwuimicro",
430 "hwuimacro",
431 ]
432}