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

Commit 5f0c3f08 authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Allow sync points to be created on the submitter's context



There are situations where a submitting thread may wish to create a
syncpoint on an already issued timestamp to pause a context until a
previous command has been retired.  Relax the restriction against
submitting a sync point against one's own context and only check to
make sure the user isn't submitting a syncpoint against a future
timestamp (which would be a certain deadlock).

Change-Id: Ic0dedbad883fc228da0d94c8416a88504f5d1377
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent a650b745
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -1634,13 +1634,24 @@ static int kgsl_cmdbatch_add_sync_timestamp(struct kgsl_device *device,
	if (context == NULL)
		return -EINVAL;

	/* Sanity check - you can't create a sync point on your own context */
	/*
	 * We allow somebody to create a sync point on their own context.
	 * This has the effect of delaying a command from submitting until the
	 * dependent command has cleared.  That said we obviously can't let them
	 * create a sync point on a future timestamp.
	 */

	if (context == cmdbatch->context) {
		unsigned int queued = kgsl_readtimestamp(device, context,
			KGSL_TIMESTAMP_QUEUED);

		if (timestamp_cmp(sync->timestamp, queued) > 0) {
			KGSL_DRV_ERR(device,
			"Cannot create a sync point on your own context %d\n",
			context->id);
			"Cannot create syncpoint for future timestamp %d (current %d)\n",
				sync->timestamp, queued);
			goto done;
		}
	}

	event = kzalloc(sizeof(*event), GFP_KERNEL);
	if (event == NULL) {