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

Commit caddd61e authored by Tarun Karra's avatar Tarun Karra
Browse files

msm: kgsl: Add options to enable/disable preemption



Options to enable/disable preemption are required for debugging
if preemption is the cause of stability or performance issues.

Add sysfs option to enable/disable preemption.
echo 0 > /sys/class/kgsl/kgsl-3d0/preemption to disable preemption.
echo 1 > /sys/class/kgsl/kgsl-3d0/preemption to enable preemption.
cat /sys/class/kgsl/kgsl-3d0/preemption to see the current state
of preemption.

Add a module parameter to disable preemption at boot. Module parameter
allows preemption to be disabled from the kernel command line for debugging
purposes.

Change-Id: Ic831e2c109e4114bc6f27d66dc0e72bfacd7ab32
Signed-off-by: default avatarTarun Karra <tkarra@codeaurora.org>
parent 50e0173f
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -41,6 +41,13 @@
/* Include the master list of GPU cores that are supported */
#include "adreno-gpulist.h"

#undef MODULE_PARAM_PREFIX
#define MODULE_PARAM_PREFIX "adreno."

static bool nopreempt;
module_param(nopreempt, bool, 0444);
MODULE_PARM_DESC(nopreempt, "Disable GPU preemption");

#define DRIVER_VERSION_MAJOR   3
#define DRIVER_VERSION_MINOR   1

@@ -1093,7 +1100,7 @@ static int adreno_probe(struct platform_device *pdev)
	if (!ADRENO_FEATURE(adreno_dev, ADRENO_CONTENT_PROTECTION))
		device->mmu.secured = false;

	status = adreno_ringbuffer_init(device);
	status = adreno_ringbuffer_init(adreno_dev, nopreempt);
	if (status)
		goto out;

@@ -1333,7 +1340,8 @@ static int adreno_init(struct kgsl_device *device)

	}

	if (ADRENO_FEATURE(adreno_dev, ADRENO_PREEMPTION)) {
	if (nopreempt == false &&
		ADRENO_FEATURE(adreno_dev, ADRENO_PREEMPTION)) {
		int r = 0;

		if (gpudev->preemption_init)
+1 −1
Original line number Diff line number Diff line
@@ -330,7 +330,7 @@ adreno_drawctxt_create(struct kgsl_device_private *dev_priv,
	/* Check for errors before trying to initialize */

	/* If preemption is not supported, ignore preemption request */
	if (!ADRENO_FEATURE(adreno_dev, ADRENO_PREEMPTION))
	if (!test_bit(ADRENO_DEVICE_PREEMPTION, &adreno_dev->priv))
		local &= ~KGSL_CONTEXT_PREEMPT_STYLE_MASK;

	/* We no longer support legacy context switching */
+2 −3
Original line number Diff line number Diff line
@@ -407,15 +407,14 @@ static int _adreno_ringbuffer_init(struct adreno_device *adreno_dev,
	return ret;
}

int adreno_ringbuffer_init(struct kgsl_device *device)
int adreno_ringbuffer_init(struct adreno_device *adreno_dev, bool nopreempt)
{
	int status = 0;
	struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
	struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev);
	struct adreno_ringbuffer *rb;
	int i;

	if (ADRENO_FEATURE(adreno_dev, ADRENO_PREEMPTION))
	if (nopreempt == false && ADRENO_FEATURE(adreno_dev, ADRENO_PREEMPTION))
		adreno_dev->num_ringbuffers = gpudev->num_prio_levels;
	else
		adreno_dev->num_ringbuffers = 1;
+1 −1
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ int adreno_ringbuffer_submitcmd(struct adreno_device *adreno_dev,
		struct kgsl_cmdbatch *cmdbatch,
		struct adreno_submit_time *time);

int adreno_ringbuffer_init(struct kgsl_device *device);
int adreno_ringbuffer_init(struct adreno_device *adreno_dev, bool nopreempt);

int adreno_ringbuffer_start(struct adreno_device *adreno_dev,
		unsigned int start_type);
+1 −1
Original line number Diff line number Diff line
@@ -795,7 +795,7 @@ void adreno_snapshot(struct kgsl_device *device, struct kgsl_snapshot *snapshot,
			snapshot, snapshot_global,
			&adreno_dev->pwron_fixup);

	if (ADRENO_FEATURE(adreno_dev, ADRENO_PREEMPTION)) {
	if (test_bit(ADRENO_DEVICE_PREEMPTION, &adreno_dev->priv)) {
		FOR_EACH_RINGBUFFER(adreno_dev, rb, i) {
			kgsl_snapshot_add_section(device,
				KGSL_SNAPSHOT_SECTION_GPU_OBJECT_V2,
Loading