RK3368 GPU version Rogue M 1.28
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue_m / build / linux / config / core.mk
1 ########################################################################### ###
2 #@File
3 #@Title         Root build configuration.
4 #@Copyright     Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 #@License       Dual MIT/GPLv2
6
7 # The contents of this file are subject to the MIT license as set out below.
8
9 # Permission is hereby granted, free of charge, to any person obtaining a copy
10 # of this software and associated documentation files (the "Software"), to deal
11 # in the Software without restriction, including without limitation the rights
12 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 # copies of the Software, and to permit persons to whom the Software is
14 # furnished to do so, subject to the following conditions:
15
16 # The above copyright notice and this permission notice shall be included in
17 # all copies or substantial portions of the Software.
18
19 # Alternatively, the contents of this file may be used under the terms of
20 # the GNU General Public License Version 2 ("GPL") in which case the provisions
21 # of GPL are applicable instead of those above.
22
23 # If you wish to allow use of your version of this file only under the terms of
24 # GPL, and not to allow others to use your version of this file under the terms
25 # of the MIT license, indicate your decision by deleting the provisions above
26 # and replace them with the notice and other provisions required by GPL as set
27 # out in the file called "GPL-COPYING" included in this distribution. If you do
28 # not delete the provisions above, a recipient may use your version of this file
29 # under the terms of either the MIT license or GPL.
30
31 # This License is also included in this distribution in the file called
32 # "MIT-COPYING".
33
34 # EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
35 # PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
36 # BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37 # PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
38 # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
39 # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
40 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 ### ###########################################################################
42
43 # Configuration wrapper for new build system. This file deals with
44 # configuration of the build. Add to this file anything that deals
45 # with switching driver options on/off and altering the defines or
46 # objects the build uses.
47 #
48 # At the end of this file is an exhaustive list of all variables
49 # that are passed between the platform/config stage and the generic
50 # build. PLEASE refrain from adding more variables than necessary
51 # to this stage -- almost all options can go through config.h.
52 #
53
54 # Sanity check: Make sure preconfig has been included
55 ifeq ($(TOP),)
56 $(error TOP not defined: Was preconfig.mk included in root makefile?)
57 endif
58
59 ################################# MACROS ####################################
60
61 ALL_TUNABLE_OPTIONS :=
62
63 # This records the config option's help text and default value. Note that
64 # the help text can't contain a literal comma. Use $(comma) instead.
65 define RegisterOptionHelp
66 ALL_TUNABLE_OPTIONS += $(1)
67 ifeq ($(INTERNAL_DESCRIPTION_FOR_$(1)),)
68 INTERNAL_DESCRIPTION_FOR_$(1) := $(3)
69 endif
70 INTERNAL_CONFIG_DEFAULT_FOR_$(1) := $(2)
71 $(if $(4),\
72         $(error Too many arguments in config option '$(1)' (stray comma in help text?)))
73 endef
74
75 # Write out a kernel GNU make option.
76 #
77 define KernelConfigMake
78 $$(shell echo "override $(1) := $(2)" >>$(CONFIG_KERNEL_MK).new)
79 $(if $(filter config,$(D)),$(info KernelConfigMake $(1) := $(2)         # $(if $($(1)),$(origin $(1)),default)))
80 endef
81
82 # Write out a GNU make option for both user & kernel
83 #
84 define BothConfigMake
85 $$(eval $$(call KernelConfigMake,$(1),$(2)))
86 $$(eval $$(call UserConfigMake,$(1),$(2)))
87 endef
88
89 # Conditionally write out a kernel GNU make option
90 #
91 define _TunableKernelConfigMake
92 ifneq ($$($(1)),)
93 ifneq ($$($(1)),0)
94 $$(eval $$(call KernelConfigMake,$(1),$$($(1))))
95 endif
96 else
97 ifneq ($(2),)
98 $$(eval $$(call KernelConfigMake,$(1),$(2)))
99 endif
100 endif
101 endef
102
103 define TunableKernelConfigMake
104 $$(eval $$(call _TunableKernelConfigMake,$(1),$(2)))
105 $(call RegisterOptionHelp,$(1),$(2),$(3),$(4))
106 endef
107
108 # Conditionally write out a GNU make option for both user & kernel
109 #
110 define TunableBothConfigMake
111 $$(eval $$(call _TunableKernelConfigMake,$(1),$(2)))
112 $$(eval $$(call _TunableUserConfigMake,$(1),$(2)))
113 $(call RegisterOptionHelp,$(1),$(2),$(3),$(4))
114 endef
115
116 # Write out a kernel-only option
117 #
118 define KernelConfigC
119 $$(shell echo "#define $(1) $(2)" >>$(CONFIG_KERNEL_H).new)
120 $(if $(filter config,$(D)),$(info KernelConfigC    #define $(1) $(2)    /* $(if $($(1)),$(origin $(1)),default) */),)
121 endef
122
123 # Write out an option for both user & kernel
124 #
125 define BothConfigC
126 $$(eval $$(call KernelConfigC,$(1),$(2)))
127 $$(eval $$(call UserConfigC,$(1),$(2)))
128 endef
129
130 # Conditionally write out a kernel-only option
131 #
132 define _TunableKernelConfigC
133 ifneq ($$($(1)),)
134 ifneq ($$($(1)),0)
135 ifeq ($$($(1)),1)
136 $$(eval $$(call KernelConfigC,$(1),))
137 else
138 $$(eval $$(call KernelConfigC,$(1),$$($(1))))
139 endif
140 endif
141 else
142 ifneq ($(2),)
143 ifeq ($(2),1)
144 $$(eval $$(call KernelConfigC,$(1),))
145 else
146 $$(eval $$(call KernelConfigC,$(1),$(2)))
147 endif
148 endif
149 endif
150 endef
151
152 define TunableKernelConfigC
153 $$(eval $$(call _TunableKernelConfigC,$(1),$(2)))
154 ALL_TUNABLE_OPTIONS += $(1)
155 ifeq ($(INTERNAL_DESCRIPTION_FOR_$(1)),)
156 INTERNAL_DESCRIPTION_FOR_$(1) := $(3)
157 endif
158 INTERNAL_CONFIG_DEFAULT_FOR_$(1) := $(2)
159 endef
160
161 # Conditionally write out an option for both user & kernel
162 #
163 define TunableBothConfigC
164 $$(eval $$(call _TunableKernelConfigC,$(1),$(2)))
165 $$(eval $$(call _TunableUserConfigC,$(1),$(2)))
166 $(call RegisterOptionHelp,$(1),$(2),$(3),$(4))
167 endef
168
169 # Use this to mark config options which have to exist, but aren't
170 # user-tunable. Warn if an attempt is made to change it.
171 #
172 define NonTunableOption
173 $(if $(filter command line environment,$(origin $(1))),\
174         $(error Changing '$(1)' is not supported))
175 endef
176
177 ############################### END MACROS ##################################
178
179 # Check we have a new enough version of GNU make.
180 #
181 need := 3.81
182 ifeq ($(filter $(need),$(firstword $(sort $(MAKE_VERSION) $(need)))),)
183 $(error A version of GNU make >= $(need) is required - this is version $(MAKE_VERSION))
184 endif
185
186 # Decide whether we need a BVNC
187 ifneq ($(COMPILER_BVNC_LIST),)
188  DONT_NEED_RGX_BVNC := 1
189 endif
190
191 include ../defs.mk
192
193 # Infer PVR_BUILD_DIR from the directory configuration is launched from.
194 # Check anyway that such a directory exists.
195 #
196 PVR_BUILD_DIR := $(notdir $(abspath .))
197 $(call directory-must-exist,$(TOP)/build/linux/$(PVR_BUILD_DIR))
198
199 # Output directory for configuration, object code,
200 # final programs/libraries, and install/rc scripts.
201 #
202 BUILD        ?= release
203 ifneq ($(filter $(WINDOW_SYSTEM),xorg wayland nullws nulldrmws ews_drm nulladfws ews_adf screen),)
204 OUT          ?= $(TOP)/binary_$(PVR_BUILD_DIR)_$(WINDOW_SYSTEM)_$(BUILD)
205 else
206 OUT          ?= $(TOP)/binary_$(PVR_BUILD_DIR)_$(BUILD)
207 endif
208 override OUT := $(if $(filter /%,$(OUT)),$(OUT),$(TOP)/$(OUT))
209
210 CONFIG_MK                       := $(OUT)/config.mk
211 CONFIG_H                        := $(OUT)/config.h
212 CONFIG_KERNEL_MK        := $(OUT)/config_kernel.mk
213 CONFIG_KERNEL_H         := $(OUT)/config_kernel.h
214
215 # Convert commas to spaces in $(D). This is so you can say "make
216 # D=config-changes,freeze-config" and have $(filter config-changes,$(D))
217 # still work.
218 override D := $(subst $(comma),$(space),$(D))
219
220 # Create the OUT directory 
221 #
222 $(shell mkdir -p $(OUT))
223
224 # Some targets don't need information about any modules. If we only specify
225 # these targets on the make command line, set INTERNAL_CLOBBER_ONLY to
226 # indicate that toplevel.mk shouldn't read any makefiles
227 CLOBBER_ONLY_TARGETS := clean clobber help install
228 INTERNAL_CLOBBER_ONLY :=
229 ifneq ($(strip $(MAKECMDGOALS)),)
230 INTERNAL_CLOBBER_ONLY := \
231 $(if \
232  $(strip $(foreach _cmdgoal,$(MAKECMDGOALS),\
233           $(if $(filter $(_cmdgoal),$(CLOBBER_ONLY_TARGETS)),,x))),,true)
234 endif
235
236 # For a clobber-only build, we shouldn't regenerate any config files
237 ifneq ($(INTERNAL_CLOBBER_ONLY),true)
238
239 -include ../config/user-defs.mk
240
241 #
242 # Core handling 
243
244
245 # delete any previous intermediary files
246 $(shell \
247         for file in $(CONFIG_KERNEL_H).new $(CONFIG_KERNEL_MK).new ; do \
248                 rm -f $$file; \
249         done)
250
251 ifeq ($(DONT_NEED_RGX_BVNC),)
252  # Extract the BNC config name
253  RGX_BNC_SPLIT := $(subst .,$(space) ,$(RGX_BVNC))
254  RGX_BNC := $(word 1,$(RGX_BNC_SPLIT)).V.$(word 3,$(RGX_BNC_SPLIT)).$(word 4,$(RGX_BNC_SPLIT))
255  
256  # Check BVNC core version
257  ALL_KM_BVNCS := \
258   $(patsubst rgxcore_km_%.h,%,\
259         $(notdir $(shell ls $(TOP)/hwdefs/km/cores/rgxcore_km_*.h)))
260  ifeq ($(filter $(RGX_BVNC),$(ALL_KM_BVNCS)),)
261  $(error Error: Invalid Kernel core RGX_BVNC=$(RGX_BVNC). \
262         Valid Kernel core BVNCs: $(subst $(space),$(comma)$(space),$(ALL_KM_BVNCS)))
263  endif
264  
265  # Check if BVNC core file exist
266  RGX_BVNC_CORE_KM := $(TOP)/hwdefs/km/cores/rgxcore_km_$(RGX_BVNC).h
267  RGX_BVNC_CORE_KM_HEADER := \"cores/rgxcore_km_$(RGX_BVNC).h\" 
268  # "rgxcore_km_$(RGX_BVNC).h"
269  ifeq ($(wildcard $(RGX_BVNC_CORE_KM)),)
270  $(error The file $(RGX_BVNC_CORE_KM) does not exist. \
271         Valid BVNCs: $(ALL_KM_BVNCS))
272  endif
273  
274  # Check BNC config version
275  ALL_KM_BNCS := \
276   $(patsubst rgxconfig_km_%.h,%,\
277         $(notdir $(shell ls $(TOP)/hwdefs/km/configs/rgxconfig_km_*.h)))
278  ifeq ($(filter $(RGX_BNC),$(ALL_KM_BNCS)),)
279  $(error Error: Invalid Kernel config RGX_BNC=$(RGX_BNC). \
280         Valid Kernel config BNCs: $(subst $(space),$(comma)$(space),$(ALL_KM_BNCS)))
281  endif
282  
283  # Check if BNC config file exist
284  RGX_BNC_CONFIG_KM := $(TOP)/hwdefs/km/configs/rgxconfig_km_$(RGX_BNC).h
285  RGX_BNC_CONFIG_KM_HEADER := \"configs/rgxconfig_km_$(RGX_BNC).h\" 
286  #"rgxcore_km_$(RGX_BNC).h"
287  ifeq ($(wildcard $(RGX_BNC_CONFIG_KM)),)
288  $(error The file $(RGX_BNC_CONFIG_KM) does not exist. \
289         Valid BNCs: $(ALL_KM_BNCS))
290  endif
291 endif
292
293 # Enforced dependencies. Move this to an include.
294 #
295 SUPPORT_LINUX_USING_WORKQUEUES ?= 1
296 ifeq ($(SUPPORT_LINUX_USING_WORKQUEUES),1)
297 override PVR_LINUX_USING_WORKQUEUES := 1
298 override PVR_LINUX_MISR_USING_PRIVATE_WORKQUEUE := 1
299 override PVR_LINUX_TIMERS_USING_WORKQUEUES := 1
300 else ifeq ($(SUPPORT_LINUX_USING_SHARED_WORKQUEUES),1)
301 override PVR_LINUX_USING_WORKQUEUES := 1
302 override PVR_LINUX_MISR_USING_WORKQUEUE := 1
303 override PVR_LINUX_TIMERS_USING_SHARED_WORKQUEUE := 1
304 endif
305
306 ifeq ($(NO_HARDWARE),1)
307 override SYS_USING_INTERRUPTS := 0
308 endif
309
310 # Rather than requiring the user to have to define two variables (one quoted,
311 # one not), make PVRSRV_MODNAME a non-tunable and give it an overridable
312 # default here.
313 #
314 PVRSRV_MODNAME ?= pvrsrvkm
315
316 # Normally builds don't touch these, but we use them to influence the
317 # components list. Make sure these are defined early enough to make this
318 # possible.
319 #
320 ifeq ($(DONT_NEED_RGX_BVNC),)
321 # we can only do this stuff if we have a BVNC
322  SUPPORT_RAY_TRACING := \
323   $(shell grep -qw RGX_FEATURE_RAY_TRACING $(RGX_BNC_CONFIG_KM) && echo 1)
324
325 SUPPORT_META_DMA :=\
326   $(shell grep -qw RGX_FEATURE_META_DMA $(RGX_BNC_CONFIG_KM) && echo 1)
327 endif
328
329 # Default place for shared libraries
330 SHLIB_DESTDIR ?= /usr/lib
331
332 # Build's selected list of components.
333 # - components.mk is a per-build file that specifies the components that are
334 #   to be built
335 -include components.mk
336
337 # Set up the host and target compiler.
338 include ../config/compiler.mk
339
340 # PDUMP needs extra components
341 #
342 ifeq ($(PDUMP),1)
343 ifneq ($(COMPONENTS),)
344 COMPONENTS += pdump
345 endif
346 ifeq ($(SUPPORT_DRM),1)
347 EXTRA_PVRSRVKM_COMPONENTS += dbgdrv
348 else
349 KERNEL_COMPONENTS += dbgdrv
350 endif
351 endif
352
353 # HWPerf KM Interface example
354 #
355 ifeq ($(SUPPORT_KERNEL_HWPERF_TEST),1)
356 KERNEL_COMPONENTS += rgxhwpdrv
357 endif
358
359 # PVRGDB needs extra components
360 #
361 ifeq ($(PVRGDB),1)
362 ifneq ($(COMPONENTS),)
363 COMPONENTS += pvrdebugger pvrgdb pvrdebugipc
364 ifneq ($(filter opencl,$(COMPONENTS)),)
365 COMPONENTS += gdb_ocl_test
366 endif
367 endif
368 override SUPPORT_EXPORTING_MEMORY_CONTEXT := 1
369 endif
370
371 # RenderScript Replay needs extra components
372 ifeq ($(RSCREPLAY),1)
373 ifneq ($(COMPONENTS),)
374 COMPONENTS += librscruntime librsccompiler renderscript renderscript_sha1 rscreplay
375 endif
376 endif
377
378 $(if $(filter config,$(D)),$(info Build configuration:))
379
380 ################################# CONFIG ####################################
381
382 ifneq ($(SUPPORT_NEUTRINO_PLATFORM), 1)
383
384 # If KERNELDIR is set, write it out to the config.mk, with
385 # KERNEL_COMPONENTS and KERNEL_ID
386 #
387 ifneq ($(strip $(KERNELDIR)),)
388 PVRSRV_MODULE_BASEDIR ?= /lib/modules/$(KERNEL_ID)/extra/
389 $(eval $(call BothConfigMake,KERNELDIR,$(KERNELDIR)))
390 $(eval $(call BothConfigMake,KERNEL_ID,$(KERNEL_ID)))
391 $(eval $(call KernelConfigMake,KERNEL_COMPONENTS,$(KERNEL_COMPONENTS)))
392 $(eval $(call TunableKernelConfigMake,EXTRA_PVRSRVKM_COMPONENTS,,\
393 List of components that should be built in to pvrsrvkm.ko$(comma) rather than_\
394 forming separate kernel modules._\
395 ))
396
397 # If KERNEL_CROSS_COMPILE is set to "undef", this is magically
398 # equivalent to being unset. If it is unset, we use CROSS_COMPILE
399 # (which might also be unset). If it is set, use it directly.
400 ifneq ($(KERNEL_CROSS_COMPILE),undef)
401 KERNEL_CROSS_COMPILE ?= $(CROSS_COMPILE)
402 $(eval $(call TunableBothConfigMake,KERNEL_CROSS_COMPILE,))
403 endif
404
405 # Check the KERNELDIR has a kernel built and also check that it is
406 # not 64-bit, which we do not support.
407 KERNEL_AUTOCONF := \
408  $(strip $(wildcard $(KERNELDIR)/include/linux/autoconf.h) \
409          $(wildcard $(KERNELDIR)/include/generated/autoconf.h))
410 ifeq ($(KERNEL_AUTOCONF),)
411 $(warning autoconf.h not found in $$(KERNELDIR)/include/linux \
412 or $$(KERNELDIR)/include/generated. Check your $$(KERNELDIR) variable \
413 and kernel configuration.)
414 endif
415 else
416 $(if $(KERNEL_COMPONENTS),$(warning KERNELDIR is not set. Kernel components cannot be built))
417 endif
418
419 endif # !Neutrino
420
421 # Normally this is off for Linux, and only used by Android, but if customers
422 # are testing their display engines using NULLADFWS, they need to enable it
423 # for dmabuf support under Linux. The sync header is needed by adf_pdp.
424 #
425 SUPPORT_ION ?= 0
426 ifneq ($(SUPPORT_ION),0)
427 # Support kernels built out-of-tree with O=/other/path
428 # In those cases, KERNELDIR will be O, not the source tree.
429 ifneq ($(wildcard $(KERNELDIR)/source),)
430 KSRCDIR := $(KERNELDIR)/source
431 else
432 KSRCDIR := $(KERNELDIR)
433 endif
434 ifneq ($(wildcard $(KSRCDIR)/drivers/staging/android/ion/ion.h),)
435 # The kernel has a more recent version of ion, located in drivers/staging.
436 # Change the default header paths and the behaviour wrt sg_dma_len.
437 PVR_ANDROID_ION_HEADER := \"../drivers/staging/android/ion/ion.h\"
438 PVR_ANDROID_ION_PRIV_HEADER := \"../drivers/staging/android/ion/ion_priv.h\"
439 PVR_ANDROID_ION_USE_SG_LENGTH := 1
440 endif
441 ifneq ($(wildcard $(KSRCDIR)/drivers/staging/android/sync.h),)
442 # The kernel has a more recent version of the sync driver, located in
443 # drivers/staging. Change the default header path.
444 PVR_ANDROID_SYNC_HEADER := \"../drivers/staging/android/sync.h\"
445 endif
446 $(eval $(call BothConfigMake,SUPPORT_ION,1))
447 $(eval $(call BothConfigC,SUPPORT_ION,))
448 $(eval $(call TunableKernelConfigC,PVR_ANDROID_ION_HEADER,\"linux/ion.h\"))
449 $(eval $(call TunableKernelConfigC,PVR_ANDROID_ION_PRIV_HEADER,\"../drivers/gpu/ion/ion_priv.h\"))
450 $(eval $(call TunableKernelConfigC,PVR_ANDROID_ION_USE_SG_LENGTH,))
451 $(eval $(call TunableKernelConfigC,PVR_ANDROID_SYNC_HEADER,\"linux/sync.h\"))
452 endif
453
454 $(eval $(call UserConfigC,PVRSRV_MODULE_BASEDIR,\"$(PVRSRV_MODULE_BASEDIR)\"))
455
456 # Ideally configured by platform Makefiles, as necessary
457 #
458 ifeq ($(SUPPORT_KERNEL_SRVINIT),1)
459 $(eval $(call TunableBothConfigMake,RGX_FW_FILENAME,rgx.fw))
460 $(eval $(call TunableBothConfigC,RGX_FW_FILENAME,"\"rgx.fw\""))
461 endif
462
463
464 $(if $(USE_CCACHE),$(if $(USE_DISTCC),$(error\
465 Enabling both USE_CCACHE and USE_DISTCC at the same time is not supported)))
466
467 # Invariant options for Linux
468 #
469 $(eval $(call BothConfigC,LINUX,))
470
471 $(eval $(call BothConfigC,PVR_BUILD_DIR,"\"$(PVR_BUILD_DIR)\""))
472 $(eval $(call BothConfigC,PVR_BUILD_TYPE,"\"$(BUILD)\""))
473 $(eval $(call BothConfigC,PVRSRV_MODNAME,"\"$(PVRSRV_MODNAME)\""))
474 $(eval $(call BothConfigMake,PVRSRV_MODNAME,$(PVRSRV_MODNAME)))
475 $(eval $(call BothConfigMake,PVR_BUILD_DIR,$(PVR_BUILD_DIR)))
476 $(eval $(call BothConfigMake,PVR_BUILD_TYPE,$(BUILD)))
477
478 $(eval $(call BothConfigC,SUPPORT_RGX,1))
479 $(eval $(call UserConfigMake,SUPPORT_RGX,1))
480
481 # Some of the definitions in stdint.h aren't exposed by default in C++ mode,
482 # unless these macros are defined. To make sure we get these definitions
483 # regardless of which files include stdint.h, define them here.
484 $(eval $(call UserConfigC,__STDC_CONSTANT_MACROS,))
485 $(eval $(call UserConfigC,__STDC_FORMAT_MACROS,))
486 $(eval $(call UserConfigC,__STDC_LIMIT_MACROS,))
487
488 $(eval $(call UserConfigC,PVR_TLS_USE_GCC__thread_KEYWORD,))
489
490 ifneq ($(DISPLAY_CONTROLLER),)
491 $(eval $(call BothConfigC,DISPLAY_CONTROLLER,$(DISPLAY_CONTROLLER)))
492 $(eval $(call BothConfigMake,DISPLAY_CONTROLLER,$(DISPLAY_CONTROLLER)))
493 endif
494
495 $(eval $(call UserConfigC,OPK_DEFAULT,"\"$(OPK_DEFAULT)\""))
496 $(eval $(call UserConfigC,OPK_FALLBACK,"\"$(OPK_FALLBACK)\""))
497
498 $(eval $(call BothConfigMake,PVR_SYSTEM,$(PVR_SYSTEM)))
499 $(eval $(call KernelConfigMake,PVR_LOADER,$(PVR_LOADER)))
500
501 ifeq ($(MESA_EGL),1)
502 $(eval $(call UserConfigMake,LIB_IMG_EGL,pvr_dri_support))
503 $(eval $(call UserConfigC,LIB_IMG_EGL_NAME,\"libpvr_dri_support.so\"))
504 else
505 $(eval $(call UserConfigMake,LIB_IMG_EGL,IMGegl))
506 $(eval $(call UserConfigC,LIB_IMG_EGL_NAME,\"libIMGegl.so\"))
507 endif
508
509 # Build-type dependent options
510 #
511 $(eval $(call BothConfigMake,BUILD,$(BUILD)))
512
513 ifeq ($(BUILD),debug)
514 PVR_RI_DEBUG ?= 1
515 SUPPORT_PAGE_FAULT_DEBUG ?= 1
516 $(eval $(call BothConfigC,DEBUG,))
517 $(eval $(call KernelConfigC,DEBUG_LINUX_MEMORY_ALLOCATIONS,))
518 $(eval $(call KernelConfigC,DEBUG_LINUX_MEM_AREAS,))
519 $(eval $(call KernelConfigC,DEBUG_LINUX_MMAP_AREAS,))
520 $(eval $(call KernelConfigC,DEBUG_BRIDGE_KM,))
521 $(eval $(call KernelConfigC,DEBUG_HANDLEALLOC_KM,))
522 $(eval $(call UserConfigC,DLL_METRIC,1))
523 $(eval $(call TunableBothConfigC,RGXFW_ALIGNCHECKS,1))
524 $(eval $(call TunableBothConfigC,PVRSRV_DEBUG_CCB_MAX,))
525 else ifeq ($(BUILD),release)
526 $(eval $(call BothConfigC,RELEASE,))
527 $(eval $(call TunableBothConfigMake,DEBUGLINK,1))
528 $(eval $(call TunableBothConfigC,RGXFW_ALIGNCHECKS,))
529 else ifeq ($(BUILD),timing)
530 $(eval $(call BothConfigC,TIMING,))
531 $(eval $(call UserConfigC,DLL_METRIC,1))
532 $(eval $(call TunableBothConfigMake,DEBUGLINK,1))
533 else
534 $(error BUILD= must be either debug, release or timing)
535 endif
536
537
538
539 # User-configurable options
540 #
541 ifeq ($(DONT_NEED_RGX_BVNC),)
542   $(eval $(call TunableBothConfigC,RGX_BVNC_CORE_KM_HEADER,))
543  $(eval $(call TunableBothConfigC,RGX_BVNC_CORE_HEADER,))
544    $(eval $(call TunableBothConfigC,RGX_BNC_CONFIG_KM_HEADER,))
545  $(eval $(call TunableBothConfigC,RGX_BNC_CONFIG_HEADER,))
546   endif
547
548 $(eval $(call TunableBothConfigC,SUPPORT_DBGDRV_EVENT_OBJECTS,1))
549 $(eval $(call TunableBothConfigC,PVR_DBG_BREAK_ASSERT_FAIL,,\
550 Enable this to treat PVR_DBG_BREAK as PVR_ASSERT(0)._\
551 Otherwise it is ignored._\
552 ))
553 $(eval $(call TunableBothConfigC,PDUMP,,\
554 Enable parameter dumping in the driver._\
555 This adds code to record the parameters being sent to the hardware for_\
556 later analysis._\
557 ))
558 PDUMP_STREAMBUF_SIZE_MB ?= 16
559 $(eval $(call TunableBothConfigC,PDUMP_STREAMBUF_MAX_SIZE_MB,$(PDUMP_STREAMBUF_SIZE_MB),))
560 $(eval $(call TunableBothConfigC,NO_HARDWARE,,\
561 Disable hardware interactions (e.g. register writes) that the driver would_\
562 normally perform. A driver built with this option can$(apos)t drive hardware$(comma)_\
563 but with PDUMP enabled$(comma) it can capture parameters to be played back later._\
564 ))
565 $(eval $(call TunableBothConfigC,PDUMP_DEBUG_OUTFILES,))
566 $(eval $(call TunableBothConfigC,SYS_USING_INTERRUPTS,1))
567 $(eval $(call TunableBothConfigC,PVRSRV_NEED_PVR_DPF,,\
568 Enable this to turn on PVR_DPF in release builds._\
569 ))
570 $(eval $(call TunableBothConfigC,PVRSRV_NEED_PVR_ASSERT,,\
571 Enable this to turn on PVR_ASSERT in release builds._\
572 ))
573 $(eval $(call TunableBothConfigC,PVRSRV_NEED_PVR_TRACE,,\
574 Enable this to turn on PVR_TRACE in release builds._\
575 ))
576 $(eval $(call TunableBothConfigC,REFCOUNT_DEBUG,))
577 $(eval $(call TunableBothConfigC,DC_DEBUG,))
578 $(eval $(call TunableBothConfigC,SCP_DEBUG,))
579 $(eval $(call TunableBothConfigC,CACHEFLUSH_TYPE,CACHEFLUSH_GENERIC))
580 $(eval $(call TunableBothConfigC,SUPPORT_INSECURE_EXPORT,))
581 $(eval $(call TunableBothConfigC,SUPPORT_SECURE_EXPORT,1,\
582 Enable support for secure device memory and sync export._\
583 This replaces export handles with file descriptors$(comma) which can be passed_\
584 between processes to share memory._\
585 ))
586 $(eval $(call TunableBothConfigC,SUPPORT_GPUTRACE_EVENTS,))
587 $(eval $(call TunableBothConfigC,SUPPORT_KERNEL_HWPERF,))
588 $(eval $(call TunableBothConfigC,SUPPORT_DISPLAY_CLASS,))
589 $(eval $(call TunableBothConfigC,PVRSRV_DEBUG_CCB_MAX,))
590 $(eval $(call TunableBothConfigC,SUPPORT_TRUSTED_DEVICE,))
591 $(eval $(call TunableBothConfigC,SUPPORT_GPUVIRT_VALIDATION,))
592 $(eval $(call TunableBothConfigC,GPUVIRT_VALIDATION_NUM_OS,8))
593 $(eval $(call TunableBothConfigC,TRUSTED_DEVICE_DEFAULT_ENABLED,))
594 $(eval $(call TunableBothConfigC,SUPPORT_EXPORTING_MEMORY_CONTEXT,))
595 $(eval $(call TunableBothConfigMake,SUPPORT_USER_REGISTER_CONFIGURATION,))
596 $(eval $(call TunableBothConfigC,SUPPORT_USER_REGISTER_CONFIGURATION,))
597 $(eval $(call TunableBothConfigC,SUPPORT_VALIDATION,))
598 $(eval $(call TunableBothConfigC,FIX_DUSTS_POW_ON_INIT,))
599 $(eval $(call TunableBothConfigC,PVR_DVFS,,\
600 Enables PVR DVFS implementation to actively change frequency / voltage depending_\
601 on current GPU load. Currently only supported on Linux._\
602 ))
603 $(eval $(call TunableBothConfigC,PVR_POWER_ACTOR,,\
604 Enables PVR power actor implementation for registration with a kernel configured_\
605 with IPA. Enables power counter measurement timer in the FW which is periodicaly_\
606 read by the host DVFS in order to operate within a governor set power envelope._\
607 ))
608 $(eval $(call TunableBothConfigC,PVR_POWER_ACTOR_SCALING,,\
609 Scaling factor for the dynamic power coefficients._\
610 ))
611 $(eval $(call TunableKernelConfigC,PVR_POWER_ACTOR_DEBUG,,\
612 Enable debug logging for power actor._\
613 ))
614 $(eval $(call TunableKernelConfigC,DEBUG_HANDLEALLOC_INFO_KM,))
615 $(eval $(call TunableKernelConfigC,SUPPORT_LINUX_X86_WRITECOMBINE,1))
616 $(eval $(call TunableKernelConfigC,SUPPORT_LINUX_X86_PAT,1))
617 $(eval $(call TunableKernelConfigC,PVRSRV_RESET_ON_HWTIMEOUT,))
618 $(eval $(call TunableKernelConfigC,PVR_LINUX_USING_WORKQUEUES,))
619 $(eval $(call TunableKernelConfigC,PVR_LINUX_MISR_USING_WORKQUEUE,))
620 $(eval $(call TunableKernelConfigC,PVR_LINUX_MISR_USING_PRIVATE_WORKQUEUE,))
621 $(eval $(call TunableKernelConfigC,PVR_LINUX_TIMERS_USING_WORKQUEUES,))
622 $(eval $(call TunableKernelConfigC,PVR_LINUX_TIMERS_USING_SHARED_WORKQUEUE,))
623 $(eval $(call TunableKernelConfigC,PVR_LDM_PLATFORM_PRE_REGISTERED,))
624 $(eval $(call TunableKernelConfigC,PVR_LDM_DRIVER_REGISTRATION_NAME,"\"$(PVRSRV_MODNAME)\""))
625 $(eval $(call TunableBothConfigC,LDM_PLATFORM,))
626 $(eval $(call TunableBothConfigC,LDM_PCI,))
627 $(eval $(call TunableBothConfigC,PVRSRV_ENABLE_FULL_SYNC_TRACKING,))
628 $(eval $(call TunableKernelConfigC,PVRSRV_FULL_SYNC_TRACKING_HISTORY_LEN,256))
629 $(eval $(call TunableKernelConfigC,PVRSRV_ENABLE_FULL_CCB_DUMP,))
630 $(eval $(call TunableKernelConfigC,SYNC_DEBUG,))
631 $(eval $(call TunableKernelConfigC,SUPPORT_DUMP_CLIENT_CCB_COMMANDS,))
632 $(eval $(call TunableKernelConfigC,PVR_LINUX_DONT_USE_RANGE_BASED_INVALIDATE,))
633 $(eval $(call TunableKernelConfigC,SUPPORT_MMU_PxE_MAP_ON_DEMAND,))
634 $(eval $(call TunableKernelConfigC,SUPPORT_MMU_MODIFICATION_LOGGING,,\
635 Enable support for logging of page table modifications. This is as debug_\
636 feature for use when debugging page-faults which are showing what look to_\
637 be unexpected values. It keeps a history of the last few modifications types_\
638 (map/unmap) and the value written during as a result of that operation._\
639 ))
640 $(eval $(call TunableKernelConfigC,SUPPORT_MMU_PAGESIZECONFIG_REFCOUNT,))
641 $(eval $(call TunableKernelConfigC,SUPPORT_DC_COMPLETE_TIMEOUT_DEBUG,))
642 $(eval $(call TunableKernelConfigC,SUPPORT_SYSTEM_INTERRUPT_HANDLING,,\
643 Enable support for system level interrupt handling. This is intended_\
644 for use on systems that have two or more levels of interrupt registers_\
645 which require the top level register to be cleared by the system layer_\
646 because it is not specific to one single device._\
647 ))
648
649 $(eval $(call TunableBothConfigC,SUPPORT_PVR_VALGRIND,))
650
651
652 $(eval $(call TunableBothConfigC,PVRSRV_DEVMEM_SAFE_MEMSETCPY,,\
653 Enable this to force the use of *DeviceMemSet/Copy in the drvier _\
654 instead of the built-in libc functions. These implemenations are device _\
655 memory safe and are used by default on AARCH64 platform._\
656 ))
657
658 $(eval $(call TunableBothConfigC,PVRSRV_BRIDGE_LOGGING,))
659
660
661
662 ifneq ($(SUPPORT_ANDROID_PLATFORM),1)
663   endif
664
665 ifneq ($(DWARF_DEBUG), 1)
666     endif
667
668 $(eval $(call TunableBothConfigMake,CACHEFLUSH_TYPE,CACHEFLUSH_GENERIC))
669 $(eval $(call TunableBothConfigMake,PDUMP,))
670 $(eval $(call TunableBothConfigMake,SUPPORT_INSECURE_EXPORT,))
671 $(eval $(call TunableBothConfigMake,SUPPORT_SECURE_EXPORT,1))
672 $(eval $(call TunableBothConfigMake,SUPPORT_DISPLAY_CLASS,))
673 $(eval $(call TunableBothConfigMake,SUPPORT_RAY_TRACING,))
674 $(eval $(call TunableBothConfigC,FORCE_DM_OVERLAP,))
675 $(eval $(call TunableBothConfigC,SUPPORT_EXTRA_METASP_DEBUG,))
676 $(eval $(call TunableBothConfigC,GPU_UTIL_SLC_STALL_COUNTERS,))
677
678 $(eval $(call TunableBothConfigMake,SUPPORT_GPUTRACE_EVENTS,))
679 $(eval $(call TunableBothConfigMake,SUPPORT_KERNEL_HWPERF,))
680
681 $(eval $(call TunableBothConfigMake,OPTIM,,\
682 Specify the optimisation flags passed to the compiler. Normally this_\
683 is autoconfigured based on the build type._\
684 ))
685 $(eval $(call TunableBothConfigC,SUPPORT_PERCONTEXT_FREELIST,1))
686 $(eval $(call TunableBothConfigC,SUPPORT_MMU_FREELIST,))
687 $(eval $(call TunableBothConfigC,SUPPORT_VFP,))
688
689 $(eval $(call TunableBothConfigC,SUPPORT_META_SLAVE_BOOT,))
690
691 $(eval $(call UserConfigC,EGL_BASENAME_SUFFIX,\"$(EGL_BASENAME_SUFFIX)\"))
692
693
694
695
696
697 $(eval $(call TunableBothConfigC,PVR_TESTING_UTILS,,\
698 Enable this to build in support for testing the PVR Transport Layer API._\
699 ))
700
701
702 TQ_CAPTURE_PARAMS ?= 1
703
704 $(eval $(call TunableBothConfigC,TDMETACODE,))
705 $(eval $(call TunableBothConfigC,PVR_DPF_ADHOC_DEBUG_ON,))
706 $(eval $(call TunableBothConfigC,RGXFW_DEBUG_LOG_GROUP,))
707 $(eval $(call TunableBothConfigC,SUPPORT_POWMON_WO_GPIO_PIN,))
708
709
710 $(eval $(call TunableKernelConfigMake,PVR_HANDLE_BACKEND,idr,\
711 Specifies the back-end that should be used$(comma) by the Services kernel handle_\
712 interface$(comma) to allocate handles. The available backends are:_\
713 * generic (OS agnostic)_\
714 * idr (Uses the Linux IDR interface)_\
715 ))
716
717
718 $(eval $(call TunableBothConfigC,PVRSRV_ENABLE_PROCESS_STATS,1,\
719 Enable Process Statistics via DebugFS._\
720 ))
721
722 $(eval $(call TunableBothConfigC,SUPPORT_SHARED_SLC,,\
723 When the SLC is shared the SLC reset is performed by the System layer when \
724 calling RGXInitSLC and not the GPU driver. Define this for system layer \
725 SLC handling. \
726 ))
727
728 # PVR_RI_DEBUG is set to enable RI annotation of devmem allocations
729 # This is enabled by default for debug builds.
730 #
731 $(eval $(call TunableBothConfigMake,PVR_RI_DEBUG,))
732 $(eval $(call TunableBothConfigC,PVR_RI_DEBUG,,\
733 Enable Resource Information (RI) debug. This logs details of_\
734 resource allocations with annotation to help indicate their use._\
735 ))
736
737 $(eval $(call TunableBothConfigMake,SUPPORT_PAGE_FAULT_DEBUG,))
738 $(eval $(call TunableBothConfigC,SUPPORT_PAGE_FAULT_DEBUG,,\
739 Collect information about allocations such as descriptive strings_\
740 and timing data for more detailed page fault analysis._\
741 ))
742
743 $(eval $(call TunableBothConfigC,PVRSRV_ENABLE_MEMORY_STATS,,\
744 Enable Memory allocations to be recorded and published via Process Statistics._\
745 ))
746
747 $(eval $(call TunableKernelConfigC,PVRSRV_ENABLE_FW_TRACE_DEBUGFS,,\
748 Enable automatic decoding of Firmware Trace via DebugFS._\
749 ))
750
751 $(eval $(call TunableBothConfigC,PVR_LINUX_PHYSMEM_MAX_POOL_PAGES,10240))
752
753 $(eval $(call TunableBothConfigC,PVR_MMAP_USE_VM_INSERT,,\
754 If enabled Linux will always use vm_insert_page for CPU mappings._\
755 vm_insert_page was found to be slower than remap_pfn_range on ARM kernels_\
756 but guarantees full memory accounting for the process that mapped the memory.\
757 The slowdown in vm_insert_page is caused by a dcache flush_\
758 that is only implemented for ARM and a few other architectures._\
759 This tunable can be enabled to debug memory issues. On x86 platforms_\
760 we always use vm_insert_page independent of this tunable._\
761 ))
762
763 # ARM-Linux specific: 
764 # When allocating uncached or write-combine memory we need to invalidate the
765 # CPU cache before we can use the acquired pages. 
766 # The threshhold defines at which number of pages we want to do a full 
767 # cache flush instead of invalidating pages one by one.
768 $(eval $(call TunableBothConfigC,PVR_LINUX_ARM_PAGEALLOC_FLUSH_THRESHOLD, 256))
769
770 # Choose the threshold at which iterative page-by-page ('n' 1 page allocs) 
771 # allocation is replaced with multiple block (1 'n' page alloc) allocation;
772 # for PVR_LINUX_PHYSMEM_MAX_ALLOC_ORDER, the valid range is [0:MAX_ORDER-1]
773 # NOTE: To disable higher-order allocation, set XXX_MAX_ALLOC_ORDER to zero
774 $(eval $(call TunableBothConfigC,PVR_LINUX_PHYSMEM_MIN_NUM_PAGES, 256 ))
775 $(eval $(call TunableBothConfigC,PVR_LINUX_PHYSMEM_MAX_ALLOC_ORDER, 2 ))
776
777 # Choose the threshold at which allocation size we want to use vmalloc instead of
778 # kmalloc. On highly fragmented systems large kmallocs can fail because it requests 
779 # physically contiguous pages. All allocations bigger than this define use vmalloc.
780 $(eval $(call TunableBothConfigC,PVR_LINUX_KMALLOC_ALLOCATION_THRESHOLD, 16384 ))
781
782 # Tunable RGX_MAX_TA_SYNCS / RGX_MAX_3D_SYNCS to increase the size of sync array in the DDK
783 # If defined, these macros take up the values as defined in the environment,
784 # Else, the default value is taken up as defined in include/rgxapi.h
785 #
786
787 $(eval $(call TunableBothConfigMake,SUPPORT_KERNEL_SRVINIT,))
788 $(eval $(call TunableBothConfigC,SUPPORT_KERNEL_SRVINIT,))
789
790
791 $(eval $(call TunableKernelConfigC,PVRSRV_SPLIT_LARGE_OSMEM_ALLOC,,\
792 Splits some critical allocations greater than page size into_\
793 two allocations: multiple page size and allocation size minus multiple_\
794 page size._\
795 ))
796
797 $(eval $(call TunableKernelConfigC,PVRSRV_FORCE_SLOWER_VMAP_ON_64BIT_BUILDS,,\
798 If enabled, all kernel mappings will use vmap/vunmap._\
799 vmap/vunmap is slower than vm_map_ram/vm_unmap_ram and can_\
800 even have bad peaks taking up to 100x longer than vm_map_ram._\
801 The disadvantage of vm_map_ram is that it can lead to vmalloc space_\
802 fragmentation that can lead to vmalloc space exhaustion on 32 bit Linux systems._\
803 This flag only affects 64 bit Linux builds, on 32 bit we always default to use vmap_\
804 because of the described fragmentation problem._\
805 ))
806
807
808 $(eval $(call TunableKernelConfigC,PVRSRV_DEBUG_LISR_EXECUTION,,\
809 Collect information about the last execution of the LISR in order to_\
810 debug interrupt handling timeouts._\
811 ))
812
813 endif # INTERNAL_CLOBBER_ONLY
814
815 export INTERNAL_CLOBBER_ONLY
816 export TOP
817 export OUT
818
819 MAKE_ETC := -Rr --no-print-directory -C $(TOP) TOP=$(TOP) OUT=$(OUT) \
820                 -f build/linux/toplevel.mk
821
822 # This must match the default value of MAKECMDGOALS below, and the default
823 # goal in toplevel.mk
824 .DEFAULT_GOAL := build
825
826 ifeq ($(MAKECMDGOALS),)
827 MAKECMDGOALS := build
828 else
829 # We can't pass autogen to toplevel.mk
830 MAKECMDGOALS := $(filter-out autogen,$(MAKECMDGOALS))
831 endif
832
833 .PHONY: autogen
834 autogen:
835 ifeq ($(INTERNAL_CLOBBER_ONLY),)
836         @$(MAKE) -s --no-print-directory -C $(TOP) \
837                 -f build/linux/prepare_tree.mk \
838                 LDM_PCI=$(LDM_PCI) \
839                 LDM_PLATFORM=$(LDM_PLATFORM)
840 else
841         @:
842 endif
843
844 include ../config/help.mk
845
846 # This deletes built-in suffix rules. Otherwise the submake isn't run when
847 # saying e.g. "make thingy.a"
848 .SUFFIXES:
849
850 # Because we have a match-anything rule below, we'll run the main build when
851 # we're actually trying to remake various makefiles after they're read in.
852 # These rules try to prevent that
853 %.mk: ;
854 Makefile%: ;
855 Makefile: ;
856
857 .PHONY: build kbuild install
858 build kbuild install: autogen
859         @$(if $(MAKECMDGOALS),$(MAKE) $(MAKE_ETC) $(MAKECMDGOALS) $(eval MAKECMDGOALS :=),:)
860
861 %: autogen
862         @$(if $(MAKECMDGOALS),$(MAKE) $(MAKE_ETC) $(MAKECMDGOALS) $(eval MAKECMDGOALS :=),:)