blob: 0ea140794753973503553a9b66d96351db0b29f7 [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 \
13 FrameTracker.cpp \
Jesse Hallfc038bd2016-03-26 22:20:22 -070014 GpuService.cpp \
Jesse Hall99c7dbb2013-03-14 14:29:29 -070015 Layer.cpp \
16 LayerDim.cpp \
Fabien Sanglard7b1563a2016-10-13 12:05:28 -070017 LayerRejecter.cpp \
Robert Carr2047fae2016-11-28 14:09:09 -080018 LayerVector.cpp \
Jesse Hall99c7dbb2013-03-14 14:29:29 -070019 MessageQueue.cpp \
Dan Stozab9b08832014-03-13 11:55:57 -070020 MonitoredProducer.cpp \
Jesse Hall99c7dbb2013-03-14 14:29:29 -070021 SurfaceFlingerConsumer.cpp \
Irvelc274c632016-06-13 16:44:08 -070022 SurfaceInterceptor.cpp \
Jesse Hall99c7dbb2013-03-14 14:29:29 -070023 Transform.cpp \
Chia-I Wuaab99f52016-10-05 12:59:58 +080024 DisplayHardware/ComposerHal.cpp \
Jesse Hall99c7dbb2013-03-14 14:29:29 -070025 DisplayHardware/FramebufferSurface.cpp \
Dan Stoza651bf312015-10-23 17:03:17 -070026 DisplayHardware/HWC2.cpp \
Dan Stozac6998d22015-09-24 17:03:36 -070027 DisplayHardware/HWC2On1Adapter.cpp \
Jesse Hall99c7dbb2013-03-14 14:29:29 -070028 DisplayHardware/PowerHAL.cpp \
29 DisplayHardware/VirtualDisplaySurface.cpp \
Mathias Agopianff2ed702013-09-01 21:36:12 -070030 Effects/Daltonizer.cpp \
Mathias Agopian85cce372013-06-04 21:50:31 -070031 EventLog/EventLogTags.logtags \
Mathias Agopian875d8e12013-06-07 15:35:48 -070032 EventLog/EventLog.cpp \
Mathias Agopian3f844832013-08-07 21:24:32 -070033 RenderEngine/Description.cpp \
34 RenderEngine/Mesh.cpp \
35 RenderEngine/Program.cpp \
36 RenderEngine/ProgramCache.cpp \
Mathias Agopian875d8e12013-06-07 15:35:48 -070037 RenderEngine/GLExtensions.cpp \
38 RenderEngine/RenderEngine.cpp \
Mathias Agopian49457ac2013-08-14 18:20:17 -070039 RenderEngine/Texture.cpp \
Irvelc274c632016-06-13 16:44:08 -070040 RenderEngine/GLES20RenderEngine.cpp \
Mathias Agopian875d8e12013-06-07 15:35:48 -070041
Irvelc274c632016-06-13 16:44:08 -070042LOCAL_MODULE := libsurfaceflinger
Jesse Hall8b0d55e2016-03-31 19:29:36 -070043LOCAL_C_INCLUDES := \
Irvelc274c632016-06-13 16:44:08 -070044 frameworks/native/vulkan/include \
45 external/vulkan-validation-layers/libs/vkjson \
Chia-I Wucd8d7f02016-11-16 11:02:31 +080046 system/libhwbinder/fast_msgq/include \
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080047
Dan Stoza01049c82014-11-11 10:32:31 -080048LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
Mathias Agopian076b1cc2009-04-10 14:24:30 -070049LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
Dan Stoza9e56aa02015-11-02 13:00:03 -080050
Daniel Nicoara2f5f8a52016-12-20 16:11:58 -050051ifeq ($(TARGET_IN_VR_MODE),true)
52 LOCAL_CFLAGS += -DIN_VR_MODE
53endif
54
Fabien Sanglard9d96de42016-10-11 00:15:18 +000055ifeq ($(TARGET_USES_HWC2),true)
56 LOCAL_CFLAGS += -DUSE_HWC2
57 LOCAL_SRC_FILES += \
58 SurfaceFlinger.cpp \
59 DisplayHardware/HWComposer.cpp
Fabien Sanglardb7432cc2016-11-11 09:40:27 -080060 ifeq ($(TARGET_USES_HWC2ON1ADAPTER), true)
61 LOCAL_CFLAGS += -DBYPASS_IHWC
62 endif
Fabien Sanglard9d96de42016-10-11 00:15:18 +000063else
Fabien Sanglardb7432cc2016-11-11 09:40:27 -080064 LOCAL_CFLAGS += -DBYPASS_IHWC
Fabien Sanglard9d96de42016-10-11 00:15:18 +000065 LOCAL_SRC_FILES += \
66 SurfaceFlinger_hwc1.cpp \
67 DisplayHardware/HWComposer_hwc1.cpp
68endif
69
Mathias Agopian5df99622012-06-18 17:27:56 -070070ifeq ($(TARGET_BOARD_PLATFORM),omap4)
Andreas Gampe89fd4f72014-11-13 14:18:56 -080071 LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY
Mathias Agopian57bf9e72011-10-07 15:42:53 -070072endif
Mathias Agopian5df99622012-06-18 17:27:56 -070073ifeq ($(TARGET_BOARD_PLATFORM),s5pc110)
Andreas Gampe89fd4f72014-11-13 14:18:56 -080074 LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY
Mathias Agopian7f42a9c2012-04-23 20:00:16 -070075endif
76
Jesse Hallc354eff2013-10-25 10:44:41 -070077ifeq ($(TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS),true)
78 LOCAL_CFLAGS += -DFORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS
Naseer Ahmed6a968462013-10-04 16:15:22 -040079endif
80
Jamie Genniscdbaecb2012-10-12 14:18:10 -070081ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),)
Andreas Gampe89fd4f72014-11-13 14:18:56 -080082 LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
Jamie Genniscdbaecb2012-10-12 14:18:10 -070083endif
84
Jamie Gennisfaf77cc2013-07-30 15:10:32 -070085ifeq ($(TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK),true)
86 LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK
87endif
88
Dan Stoza28ffe192016-09-09 13:50:19 -070089# The following two BoardConfig variables define (respectively):
90#
91# - The phase offset between hardware vsync and when apps are woken up by the
92# Choreographer callback
93# - The phase offset between hardware vsync and when SurfaceFlinger wakes up
94# to consume input
95#
96# Their values can be tuned to trade off between display pipeline latency (both
97# overall latency and the lengths of the app --> SF and SF --> display phases)
98# and frame delivery jitter (which typically manifests as "jank" or "jerkiness"
99# while interacting with the device). The default values should produce a
100# relatively low amount of jitter at the expense of roughly two frames of
101# app --> display latency, and unless significant testing is performed to avoid
102# increased display jitter (both manual investigation using systrace [1] and
103# automated testing using dumpsys gfxinfo [2] are recommended), they should not
104# be modified.
105#
106# [1] https://developer.android.com/studio/profile/systrace.html
107# [2] https://developer.android.com/training/testing/performance.html
108
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700109ifneq ($(VSYNC_EVENT_PHASE_OFFSET_NS),)
110 LOCAL_CFLAGS += -DVSYNC_EVENT_PHASE_OFFSET_NS=$(VSYNC_EVENT_PHASE_OFFSET_NS)
111else
Dan Stoza28ffe192016-09-09 13:50:19 -0700112 LOCAL_CFLAGS += -DVSYNC_EVENT_PHASE_OFFSET_NS=1000000
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700113endif
114
Jamie Gennis0a645cc2013-10-14 20:52:46 -0700115ifneq ($(SF_VSYNC_EVENT_PHASE_OFFSET_NS),)
116 LOCAL_CFLAGS += -DSF_VSYNC_EVENT_PHASE_OFFSET_NS=$(SF_VSYNC_EVENT_PHASE_OFFSET_NS)
117else
Dan Stoza28ffe192016-09-09 13:50:19 -0700118 LOCAL_CFLAGS += -DSF_VSYNC_EVENT_PHASE_OFFSET_NS=1000000
Jamie Gennis0a645cc2013-10-14 20:52:46 -0700119endif
120
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700121ifneq ($(PRESENT_TIME_OFFSET_FROM_VSYNC_NS),)
122 LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=$(PRESENT_TIME_OFFSET_FROM_VSYNC_NS)
123else
124 LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=0
125endif
126
Dan Stoza1f3efb12014-10-15 16:34:55 -0700127ifneq ($(MAX_VIRTUAL_DISPLAY_DIMENSION),)
128 LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=$(MAX_VIRTUAL_DISPLAY_DIMENSION)
129else
130 LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=0
131endif
132
Michael Lentine7306c672014-07-30 13:00:37 -0700133LOCAL_CFLAGS += -fvisibility=hidden -Werror=format
Mathias Agopianb6df7d02013-05-09 14:53:35 -0700134
Chia-I Wucd8d7f02016-11-16 11:02:31 +0800135LOCAL_STATIC_LIBRARIES := libhwcomposer-command-buffer libtrace_proto libvkjson
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800136LOCAL_SHARED_LIBRARIES := \
Daniel Nicoara2f5f8a52016-12-20 16:11:58 -0500137 android.dvr.composer@1.0 \
Chia-I Wuaab99f52016-10-05 12:59:58 +0800138 android.hardware.graphics.allocator@2.0 \
139 android.hardware.graphics.composer@2.1 \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800140 libcutils \
141 liblog \
142 libdl \
Chia-I Wucd8d7f02016-11-16 11:02:31 +0800143 libfmq \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800144 libhardware \
Yifan Hong67a47622016-11-17 13:02:06 -0800145 libhidlbase \
146 libhidltransport \
Chia-I Wuaab99f52016-10-05 12:59:58 +0800147 libhwbinder \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800148 libutils \
149 libEGL \
150 libGLESv1_CM \
151 libGLESv2 \
152 libbinder \
153 libui \
154 libgui \
Jesse Hall8b0d55e2016-03-31 19:29:36 -0700155 libpowermanager \
Irvelc274c632016-06-13 16:44:08 -0700156 libvulkan \
Chia-I Wucd8d7f02016-11-16 11:02:31 +0800157 libsync \
Colin Cross63549382016-10-26 12:52:53 -0700158 libprotobuf-cpp-lite \
Ruchi Kandoib5ee1782016-10-04 17:51:50 -0700159 libbase \
Ruchi Kandoib5ee1782016-10-04 17:51:50 -0700160 android.hardware.power@1.0
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800161
Chia-I Wuaab99f52016-10-05 12:59:58 +0800162LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := \
163 android.hardware.graphics.allocator@2.0 \
164 android.hardware.graphics.composer@2.1 \
Yifan Hong67a47622016-11-17 13:02:06 -0800165 libhidlbase \
166 libhidltransport \
Chia-I Wuaab99f52016-10-05 12:59:58 +0800167 libhwbinder
168
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800169LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
170
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800171include $(BUILD_SHARED_LIBRARY)
Keun young Park63f165f2012-08-31 10:53:36 -0700172
173###############################################################
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700174# build surfaceflinger's executable
175include $(CLEAR_VARS)
176
Dan Stoza01049c82014-11-11 10:32:31 -0800177LOCAL_CLANG := true
Mathias Agopian4f4f0942013-08-19 17:26:18 -0700178
Dimitry Ivanovf06248f2016-08-01 14:13:37 -0700179LOCAL_LDFLAGS_32 := -Wl,--version-script,art/sigchainlib/version-script32.txt -Wl,--export-dynamic
180LOCAL_LDFLAGS_64 := -Wl,--version-script,art/sigchainlib/version-script64.txt -Wl,--export-dynamic
Dan Stoza01049c82014-11-11 10:32:31 -0800181LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
Dan Stoza01049c82014-11-11 10:32:31 -0800182
Tom Cherry74155992015-08-14 13:01:23 -0700183LOCAL_INIT_RC := surfaceflinger.rc
184
Tim Murrayac8d2392015-11-10 14:29:45 -0800185ifneq ($(ENABLE_CPUSETS),)
186 LOCAL_CFLAGS += -DENABLE_CPUSETS
187endif
188
Fabien Sanglard9d96de42016-10-11 00:15:18 +0000189ifeq ($(TARGET_USES_HWC2),true)
190 LOCAL_CFLAGS += -DUSE_HWC2
191endif
192
Dan Stoza01049c82014-11-11 10:32:31 -0800193LOCAL_SRC_FILES := \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800194 main_surfaceflinger.cpp
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700195
196LOCAL_SHARED_LIBRARIES := \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800197 libsurfaceflinger \
198 libcutils \
199 liblog \
200 libbinder \
201 libutils \
202 libdl
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700203
Dmitriy Ivanov4340a142014-10-20 14:17:26 -0700204LOCAL_WHOLE_STATIC_LIBRARIES := libsigchain
Irvelc274c632016-06-13 16:44:08 -0700205LOCAL_STATIC_LIBRARIES := libtrace_proto
Dmitriy Ivanov4340a142014-10-20 14:17:26 -0700206
Dan Stoza01049c82014-11-11 10:32:31 -0800207LOCAL_MODULE := surfaceflinger
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700208
Colin Cross89450d42014-02-20 15:36:21 -0800209ifdef TARGET_32_BIT_SURFACEFLINGER
210LOCAL_32_BIT_ONLY := true
211endif
212
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800213LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
214
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700215include $(BUILD_EXECUTABLE)
216
217###############################################################
Keun young Park63f165f2012-08-31 10:53:36 -0700218# uses jni which may not be available in PDK
219ifneq ($(wildcard libnativehelper/include),)
220include $(CLEAR_VARS)
Mathias Agopian1b3aeb42012-10-07 16:41:12 -0700221
Dan Stoza01049c82014-11-11 10:32:31 -0800222LOCAL_CLANG := true
223
224LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
Dan Stoza01049c82014-11-11 10:32:31 -0800225
226LOCAL_SRC_FILES := \
Keun young Park63f165f2012-08-31 10:53:36 -0700227 DdmConnection.cpp
228
229LOCAL_SHARED_LIBRARIES := \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800230 libcutils \
231 liblog \
232 libdl
Keun young Park63f165f2012-08-31 10:53:36 -0700233
Dan Stoza01049c82014-11-11 10:32:31 -0800234LOCAL_MODULE := libsurfaceflinger_ddmconnection
Keun young Park63f165f2012-08-31 10:53:36 -0700235
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800236LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
237
Keun young Park63f165f2012-08-31 10:53:36 -0700238include $(BUILD_SHARED_LIBRARY)
239endif # libnativehelper