blob: f695edb4a5ba1d48a5f5221a6cb75457537fa6c3 [file] [log] [blame]
Dan Stoza01049c82014-11-11 10:32:31 -08001LOCAL_PATH := $(call my-dir)
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08002include $(CLEAR_VARS)
3
Jesse Hall24cd98e2014-07-13 14:37:16 -07004LOCAL_CLANG := true
5
Jesse Halle9b23b62014-07-14 15:32:59 -07006LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dan Stoza01049c82014-11-11 10:32:31 -08007LOCAL_SRC_FILES := \
Jesse Hall99c7dbb2013-03-14 14:29:29 -07008 Client.cpp \
9 DisplayDevice.cpp \
Jamie Gennisfaf77cc2013-07-30 15:10:32 -070010 DispSync.cpp \
Jamie Gennisd1700752013-10-14 12:22:52 -070011 EventControlThread.cpp \
Jesse Hall99c7dbb2013-03-14 14:29:29 -070012 EventThread.cpp \
Pablo Ceballos40845df2016-01-25 17:41:15 -080013 FenceTracker.cpp \
Jesse Hall99c7dbb2013-03-14 14:29:29 -070014 FrameTracker.cpp \
Jesse Hallfc038bd2016-03-26 22:20:22 -070015 GpuService.cpp \
Jesse Hall99c7dbb2013-03-14 14:29:29 -070016 Layer.cpp \
17 LayerDim.cpp \
18 MessageQueue.cpp \
Dan Stozab9b08832014-03-13 11:55:57 -070019 MonitoredProducer.cpp \
Jesse Hall99c7dbb2013-03-14 14:29:29 -070020 SurfaceFlingerConsumer.cpp \
Irvelc274c632016-06-13 16:44:08 -070021 SurfaceInterceptor.cpp \
Jesse Hall99c7dbb2013-03-14 14:29:29 -070022 Transform.cpp \
Chia-I Wuaab99f52016-10-05 12:59:58 +080023 DisplayHardware/ComposerHal.cpp \
Jesse Hall99c7dbb2013-03-14 14:29:29 -070024 DisplayHardware/FramebufferSurface.cpp \
Dan Stoza651bf312015-10-23 17:03:17 -070025 DisplayHardware/HWC2.cpp \
Dan Stozac6998d22015-09-24 17:03:36 -070026 DisplayHardware/HWC2On1Adapter.cpp \
Jesse Hall99c7dbb2013-03-14 14:29:29 -070027 DisplayHardware/PowerHAL.cpp \
28 DisplayHardware/VirtualDisplaySurface.cpp \
Mathias Agopianff2ed702013-09-01 21:36:12 -070029 Effects/Daltonizer.cpp \
Mathias Agopian85cce372013-06-04 21:50:31 -070030 EventLog/EventLogTags.logtags \
Mathias Agopian875d8e12013-06-07 15:35:48 -070031 EventLog/EventLog.cpp \
Mathias Agopian3f844832013-08-07 21:24:32 -070032 RenderEngine/Description.cpp \
33 RenderEngine/Mesh.cpp \
34 RenderEngine/Program.cpp \
35 RenderEngine/ProgramCache.cpp \
Mathias Agopian875d8e12013-06-07 15:35:48 -070036 RenderEngine/GLExtensions.cpp \
37 RenderEngine/RenderEngine.cpp \
Mathias Agopian49457ac2013-08-14 18:20:17 -070038 RenderEngine/Texture.cpp \
Irvelc274c632016-06-13 16:44:08 -070039 RenderEngine/GLES20RenderEngine.cpp \
Mathias Agopian875d8e12013-06-07 15:35:48 -070040
Irvelc274c632016-06-13 16:44:08 -070041LOCAL_MODULE := libsurfaceflinger
Jesse Hall8b0d55e2016-03-31 19:29:36 -070042LOCAL_C_INCLUDES := \
Irvelc274c632016-06-13 16:44:08 -070043 frameworks/native/vulkan/include \
44 external/vulkan-validation-layers/libs/vkjson \
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080045
Dan Stoza01049c82014-11-11 10:32:31 -080046LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
Mathias Agopian076b1cc2009-04-10 14:24:30 -070047LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
Dan Stoza9e56aa02015-11-02 13:00:03 -080048
Fabien Sanglard9d96de42016-10-11 00:15:18 +000049ifeq ($(TARGET_USES_HWC2),true)
50 LOCAL_CFLAGS += -DUSE_HWC2
51 LOCAL_SRC_FILES += \
52 SurfaceFlinger.cpp \
53 DisplayHardware/HWComposer.cpp
54else
55 LOCAL_SRC_FILES += \
56 SurfaceFlinger_hwc1.cpp \
57 DisplayHardware/HWComposer_hwc1.cpp
58endif
59
Mathias Agopian5df99622012-06-18 17:27:56 -070060ifeq ($(TARGET_BOARD_PLATFORM),omap4)
Andreas Gampe89fd4f72014-11-13 14:18:56 -080061 LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY
Mathias Agopian57bf9e72011-10-07 15:42:53 -070062endif
Mathias Agopian5df99622012-06-18 17:27:56 -070063ifeq ($(TARGET_BOARD_PLATFORM),s5pc110)
Andreas Gampe89fd4f72014-11-13 14:18:56 -080064 LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY
Mathias Agopian7f42a9c2012-04-23 20:00:16 -070065endif
66
Mathias Agopian5df99622012-06-18 17:27:56 -070067ifeq ($(TARGET_DISABLE_TRIPLE_BUFFERING),true)
Andreas Gampe89fd4f72014-11-13 14:18:56 -080068 LOCAL_CFLAGS += -DTARGET_DISABLE_TRIPLE_BUFFERING
Mathias Agopian67226812010-10-11 17:54:43 -070069endif
70
Jesse Hallc354eff2013-10-25 10:44:41 -070071ifeq ($(TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS),true)
72 LOCAL_CFLAGS += -DFORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS
Naseer Ahmed6a968462013-10-04 16:15:22 -040073endif
74
Jamie Genniscdbaecb2012-10-12 14:18:10 -070075ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),)
Andreas Gampe89fd4f72014-11-13 14:18:56 -080076 LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
Jamie Genniscdbaecb2012-10-12 14:18:10 -070077endif
78
Jamie Gennisfaf77cc2013-07-30 15:10:32 -070079ifeq ($(TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK),true)
80 LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK
81endif
82
Dan Stoza28ffe192016-09-09 13:50:19 -070083# The following two BoardConfig variables define (respectively):
84#
85# - The phase offset between hardware vsync and when apps are woken up by the
86# Choreographer callback
87# - The phase offset between hardware vsync and when SurfaceFlinger wakes up
88# to consume input
89#
90# Their values can be tuned to trade off between display pipeline latency (both
91# overall latency and the lengths of the app --> SF and SF --> display phases)
92# and frame delivery jitter (which typically manifests as "jank" or "jerkiness"
93# while interacting with the device). The default values should produce a
94# relatively low amount of jitter at the expense of roughly two frames of
95# app --> display latency, and unless significant testing is performed to avoid
96# increased display jitter (both manual investigation using systrace [1] and
97# automated testing using dumpsys gfxinfo [2] are recommended), they should not
98# be modified.
99#
100# [1] https://developer.android.com/studio/profile/systrace.html
101# [2] https://developer.android.com/training/testing/performance.html
102
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700103ifneq ($(VSYNC_EVENT_PHASE_OFFSET_NS),)
104 LOCAL_CFLAGS += -DVSYNC_EVENT_PHASE_OFFSET_NS=$(VSYNC_EVENT_PHASE_OFFSET_NS)
105else
Dan Stoza28ffe192016-09-09 13:50:19 -0700106 LOCAL_CFLAGS += -DVSYNC_EVENT_PHASE_OFFSET_NS=1000000
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700107endif
108
Jamie Gennis0a645cc2013-10-14 20:52:46 -0700109ifneq ($(SF_VSYNC_EVENT_PHASE_OFFSET_NS),)
110 LOCAL_CFLAGS += -DSF_VSYNC_EVENT_PHASE_OFFSET_NS=$(SF_VSYNC_EVENT_PHASE_OFFSET_NS)
111else
Dan Stoza28ffe192016-09-09 13:50:19 -0700112 LOCAL_CFLAGS += -DSF_VSYNC_EVENT_PHASE_OFFSET_NS=1000000
Jamie Gennis0a645cc2013-10-14 20:52:46 -0700113endif
114
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700115ifneq ($(PRESENT_TIME_OFFSET_FROM_VSYNC_NS),)
116 LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=$(PRESENT_TIME_OFFSET_FROM_VSYNC_NS)
117else
118 LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=0
119endif
120
Dan Stoza1f3efb12014-10-15 16:34:55 -0700121ifneq ($(MAX_VIRTUAL_DISPLAY_DIMENSION),)
122 LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=$(MAX_VIRTUAL_DISPLAY_DIMENSION)
123else
124 LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=0
125endif
126
Michael Lentine7306c672014-07-30 13:00:37 -0700127LOCAL_CFLAGS += -fvisibility=hidden -Werror=format
Mathias Agopianb6df7d02013-05-09 14:53:35 -0700128
Irvelc274c632016-06-13 16:44:08 -0700129LOCAL_STATIC_LIBRARIES := libtrace_proto libvkjson
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800130LOCAL_SHARED_LIBRARIES := \
Chia-I Wuaab99f52016-10-05 12:59:58 +0800131 android.hardware.graphics.allocator@2.0 \
132 android.hardware.graphics.composer@2.1 \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800133 libcutils \
134 liblog \
135 libdl \
136 libhardware \
Chia-I Wuaab99f52016-10-05 12:59:58 +0800137 libhidl \
138 libhwbinder \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800139 libutils \
140 libEGL \
141 libGLESv1_CM \
142 libGLESv2 \
143 libbinder \
144 libui \
145 libgui \
Jesse Hall8b0d55e2016-03-31 19:29:36 -0700146 libpowermanager \
Irvelc274c632016-06-13 16:44:08 -0700147 libvulkan \
Ruchi Kandoib5ee1782016-10-04 17:51:50 -0700148 libprotobuf-cpp-full \
149 libhidl \
150 libhwbinder \
151 libbase \
152 libutils \
153 android.hardware.power@1.0
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800154
Chia-I Wuaab99f52016-10-05 12:59:58 +0800155LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := \
156 android.hardware.graphics.allocator@2.0 \
157 android.hardware.graphics.composer@2.1 \
158 libhidl \
159 libhwbinder
160
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800161LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
162
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800163include $(BUILD_SHARED_LIBRARY)
Keun young Park63f165f2012-08-31 10:53:36 -0700164
165###############################################################
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700166# build surfaceflinger's executable
167include $(CLEAR_VARS)
168
Dan Stoza01049c82014-11-11 10:32:31 -0800169LOCAL_CLANG := true
Mathias Agopian4f4f0942013-08-19 17:26:18 -0700170
Dimitry Ivanovf06248f2016-08-01 14:13:37 -0700171LOCAL_LDFLAGS_32 := -Wl,--version-script,art/sigchainlib/version-script32.txt -Wl,--export-dynamic
172LOCAL_LDFLAGS_64 := -Wl,--version-script,art/sigchainlib/version-script64.txt -Wl,--export-dynamic
Dan Stoza01049c82014-11-11 10:32:31 -0800173LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
Dan Stoza01049c82014-11-11 10:32:31 -0800174
Tom Cherry74155992015-08-14 13:01:23 -0700175LOCAL_INIT_RC := surfaceflinger.rc
176
Tim Murrayac8d2392015-11-10 14:29:45 -0800177ifneq ($(ENABLE_CPUSETS),)
178 LOCAL_CFLAGS += -DENABLE_CPUSETS
179endif
180
Fabien Sanglard9d96de42016-10-11 00:15:18 +0000181ifeq ($(TARGET_USES_HWC2),true)
182 LOCAL_CFLAGS += -DUSE_HWC2
183endif
184
Dan Stoza01049c82014-11-11 10:32:31 -0800185LOCAL_SRC_FILES := \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800186 main_surfaceflinger.cpp
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700187
188LOCAL_SHARED_LIBRARIES := \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800189 libsurfaceflinger \
190 libcutils \
191 liblog \
192 libbinder \
193 libutils \
194 libdl
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700195
Dmitriy Ivanov4340a142014-10-20 14:17:26 -0700196LOCAL_WHOLE_STATIC_LIBRARIES := libsigchain
Irvelc274c632016-06-13 16:44:08 -0700197LOCAL_STATIC_LIBRARIES := libtrace_proto
Dmitriy Ivanov4340a142014-10-20 14:17:26 -0700198
Dan Stoza01049c82014-11-11 10:32:31 -0800199LOCAL_MODULE := surfaceflinger
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700200
Colin Cross89450d42014-02-20 15:36:21 -0800201ifdef TARGET_32_BIT_SURFACEFLINGER
202LOCAL_32_BIT_ONLY := true
203endif
204
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800205LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
206
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700207include $(BUILD_EXECUTABLE)
208
209###############################################################
Keun young Park63f165f2012-08-31 10:53:36 -0700210# uses jni which may not be available in PDK
211ifneq ($(wildcard libnativehelper/include),)
212include $(CLEAR_VARS)
Mathias Agopian1b3aeb42012-10-07 16:41:12 -0700213
Dan Stoza01049c82014-11-11 10:32:31 -0800214LOCAL_CLANG := true
215
216LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
Dan Stoza01049c82014-11-11 10:32:31 -0800217
218LOCAL_SRC_FILES := \
Keun young Park63f165f2012-08-31 10:53:36 -0700219 DdmConnection.cpp
220
221LOCAL_SHARED_LIBRARIES := \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800222 libcutils \
223 liblog \
224 libdl
Keun young Park63f165f2012-08-31 10:53:36 -0700225
Dan Stoza01049c82014-11-11 10:32:31 -0800226LOCAL_MODULE := libsurfaceflinger_ddmconnection
Keun young Park63f165f2012-08-31 10:53:36 -0700227
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800228LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
229
Keun young Park63f165f2012-08-31 10:53:36 -0700230include $(BUILD_SHARED_LIBRARY)
231endif # libnativehelper