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

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

Merge "msm: vidc: Fix compilation issues for 32 bit"

parents 85552d51 e9f98550
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -17,10 +17,16 @@
#ifndef __FP_H__
#define __FP_H__

/* Normally would typedef'ed, but checkpatch doesn't like typedef */
#define fp_t int64_t
/*
 * Normally would typedef'ed, but checkpatch doesn't like typedef.
 * Also should be normally typedef'ed to intmax_t but that doesn't seem to be
 * available in the kernel
 */
#define fp_t size_t

/* (Arbitrarily) make the first 25% of the bits to be the fractional bits */
#define FP_FRACTIONAL_BITS ((sizeof(fp_t) * 8) / 4)

#define FP_FRACTIONAL_BITS 16
#define FP(__i, __f_n, __f_d) \
	((((fp_t)(__i)) << FP_FRACTIONAL_BITS) + \
	(((__f_n) << FP_FRACTIONAL_BITS) / (__f_d)))
@@ -29,22 +35,22 @@
#define FP_ONE FP_INT(1)
#define FP_ZERO FP_INT(0)

static inline int64_t fp_frac_base(void)
static inline size_t fp_frac_base(void)
{
	return GENMASK(FP_FRACTIONAL_BITS - 1, 0);
}

static inline int64_t fp_frac(fp_t a)
static inline size_t fp_frac(fp_t a)
{
	return a & GENMASK(FP_FRACTIONAL_BITS - 1, 0);
}

static inline int64_t fp_int(fp_t a)
static inline size_t fp_int(fp_t a)
{
	return a >> FP_FRACTIONAL_BITS;
}

static inline int64_t fp_round(fp_t a)
static inline size_t fp_round(fp_t a)
{
	/* is the fractional part >= frac_max / 2? */
	bool round_up = fp_frac(a) >= fp_frac_base() / 2;
+5 −6
Original line number Diff line number Diff line
@@ -60,8 +60,8 @@ const unsigned long NOMINAL_BW_MBPS = 6000 /* ideally 320 Mhz */,
	SVS_BW_MBPS = 2000 /* ideally 100 Mhz */;

/* converts Mbps to bps (the "b" part can be bits or bytes based on context) */
#define kbps(__mbps) ((__mbps) * U64_C(1000))
#define bps(__mbps) (kbps(__mbps) * U64_C(1000))
#define kbps(__mbps) ((__mbps) * 1000)
#define bps(__mbps) (kbps(__mbps) * 1000)

#define GENERATE_SCENARIO_PROFILE(__average, __worst) {                        \
	[SCENARIO_AVERAGE] = (__average),                                      \
@@ -200,7 +200,7 @@ static fp_t __compression_ratio(struct lut const *entry, int bpp,
struct dump {
	char *key;
	char *format;
	int64_t val;
	size_t val;
};

static void __dump(struct dump dump[], int len)
@@ -223,12 +223,12 @@ static void __dump(struct dump dump[], int len)
				snprintf(formatted_line, sizeof(formatted_line),
						format_line, dump[c].val);
			} else {
				int64_t integer_part, fractional_part;
				size_t integer_part, fractional_part;

				integer_part = fp_int(dump[c].val);
				fractional_part = fp_frac(dump[c].val);
				snprintf(formatted_line, sizeof(formatted_line),
						"    %-35s: %lld + %lld/%lld\n",
						"    %-35s: %zd + %zd/%zd\n",
						dump[c].key, integer_part,
						fractional_part,
						fp_frac_base());
@@ -602,7 +602,6 @@ static unsigned long __calculate_decoder(struct vidc_bus_vote_data *d,
		{"DPB read", DUMP_FP_FMT, vmem.dpb_read},
		{"DPB write", DUMP_FP_FMT, vmem.dpb_write},
		};

		__dump(dump, ARRAY_SIZE(dump));
	}

+3 −3
Original line number Diff line number Diff line
@@ -1203,7 +1203,7 @@ int msm_vidc_smmu_fault_handler(struct iommu_domain *domain,
		mutex_lock(&inst->scratchbufs.lock);
		dprintk(VIDC_ERR, "scratch buffer list:\n");
		list_for_each_entry(buf, &inst->scratchbufs.list, list)
			dprintk(VIDC_ERR, "type: %d addr: %pa size: %lu\n",
			dprintk(VIDC_ERR, "type: %d addr: %pa size: %zu\n",
				buf->buffer_type, &buf->handle->device_addr,
				buf->handle->size);
		mutex_unlock(&inst->scratchbufs.lock);
@@ -1211,7 +1211,7 @@ int msm_vidc_smmu_fault_handler(struct iommu_domain *domain,
		mutex_lock(&inst->persistbufs.lock);
		dprintk(VIDC_ERR, "persist buffer list:\n");
		list_for_each_entry(buf, &inst->persistbufs.list, list)
			dprintk(VIDC_ERR, "type: %d addr: %pa size: %lu\n",
			dprintk(VIDC_ERR, "type: %d addr: %pa size: %zu\n",
				buf->buffer_type, &buf->handle->device_addr,
				buf->handle->size);
		mutex_unlock(&inst->persistbufs.lock);
@@ -1219,7 +1219,7 @@ int msm_vidc_smmu_fault_handler(struct iommu_domain *domain,
		mutex_lock(&inst->outputbufs.lock);
		dprintk(VIDC_ERR, "dpb buffer list:\n");
		list_for_each_entry(buf, &inst->outputbufs.list, list)
			dprintk(VIDC_ERR, "type: %d addr: %pa size: %lu\n",
			dprintk(VIDC_ERR, "type: %d addr: %pa size: %zu\n",
				buf->buffer_type, &buf->handle->device_addr,
				buf->handle->size);
		mutex_unlock(&inst->outputbufs.lock);