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

Commit 79930baf authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Thierry Reding
Browse files

gpu: host1x: Continue CDMA execution starting with a next job



Currently gathers of a hung job are getting NOP'ed and a restarted CDMA
executes the NOP'ed gathers. There shouldn't be a reason to not restart
CDMA execution starting with a next job, avoiding the unnecessary churning
with gathers NOP'ing.

Signed-off-by: default avatarDmitry Osipenko <digetx@gmail.com>
Reviewed-by: default avatarMikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 5d6f0436
Loading
Loading
Loading
Loading
+11 −12
Original line number Diff line number Diff line
@@ -383,7 +383,7 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
{
	struct host1x *host1x = cdma_to_host1x(cdma);
	u32 restart_addr, syncpt_incrs, syncpt_val;
	struct host1x_job *job;
	struct host1x_job *job, *next_job = NULL;

	syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt);

@@ -401,8 +401,13 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
		__func__);

	list_for_each_entry(job, &cdma->sync_queue, list) {
		if (syncpt_val < job->syncpt_end)
		if (syncpt_val < job->syncpt_end) {

			if (!list_is_last(&job->list, &cdma->sync_queue))
				next_job = list_next_entry(job, list);

			goto syncpt_incr;
		}

		host1x_job_dump(dev, job);
	}
@@ -415,17 +420,11 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
	/*
	 * Increment with CPU the remaining syncpts of a partially executed job.
	 *
	 * Syncpt increments must be done inline with the pushbuffer from a
	 * GATHER buffer to maintain the order (slots are modified to be a
	 * GATHER of syncpt incrs).
	 *
	 * Note: save in restart_addr the location where the timed out buffer
	 * started in the PB, so we can start the refetch from there (with the
	 * modified NOP-ed PB slots). This lets things appear to have completed
	 * properly for this buffer and resources are freed.
	 * CDMA will continue execution starting with the next job or will get
	 * into idle state.
	 */
	if (job)
		restart_addr = job->first_get;
	if (next_job)
		restart_addr = next_job->first_get;
	else
		restart_addr = cdma->last_pos;

+0 −14
Original line number Diff line number Diff line
@@ -39,8 +39,6 @@ static void push_buffer_init(struct push_buffer *pb)
static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
				u32 syncpt_incrs, u32 syncval, u32 nr_slots)
{
	struct host1x *host1x = cdma_to_host1x(cdma);
	struct push_buffer *pb = &cdma->push_buffer;
	unsigned int i;

	for (i = 0; i < syncpt_incrs; i++)
@@ -48,18 +46,6 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,

	/* after CPU incr, ensure shadow is up to date */
	host1x_syncpt_load(cdma->timeout.syncpt);

	/* NOP all the PB slots */
	while (nr_slots--) {
		u32 *p = (u32 *)(pb->mapped + getptr);
		*(p++) = HOST1X_OPCODE_NOP;
		*(p++) = HOST1X_OPCODE_NOP;
		dev_dbg(host1x->dev, "%s: NOP at %pad+%#x\n", __func__,
			&pb->dma, getptr);
		getptr = (getptr + 8) & (pb->size - 1);
	}

	wmb();
}

/*