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

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

Merge "msm: kgsl: allow creation of events from the future"

parents e666c223 41f7d7fc
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);