blob: 26442927a60eef14d6bb690ad9c989c1dc9060b2 [file] [log] [blame]
Colin Crossf6298102017-04-19 15:25:25 -07001cc_defaults {
2 name: "hwui_defaults",
3 defaults: [
4 "hwui_static_deps",
Derek Sollenbergerd938e5a2017-07-24 09:42:07 -04005 "skia_deps"
Colin Crossf6298102017-04-19 15:25:25 -07006 //"hwui_bugreport_font_cache_usage",
7 //"hwui_compile_for_perf",
Colin Crossf6298102017-04-19 15:25:25 -07008 ],
9
John Reckf8441e62017-10-23 13:10:41 -070010 cpp_std: "c++17",
11
Colin Crossf6298102017-04-19 15:25:25 -070012 cflags: [
13 "-DEGL_EGLEXT_PROTOTYPES",
14 "-DGL_GLEXT_PROTOTYPES",
15 "-DATRACE_TAG=ATRACE_TAG_VIEW",
16 "-DLOG_TAG=\"OpenGLRenderer\"",
17 "-Wall",
18 "-Wno-unused-parameter",
19 "-Wunreachable-code",
20 "-Werror",
21 "-fvisibility=hidden",
22
23 // GCC false-positives on this warning, and since we -Werror that's
24 // a problem
25 "-Wno-free-nonheap-object",
26
27 // clang's warning is broken, see: https://llvm.org/bugs/show_bug.cgi?id=21629
28 "-Wno-missing-braces",
29
30 // TODO: Linear blending should be enabled by default, but we are
31 // TODO: making it an opt-in while it's a work in progress
32 //"-DANDROID_ENABLE_LINEAR_BLENDING",
33 ],
34
35 include_dirs: [
36 "external/skia/include/private",
37 "external/skia/src/core",
38 "external/skia/src/effects",
39 "external/skia/src/image",
40 "external/skia/src/utils",
Stan Iliev3310fb12017-03-23 16:56:51 -040041 "external/skia/src/gpu",
Colin Crossf6298102017-04-19 15:25:25 -070042 ],
43
44 product_variables: {
45 device_uses_hwc2: {
46 cflags: ["-DUSE_HWC2"],
47 },
48 },
49}
50
51cc_defaults {
52 name: "hwui_static_deps",
53 shared_libs: [
54 "liblog",
55 "libcutils",
56 "libutils",
57 "libEGL",
58 "libGLESv2",
59 "libvulkan",
Colin Crossf6298102017-04-19 15:25:25 -070060 "libui",
61 "libgui",
John Reck915883b2017-05-03 10:27:20 -070062 "libprotobuf-cpp-lite",
Colin Crossf6298102017-04-19 15:25:25 -070063 "libharfbuzz_ng",
64 "libft2",
65 "libminikin",
66 "libandroidfw",
67 "libRScpp",
68 ],
69 static_libs: [
70 "libplatformprotos",
71 ],
72}
73
74cc_defaults {
75 name: "hwui_bugreport_font_cache_usage",
76 srcs: ["font/FontCacheHistoryTracker.cpp"],
77 cflags: ["-DBUGREPORT_FONT_CACHE_USAGE"],
78}
79
80cc_defaults {
81 name: "hwui_compile_for_perf",
82 // TODO: Non-arm?
83 cflags: [
84 "-fno-omit-frame-pointer",
85 "-marm",
86 "-mapcs",
87 ],
88}
89
90cc_defaults {
91 name: "hwui_debug",
92 cflags: ["-include debug/wrap_gles.h"],
93 srcs: [
94 "debug/wrap_gles.cpp",
95 "debug/DefaultGlesDriver.cpp",
96 "debug/GlesErrorCheckWrapper.cpp",
97 "debug/GlesDriver.cpp",
98 "debug/FatalBaseDriver.cpp",
99 "debug/NullGlesDriver.cpp",
100 ],
101 include_dirs: ["frameworks/native/opengl/libs/GLES2"],
102}
103
104cc_defaults {
105 name: "hwui_enable_opengl_validation",
106 defaults: ["hwui_debug"],
107 cflags: ["-DDEBUG_OPENGL=3"],
Colin Crossf6298102017-04-19 15:25:25 -0700108 include_dirs: ["frameworks/native/opengl/libs/GLES2"],
109}
110
111// ------------------------
112// library
113// ------------------------
114
115cc_defaults {
116 name: "libhwui_defaults",
117 defaults: ["hwui_defaults"],
Derek Sollenbergerd938e5a2017-07-24 09:42:07 -0400118
119 whole_static_libs: ["libskia"],
120
Colin Crossf6298102017-04-19 15:25:25 -0700121 srcs: [
122 "hwui/Bitmap.cpp",
123 "font/CacheTexture.cpp",
124 "font/Font.cpp",
125 "hwui/Canvas.cpp",
126 "hwui/MinikinSkia.cpp",
127 "hwui/MinikinUtils.cpp",
128 "hwui/PaintImpl.cpp",
129 "hwui/Typeface.cpp",
130 "pipeline/skia/GLFunctorDrawable.cpp",
131 "pipeline/skia/LayerDrawable.cpp",
132 "pipeline/skia/RenderNodeDrawable.cpp",
133 "pipeline/skia/ReorderBarrierDrawables.cpp",
134 "pipeline/skia/SkiaDisplayList.cpp",
135 "pipeline/skia/SkiaOpenGLPipeline.cpp",
136 "pipeline/skia/SkiaOpenGLReadback.cpp",
137 "pipeline/skia/SkiaPipeline.cpp",
138 "pipeline/skia/SkiaProfileRenderer.cpp",
139 "pipeline/skia/SkiaRecordingCanvas.cpp",
140 "pipeline/skia/SkiaVulkanPipeline.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400141 "pipeline/skia/VectorDrawableAtlas.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700142 "renderstate/Blend.cpp",
143 "renderstate/MeshState.cpp",
144 "renderstate/OffscreenBufferPool.cpp",
145 "renderstate/PixelBufferState.cpp",
146 "renderstate/RenderState.cpp",
147 "renderstate/Scissor.cpp",
148 "renderstate/Stencil.cpp",
149 "renderstate/TextureState.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400150 "renderthread/CacheManager.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700151 "renderthread/CanvasContext.cpp",
152 "renderthread/OpenGLPipeline.cpp",
153 "renderthread/DrawFrameTask.cpp",
154 "renderthread/EglManager.cpp",
155 "renderthread/VulkanManager.cpp",
156 "renderthread/RenderProxy.cpp",
157 "renderthread/RenderTask.cpp",
158 "renderthread/RenderThread.cpp",
159 "renderthread/TimeLord.cpp",
160 "renderthread/Frame.cpp",
161 "service/GraphicsStatsService.cpp",
162 "thread/TaskManager.cpp",
163 "utils/Blur.cpp",
164 "utils/Color.cpp",
165 "utils/GLUtils.cpp",
166 "utils/LinearAllocator.cpp",
167 "utils/StringUtils.cpp",
168 "utils/TestWindowContext.cpp",
169 "utils/VectorDrawableUtils.cpp",
170 "AmbientShadow.cpp",
171 "AnimationContext.cpp",
172 "Animator.cpp",
173 "AnimatorManager.cpp",
174 "BakedOpDispatcher.cpp",
175 "BakedOpRenderer.cpp",
176 "BakedOpState.cpp",
177 "Caches.cpp",
178 "CanvasState.cpp",
179 "ClipArea.cpp",
180 "DamageAccumulator.cpp",
181 "DeferredLayerUpdater.cpp",
182 "DeviceInfo.cpp",
183 "DisplayList.cpp",
184 "Extensions.cpp",
185 "FboCache.cpp",
186 "FontRenderer.cpp",
187 "FrameBuilder.cpp",
188 "FrameInfo.cpp",
189 "FrameInfoVisualizer.cpp",
190 "GammaFontRenderer.cpp",
191 "GlLayer.cpp",
192 "GlopBuilder.cpp",
193 "GpuMemoryTracker.cpp",
194 "GradientCache.cpp",
195 "Image.cpp",
196 "Interpolator.cpp",
197 "JankTracker.cpp",
198 "Layer.cpp",
199 "LayerBuilder.cpp",
200 "LayerUpdateQueue.cpp",
201 "Matrix.cpp",
202 "OpDumper.cpp",
203 "OpenGLReadback.cpp",
204 "Patch.cpp",
205 "PatchCache.cpp",
206 "PathCache.cpp",
207 "PathParser.cpp",
208 "PathTessellator.cpp",
209 "PixelBuffer.cpp",
John Reck7075c792017-07-05 14:03:43 -0700210 "ProfileData.cpp",
John Reck34781b22017-07-05 16:39:36 -0700211 "ProfileDataContainer.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700212 "ProfileRenderer.cpp",
213 "Program.cpp",
214 "ProgramCache.cpp",
215 "Properties.cpp",
216 "PropertyValuesAnimatorSet.cpp",
217 "PropertyValuesHolder.cpp",
218 "RecordingCanvas.cpp",
219 "RenderBufferCache.cpp",
220 "RenderNode.cpp",
221 "RenderProperties.cpp",
222 "ResourceCache.cpp",
223 "ShadowTessellator.cpp",
224 "SkiaCanvas.cpp",
225 "SkiaCanvasProxy.cpp",
226 "SkiaShader.cpp",
227 "Snapshot.cpp",
228 "SpotShadow.cpp",
229 "TessellationCache.cpp",
230 "TextDropShadowCache.cpp",
231 "Texture.cpp",
232 "TextureCache.cpp",
233 "VectorDrawable.cpp",
234 "VkLayer.cpp",
235 "protos/hwui.proto",
236 ],
237
238 proto: {
239 export_proto_headers: true,
240 },
241
242 export_include_dirs: ["."],
Colin Cross3f8fd402017-04-20 12:20:20 -0700243 export_shared_lib_headers: ["libRScpp"],
Colin Crossf6298102017-04-19 15:25:25 -0700244}
245
246cc_library {
247 name: "libhwui",
Chris Craikd17b63c2017-06-01 10:45:36 -0700248 defaults: [
249 "libhwui_defaults",
250
251 // Enables fine-grained GLES error checking
252 // If enabled, every GLES call is wrapped & error checked
253 // Has moderate overhead
254 "hwui_enable_opengl_validation",
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700255 ],
256
257 // Build libhwui with PGO by default.
258 // Location of PGO profile data is defined in build/soong/cc/pgo.go
259 // and is separate from hwui.
Zhizhou Yangded60352017-10-17 13:37:00 -0700260 // To turn it off, set ANDROID_PGO_NO_PROFILE_USE environment variable
261 // or set enable_profile_use property to false.
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700262 pgo: {
263 instrumentation: true,
264 profile_file: "hwui/hwui.profdata",
265 benchmarks: ["hwui"],
Zhizhou Yangded60352017-10-17 13:37:00 -0700266 enable_profile_use: false,
Zhizhou Yang17371ec2017-10-13 11:42:13 -0700267 },
Colin Crossf6298102017-04-19 15:25:25 -0700268}
269
270// ------------------------
271// static library null gpu
272// ------------------------
273
274cc_library_static {
275 name: "libhwui_static_debug",
276 defaults: [
277 "libhwui_defaults",
278 "hwui_debug",
279 ],
280 cflags: ["-DHWUI_NULL_GPU"],
281 srcs: [
282 "debug/nullegl.cpp",
283 ],
Colin Crossf6298102017-04-19 15:25:25 -0700284}
285
286cc_defaults {
287 name: "hwui_test_defaults",
288 defaults: ["hwui_defaults"],
289 test_suites: ["device-tests"],
290 srcs: [
291 "tests/common/scenes/*.cpp",
292 "tests/common/LeakChecker.cpp",
293 "tests/common/TestListViewSceneBase.cpp",
294 "tests/common/TestContext.cpp",
295 "tests/common/TestScene.cpp",
296 "tests/common/TestUtils.cpp",
297 ],
298}
299
300// ------------------------
301// unit tests
302// ------------------------
303
304cc_test {
305 name: "hwui_unit_tests",
306 defaults: ["hwui_test_defaults"],
307
308 static_libs: [
309 "libgmock",
310 "libhwui_static_debug",
311 ],
312 shared_libs: ["libmemunreachable"],
313 cflags: [
314 "-include debug/wrap_gles.h",
315 "-DHWUI_NULL_GPU",
316 ],
317
318 srcs: [
319 "tests/unit/main.cpp",
320 "tests/unit/BakedOpDispatcherTests.cpp",
321 "tests/unit/BakedOpRendererTests.cpp",
322 "tests/unit/BakedOpStateTests.cpp",
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400323 "tests/unit/CacheManagerTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700324 "tests/unit/CanvasContextTests.cpp",
325 "tests/unit/CanvasStateTests.cpp",
326 "tests/unit/ClipAreaTests.cpp",
327 "tests/unit/DamageAccumulatorTests.cpp",
328 "tests/unit/DeferredLayerUpdaterTests.cpp",
329 "tests/unit/DeviceInfoTests.cpp",
330 "tests/unit/FatVectorTests.cpp",
331 "tests/unit/FontRendererTests.cpp",
332 "tests/unit/FrameBuilderTests.cpp",
333 "tests/unit/GlopBuilderTests.cpp",
334 "tests/unit/GpuMemoryTrackerTests.cpp",
335 "tests/unit/GradientCacheTests.cpp",
336 "tests/unit/GraphicsStatsServiceTests.cpp",
337 "tests/unit/LayerUpdateQueueTests.cpp",
338 "tests/unit/LeakCheckTests.cpp",
339 "tests/unit/LinearAllocatorTests.cpp",
340 "tests/unit/MatrixTests.cpp",
341 "tests/unit/MeshStateTests.cpp",
342 "tests/unit/OffscreenBufferPoolTests.cpp",
343 "tests/unit/OpDumperTests.cpp",
344 "tests/unit/PathInterpolatorTests.cpp",
345 "tests/unit/RenderNodeDrawableTests.cpp",
346 "tests/unit/RecordingCanvasTests.cpp",
347 "tests/unit/RenderNodeTests.cpp",
348 "tests/unit/RenderPropertiesTests.cpp",
349 "tests/unit/SkiaBehaviorTests.cpp",
350 "tests/unit/SkiaDisplayListTests.cpp",
351 "tests/unit/SkiaPipelineTests.cpp",
352 "tests/unit/SkiaRenderPropertiesTests.cpp",
353 "tests/unit/SkiaCanvasTests.cpp",
354 "tests/unit/SnapshotTests.cpp",
355 "tests/unit/StringUtilsTests.cpp",
356 "tests/unit/TestUtilsTests.cpp",
357 "tests/unit/TextDropShadowCacheTests.cpp",
358 "tests/unit/TextureCacheTests.cpp",
John Reckf8441e62017-10-23 13:10:41 -0700359 "tests/unit/ThreadBaseTests.cpp",
360 "tests/unit/TypefaceTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700361 "tests/unit/VectorDrawableTests.cpp",
Stan Iliev3310fb12017-03-23 16:56:51 -0400362 "tests/unit/VectorDrawableAtlasTests.cpp",
Colin Crossf6298102017-04-19 15:25:25 -0700363 ],
364}
365
366// ------------------------
367// Macro-bench app
368// ------------------------
369
370cc_benchmark {
371 name: "hwuimacro",
372 defaults: ["hwui_test_defaults"],
373
374 // set to libhwui_static_debug to skip actual GL commands
375 whole_static_libs: ["libhwui"],
376 shared_libs: ["libmemunreachable"],
377
378 srcs: [
379 "tests/macrobench/TestSceneRunner.cpp",
380 "tests/macrobench/main.cpp",
381 ],
382}
383
384// ------------------------
385// Micro-bench app
386// ---------------------
387
388cc_benchmark {
389 name: "hwuimicro",
390 defaults: ["hwui_test_defaults"],
391
392 cflags: [
393 "-include debug/wrap_gles.h",
394 "-DHWUI_NULL_GPU",
395 ],
396
397 whole_static_libs: ["libhwui_static_debug"],
398 shared_libs: ["libmemunreachable"],
399
400 srcs: [
401 "tests/microbench/main.cpp",
402 "tests/microbench/DisplayListCanvasBench.cpp",
403 "tests/microbench/FontBench.cpp",
404 "tests/microbench/FrameBuilderBench.cpp",
405 "tests/microbench/LinearAllocatorBench.cpp",
406 "tests/microbench/PathParserBench.cpp",
407 "tests/microbench/RenderNodeBench.cpp",
408 "tests/microbench/ShadowBench.cpp",
409 "tests/microbench/TaskManagerBench.cpp",
410 ],
411}