1cc_defaults { 2 name: "surfaceflinger_defaults", 3 cflags: [ 4 "-Wall", 5 "-Werror", 6 "-Wformat", 7 "-Wthread-safety", 8 "-Wunused", 9 "-Wunreachable-code", 10 "-Wconversion", 11 ], 12} 13 14cc_defaults { 15 name: "libsurfaceflinger_defaults", 16 defaults: ["surfaceflinger_defaults"], 17 cflags: [ 18 "-DLOG_TAG=\"SurfaceFlinger\"", 19 "-DGL_GLEXT_PROTOTYPES", 20 "-DEGL_EGLEXT_PROTOTYPES", 21 ], 22 shared_libs: [ 23 "android.frameworks.vr.composer@2.0", 24 "android.hardware.configstore-utils", 25 "android.hardware.configstore@1.0", 26 "android.hardware.configstore@1.1", 27 "android.hardware.graphics.allocator@2.0", 28 "android.hardware.graphics.allocator@3.0", 29 "android.hardware.graphics.common@1.2", 30 "android.hardware.graphics.composer@2.1", 31 "android.hardware.graphics.composer@2.2", 32 "android.hardware.graphics.composer@2.3", 33 "android.hardware.graphics.composer@2.4", 34 "android.hardware.power@1.0", 35 "android.hardware.power@1.3", 36 "android.hardware.power-cpp", 37 "libbase", 38 "libbinder", 39 "libbufferhubqueue", 40 "libcutils", 41 "libEGL", 42 "libfmq", 43 "libGLESv1_CM", 44 "libGLESv2", 45 "libgui", 46 "libhidlbase", 47 "liblayers_proto", 48 "liblog", 49 "libnativewindow", 50 "libpdx_default_transport", 51 "libprocessgroup", 52 "libprotobuf-cpp-lite", 53 "libstatslog", 54 "libsync", 55 "libtimestats", 56 "libui", 57 "libinput", 58 "libutils", 59 "libSurfaceFlingerProp", 60 ], 61 // VrComposer is not used when building surfaceflinger for vendors 62 target: { 63 vendor: { 64 exclude_shared_libs: [ 65 "android.frameworks.vr.composer@2.0", 66 ], 67 }, 68 }, 69 static_libs: [ 70 "libcompositionengine", 71 "libperfetto_client_experimental", 72 "librenderengine", 73 "libserviceutils", 74 "libtrace_proto", 75 "libvrflinger", 76 ], 77 header_libs: [ 78 "android.hardware.graphics.composer@2.1-command-buffer", 79 "android.hardware.graphics.composer@2.2-command-buffer", 80 "android.hardware.graphics.composer@2.3-command-buffer", 81 "android.hardware.graphics.composer@2.4-command-buffer", 82 ], 83 export_static_lib_headers: [ 84 "libcompositionengine", 85 "librenderengine", 86 "libserviceutils", 87 ], 88 export_shared_lib_headers: [ 89 "android.hardware.graphics.allocator@2.0", 90 "android.hardware.graphics.allocator@3.0", 91 "android.hardware.graphics.common@1.2", 92 "android.hardware.graphics.composer@2.1", 93 "android.hardware.graphics.composer@2.2", 94 "android.hardware.graphics.composer@2.3", 95 "android.hardware.graphics.composer@2.4", 96 "android.hardware.power@1.3", 97 "libhidlbase", 98 "libtimestats", 99 ], 100 // TODO (marissaw): this library is not used by surfaceflinger. This is here so 101 // the library compiled in a way that is accessible to system partition when running 102 // IMapper's VTS. 103 required: ["libgralloctypes"] 104} 105 106cc_defaults { 107 name: "libsurfaceflinger_production_defaults", 108 defaults: ["libsurfaceflinger_defaults"], 109 cflags: [ 110 "-fvisibility=hidden", 111 "-fwhole-program-vtables", // requires ThinLTO 112 ], 113 lto: { 114 thin: true, 115 }, 116 // TODO(b/131771163): Fix broken fuzzer support with LTO. 117 sanitize: { 118 fuzzer: false, 119 }, 120} 121 122cc_library_headers { 123 name: "libsurfaceflinger_headers", 124 export_include_dirs: ["."], 125 static_libs: ["libserviceutils"], 126 export_static_lib_headers: ["libserviceutils"], 127} 128 129filegroup { 130 name: "libsurfaceflinger_sources", 131 srcs: [ 132 "BufferLayer.cpp", 133 "BufferLayerConsumer.cpp", 134 "BufferQueueLayer.cpp", 135 "BufferStateLayer.cpp", 136 "ClientCache.cpp", 137 "Client.cpp", 138 "EffectLayer.cpp", 139 "ContainerLayer.cpp", 140 "DisplayDevice.cpp", 141 "DisplayHardware/ComposerHal.cpp", 142 "DisplayHardware/DisplayIdentification.cpp", 143 "DisplayHardware/FramebufferSurface.cpp", 144 "DisplayHardware/HWC2.cpp", 145 "DisplayHardware/HWComposer.cpp", 146 "DisplayHardware/PowerAdvisor.cpp", 147 "DisplayHardware/VirtualDisplaySurface.cpp", 148 "Effects/Daltonizer.cpp", 149 "EventLog/EventLog.cpp", 150 "FrameTracer/FrameTracer.cpp", 151 "FrameTracker.cpp", 152 "Layer.cpp", 153 "LayerProtoHelper.cpp", 154 "LayerRejecter.cpp", 155 "LayerVector.cpp", 156 "MonitoredProducer.cpp", 157 "NativeWindowSurface.cpp", 158 "RefreshRateOverlay.cpp", 159 "RegionSamplingThread.cpp", 160 "RenderArea.cpp", 161 "Scheduler/DispSync.cpp", 162 "Scheduler/DispSyncSource.cpp", 163 "Scheduler/EventControlThread.cpp", 164 "Scheduler/EventThread.cpp", 165 "Scheduler/OneShotTimer.cpp", 166 "Scheduler/LayerHistory.cpp", 167 "Scheduler/LayerHistoryV2.cpp", 168 "Scheduler/LayerInfo.cpp", 169 "Scheduler/LayerInfoV2.cpp", 170 "Scheduler/MessageQueue.cpp", 171 "Scheduler/PhaseOffsets.cpp", 172 "Scheduler/RefreshRateConfigs.cpp", 173 "Scheduler/Scheduler.cpp", 174 "Scheduler/SchedulerUtils.cpp", 175 "Scheduler/Timer.cpp", 176 "Scheduler/VSyncDispatchTimerQueue.cpp", 177 "Scheduler/VSyncPredictor.cpp", 178 "Scheduler/VSyncModulator.cpp", 179 "Scheduler/VSyncReactor.cpp", 180 "StartPropertySetThread.cpp", 181 "SurfaceFlinger.cpp", 182 "SurfaceFlingerDefaultFactory.cpp", 183 "SurfaceInterceptor.cpp", 184 "SurfaceTracing.cpp", 185 "TransactionCompletedThread.cpp", 186 ], 187} 188 189cc_library_shared { 190 // Please use libsurfaceflinger_defaults to configure how the sources are 191 // built, so the same settings can be used elsewhere. 192 name: "libsurfaceflinger", 193 defaults: ["libsurfaceflinger_production_defaults"], 194 srcs: [ 195 ":libsurfaceflinger_sources", 196 197 // Note: SurfaceFlingerFactory is not in the default sources so that it 198 // can be easily replaced. 199 "SurfaceFlingerFactory.cpp", 200 ], 201 cflags: [ 202 "-DUSE_VR_COMPOSER=1", 203 ], 204 // VrComposer is not used when building surfaceflinger for vendors 205 target: { 206 vendor: { 207 cflags: [ 208 "-DUSE_VR_COMPOSER=0", 209 ], 210 }, 211 }, 212 logtags: ["EventLog/EventLogTags.logtags"], 213} 214 215cc_defaults { 216 name: "libsurfaceflinger_binary", 217 defaults: ["surfaceflinger_defaults"], 218 cflags: [ 219 "-DLOG_TAG=\"SurfaceFlinger\"", 220 ], 221 shared_libs: [ 222 "android.frameworks.displayservice@1.0", 223 "android.hardware.configstore-utils", 224 "android.hardware.configstore@1.0", 225 "android.hardware.graphics.allocator@2.0", 226 "android.hardware.graphics.allocator@3.0", 227 "libbinder", 228 "libcutils", 229 "libdisplayservicehidl", 230 "libhidlbase", 231 "libinput", 232 "liblayers_proto", 233 "liblog", 234 "libprocessgroup", 235 "libsync", 236 "libutils", 237 ], 238 static_libs: [ 239 "libserviceutils", 240 "libtrace_proto", 241 ], 242 ldflags: ["-Wl,--export-dynamic"], 243} 244 245filegroup { 246 name: "surfaceflinger_binary_sources", 247 srcs: ["main_surfaceflinger.cpp"], 248} 249 250cc_binary { 251 name: "surfaceflinger", 252 defaults: ["libsurfaceflinger_binary"], 253 init_rc: ["surfaceflinger.rc"], 254 srcs: [":surfaceflinger_binary_sources"], 255 shared_libs: [ 256 "libsurfaceflinger", 257 "libSurfaceFlingerProp", 258 ], 259} 260 261subdirs = [ 262 "layerproto", 263 "tests", 264] 265 266cc_library_shared { 267 name: "libSurfaceFlingerProp", 268 srcs: [ 269 "SurfaceFlingerProperties.cpp", 270 ], 271 shared_libs: [ 272 "android.hardware.configstore-utils", 273 "android.hardware.configstore@1.0", 274 "android.hardware.configstore@1.1", 275 "android.hardware.graphics.common@1.2", 276 "libhidlbase", 277 "libui", 278 "libutils", 279 "liblog", 280 ], 281 static_libs: [ 282 "SurfaceFlingerProperties", 283 ], 284 export_shared_lib_headers: [ 285 "android.hardware.graphics.common@1.2", 286 "libhidlbase", 287 "libui", 288 ], 289 export_static_lib_headers: [ 290 "SurfaceFlingerProperties", 291 ], 292} 293