Home | History | Annotate | Download | only in hwui
      1 cc_defaults {
      2     name: "hwui_defaults",
      3     defaults: [
      4         "hwui_static_deps",
      5         "skia_deps",
      6         //"hwui_bugreport_font_cache_usage",
      7         //"hwui_compile_for_perf",
      8         "hwui_pgo",
      9         "hwui_lto",
     10     ],
     11 
     12     cpp_std: "c++17",
     13 
     14     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",
     43         "external/skia/src/gpu",
     44         "external/skia/src/shaders",
     45     ],
     46 
     47     product_variables: {
     48         device_uses_hwc2: {
     49             cflags: ["-DUSE_HWC2"],
     50         },
     51     },
     52 }
     53 
     54 cc_defaults {
     55     name: "hwui_static_deps",
     56     shared_libs: [
     57         "liblog",
     58         "libcutils",
     59         "libutils",
     60         "libEGL",
     61         "libGLESv2",
     62         "libvulkan",
     63         "libui",
     64         "libgui",
     65         "libprotobuf-cpp-lite",
     66         "libharfbuzz_ng",
     67         "libft2",
     68         "libminikin",
     69         "libandroidfw",
     70         "libRScpp",
     71     ],
     72     static_libs: [
     73         "libEGL_blobCache",
     74     ],
     75 }
     76 
     77 cc_defaults {
     78     name: "hwui_bugreport_font_cache_usage",
     79     srcs: ["font/FontCacheHistoryTracker.cpp"],
     80     cflags: ["-DBUGREPORT_FONT_CACHE_USAGE"],
     81 }
     82 
     83 cc_defaults {
     84     name: "hwui_compile_for_perf",
     85     // TODO: Non-arm?
     86     cflags: [
     87         "-fno-omit-frame-pointer",
     88         "-marm",
     89         "-mapcs",
     90     ],
     91 }
     92 
     93 cc_defaults {
     94     name: "hwui_debug",
     95     cflags: ["-include debug/wrap_gles.h"],
     96     srcs: [
     97         "debug/wrap_gles.cpp",
     98         "debug/DefaultGlesDriver.cpp",
     99         "debug/GlesErrorCheckWrapper.cpp",
    100         "debug/GlesDriver.cpp",
    101         "debug/FatalBaseDriver.cpp",
    102         "debug/NullGlesDriver.cpp",
    103     ],
    104     include_dirs: ["frameworks/native/opengl/libs/GLES2"],
    105 }
    106 
    107 cc_defaults {
    108     name: "hwui_enable_opengl_validation",
    109     defaults: ["hwui_debug"],
    110     cflags: ["-DDEBUG_OPENGL=3"],
    111     include_dirs: ["frameworks/native/opengl/libs/GLES2"],
    112 }
    113 
    114 // Build libhwui with PGO by default.
    115 // Location of PGO profile data is defined in build/soong/cc/pgo.go
    116 // and is separate from hwui.
    117 // To turn it off, set ANDROID_PGO_NO_PROFILE_USE environment variable
    118 // or set enable_profile_use property to false.
    119 cc_defaults {
    120     name: "hwui_pgo",
    121 
    122     pgo: {
    123         instrumentation: true,
    124         profile_file: "hwui/hwui.profdata",
    125         benchmarks: ["hwui"],
    126         enable_profile_use: true,
    127     },
    128 }
    129 
    130 // Build hwui library with ThinLTO by default.
    131 cc_defaults {
    132     name: "hwui_lto",
    133     target: {
    134         android: {
    135             lto: {
    136                 thin: true,
    137             },
    138         },
    139     },
    140 }
    141 
    142 // ------------------------
    143 // library
    144 // ------------------------
    145 
    146 cc_defaults {
    147     name: "libhwui_defaults",
    148     defaults: ["hwui_defaults"],
    149 
    150     whole_static_libs: ["libskia"],
    151 
    152     srcs: [
    153         "hwui/AnimatedImageDrawable.cpp",
    154         "hwui/AnimatedImageThread.cpp",
    155         "hwui/Bitmap.cpp",
    156         "font/CacheTexture.cpp",
    157         "font/Font.cpp",
    158         "hwui/Canvas.cpp",
    159         "hwui/MinikinSkia.cpp",
    160         "hwui/MinikinUtils.cpp",
    161         "hwui/PaintImpl.cpp",
    162         "hwui/Typeface.cpp",
    163         "pipeline/skia/GLFunctorDrawable.cpp",
    164         "pipeline/skia/LayerDrawable.cpp",
    165         "pipeline/skia/RenderNodeDrawable.cpp",
    166         "pipeline/skia/ReorderBarrierDrawables.cpp",
    167         "pipeline/skia/ShaderCache.cpp",
    168         "pipeline/skia/SkiaDisplayList.cpp",
    169         "pipeline/skia/SkiaMemoryTracer.cpp",
    170         "pipeline/skia/SkiaOpenGLPipeline.cpp",
    171         "pipeline/skia/SkiaOpenGLReadback.cpp",
    172         "pipeline/skia/SkiaPipeline.cpp",
    173         "pipeline/skia/SkiaProfileRenderer.cpp",
    174         "pipeline/skia/SkiaRecordingCanvas.cpp",
    175         "pipeline/skia/SkiaVulkanPipeline.cpp",
    176         "pipeline/skia/VectorDrawableAtlas.cpp",
    177         "renderstate/Blend.cpp",
    178         "renderstate/MeshState.cpp",
    179         "renderstate/OffscreenBufferPool.cpp",
    180         "renderstate/PixelBufferState.cpp",
    181         "renderstate/RenderState.cpp",
    182         "renderstate/Scissor.cpp",
    183         "renderstate/Stencil.cpp",
    184         "renderstate/TextureState.cpp",
    185         "renderthread/CacheManager.cpp",
    186         "renderthread/CanvasContext.cpp",
    187         "renderthread/OpenGLPipeline.cpp",
    188         "renderthread/DrawFrameTask.cpp",
    189         "renderthread/EglManager.cpp",
    190         "renderthread/VulkanManager.cpp",
    191         "renderthread/RenderProxy.cpp",
    192         "renderthread/RenderTask.cpp",
    193         "renderthread/RenderThread.cpp",
    194         "renderthread/TimeLord.cpp",
    195         "renderthread/Frame.cpp",
    196         "service/GraphicsStatsService.cpp",
    197         "thread/TaskManager.cpp",
    198         "utils/Blur.cpp",
    199         "utils/Color.cpp",
    200         "utils/GLUtils.cpp",
    201         "utils/LinearAllocator.cpp",
    202         "utils/StringUtils.cpp",
    203         "utils/TestWindowContext.cpp",
    204         "utils/VectorDrawableUtils.cpp",
    205         "AmbientShadow.cpp",
    206         "AnimationContext.cpp",
    207         "Animator.cpp",
    208         "AnimatorManager.cpp",
    209         "BakedOpDispatcher.cpp",
    210         "BakedOpRenderer.cpp",
    211         "BakedOpState.cpp",
    212         "Caches.cpp",
    213         "CanvasState.cpp",
    214         "ClipArea.cpp",
    215         "DamageAccumulator.cpp",
    216         "DeferredLayerUpdater.cpp",
    217         "DeviceInfo.cpp",
    218         "DisplayList.cpp",
    219         "Extensions.cpp",
    220         "FboCache.cpp",
    221         "FontRenderer.cpp",
    222         "FrameBuilder.cpp",
    223         "FrameInfo.cpp",
    224         "FrameInfoVisualizer.cpp",
    225         "GammaFontRenderer.cpp",
    226         "GlLayer.cpp",
    227         "GlopBuilder.cpp",
    228         "GpuMemoryTracker.cpp",
    229         "GradientCache.cpp",
    230         "Image.cpp",
    231         "Interpolator.cpp",
    232         "JankTracker.cpp",
    233         "Layer.cpp",
    234         "LayerBuilder.cpp",
    235         "LayerUpdateQueue.cpp",
    236         "Matrix.cpp",
    237         "OpDumper.cpp",
    238         "OpenGLReadback.cpp",
    239         "Patch.cpp",
    240         "PatchCache.cpp",
    241         "PathCache.cpp",
    242         "PathParser.cpp",
    243         "PathTessellator.cpp",
    244         "PixelBuffer.cpp",
    245         "ProfileData.cpp",
    246         "ProfileDataContainer.cpp",
    247         "ProfileRenderer.cpp",
    248         "Program.cpp",
    249         "ProgramCache.cpp",
    250         "Properties.cpp",
    251         "PropertyValuesAnimatorSet.cpp",
    252         "PropertyValuesHolder.cpp",
    253         "RecordingCanvas.cpp",
    254         "RenderBufferCache.cpp",
    255         "RenderNode.cpp",
    256         "RenderProperties.cpp",
    257         "ResourceCache.cpp",
    258         "ShadowTessellator.cpp",
    259         "SkiaCanvas.cpp",
    260         "SkiaCanvasProxy.cpp",
    261         "SkiaShader.cpp",
    262         "Snapshot.cpp",
    263         "SpotShadow.cpp",
    264         "TessellationCache.cpp",
    265         "TextDropShadowCache.cpp",
    266         "Texture.cpp",
    267         "TextureCache.cpp",
    268         "VectorDrawable.cpp",
    269         "VkLayer.cpp",
    270         "protos/graphicsstats.proto",
    271         "protos/hwui.proto",
    272     ],
    273 
    274     proto: {
    275         export_proto_headers: true,
    276     },
    277 
    278     export_include_dirs: ["."],
    279     export_shared_lib_headers: ["libRScpp"],
    280 }
    281 
    282 cc_library {
    283     name: "libhwui",
    284     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",
    291     ],
    292 }
    293 
    294 // ------------------------
    295 // static library null gpu
    296 // ------------------------
    297 
    298 cc_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     ],
    308 }
    309 
    310 cc_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 
    328 cc_test {
    329     name: "hwui_unit_tests",
    330     defaults: ["hwui_test_defaults"],
    331 
    332     static_libs: [
    333         "libgmock",
    334         "libhwui_static_debug",
    335     ],
    336     shared_libs: [
    337         "libmemunreachable",
    338     ],
    339     cflags: [
    340         "-include debug/wrap_gles.h",
    341         "-DHWUI_NULL_GPU",
    342     ],
    343 
    344     srcs: [
    345         "tests/unit/main.cpp",
    346         "tests/unit/BakedOpDispatcherTests.cpp",
    347         "tests/unit/BakedOpRendererTests.cpp",
    348         "tests/unit/BakedOpStateTests.cpp",
    349         "tests/unit/CacheManagerTests.cpp",
    350         "tests/unit/CanvasContextTests.cpp",
    351         "tests/unit/CanvasStateTests.cpp",
    352         "tests/unit/ClipAreaTests.cpp",
    353         "tests/unit/DamageAccumulatorTests.cpp",
    354         "tests/unit/DeferredLayerUpdaterTests.cpp",
    355         "tests/unit/DeviceInfoTests.cpp",
    356         "tests/unit/FatVectorTests.cpp",
    357         "tests/unit/FontRendererTests.cpp",
    358         "tests/unit/FrameBuilderTests.cpp",
    359         "tests/unit/GlopBuilderTests.cpp",
    360         "tests/unit/GpuMemoryTrackerTests.cpp",
    361         "tests/unit/GradientCacheTests.cpp",
    362         "tests/unit/GraphicsStatsServiceTests.cpp",
    363         "tests/unit/LayerUpdateQueueTests.cpp",
    364         "tests/unit/LeakCheckTests.cpp",
    365         "tests/unit/LinearAllocatorTests.cpp",
    366         "tests/unit/MatrixTests.cpp",
    367         "tests/unit/MeshStateTests.cpp",
    368         "tests/unit/OffscreenBufferPoolTests.cpp",
    369         "tests/unit/OpDumperTests.cpp",
    370         "tests/unit/PathInterpolatorTests.cpp",
    371         "tests/unit/RenderNodeDrawableTests.cpp",
    372         "tests/unit/RecordingCanvasTests.cpp",
    373         "tests/unit/RenderNodeTests.cpp",
    374         "tests/unit/RenderPropertiesTests.cpp",
    375         "tests/unit/ShaderCacheTests.cpp",
    376         "tests/unit/SkiaBehaviorTests.cpp",
    377         "tests/unit/SkiaDisplayListTests.cpp",
    378         "tests/unit/SkiaPipelineTests.cpp",
    379         "tests/unit/SkiaRenderPropertiesTests.cpp",
    380         "tests/unit/SkiaCanvasTests.cpp",
    381         "tests/unit/SnapshotTests.cpp",
    382         "tests/unit/StringUtilsTests.cpp",
    383         "tests/unit/TestUtilsTests.cpp",
    384         "tests/unit/TextDropShadowCacheTests.cpp",
    385         "tests/unit/TextureCacheTests.cpp",
    386         "tests/unit/ThreadBaseTests.cpp",
    387         "tests/unit/TypefaceTests.cpp",
    388         "tests/unit/VectorDrawableTests.cpp",
    389         "tests/unit/VectorDrawableAtlasTests.cpp",
    390     ],
    391 }
    392 
    393 // ------------------------
    394 // Macro-bench app
    395 // ------------------------
    396 
    397 cc_benchmark {
    398     name: "hwuimacro",
    399     defaults: ["hwui_test_defaults"],
    400 
    401     // set to libhwui_static_debug to skip actual GL commands
    402     whole_static_libs: ["libhwui"],
    403     shared_libs: [
    404         "libmemunreachable",
    405     ],
    406 
    407     srcs: [
    408         "tests/macrobench/TestSceneRunner.cpp",
    409         "tests/macrobench/main.cpp",
    410     ],
    411 }
    412 
    413 // ------------------------
    414 // Micro-bench app
    415 // ---------------------
    416 
    417 cc_benchmark {
    418     name: "hwuimicro",
    419     defaults: ["hwui_test_defaults"],
    420 
    421     cflags: [
    422         "-include debug/wrap_gles.h",
    423         "-DHWUI_NULL_GPU",
    424     ],
    425 
    426     whole_static_libs: ["libhwui_static_debug"],
    427     shared_libs: [
    428         "libmemunreachable",
    429     ],
    430 
    431     srcs: [
    432         "tests/microbench/main.cpp",
    433         "tests/microbench/DisplayListCanvasBench.cpp",
    434         "tests/microbench/FontBench.cpp",
    435         "tests/microbench/FrameBuilderBench.cpp",
    436         "tests/microbench/LinearAllocatorBench.cpp",
    437         "tests/microbench/PathParserBench.cpp",
    438         "tests/microbench/RenderNodeBench.cpp",
    439         "tests/microbench/ShadowBench.cpp",
    440         "tests/microbench/TaskManagerBench.cpp",
    441     ],
    442 }
    443 
    444 // ----------------------------------------
    445 // Phony target to build benchmarks for PGO
    446 // ----------------------------------------
    447 
    448 phony {
    449     name: "pgo-targets-hwui",
    450     required: [
    451         "hwuimicro",
    452         "hwuimacro",
    453     ]
    454 }
    455