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

Commit 41f7d7fc authored by Jeremy Gebben's avatar Jeremy Gebben Committed by Jordan Crouse
Browse files

msm: kgsl: allow creation of events from the future



For contexts created with the KGSL_CONTEXT_USER_GENERATED_TS,
allow events to be created for timestamps that have not
been issued yet. Presumably these contexts know what they
are doing.

Change-Id: Iccf2e549b38e1a11850d26ee64b7279ab0b8a1ae
Signed-off-by: default avatarJeremy Gebben <jgebben@codeaurora.org>
parent bfd49369
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -210,7 +210,7 @@ int kgsl_add_event(struct kgsl_device *device, u32 id, u32 ts,
	kgsl_event_func func, void *priv, void *owner)
{
	struct kgsl_event *event;
	unsigned int queued, cur_ts;
	unsigned int queued = 0, cur_ts;
	struct kgsl_context *context = NULL;

	BUG_ON(!mutex_is_locked(&device->mutex));
@@ -223,13 +223,21 @@ int kgsl_add_event(struct kgsl_device *device, u32 id, u32 ts,
		if (context == NULL)
			return -EINVAL;
	}

	kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_QUEUED, &queued);
	/*
	 * If the caller is creating their own timestamps, let them schedule
	 * events in the future. Otherwise only allow timestamps that have been
	 * queued.
	 */
	if (context == NULL ||
		((context->flags & KGSL_CONTEXT_USER_GENERATED_TS) == 0)) {
		kgsl_readtimestamp(device, context,
			KGSL_TIMESTAMP_QUEUED, &queued);

		if (timestamp_cmp(ts, queued) > 0) {
			kgsl_context_put(context);
			return -EINVAL;
		}
	}

	kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_RETIRED, &cur_ts);