Merge tag 'v3.10.90' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / gpu / mt8127 / mali / mali / Kbuild
1 #
2 # This confidential and proprietary software may be used only as
3 # authorised by a licensing agreement from ARM Limited
4 # (C) COPYRIGHT 2007-2011 ARM Limited
5 # ALL RIGHTS RESERVED
6 # The entire notice above must be reproduced on all authorised
7 # copies and copies may only be made to the extent permitted
8 # by a licensing agreement from ARM Limited.
9 #
10
11 # This file is called by the Linux build system.
12
13 # set up defaults if not defined by the user
14 #MTK port custom Kbuild
15 #To Add 1.environment variable
16 include $(src)/Kbuild-mtk-custom-env
17
18 TIMESTAMP ?= default
19 OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB ?= 16
20 USING_GPU_UTILIZATION ?= 1
21 PROFILING_SKIP_PP_JOBS ?= 0
22 PROFILING_SKIP_PP_AND_GP_JOBS ?= 0
23 MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP ?= 0
24 MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED ?= 0
25 MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS ?= 0
26 MALI_UPPER_HALF_SCHEDULING ?= 1
27 MALI_ENABLE_CPU_CYCLES ?= 0
28 #ifeq ($(FLAG_MTK_BUILD_SYS),1)
29 #DRIVER_DIR=$(MTK_PATH_PLATFORM)/drivers/gpu/mali/mali
30 #else
31 # Get path to driver source from Linux build system
32 DRIVER_DIR=$(src)
33 #endif
34
35 # For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases:
36 # The ARM proprietary product will only include the license/proprietary directory
37 # The GPL product will only include the license/gpl directory
38 #ifeq ($(wildcard $(DRIVER_DIR)/linux/license/gpl/*),)
39 # ccflags-y += -I$(DRIVER_DIR)/linux/license/proprietary
40 # ifeq ($(CONFIG_MALI400_PROFILING),y)
41 # $(error Profiling is incompatible with non-GPL license)
42 # endif
43 # ifeq ($(CONFIG_PM_RUNTIME),y)
44 # $(error Runtime PM is incompatible with non-GPL license)
45 # endif
46 # ifeq ($(CONFIG_DMA_SHARED_BUFFER),y)
47 # $(error DMA-BUF is incompatible with non-GPL license)
48 # endif
49 # $(error Linux Device integration is incompatible with non-GPL license)
50 #else
51 ccflags-y += -I$(DRIVER_DIR)/linux/license/gpl
52 #endif
53
54 mali-y += \
55 linux/mali_osk_atomics.o \
56 linux/mali_osk_irq.o \
57 linux/mali_osk_wq.o \
58 linux/mali_osk_locks.o \
59 linux/mali_osk_wait_queue.o \
60 linux/mali_osk_low_level_mem.o \
61 linux/mali_osk_math.o \
62 linux/mali_osk_memory.o \
63 linux/mali_osk_misc.o \
64 linux/mali_osk_mali.o \
65 linux/mali_osk_notification.o \
66 linux/mali_osk_time.o \
67 linux/mali_osk_timers.o
68
69 mali-y += linux/mali_memory.o linux/mali_memory_os_alloc.o
70 mali-y += linux/mali_memory_external.o
71 mali-y += linux/mali_memory_block_alloc.o
72
73 mali-y += \
74 linux/mali_ukk_mem.o \
75 linux/mali_ukk_gp.o \
76 linux/mali_ukk_pp.o \
77 linux/mali_ukk_core.o \
78 linux/mali_ukk_soft_job.o \
79 linux/mali_ukk_timeline.o
80
81 # Source files which always are included in a build
82 mali-y += \
83 common/mali_kernel_core.o \
84 linux/mali_kernel_linux.o \
85 common/mali_kernel_descriptor_mapping.o \
86 common/mali_session.o \
87 linux/mali_device_pause_resume.o \
88 common/mali_kernel_vsync.o \
89 linux/mali_ukk_vsync.o \
90 linux/mali_kernel_sysfs.o \
91 common/mali_mmu.o \
92 common/mali_mmu_page_directory.o \
93 common/mali_mem_validation.o \
94 common/mali_hw_core.o \
95 common/mali_gp.o \
96 common/mali_pp.o \
97 common/mali_pp_job.o \
98 common/mali_gp_job.o \
99 common/mali_soft_job.o \
100 common/mali_scheduler.o \
101 common/mali_gp_scheduler.o \
102 common/mali_pp_scheduler.o \
103 common/mali_group.o \
104 common/mali_dlbu.o \
105 common/mali_broadcast.o \
106 common/mali_pm.o \
107 common/mali_pmu.o \
108 common/mali_user_settings_db.o \
109 common/mali_kernel_utilization.o \
110 common/mali_l2_cache.o \
111 common/mali_dma.o \
112 common/mali_timeline.o \
113 common/mali_timeline_fence_wait.o \
114 common/mali_timeline_sync_fence.o \
115 common/mali_spinlock_reentrant.o \
116 common/mali_pm_domain.o \
117 linux/mali_osk_pm.o \
118 linux/mali_pmu_power_up_down.o \
119 __malidrv_build_info.o
120
121 mali-y += platform/platform.o
122 mali-y += platform/platform_pmm.o
123 #mali-$(CONFIG_MTK_MET) += platform/platform_met.o
124
125 ifneq ($(MALI_PLATFORM_FILES),)
126 mali-y += $(MALI_PLATFORM_FILES:.c=.o)
127 endif
128
129 mali-$(CONFIG_MALI400_PROFILING) += linux/mali_ukk_profiling.o
130 mali-$(CONFIG_MALI400_PROFILING) += linux/mali_osk_profiling.o
131
132 mali-$(CONFIG_MALI400_INTERNAL_PROFILING) += linux/mali_profiling_internal.o timestamp-$(TIMESTAMP)/mali_timestamp.o
133 ccflags-$(CONFIG_MALI400_INTERNAL_PROFILING) += -I$(DRIVER_DIR)/timestamp-$(TIMESTAMP)
134
135 mali-$(CONFIG_DMA_SHARED_BUFFER) += linux/mali_memory_dma_buf.o
136 mali-$(CONFIG_SYNC) += linux/mali_sync.o
137
138 mali-$(CONFIG_MALI400_UMP) += linux/mali_memory_ump.o
139
140 mali-$(CONFIG_MALI400_POWER_PERFORMANCE_POLICY) += common/mali_power_performance_policy.o
141
142 # Tell the Linux build system from which .o file to create the kernel module
143 obj-$(CONFIG_MALI400) := mali.o
144
145 ccflags-y += $(EXTRA_DEFINES)
146
147 # Set up our defines, which will be passed to gcc
148 ccflags-y += -DPROFILING_SKIP_PP_JOBS=$(PROFILING_SKIP_PP_JOBS)
149 ccflags-y += -DPROFILING_SKIP_PP_AND_GP_JOBS=$(PROFILING_SKIP_PP_AND_GP_JOBS)
150
151 ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP)
152 ccflags-y += -DMALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED=$(MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED)
153 ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS)
154 ccflags-y += -DMALI_STATE_TRACKING=1
155 ccflags-y += -DMALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
156 ccflags-y += -DUSING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
157 ccflags-y += -DMALI_ENABLE_CPU_CYCLES=$(MALI_ENABLE_CPU_CYCLES)
158
159 ifeq ($(MALI_UPPER_HALF_SCHEDULING),1)
160 ccflags-y += -DMALI_UPPER_HALF_SCHEDULING
161 endif
162
163 ccflags-$(CONFIG_MALI400_UMP) += -I$(DRIVER_DIR)/../../ump/include/ump
164 ccflags-$(CONFIG_MALI400_DEBUG) += -DDEBUG
165
166 # Use our defines when compiling
167 ccflags-y += -I$(DRIVER_DIR) -I$(DRIVER_DIR)/include -I$(DRIVER_DIR)/common -I$(DRIVER_DIR)/linux -I$(DRIVER_DIR)/platform
168
169 # Get subversion revision number, fall back to only ${MALI_RELEASE_NAME} if no svn info is available
170 MALI_RELEASE_NAME=$(shell cat $(DRIVER_DIR)/.version 2> /dev/null)
171
172 SVN_INFO = (cd $(DRIVER_DIR); svn info 2>/dev/null)
173
174 ifneq ($(shell $(SVN_INFO) 2>/dev/null),)
175 # SVN detected
176 SVN_REV := $(shell $(SVN_INFO) | grep '^Revision: '| sed -e 's/^Revision: //' 2>/dev/null)
177 DRIVER_REV := $(MALI_RELEASE_NAME)-r$(SVN_REV)
178 CHANGE_DATE := $(shell $(SVN_INFO) | grep '^Last Changed Date: ' | cut -d: -f2- | cut -b2-)
179 CHANGED_REVISION := $(shell $(SVN_INFO) | grep '^Last Changed Rev: ' | cut -d: -f2- | cut -b2-)
180 REPO_URL := $(shell $(SVN_INFO) | grep '^URL: ' | cut -d: -f2- | cut -b2-)
181
182 else # SVN
183 GIT_REV := $(shell cd $(DRIVER_DIR); git describe --always 2>/dev/null)
184 ifneq ($(GIT_REV),)
185 # Git detected
186 DRIVER_REV := $(MALI_RELEASE_NAME)-$(GIT_REV)
187 CHANGE_DATE := $(shell cd $(DRIVER_DIR); git log -1 --format="%ci")
188 CHANGED_REVISION := $(GIT_REV)
189 REPO_URL := $(shell cd $(DRIVER_DIR); git describe --all --always 2>/dev/null)
190
191 else # Git
192 # No Git or SVN detected
193 DRIVER_REV := $(MALI_RELEASE_NAME)
194 CHANGE_DATE := $(MALI_RELEASE_NAME)
195 CHANGED_REVISION := $(MALI_RELEASE_NAME)
196 endif
197 endif
198
199 ccflags-y += -DSVN_REV_STRING=\"$(DRIVER_REV)\"
200
201 #Add staging include for android ..
202 ccflags-y += -I$(srctree)/drivers/staging/android
203
204 VERSION_STRINGS :=
205 VERSION_STRINGS += API_VERSION=$(shell cd $(DRIVER_DIR); grep "\#define _MALI_API_VERSION" $(FILES_PREFIX)include/linux/mali/mali_utgard_uk_types.h | cut -d' ' -f 3 )
206 VERSION_STRINGS += REPO_URL=$(REPO_URL)
207 VERSION_STRINGS += REVISION=$(DRIVER_REV)
208 VERSION_STRINGS += CHANGED_REVISION=$(CHANGED_REVISION)
209 VERSION_STRINGS += CHANGE_DATE=$(CHANGE_DATE)
210 VERSION_STRINGS += BUILD_DATE=$(shell date)
211 ifdef CONFIG_MALI400_DEBUG
212 VERSION_STRINGS += BUILD=debug
213 else
214 VERSION_STRINGS += BUILD=release
215 endif
216 VERSION_STRINGS += TARGET_PLATFORM=$(TARGET_PLATFORM)
217 VERSION_STRINGS += MALI_PLATFORM=$(MALI_PLATFORM)
218 VERSION_STRINGS += KDIR=$(KDIR)
219 VERSION_STRINGS += OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
220 VERSION_STRINGS += USING_UMP=$(CONFIG_MALI400_UMP)
221 VERSION_STRINGS += USING_PROFILING=$(CONFIG_MALI400_PROFILING)
222 VERSION_STRINGS += USING_INTERNAL_PROFILING=$(CONFIG_MALI400_INTERNAL_PROFILING)
223 VERSION_STRINGS += USING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
224 VERSION_STRINGS += USING_POWER_PERFORMANCE_POLICY=$(CONFIG_POWER_PERFORMANCE_POLICY)
225 VERSION_STRINGS += MALI_UPPER_HALF_SCHEDULING=$(MALI_UPPER_HALF_SCHEDULING)
226
227
228
229 #MTK port custom Kbuild
230 #To Add 1.ccflags-y 2.SRC
231 include $(DRIVER_DIR)/Kbuild-mtk-custom-src
232 ifeq ($(FLAG_MTK_BUILD_SYS),1)
233 # Create file with Mali driver configuration
234 $(src)/__malidrv_build_info.c:
235 @echo 'const char *__malidrv_build_info(void) { return "malidrv: $(VERSION_STRINGS)";}' > $(src)/__malidrv_build_info.c
236 else
237 # Create file with Mali driver configuration
238 $(DRIVER_DIR)/__malidrv_build_info.c:
239 @echo 'const char *__malidrv_build_info(void) { return "malidrv: $(VERSION_STRINGS)";}' > $(DRIVER_DIR)/__malidrv_build_info.c
240 endif