summaryrefslogtreecommitdiff
path: root/drivers/gpu/mali/mali/Kbuild
blob: 70e090656a950da7d0056f9b91d0808332036ab9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#
# Copyright (C) 2010-2011 ARM Limited. All rights reserved.
# 
# This program is free software and is provided to you under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
# 
# A copy of the licence is included with the program, and can also be obtained from Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#

# This file is called by the Linux build system.

# set up defaults if not defined by the user
TIMESTAMP ?= default
OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB ?= 16
USING_GPU_UTILIZATION ?= 1
MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP ?= 0
MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED ?= 0
MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS ?= 0
MALI_UPPER_HALF_SCHEDULING ?= 1
MALI_ENABLE_CPU_CYCLES ?= 0

# For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases:
# The ARM proprietary product will only include the license/proprietary directory
# The GPL product will only include the license/gpl directory
ifeq ($(wildcard $(src)/linux/license/gpl/*),)
    ccflags-y += -I$(src)/linux/license/proprietary
    ifeq ($(CONFIG_MALI400_PROFILING),y)
        $(error Profiling is incompatible with non-GPL license)
    endif
    ifeq ($(CONFIG_PM_RUNTIME),y)
        $(error Runtime PM is incompatible with non-GPL license)
    endif
    ifeq ($(CONFIG_DMA_SHARED_BUFFER),y)
        $(error DMA-BUF is incompatible with non-GPL license)
    endif
    $(error Linux Device integration is incompatible with non-GPL license)
else
    ccflags-y += -I$(src)/linux/license/gpl
endif

mali-y += \
	linux/mali_osk_atomics.o \
	linux/mali_osk_irq.o \
	linux/mali_osk_wq.o \
	linux/mali_osk_locks.o \
	linux/mali_osk_wait_queue.o \
	linux/mali_osk_low_level_mem.o \
	linux/mali_osk_math.o \
	linux/mali_osk_memory.o \
	linux/mali_osk_misc.o \
	linux/mali_osk_mali.o \
	linux/mali_osk_notification.o \
	linux/mali_osk_time.o \
	linux/mali_osk_timers.o

mali-y += linux/mali_memory.o linux/mali_memory_os_alloc.o
mali-y += linux/mali_memory_external.o
mali-y += linux/mali_memory_block_alloc.o

mali-y += \
	linux/mali_ukk_mem.o \
	linux/mali_ukk_gp.o \
	linux/mali_ukk_pp.o \
	linux/mali_ukk_core.o \
	linux/mali_ukk_soft_job.o \
	linux/mali_ukk_timeline.o

# Source files which always are included in a build
mali-y += \
	common/mali_kernel_core.o \
	linux/mali_kernel_linux.o \
	common/mali_kernel_descriptor_mapping.o \
	common/mali_session.o \
	linux/mali_device_pause_resume.o \
	common/mali_kernel_vsync.o \
	linux/mali_ukk_vsync.o \
	linux/mali_kernel_sysfs.o \
	common/mali_mmu.o \
	common/mali_mmu_page_directory.o \
	common/mali_mem_validation.o \
	common/mali_hw_core.o \
	common/mali_gp.o \
	common/mali_pp.o \
	common/mali_pp_job.o \
	common/mali_gp_job.o \
	common/mali_soft_job.o \
	common/mali_scheduler.o \
	common/mali_gp_scheduler.o \
	common/mali_pp_scheduler.o \
	common/mali_group.o \
	common/mali_dlbu.o \
	common/mali_broadcast.o \
	common/mali_pm.o \
	common/mali_pmu.o \
	common/mali_user_settings_db.o \
	common/mali_kernel_utilization.o \
	common/mali_l2_cache.o \
	common/mali_dma.o \
	common/mali_timeline.o \
	common/mali_timeline_fence_wait.o \
	common/mali_timeline_sync_fence.o \
	common/mali_spinlock_reentrant.o \
	common/mali_pm_domain.o \
	linux/mali_osk_pm.o \
	linux/mali_pmu_power_up_down.o \
	__malidrv_build_info.o

ifneq ($(MALI_PLATFORM_FILES),)
	mali-y += $(MALI_PLATFORM_FILES:.c=.o)
endif

mali-$(CONFIG_MALI400_PROFILING) += linux/mali_ukk_profiling.o
mali-$(CONFIG_MALI400_PROFILING) += linux/mali_osk_profiling.o

mali-$(CONFIG_MALI400_INTERNAL_PROFILING) += linux/mali_profiling_internal.o timestamp-$(TIMESTAMP)/mali_timestamp.o
ccflags-$(CONFIG_MALI400_INTERNAL_PROFILING) += -I$(src)/timestamp-$(TIMESTAMP)

mali-$(CONFIG_DMA_SHARED_BUFFER) += linux/mali_memory_dma_buf.o
mali-$(CONFIG_SYNC) += linux/mali_sync.o
ccflags-$(CONFIG_SYNC) += -Idrivers/staging/android

mali-$(CONFIG_MALI400_UMP) += linux/mali_memory_ump.o

mali-$(CONFIG_MALI400_POWER_PERFORMANCE_POLICY) += common/mali_power_performance_policy.o

# Tell the Linux build system from which .o file to create the kernel module
obj-$(CONFIG_MALI400) := mali.o

ccflags-y += $(EXTRA_DEFINES)

# Set up our defines, which will be passed to gcc
ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP)
ccflags-y += -DMALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED=$(MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED)
ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS)
ccflags-y += -DMALI_STATE_TRACKING=1
ccflags-y += -DMALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
ccflags-y += -DUSING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
ccflags-y += -DMALI_ENABLE_CPU_CYCLES=$(MALI_ENABLE_CPU_CYCLES)

ifeq ($(MALI_UPPER_HALF_SCHEDULING),1)
	ccflags-y += -DMALI_UPPER_HALF_SCHEDULING
endif

ccflags-$(CONFIG_MALI400_UMP) += -I$(src)/../../ump/include/ump
ccflags-$(CONFIG_MALI400_DEBUG) += -DDEBUG

# Use our defines when compiling
ccflags-y += -I$(src) -I$(src)/include -I$(src)/common -I$(src)/linux -I$(src)/platform

# Get subversion revision number, fall back to only ${MALI_RELEASE_NAME} if no svn info is available
MALI_RELEASE_NAME=$(shell cat $(src)/.version 2> /dev/null)

SVN_INFO = (cd $(src); svn info 2>/dev/null)

ifneq ($(shell $(SVN_INFO) 2>/dev/null),)
# SVN detected
SVN_REV := $(shell $(SVN_INFO) | grep '^Revision: '| sed -e 's/^Revision: //' 2>/dev/null)
DRIVER_REV := $(MALI_RELEASE_NAME)-r$(SVN_REV)
CHANGE_DATE := $(shell $(SVN_INFO) | grep '^Last Changed Date: ' | cut -d: -f2- | cut -b2-)
CHANGED_REVISION := $(shell $(SVN_INFO) | grep '^Last Changed Rev: ' | cut -d: -f2- | cut -b2-)
REPO_URL := $(shell $(SVN_INFO) | grep '^URL: ' | cut -d: -f2- | cut -b2-)

else # SVN
GIT_REV := $(shell cd $(src); git describe --always 2>/dev/null)
ifneq ($(GIT_REV),)
# Git detected
DRIVER_REV := $(MALI_RELEASE_NAME)-$(GIT_REV)
CHANGE_DATE := $(shell cd $(src); git log -1 --format="%ci")
CHANGED_REVISION := $(GIT_REV)
REPO_URL := $(shell cd $(src); git describe --all --always 2>/dev/null)

else # Git
# No Git or SVN detected
DRIVER_REV := $(MALI_RELEASE_NAME)
CHANGE_DATE := $(MALI_RELEASE_NAME)
CHANGED_REVISION := $(MALI_RELEASE_NAME)
endif
endif

ccflags-y += -DSVN_REV_STRING=\"$(DRIVER_REV)\"

VERSION_STRINGS :=
VERSION_STRINGS += API_VERSION=$(shell cd $(src); grep "\#define _MALI_API_VERSION" $(FILES_PREFIX)include/linux/mali/mali_utgard_uk_types.h | cut -d' ' -f 3 )
VERSION_STRINGS += REPO_URL=$(REPO_URL)
VERSION_STRINGS += REVISION=$(DRIVER_REV)
VERSION_STRINGS += CHANGED_REVISION=$(CHANGED_REVISION)
VERSION_STRINGS += CHANGE_DATE=$(CHANGE_DATE)
VERSION_STRINGS += BUILD_DATE=$(shell date)
ifdef CONFIG_MALI400_DEBUG
VERSION_STRINGS += BUILD=debug
else
VERSION_STRINGS += BUILD=release
endif
VERSION_STRINGS += TARGET_PLATFORM=$(TARGET_PLATFORM)
VERSION_STRINGS += MALI_PLATFORM=$(MALI_PLATFORM)
VERSION_STRINGS += KDIR=$(KDIR)
VERSION_STRINGS += OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
VERSION_STRINGS += USING_UMP=$(CONFIG_MALI400_UMP)
VERSION_STRINGS += USING_PROFILING=$(CONFIG_MALI400_PROFILING)
VERSION_STRINGS += USING_INTERNAL_PROFILING=$(CONFIG_MALI400_INTERNAL_PROFILING)
VERSION_STRINGS += USING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
VERSION_STRINGS += USING_POWER_PERFORMANCE_POLICY=$(CONFIG_POWER_PERFORMANCE_POLICY)
VERSION_STRINGS += MALI_UPPER_HALF_SCHEDULING=$(MALI_UPPER_HALF_SCHEDULING)

# Create file with Mali driver configuration
$(src)/__malidrv_build_info.c:
	@echo 'const char *__malidrv_build_info(void) { return "malidrv: $(VERSION_STRINGS)";}' > $(src)/__malidrv_build_info.c