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

Commit 3568bceb authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Correct GPU busy counter overflow detection"

parents 146f9f75 0f97e35b
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -1808,7 +1808,7 @@ static inline bool is_power_counter_overflow(struct adreno_device *adreno_dev,
		return ret;
	}
	adreno_readreg(adreno_dev, ADRENO_REG_RBBM_PERFCTR_RBBM_0_HI, &val);
	if (val != *perfctr_pwr_hi) {
	if (val > *perfctr_pwr_hi) {
		*perfctr_pwr_hi = val;
		ret = true;
	}
@@ -1823,14 +1823,17 @@ static inline unsigned int counter_delta(struct kgsl_device *device,
	unsigned int ret = 0;
	bool overflow = true;
	static unsigned int perfctr_pwr_hi;
	unsigned int prev_perfctr_pwr_hi = 0;

	/* Read the value */
	kgsl_regread(device, reg, &val);

	if (adreno_is_a5xx(adreno_dev) && reg == adreno_getreg
		(adreno_dev, ADRENO_REG_RBBM_PERFCTR_RBBM_0_LO))
		(adreno_dev, ADRENO_REG_RBBM_PERFCTR_RBBM_0_LO)) {
		prev_perfctr_pwr_hi = perfctr_pwr_hi;
		overflow = is_power_counter_overflow(adreno_dev, reg,
				*counter, &perfctr_pwr_hi);
	}

	/* Return 0 for the first read */
	if (*counter != 0) {
@@ -1843,9 +1846,12 @@ static inline unsigned int counter_delta(struct kgsl_device *device,
			 * Since KGSL got abnormal value from the counter,
			 * We will drop the value from being accumulated.
			 */
			pr_warn_once("KGSL: Abnormal value :0x%x (0x%x) from perf counter : 0x%x\n",
					val, *counter, reg);
			return 0;
			KGSL_DRV_ERR_RATELIMIT(device,
				"Abnormal value:0x%llx (0x%llx) from perf counter : 0x%x\n",
				val | ((uint64_t)perfctr_pwr_hi << 32),
				*counter |
					((uint64_t)prev_perfctr_pwr_hi << 32),
				reg);
		}
	}