blob: 39b452808754f62303855c3b376561cb427b3e7a [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 \
23 DisplayHardware/FramebufferSurface.cpp \
Dan Stoza651bf312015-10-23 17:03:17 -070024 DisplayHardware/HWC2.cpp \
Dan Stozac6998d22015-09-24 17:03:36 -070025 DisplayHardware/HWC2On1Adapter.cpp \
Jesse Hall99c7dbb2013-03-14 14:29:29 -070026 DisplayHardware/PowerHAL.cpp \
27 DisplayHardware/VirtualDisplaySurface.cpp \
Mathias Agopianff2ed702013-09-01 21:36:12 -070028 Effects/Daltonizer.cpp \
Mathias Agopian85cce372013-06-04 21:50:31 -070029 EventLog/EventLogTags.logtags \
Mathias Agopian875d8e12013-06-07 15:35:48 -070030 EventLog/EventLog.cpp \
Mathias Agopian3f844832013-08-07 21:24:32 -070031 RenderEngine/Description.cpp \
32 RenderEngine/Mesh.cpp \
33 RenderEngine/Program.cpp \
34 RenderEngine/ProgramCache.cpp \
Mathias Agopian875d8e12013-06-07 15:35:48 -070035 RenderEngine/GLExtensions.cpp \
36 RenderEngine/RenderEngine.cpp \
Mathias Agopian49457ac2013-08-14 18:20:17 -070037 RenderEngine/Texture.cpp \
Mathias Agopian875d8e12013-06-07 15:35:48 -070038 RenderEngine/GLES10RenderEngine.cpp \
Mathias Agopian3f844832013-08-07 21:24:32 -070039 RenderEngine/GLES11RenderEngine.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 \
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080046
Dan Stoza01049c82014-11-11 10:32:31 -080047LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
Mathias Agopian076b1cc2009-04-10 14:24:30 -070048LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
Dan Stoza9e56aa02015-11-02 13:00:03 -080049
Dan Stozaf9d7e1a2016-06-21 10:00:37 -070050ifeq ($(TARGET_USES_HWC2),true)
Dan Stoza9e56aa02015-11-02 13:00:03 -080051 LOCAL_CFLAGS += -DUSE_HWC2
52 LOCAL_SRC_FILES += \
53 SurfaceFlinger.cpp \
54 DisplayHardware/HWComposer.cpp
55else
56 LOCAL_SRC_FILES += \
57 SurfaceFlinger_hwc1.cpp \
58 DisplayHardware/HWComposer_hwc1.cpp
59endif
60
Mathias Agopian5df99622012-06-18 17:27:56 -070061ifeq ($(TARGET_BOARD_PLATFORM),omap4)
Andreas Gampe89fd4f72014-11-13 14:18:56 -080062 LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY
Mathias Agopian57bf9e72011-10-07 15:42:53 -070063endif
Mathias Agopian5df99622012-06-18 17:27:56 -070064ifeq ($(TARGET_BOARD_PLATFORM),s5pc110)
Andreas Gampe89fd4f72014-11-13 14:18:56 -080065 LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY
Mathias Agopian7f42a9c2012-04-23 20:00:16 -070066endif
67
Mathias Agopian5df99622012-06-18 17:27:56 -070068ifeq ($(TARGET_DISABLE_TRIPLE_BUFFERING),true)
Andreas Gampe89fd4f72014-11-13 14:18:56 -080069 LOCAL_CFLAGS += -DTARGET_DISABLE_TRIPLE_BUFFERING
Mathias Agopian67226812010-10-11 17:54:43 -070070endif
71
Jesse Hallc354eff2013-10-25 10:44:41 -070072ifeq ($(TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS),true)
73 LOCAL_CFLAGS += -DFORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS
Naseer Ahmed6a968462013-10-04 16:15:22 -040074endif
75
Jamie Genniscdbaecb2012-10-12 14:18:10 -070076ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),)
Andreas Gampe89fd4f72014-11-13 14:18:56 -080077 LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
Jamie Genniscdbaecb2012-10-12 14:18:10 -070078endif
79
Jamie Gennisfaf77cc2013-07-30 15:10:32 -070080ifeq ($(TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK),true)
81 LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK
82endif
83
Dan Stoza28ffe192016-09-09 13:50:19 -070084# The following two BoardConfig variables define (respectively):
85#
86# - The phase offset between hardware vsync and when apps are woken up by the
87# Choreographer callback
88# - The phase offset between hardware vsync and when SurfaceFlinger wakes up
89# to consume input
90#
91# Their values can be tuned to trade off between display pipeline latency (both
92# overall latency and the lengths of the app --> SF and SF --> display phases)
93# and frame delivery jitter (which typically manifests as "jank" or "jerkiness"
94# while interacting with the device). The default values should produce a
95# relatively low amount of jitter at the expense of roughly two frames of
96# app --> display latency, and unless significant testing is performed to avoid
97# increased display jitter (both manual investigation using systrace [1] and
98# automated testing using dumpsys gfxinfo [2] are recommended), they should not
99# be modified.
100#
101# [1] https://developer.android.com/studio/profile/systrace.html
102# [2] https://developer.android.com/training/testing/performance.html
103
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700104ifneq ($(VSYNC_EVENT_PHASE_OFFSET_NS),)
105 LOCAL_CFLAGS += -DVSYNC_EVENT_PHASE_OFFSET_NS=$(VSYNC_EVENT_PHASE_OFFSET_NS)
106else
Dan Stoza28ffe192016-09-09 13:50:19 -0700107 LOCAL_CFLAGS += -DVSYNC_EVENT_PHASE_OFFSET_NS=1000000
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700108endif
109
Jamie Gennis0a645cc2013-10-14 20:52:46 -0700110ifneq ($(SF_VSYNC_EVENT_PHASE_OFFSET_NS),)
111 LOCAL_CFLAGS += -DSF_VSYNC_EVENT_PHASE_OFFSET_NS=$(SF_VSYNC_EVENT_PHASE_OFFSET_NS)
112else
Dan Stoza28ffe192016-09-09 13:50:19 -0700113 LOCAL_CFLAGS += -DSF_VSYNC_EVENT_PHASE_OFFSET_NS=1000000
Jamie Gennis0a645cc2013-10-14 20:52:46 -0700114endif
115
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700116ifneq ($(PRESENT_TIME_OFFSET_FROM_VSYNC_NS),)
117 LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=$(PRESENT_TIME_OFFSET_FROM_VSYNC_NS)
118else
119 LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=0
120endif
121
Dan Stoza1f3efb12014-10-15 16:34:55 -0700122ifneq ($(MAX_VIRTUAL_DISPLAY_DIMENSION),)
123 LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=$(MAX_VIRTUAL_DISPLAY_DIMENSION)
124else
125 LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=0
126endif
127
Michael Lentine7306c672014-07-30 13:00:37 -0700128LOCAL_CFLAGS += -fvisibility=hidden -Werror=format
Pablo Ceballos40845df2016-01-25 17:41:15 -0800129LOCAL_CFLAGS += -std=c++14
Mathias Agopianb6df7d02013-05-09 14:53:35 -0700130
Irvelc274c632016-06-13 16:44:08 -0700131LOCAL_STATIC_LIBRARIES := libtrace_proto libvkjson
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800132LOCAL_SHARED_LIBRARIES := \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800133 libcutils \
134 liblog \
135 libdl \
136 libhardware \
137 libutils \
138 libEGL \
139 libGLESv1_CM \
140 libGLESv2 \
141 libbinder \
142 libui \
143 libgui \
Jesse Hall8b0d55e2016-03-31 19:29:36 -0700144 libpowermanager \
Irvelc274c632016-06-13 16:44:08 -0700145 libvulkan \
146 libprotobuf-cpp-full
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800147
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800148LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
149
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800150include $(BUILD_SHARED_LIBRARY)
Keun young Park63f165f2012-08-31 10:53:36 -0700151
152###############################################################
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700153# build surfaceflinger's executable
154include $(CLEAR_VARS)
155
Dan Stoza01049c82014-11-11 10:32:31 -0800156LOCAL_CLANG := true
Mathias Agopian4f4f0942013-08-19 17:26:18 -0700157
Dimitry Ivanovf06248f2016-08-01 14:13:37 -0700158LOCAL_LDFLAGS_32 := -Wl,--version-script,art/sigchainlib/version-script32.txt -Wl,--export-dynamic
159LOCAL_LDFLAGS_64 := -Wl,--version-script,art/sigchainlib/version-script64.txt -Wl,--export-dynamic
Dan Stoza01049c82014-11-11 10:32:31 -0800160LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
Pablo Ceballos40845df2016-01-25 17:41:15 -0800161LOCAL_CPPFLAGS := -std=c++14
Dan Stoza01049c82014-11-11 10:32:31 -0800162
Tom Cherry74155992015-08-14 13:01:23 -0700163LOCAL_INIT_RC := surfaceflinger.rc
164
Tim Murrayac8d2392015-11-10 14:29:45 -0800165ifneq ($(ENABLE_CPUSETS),)
166 LOCAL_CFLAGS += -DENABLE_CPUSETS
167endif
168
Dan Stoza10d3fb22016-07-27 15:05:38 -0700169ifeq ($(TARGET_USES_HWC2),true)
170 LOCAL_CFLAGS += -DUSE_HWC2
171endif
172
Dan Stoza01049c82014-11-11 10:32:31 -0800173LOCAL_SRC_FILES := \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800174 main_surfaceflinger.cpp
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700175
176LOCAL_SHARED_LIBRARIES := \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800177 libsurfaceflinger \
178 libcutils \
179 liblog \
180 libbinder \
181 libutils \
182 libdl
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700183
Dmitriy Ivanov4340a142014-10-20 14:17:26 -0700184LOCAL_WHOLE_STATIC_LIBRARIES := libsigchain
Irvelc274c632016-06-13 16:44:08 -0700185LOCAL_STATIC_LIBRARIES := libtrace_proto
Dmitriy Ivanov4340a142014-10-20 14:17:26 -0700186
Dan Stoza01049c82014-11-11 10:32:31 -0800187LOCAL_MODULE := surfaceflinger
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700188
Colin Cross89450d42014-02-20 15:36:21 -0800189ifdef TARGET_32_BIT_SURFACEFLINGER
190LOCAL_32_BIT_ONLY := true
191endif
192
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800193LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
194
Mathias Agopian7ffaa7c2013-07-22 12:20:28 -0700195include $(BUILD_EXECUTABLE)
196
197###############################################################
Keun young Park63f165f2012-08-31 10:53:36 -0700198# uses jni which may not be available in PDK
199ifneq ($(wildcard libnativehelper/include),)
200include $(CLEAR_VARS)
Mathias Agopian1b3aeb42012-10-07 16:41:12 -0700201
Dan Stoza01049c82014-11-11 10:32:31 -0800202LOCAL_CLANG := true
203
204LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
Pablo Ceballos40845df2016-01-25 17:41:15 -0800205LOCAL_CPPFLAGS := -std=c++14
Dan Stoza01049c82014-11-11 10:32:31 -0800206
207LOCAL_SRC_FILES := \
Keun young Park63f165f2012-08-31 10:53:36 -0700208 DdmConnection.cpp
209
210LOCAL_SHARED_LIBRARIES := \
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800211 libcutils \
212 liblog \
213 libdl
Keun young Park63f165f2012-08-31 10:53:36 -0700214
Dan Stoza01049c82014-11-11 10:32:31 -0800215LOCAL_MODULE := libsurfaceflinger_ddmconnection
Keun young Park63f165f2012-08-31 10:53:36 -0700216
Andreas Gampe89fd4f72014-11-13 14:18:56 -0800217LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
218
Keun young Park63f165f2012-08-31 10:53:36 -0700219include $(BUILD_SHARED_LIBRARY)
220endif # libnativehelper