]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/mxc/gpu-viv/Kbuild
2b277d6f4ee75701e5464f6c1d19afb8f2635c9f
[karo-tx-linux.git] / drivers / mxc / gpu-viv / Kbuild
1 ##############################################################################
2 #
3 #    Copyright (C) 2005 - 2013 by Vivante Corp.
4 #
5 #    This program is free software; you can redistribute it and/or modify
6 #    it under the terms of the GNU General Public License as published by
7 #    the Free Software Foundation; either version 2 of the license, or
8 #    (at your option) any later version.
9 #
10 #    This program is distributed in the hope that it will be useful,
11 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #    GNU General Public License for more details.
14 #
15 #    You should have received a copy of the GNU General Public License
16 #    along with this program; if not write to the Free Software
17 #    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 #
19 ##############################################################################
20
21
22 #
23 # Linux build file for kernel HAL driver.
24 #
25
26 AQROOT := $(srctree)/drivers/mxc/gpu-viv
27 AQARCH := $(AQROOT)/arch/XAQ2
28 AQVGARCH := $(AQROOT)/arch/GC350
29
30 include $(AQROOT)/config
31
32 KERNEL_DIR ?= $(TOOL_DIR)/kernel
33
34 OS_KERNEL_DIR   := hal/os/linux/kernel
35 ARCH_KERNEL_DIR := arch/$(notdir $(AQARCH))/hal/kernel
36 ARCH_VG_KERNEL_DIR := arch/$(notdir $(AQVGARCH))/hal/kernel
37 HAL_KERNEL_DIR  := hal/kernel
38
39 EXTRA_CFLAGS += -Werror
40
41 OBJS := $(OS_KERNEL_DIR)/gc_hal_kernel_device.o \
42         $(OS_KERNEL_DIR)/gc_hal_kernel_driver.o \
43         $(OS_KERNEL_DIR)/gc_hal_kernel_linux.o \
44         $(OS_KERNEL_DIR)/gc_hal_kernel_math.o \
45         $(OS_KERNEL_DIR)/gc_hal_kernel_os.o \
46         $(OS_KERNEL_DIR)/gc_hal_kernel_debugfs.o
47
48 OBJS += $(HAL_KERNEL_DIR)/gc_hal_kernel.o \
49         $(HAL_KERNEL_DIR)/gc_hal_kernel_command.o \
50         $(HAL_KERNEL_DIR)/gc_hal_kernel_db.o \
51         $(HAL_KERNEL_DIR)/gc_hal_kernel_debug.o \
52         $(HAL_KERNEL_DIR)/gc_hal_kernel_event.o \
53         $(HAL_KERNEL_DIR)/gc_hal_kernel_heap.o \
54         $(HAL_KERNEL_DIR)/gc_hal_kernel_mmu.o \
55         $(HAL_KERNEL_DIR)/gc_hal_kernel_video_memory.o \
56         $(HAL_KERNEL_DIR)/gc_hal_kernel_power.o
57
58 OBJS += $(ARCH_KERNEL_DIR)/gc_hal_kernel_context.o \
59         $(ARCH_KERNEL_DIR)/gc_hal_kernel_hardware.o
60
61 ifeq ($(VIVANTE_ENABLE_VG), 1)
62 OBJS +=\
63           $(HAL_KERNEL_DIR)/gc_hal_kernel_vg.o\
64           $(HAL_KERNEL_DIR)/gc_hal_kernel_command_vg.o\
65           $(HAL_KERNEL_DIR)/gc_hal_kernel_interrupt_vg.o\
66           $(HAL_KERNEL_DIR)/gc_hal_kernel_mmu_vg.o\
67           $(ARCH_VG_KERNEL_DIR)/gc_hal_kernel_hardware_command_vg.o\
68           $(ARCH_VG_KERNEL_DIR)/gc_hal_kernel_hardware_vg.o
69 endif
70
71 ifneq ($(CONFIG_SYNC),)
72 OBJS += $(OS_KERNEL_DIR)/gc_hal_kernel_sync.o
73 endif
74
75 ifeq ($(KERNELRELEASE), )
76
77 .PHONY: all clean install
78
79 # Define targets.
80 all:
81         @make V=$(V) ARCH=$(ARCH_TYPE) -C $(KERNEL_DIR) SUBDIRS=`pwd` modules
82
83 clean:
84         @rm -rf $(OBJS)
85         @rm -rf modules.order Module.symvers
86         @find $(AQROOT) -name ".gc_*.cmd" | xargs rm -f
87
88 install: all
89         @mkdir -p $(SDK_DIR)/drivers
90
91 else
92
93
94 EXTRA_CFLAGS += -DLINUX -DDRIVER
95
96 ifeq ($(ENUM_WORKAROUND), 1)
97 EXTRA_CFLAGS += -DENUM_WORKAROUND=1
98 else
99 EXTRA_CFLAGS += -DENUM_WORKAROUND=0
100 endif
101
102 ifeq ($(FLAREON),1)
103 EXTRA_CFLAGS += -DFLAREON
104 endif
105
106 ifeq ($(DEBUG), 1)
107 EXTRA_CFLAGS += -DDBG=1 -DDEBUG -D_DEBUG
108 else
109 EXTRA_CFLAGS += -DDBG=0
110 endif
111
112 ifeq ($(NO_DMA_COHERENT), 1)
113 EXTRA_CFLAGS += -DNO_DMA_COHERENT
114 endif
115
116 ifeq ($(CONFIG_DOVE_GPU), 1)
117 EXTRA_CFLAGS += -DCONFIG_DOVE_GPU=1
118 endif
119
120 ifneq ($(USE_PLATFORM_DRIVER), 0)
121 EXTRA_CFLAGS += -DUSE_PLATFORM_DRIVER=1
122 else
123 EXTRA_CFLAGS += -DUSE_PLATFORM_DRIVER=0
124 endif
125
126
127 EXTRA_CFLAGS += -DVIVANTE_PROFILER=1
128 EXTRA_CFLAGS += -DVIVANTE_PROFILER_CONTEXT=1
129
130
131 ifeq ($(ANDROID), 1)
132 EXTRA_CFLAGS += -DANDROID=1
133 endif
134
135 ifeq ($(ENABLE_GPU_CLOCK_BY_DRIVER), 1)
136 EXTRA_CFLAGS += -DENABLE_GPU_CLOCK_BY_DRIVER=1
137 else
138 EXTRA_CFLAGS += -DENABLE_GPU_CLOCK_BY_DRIVER=0
139 endif
140
141 ifeq ($(USE_NEW_LINUX_SIGNAL), 1)
142 EXTRA_CFLAGS += -DUSE_NEW_LINUX_SIGNAL=1
143 else
144 EXTRA_CFLAGS += -DUSE_NEW_LINUX_SIGNAL=0
145 endif
146
147 ifeq ($(NO_USER_DIRECT_ACCESS_FROM_KERNEL), 1)
148 EXTRA_CFLAGS += -DNO_USER_DIRECT_ACCESS_FROM_KERNEL=1
149 else
150 EXTRA_CFLAGS += -DNO_USER_DIRECT_ACCESS_FROM_KERNEL=0
151 endif
152
153 ifeq ($(FORCE_ALL_VIDEO_MEMORY_CACHED), 1)
154 EXTRA_CFLAGS += -DgcdPAGED_MEMORY_CACHEABLE=1
155 else
156 EXTRA_CFLAGS += -DgcdPAGED_MEMORY_CACHEABLE=0
157 endif
158
159 ifeq ($(NONPAGED_MEMORY_CACHEABLE), 1)
160 EXTRA_CFLAGS += -DgcdNONPAGED_MEMORY_CACHEABLE=1
161 else
162 EXTRA_CFLAGS += -DgcdNONPAGED_MEMORY_CACHEABLE=0
163 endif
164
165 ifeq ($(NONPAGED_MEMORY_BUFFERABLE), 1)
166 EXTRA_CFLAGS += -DgcdNONPAGED_MEMORY_BUFFERABLE=1
167 else
168 EXTRA_CFLAGS += -DgcdNONPAGED_MEMORY_BUFFERABLE=0
169 endif
170
171 ifeq ($(CACHE_FUNCTION_UNIMPLEMENTED), 1)
172 EXTRA_CFLAGS += -DgcdCACHE_FUNCTION_UNIMPLEMENTED=1
173 else
174 EXTRA_CFLAGS += -DgcdCACHE_FUNCTION_UNIMPLEMENTED=0
175 endif
176
177 ifeq ($(SUPPORT_SWAP_RECTANGLE), 1)
178 EXTRA_CFLAGS += -DgcdSUPPORT_SWAP_RECTANGLE=1
179 else
180 EXTRA_CFLAGS += -DgcdSUPPORT_SWAP_RECTANGLE=0
181 endif
182
183 ifeq ($(VIVANTE_ENABLE_VG), 1)
184 EXTRA_CFLAGS += -DgcdENABLE_VG=1
185 else
186 EXTRA_CFLAGS += -DgcdENABLE_VG=0
187 endif
188
189 ifeq ($(CONFIG_SMP), y)
190 EXTRA_CFLAGS += -DgcdSMP=1
191 else
192 EXTRA_CFLAGS += -DgcdSMP=0
193 endif
194
195 ifeq ($(VIVANTE_NO_3D),1)
196 EXTRA_CFLAGS += -DVIVANTE_NO_3D
197 endif
198
199 ifeq ($(ENABLE_OUTER_CACHE_PATCH), 1)
200 EXTRA_CFLAGS += -DgcdENABLE_OUTER_CACHE_PATCH=1
201 else
202 EXTRA_CFLAGS += -DgcdENABLE_OUTER_CACHE_PATCH=0
203 endif
204
205 ifeq ($(USE_BANK_ALIGNMENT), 1)
206     EXTRA_CFLAGS += -DgcdENABLE_BANK_ALIGNMENT=1
207     ifneq ($(BANK_BIT_START), 0)
208                 ifneq ($(BANK_BIT_END), 0)
209                     EXTRA_CFLAGS += -DgcdBANK_BIT_START=$(BANK_BIT_START)
210                     EXTRA_CFLAGS += -DgcdBANK_BIT_END=$(BANK_BIT_END)
211                 endif
212     endif
213
214     ifneq ($(BANK_CHANNEL_BIT), 0)
215         EXTRA_CFLAGS += -DgcdBANK_CHANNEL_BIT=$(BANK_CHANNEL_BIT)
216     endif
217 endif
218
219 ifneq ($(CONFIG_SYNC),)
220 EXTRA_CFLAGS += -DgcdANDROID_NATIVE_FENCE_SYNC=1
221 endif
222
223 EXTRA_CFLAGS += -I$(AQROOT)/hal/kernel/inc
224 EXTRA_CFLAGS += -I$(AQROOT)/hal/kernel
225 EXTRA_CFLAGS += -I$(AQARCH)/hal/kernel
226 EXTRA_CFLAGS += -I$(AQROOT)/hal/os/linux/kernel
227
228 ifeq ($(VIVANTE_ENABLE_VG), 1)
229 EXTRA_CFLAGS += -I$(AQVGARCH)/hal/kernel
230 endif
231
232 obj-$(CONFIG_MXC_GPU_VIV) += galcore.o
233
234 galcore-objs  := $(OBJS)
235
236 endif