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

Commit f87a5edc authored by Hareesh Gundu's avatar Hareesh Gundu
Browse files

msm: kgsl: Free up preemption buffers on ringbuffer close



Ensure that all HW preemption related buffers gets freed
up during ringbuffer close. Also move preemption buffers
allocation from HW init to ringbuffer probe.

Change-Id: Ia144a6a891e20deab9488d6cc49d7ffd32f0d1e4
Signed-off-by: default avatarHareesh Gundu <hareeshg@codeaurora.org>
parent 1dd9d0a1
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -1761,19 +1761,6 @@ static int adreno_init(struct kgsl_device *device)

	}

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

		if (gpudev->preemption_init)
			r = gpudev->preemption_init(adreno_dev);

		if (r == 0)
			set_bit(ADRENO_DEVICE_PREEMPTION, &adreno_dev->priv);
		else
			WARN(1, "adreno: GPU preemption is disabled\n");
	}

	return 0;
}

+1 −0
Original line number Diff line number Diff line
@@ -1013,6 +1013,7 @@ struct adreno_gpudev {
				struct adreno_device *adreno_dev,
				unsigned int *cmds);
	int (*preemption_init)(struct adreno_device *);
	void (*preemption_close)(struct adreno_device *);
	void (*preemption_schedule)(struct adreno_device *);
	int (*preemption_context_init)(struct kgsl_context *);
	void (*preemption_context_destroy)(struct kgsl_context *);
+1 −0
Original line number Diff line number Diff line
@@ -3642,6 +3642,7 @@ struct adreno_gpudev adreno_a5xx_gpudev = {
	.preemption_post_ibsubmit =
			a5xx_preemption_post_ibsubmit,
	.preemption_init = a5xx_preemption_init,
	.preemption_close = a5xx_preemption_close,
	.preemption_schedule = a5xx_preemption_schedule,
	.enable_64bit = a5xx_enable_64bit,
	.clk_set_options = a5xx_clk_set_options,
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2017,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
@@ -226,6 +226,7 @@ void a5xx_preemption_trigger(struct adreno_device *adreno_dev);
void a5xx_preemption_schedule(struct adreno_device *adreno_dev);
void a5xx_preemption_start(struct adreno_device *adreno_dev);
int a5xx_preemption_init(struct adreno_device *adreno_dev);
void a5xx_preemption_close(struct adreno_device *adreno_dev);
int a5xx_preemption_yield_enable(unsigned int *cmds);

unsigned int a5xx_preemption_post_ibsubmit(struct adreno_device *adreno_dev,
+13 −4
Original line number Diff line number Diff line
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2017,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
@@ -567,9 +567,9 @@ static void a5xx_preemption_iommu_close(struct adreno_device *adreno_dev)
}
#endif

static void a5xx_preemption_close(struct kgsl_device *device)
static void _preemption_close(struct adreno_device *adreno_dev)
{
	struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	struct adreno_preemption *preempt = &adreno_dev->preempt;
	struct adreno_ringbuffer *rb;
	unsigned int i;
@@ -583,6 +583,15 @@ static void a5xx_preemption_close(struct kgsl_device *device)
	}
}

void a5xx_preemption_close(struct adreno_device *adreno_dev)
{
	if (!test_bit(ADRENO_DEVICE_PREEMPTION, &adreno_dev->priv))
		return;

	_preemption_close(adreno_dev);
}


int a5xx_preemption_init(struct adreno_device *adreno_dev)
{
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
@@ -624,7 +633,7 @@ int a5xx_preemption_init(struct adreno_device *adreno_dev)

err:
	if (ret)
		a5xx_preemption_close(device);
		_preemption_close(adreno_dev);

	return ret;
}
Loading