Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18107bc8 authored by Albert I's avatar Albert I Committed by Razziell
Browse files

gpu: msm_adreno: Compile only Adreno codes specific to chipset



Idea based on YaroST12/Z2_PLUS_Kernel@5d969c68c10c, but instead of
completely removing unused parts we only compile Adreno codes that
are specific to target qcom chipset(s) we're compiling against.

To be warned, this is only tested against msm8953 and msm8996
devices only, and may be revised when this change is later known to
break other chipset(s).

Change-Id: I6e1856e345d4b3b818e45025ef4a8f8fd8087928
Signed-off-by: default avatarAlbert I <krascgq@outlook.co.id>
Signed-off-by: default avatarAdesh15 <adesikha15@gmail.com>
parent 47d0a481
Loading
Loading
Loading
Loading
+10 −8
Original line number Original line Diff line number Diff line
@@ -27,19 +27,21 @@ msm_adreno-y += \
	adreno_snapshot.o \
	adreno_snapshot.o \
	adreno_coresight.o \
	adreno_coresight.o \
	adreno_trace.o \
	adreno_trace.o \
	adreno_a3xx.o \
	adreno_a4xx.o \
	adreno_a5xx.o \
	adreno_a3xx_snapshot.o \
	adreno_a4xx_snapshot.o \
	adreno_a5xx_snapshot.o \
	adreno_a4xx_preempt.o \
	adreno_a5xx_preempt.o \
	adreno_sysfs.o \
	adreno_sysfs.o \
	adreno.o \
	adreno.o \
	adreno_cp_parser.o \
	adreno_cp_parser.o \
	adreno_perfcounter.o
	adreno_perfcounter.o


msm_adreno-$(CONFIG_ARCH_MSM8916) += adreno_a4xx.o adreno_a4xx_snapshot.o adreno_a4xx_preempt.o
msm_adreno-$(CONFIG_ARCH_MSM8917) += adreno_a3xx.o adreno_a3xx_snapshot.o
msm_adreno-$(CONFIG_ARCH_MSM8920) += adreno_a3xx.o adreno_a3xx_snapshot.o
msm_adreno-$(CONFIG_ARCH_MSM8937) += adreno_a5xx.o adreno_a5xx_snapshot.o adreno_a5xx_preempt.o
msm_adreno-$(CONFIG_ARCH_MSM8940) += adreno_a5xx.o adreno_a5xx_snapshot.o adreno_a5xx_preempt.o
msm_adreno-$(CONFIG_ARCH_MSM8953) += adreno_a5xx.o adreno_a5xx_snapshot.o adreno_a5xx_preempt.o
msm_adreno-$(CONFIG_ARCH_MSM8996) += adreno_a5xx.o adreno_a5xx_snapshot.o adreno_a5xx_preempt.o
msm_adreno-$(CONFIG_ARCH_MSMCOBALT) += adreno_a5xx.o adreno_a5xx_snapshot.o adreno_a5xx_preempt.o
msm_adreno-$(CONFIG_ARCH_SDM450) += adreno_a5xx.o adreno_a5xx_snapshot.o adreno_a5xx_preempt.o

msm_adreno-$(CONFIG_MSM_KGSL_IOMMU) += adreno_iommu.o
msm_adreno-$(CONFIG_MSM_KGSL_IOMMU) += adreno_iommu.o
msm_adreno-$(CONFIG_DEBUG_FS) += adreno_debugfs.o adreno_profile.o
msm_adreno-$(CONFIG_DEBUG_FS) += adreno_debugfs.o adreno_profile.o
msm_adreno-$(CONFIG_COMPAT) += adreno_compat.o
msm_adreno-$(CONFIG_COMPAT) += adreno_compat.o
+6 −0
Original line number Original line Diff line number Diff line
@@ -14,6 +14,7 @@
#define ANY_ID (~0)
#define ANY_ID (~0)


static const struct adreno_gpu_core adreno_gpulist[] = {
static const struct adreno_gpu_core adreno_gpulist[] = {
#if defined(CONFIG_ARCH_MSM8917) | defined(CONFIG_ARCH_MSM8920)
	{
	{
		.gpurev = ADRENO_REV_A306,
		.gpurev = ADRENO_REV_A306,
		.core = 3,
		.core = 3,
@@ -50,6 +51,8 @@ static const struct adreno_gpu_core adreno_gpulist[] = {
		.gmem_size = (SZ_64K + SZ_32K),
		.gmem_size = (SZ_64K + SZ_32K),
		.busy_mask = 0x7FFFFFFE,
		.busy_mask = 0x7FFFFFFE,
	},
	},
#endif /* CONFIG_ARCH_MSM8917 | CONFIG_ARCH_MSM8920 */
#ifdef CONFIG_ARCH_MSM8916
	{
	{
		.gpurev = ADRENO_REV_A405,
		.gpurev = ADRENO_REV_A405,
		.core = 4,
		.core = 4,
@@ -133,6 +136,8 @@ static const struct adreno_gpu_core adreno_gpulist[] = {
		.num_protected_regs = 0x18,
		.num_protected_regs = 0x18,
		.busy_mask = 0x7FFFFFFE,
		.busy_mask = 0x7FFFFFFE,
	},
	},
#endif /* CONFIG_ARCH_MSM8916 */
#if defined(CONFIG_ARCH_MSM8937) | defined(CONFIG_ARCH_MSM8940) | defined(CONFIG_ARCH_MSM8953) | defined(CONFIG_ARCH_MSM8996) | defined(CONFIG_ARCH_MSMCOBALT) | defined(CONFIG_ARCH_SDM450)
	{
	{
		.gpurev = ADRENO_REV_A530,
		.gpurev = ADRENO_REV_A530,
		.core = 5,
		.core = 5,
@@ -261,4 +266,5 @@ static const struct adreno_gpu_core adreno_gpulist[] = {
		.gpmu_tsens = 0x000C000D,
		.gpmu_tsens = 0x000C000D,
		.max_power = 5448,
		.max_power = 5448,
	},
	},
#endif /* CONFIG_ARCH_MSM8937 | CONFIG_ARCH_MSM8940 | CONFIG_ARCH_MSM8953 | CONFIG_ARCH_MSM8996 | CONFIG_ARCH_MSMCOBALT | CONFIG_ARCH_SDM450 */
};
};
+18 −4
Original line number Original line Diff line number Diff line
@@ -15,8 +15,12 @@


#include "adreno.h"
#include "adreno.h"


#if defined(CONFIG_ARCH_MSM8917) | defined(CONFIG_ARCH_MSM8920)
extern const unsigned int a3xx_cp_addr_regs[];
extern const unsigned int a3xx_cp_addr_regs[];
#endif
#ifdef CONFIG_ARCH_MSM8916
extern const unsigned int a4xx_cp_addr_regs[];
extern const unsigned int a4xx_cp_addr_regs[];
#endif


/*
/*
 * struct adreno_ib_object - Structure containing information about an
 * struct adreno_ib_object - Structure containing information about an
@@ -137,12 +141,17 @@ static inline int adreno_cp_parser_getreg(struct adreno_device *adreno_dev,
	if (reg_enum == ADRENO_CP_ADDR_MAX)
	if (reg_enum == ADRENO_CP_ADDR_MAX)
		return -EEXIST;
		return -EEXIST;


#if defined(CONFIG_ARCH_MSM8917) | defined(CONFIG_ARCH_MSM8920)
	if (adreno_is_a3xx(adreno_dev))
	if (adreno_is_a3xx(adreno_dev))
		return a3xx_cp_addr_regs[reg_enum];
		return a3xx_cp_addr_regs[reg_enum];
	else if (adreno_is_a4xx(adreno_dev))
#endif
#ifdef CONFIG_ARCH_MSM8916
	if (adreno_is_a4xx(adreno_dev))
		return a4xx_cp_addr_regs[reg_enum];
		return a4xx_cp_addr_regs[reg_enum];
	else
#endif
#if defined(CONFIG_ARCH_MSM8937) | defined(CONFIG_ARCH_MSM8940) | defined(CONFIG_ARCH_MSM8953) | defined(CONFIG_ARCH_MSM8996) | defined(CONFIG_ARCH_MSMCOBALT) | defined(CONFIG_ARCH_SDM450)
		return -EEXIST;
		return -EEXIST;
#endif
}
}


/*
/*
@@ -162,12 +171,17 @@ static inline int adreno_cp_parser_regindex(struct adreno_device *adreno_dev,
{
{
	int i;
	int i;
	const unsigned int *regs;
	const unsigned int *regs;
#ifdef CONFIG_ARCH_MSM8916
	if (adreno_is_a4xx(adreno_dev))
	if (adreno_is_a4xx(adreno_dev))
		regs = a4xx_cp_addr_regs;
		regs = a4xx_cp_addr_regs;
	else if (adreno_is_a3xx(adreno_dev))
#endif
#if defined(CONFIG_ARCH_MSM8917) | defined(CONFIG_ARCH_MSM8920)
	if (adreno_is_a3xx(adreno_dev))
		regs = a3xx_cp_addr_regs;
		regs = a3xx_cp_addr_regs;
	else
#endif
#if defined(CONFIG_ARCH_MSM8937) | defined(CONFIG_ARCH_MSM8940) | defined(CONFIG_ARCH_MSM8953) | defined(CONFIG_ARCH_MSM8996) | defined(CONFIG_ARCH_MSMCOBALT) | defined(CONFIG_ARCH_SDM450)
		return -EEXIST;
		return -EEXIST;
#endif


	for (i = start; i <= end && i < ADRENO_CP_ADDR_MAX; i++)
	for (i = start; i <= end && i < ADRENO_CP_ADDR_MAX; i++)
		if (regs[i] == offset)
		if (regs[i] == offset)