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

Commit 3a981e73 authored by ssizon's avatar ssizon
Browse files

Merge branch '8901-fairphone-p-fairphone' of...

Merge branch '8901-fairphone-p-fairphone' of https://gitlab.e.foundation/msm8953/android_kernel_msm-4.9 into v1-pie
parents 9c0764fd b530a0fe
Loading
Loading
Loading
Loading
+50 −0
Original line number Diff line number Diff line
@@ -581,30 +581,80 @@
			nvmem = <&pmi632_sdam7>;
			qcom,pbs-client = <&pmi632_pbs_client3>;
			qcom,lut-sdam-base = <0x80>;
		//<2019/10/25-Yuting Shih.[FAIRPHONE][MISC][COMMON][LED][][]Modified for breath ramp and timing.
		#if 1
			qcom,lut-patterns = <0 0 0 0 0 0 0 0 0 0 2 16 30 44 58 72 86 100 100
						100 100 86 72 58 44 30 16 2 0 0 0 0 0 0 0 0 0 0>;
		#else
			/* Code default */
			qcom,lut-patterns = <0 0 0 14 28 42 56 70 84 100
						100 84 70 56 42 28 14 0 0 0>;
		#endif
		//>2019/10/25-Yuting Shih.[FAIRPHONE][MISC][COMMON][LED][][].
			lpg@1 {
				qcom,lpg-chan-id = <1>;
		//<2019/10/25-Yuting Shih.[FAIRPHONE][MISC][COMMON][LED][][]Modified for breath ramp and timing.
		#if 1
				qcom,ramp-step-ms = <80>;
				qcom,ramp-pause-hi-count = <80>;
				qcom,ramp-pause-lo-count = <80>;
				qcom,ramp-low-index = <0>;
				qcom,ramp-high-index = <37>;
				//qcom,ramp-toggle; /* ramp from high to low */
				//qcom,ramp-from-low-to-high;
				qcom,ramp-pattern-repeat;
		#else
			/* Code default */
				qcom,ramp-step-ms = <200>;
				qcom,ramp-low-index = <0>;
				qcom,ramp-high-index = <19>;
				qcom,ramp-pattern-repeat;
		#endif
		//>2019/10/25-Yuting Shih.[FAIRPHONE][MISC][COMMON][LED][][].
				qcom,lpg-sdam-base = <0x48>;
			};
			lpg@2 {
				qcom,lpg-chan-id = <2>;
		//<2019/10/25-Yuting Shih.[FAIRPHONE][MISC][COMMON][LED][][]Modified for breath ramp and timing.
		#if 1
				qcom,ramp-step-ms = <80>;
				qcom,ramp-pause-hi-count = <80>;
				qcom,ramp-pause-lo-count = <80>;
				qcom,ramp-low-index = <0>;
				qcom,ramp-high-index = <37>;
				//qcom,ramp-toggle; /* ramp from high to low */
				//qcom,ramp-from-low-to-high;
				qcom,ramp-pattern-repeat;
		#else
			/* Code default */
				qcom,ramp-step-ms = <200>;
				qcom,ramp-low-index = <0>;
				qcom,ramp-high-index = <19>;
				qcom,ramp-pattern-repeat;
		#endif
		//>2019/10/25-Yuting Shih.[FAIRPHONE][MISC][COMMON][LED][][].
				qcom,lpg-sdam-base = <0x56>;
			};
			lpg@3 {
				qcom,lpg-chan-id = <3>;
		//<2019/10/25-Yuting Shih.[FAIRPHONE][MISC][COMMON][LED][][]Modified for breath ramp and timing.
		#if 1
				qcom,ramp-step-ms = <80>;
				qcom,ramp-pause-hi-count = <80>;
				qcom,ramp-pause-lo-count = <80>;
				qcom,ramp-low-index = <0>;
				qcom,ramp-high-index = <37>;
				//qcom,ramp-toggle; /* ramp from high to low */
				//qcom,ramp-from-low-to-high;
				qcom,ramp-pattern-repeat;
		#else
			/* Code default */
				qcom,ramp-step-ms = <200>;
				qcom,ramp-low-index = <0>;
				qcom,ramp-high-index = <19>;
				qcom,ramp-pattern-repeat;
		#endif
		//>2019/10/25-Yuting Shih.[FAIRPHONE][MISC][COMMON][LED][][].
				qcom,lpg-sdam-base = <0x64>;
			};
		};
+5 −0
Original line number Diff line number Diff line
@@ -218,6 +218,11 @@ static int binder_update_page_range(struct binder_alloc *alloc, int allocate,

	if (mm) {
		down_write(&mm->mmap_sem);
		if (!mmget_still_valid(mm)) {
			if (allocate == 0)
				goto free_range;
			goto err_no_vma;
		}
		vma = alloc->vma;
	}

+17 −1
Original line number Diff line number Diff line
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1411,6 +1411,22 @@ int adreno_dispatcher_queue_cmds(struct kgsl_device_private *dev_priv,

	user_ts = *timestamp;

	/*
	 * If there is only one drawobj in the array and it is of
	 * type SYNCOBJ_TYPE, skip comparing user_ts as it can be 0
	 */
	if (!(count == 1 && drawobj[0]->type == SYNCOBJ_TYPE) &&
		(drawctxt->base.flags & KGSL_CONTEXT_USER_GENERATED_TS)) {
		/*
		 * User specified timestamps need to be greater than the last
		 * issued timestamp in the context
		 */
		if (timestamp_cmp(drawctxt->timestamp, user_ts) >= 0) {
			spin_unlock(&drawctxt->lock);
			return -ERANGE;
		}
	}

	for (i = 0; i < count; i++) {

		switch (drawobj[i]->type) {
+45 −12
Original line number Diff line number Diff line
/* Copyright (c) 2002,2007-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2002,2007-2018,2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -299,6 +299,11 @@ static int _adreno_ringbuffer_probe(struct adreno_device *adreno_dev,
		PAGE_SIZE, 0, KGSL_MEMDESC_PRIVILEGED, "pagetable_desc");
	if (ret)
		return ret;

	/* allocate a chunk of memory to create user profiling IB1s */
	kgsl_allocate_global(KGSL_DEVICE(adreno_dev), &rb->profile_desc,
		PAGE_SIZE, KGSL_MEMFLAGS_GPUREADONLY, 0, "profile_desc");

	return kgsl_allocate_global(KGSL_DEVICE(adreno_dev), &rb->buffer_desc,
			KGSL_RB_SIZE, KGSL_MEMFLAGS_GPUREADONLY,
			0, "ringbuffer");
@@ -344,7 +349,7 @@ static void _adreno_ringbuffer_close(struct adreno_device *adreno_dev,

	kgsl_free_global(device, &rb->pagetable_desc);
	kgsl_free_global(device, &rb->preemption_desc);

	kgsl_free_global(device, &rb->profile_desc);
	kgsl_free_global(device, &rb->buffer_desc);
	kgsl_del_event_group(&rb->events);
	memset(rb, 0, sizeof(struct adreno_ringbuffer));
@@ -837,6 +842,37 @@ static inline int _get_alwayson_counter(struct adreno_device *adreno_dev,
	return (unsigned int)(p - cmds);
}

/* This is the maximum possible size for 64 bit targets */
#define PROFILE_IB_DWORDS 4
#define PROFILE_IB_SLOTS (PAGE_SIZE / (PROFILE_IB_DWORDS << 2))

static int set_user_profiling(struct adreno_device *adreno_dev,
		struct adreno_ringbuffer *rb, u32 *cmds, u64 gpuaddr)
{
	int dwords, index = 0;
	u64 ib_gpuaddr;
	u32 *ib;

	if (!rb->profile_desc.hostptr)
		return 0;

	ib = ((u32 *) rb->profile_desc.hostptr) +
		(rb->profile_index * PROFILE_IB_DWORDS);
	ib_gpuaddr = rb->profile_desc.gpuaddr +
		(rb->profile_index * (PROFILE_IB_DWORDS << 2));

	dwords = _get_alwayson_counter(adreno_dev, ib, gpuaddr);

	/* Make an indirect buffer for the request */
	cmds[index++] = cp_mem_packet(adreno_dev, CP_INDIRECT_BUFFER_PFE, 2, 1);
	index += cp_gpuaddr(adreno_dev, &cmds[index], ib_gpuaddr);
	cmds[index++] = dwords;

	rb->profile_index = (rb->profile_index + 1) % PROFILE_IB_SLOTS;

	return index;
}

/* adreno_rindbuffer_submitcmd - submit userspace IBs to the GPU */
int adreno_ringbuffer_submitcmd(struct adreno_device *adreno_dev,
		struct kgsl_drawobj_cmd *cmdobj,
@@ -937,14 +973,11 @@ int adreno_ringbuffer_submitcmd(struct adreno_device *adreno_dev,
		!adreno_is_a3xx(adreno_dev) &&
		(cmdobj->profiling_buf_entry != NULL)) {
		user_profiling = true;
		dwords += 6;

		/*
		 * REG_TO_MEM packet on A5xx and above needs another ordinal.
		 * Add 2 more dwords since we do profiling before and after.
		 * User side profiling uses two IB1s, one before with 4 dwords
		 * per INDIRECT_BUFFER_PFE call
		 */
		if (!ADRENO_LEGACY_PM4(adreno_dev))
			dwords += 2;
		dwords += 8;

		/*
		 * we want to use an adreno_submit_time struct to get the
@@ -1003,11 +1036,11 @@ int adreno_ringbuffer_submitcmd(struct adreno_device *adreno_dev,
	}

	/*
	 * Add cmds to read the GPU ticks at the start of command obj and
	 * Add IB1 to read the GPU ticks at the start of command obj and
	 * write it into the appropriate command obj profiling buffer offset
	 */
	if (user_profiling) {
		cmds += _get_alwayson_counter(adreno_dev, cmds,
		cmds += set_user_profiling(adreno_dev, rb, cmds,
			cmdobj->profiling_buffer_gpuaddr +
			offsetof(struct kgsl_drawobj_profiling_buffer,
			gpu_ticks_submitted));
@@ -1055,11 +1088,11 @@ int adreno_ringbuffer_submitcmd(struct adreno_device *adreno_dev,
	}

	/*
	 * Add cmds to read the GPU ticks at the end of command obj and
	 * Add IB1 to read the GPU ticks at the end of command obj and
	 * write it into the appropriate command obj profiling buffer offset
	 */
	if (user_profiling) {
		cmds += _get_alwayson_counter(adreno_dev, cmds,
		cmds += set_user_profiling(adreno_dev, rb, cmds,
			cmdobj->profiling_buffer_gpuaddr +
			offsetof(struct kgsl_drawobj_profiling_buffer,
			gpu_ticks_retired));
+13 −1
Original line number Diff line number Diff line
/* Copyright (c) 2002,2007-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2002,2007-2018,2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -135,6 +135,18 @@ struct adreno_ringbuffer {
	unsigned long sched_timer;
	enum adreno_dispatcher_starve_timer_states starve_timer_state;
	spinlock_t preempt_lock;
	/**
	 * @profile_desc: global memory to construct IB1s to do user side
	 * profiling
	 */
	struct kgsl_memdesc profile_desc;
	/**
	 * @profile_index: Pointer to the next "slot" in profile_desc for a user
	 * profiling IB1.  This allows for PAGE_SIZE / 16 = 256 simultaneous
	 * commands per ringbuffer with user profiling enabled
	 * enough.
	 */
	u32 profile_index;
};

/* Returns the current ringbuffer */
Loading