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

Commit 0b51b3a7 authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Track the submitted timestamp for a draw context



Track the last timestamp that each draw context has submitted to
the ringbuffer.  This complete the picture for the draw context
dump:

kgsl-3d0: context[13]: queue=165, submit=115, start=101, retire=100

here, timestamp 165-116 are on the queue, 115-102 are on the
ringbuffer, 101 is in the GPU and 100 and older have been retired.
If we get a fence timeout with this data we can easily see where the
fence timestamp is in the pipeline.

Change-Id: Ic0dedbadf54c1714296149af02b6938eef375d50
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent a56ef037
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -578,6 +578,7 @@ static int dispatcher_context_sendcmds(struct adreno_device *adreno_dev,
	int count = 0;
	int ret = 0;
	int inflight = _cmdqueue_inflight(dispatch_q);
	unsigned int timestamp;

	if (dispatch_q->inflight >= inflight)
		return -EBUSY;
@@ -619,6 +620,8 @@ static int dispatcher_context_sendcmds(struct adreno_device *adreno_dev,
			continue;
		}

		timestamp = cmdbatch->timestamp;

		ret = sendcmd(adreno_dev, cmdbatch);

		/*
@@ -635,6 +638,8 @@ static int dispatcher_context_sendcmds(struct adreno_device *adreno_dev,
			break;
		}

		drawctxt->submitted_timestamp = timestamp;

		count++;
	}

@@ -958,7 +963,7 @@ int adreno_dispatcher_queue_cmd(struct adreno_device *adreno_dev,
		 */

		if (!drawctxt->queued && kgsl_check_timestamp(cmdbatch->device,
			cmdbatch->context, drawctxt->inflight_timestamp)) {
			cmdbatch->context, drawctxt->queued_timestamp)) {
			trace_adreno_cmdbatch_queued(cmdbatch,
				drawctxt->queued);

@@ -973,12 +978,12 @@ int adreno_dispatcher_queue_cmd(struct adreno_device *adreno_dev,
		 * comes along and forces the marker to execute)
		 */

		cmdbatch->marker_timestamp = drawctxt->inflight_timestamp;
		cmdbatch->marker_timestamp = drawctxt->queued_timestamp;
	}

	/* SYNC commands have timestamp 0 and will get optimized out anyway */
	if (!(cmdbatch->flags & KGSL_CONTEXT_SYNC))
		drawctxt->inflight_timestamp = *timestamp;
		drawctxt->queued_timestamp = *timestamp;

	/*
	 * Set the fault tolerance policy for the command batch - assuming the
+3 −2
Original line number Diff line number Diff line
@@ -68,8 +68,9 @@ void adreno_drawctxt_dump(struct kgsl_device *device,
	kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_RETIRED, &retire);

	dev_err(device->dev,
		"  context[%d]: queue=%d, start=%d, retire=%d\n",
		context->id, queue, start, retire);
		"  context[%d]: queue=%d, submit=%d, start=%d, retire=%d\n",
		context->id, queue, drawctxt->submitted_timestamp,
		start, retire);

	if (drawctxt->cmdqueue_head != drawctxt->cmdqueue_tail) {
		struct kgsl_cmdbatch *cmdbatch =
+4 −2
Original line number Diff line number Diff line
@@ -43,8 +43,9 @@ struct kgsl_context;
 * @queued: Number of commands queued in the cmdqueue
 * @fault_policy: GFT fault policy set in cmdbatch_skip_cmd();
 * @debug_root: debugfs entry for this context.
 * @inflight_timestamp: The last timestamp that was queued on this context
 * @queued_timestamp: The last timestamp that was queued on this context
 * @rb: The ringbuffer in which this context submits commands.
 * @submitted_timestamp: The last timestamp that was submitted for this context
 */
struct adreno_context {
	struct kgsl_context base;
@@ -65,8 +66,9 @@ struct adreno_context {
	int queued;
	unsigned int fault_policy;
	struct dentry *debug_root;
	unsigned int inflight_timestamp;
	unsigned int queued_timestamp;
	struct adreno_ringbuffer *rb;
	unsigned int submitted_timestamp;
};

/**