Commit 5d6f0436 authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Thierry Reding

gpu: host1x: Don't complete a completed job

There is a chance that the last job has been completed at the time of
CDMA timeout handler invocation. In this case there is no need to complete
the completed job.
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 e8bad659
...@@ -383,7 +383,7 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, ...@@ -383,7 +383,7 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
{ {
struct host1x *host1x = cdma_to_host1x(cdma); struct host1x *host1x = cdma_to_host1x(cdma);
u32 restart_addr, syncpt_incrs, syncpt_val; u32 restart_addr, syncpt_incrs, syncpt_val;
struct host1x_job *job = NULL; struct host1x_job *job;
syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt);
...@@ -402,11 +402,16 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, ...@@ -402,11 +402,16 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
list_for_each_entry(job, &cdma->sync_queue, list) { list_for_each_entry(job, &cdma->sync_queue, list) {
if (syncpt_val < job->syncpt_end) if (syncpt_val < job->syncpt_end)
break; goto syncpt_incr;
host1x_job_dump(dev, job); host1x_job_dump(dev, job);
} }
/* all jobs have been completed */
job = NULL;
syncpt_incr:
/* /*
* Increment with CPU the remaining syncpts of a partially executed job. * Increment with CPU the remaining syncpts of a partially executed job.
* *
...@@ -419,16 +424,16 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, ...@@ -419,16 +424,16 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
* modified NOP-ed PB slots). This lets things appear to have completed * modified NOP-ed PB slots). This lets things appear to have completed
* properly for this buffer and resources are freed. * properly for this buffer and resources are freed.
*/ */
if (job)
dev_dbg(dev, "%s: perform CPU incr on pending buffers\n", __func__);
if (!list_empty(&cdma->sync_queue))
restart_addr = job->first_get; restart_addr = job->first_get;
else else
restart_addr = cdma->last_pos; restart_addr = cdma->last_pos;
/* do CPU increments for the remaining syncpts */ /* do CPU increments for the remaining syncpts */
if (job) { if (job) {
dev_dbg(dev, "%s: perform CPU incr on pending buffers\n",
__func__);
/* won't need a timeout when replayed */ /* won't need a timeout when replayed */
job->timeout = 0; job->timeout = 0;
...@@ -441,9 +446,10 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, ...@@ -441,9 +446,10 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
host1x_hw_cdma_timeout_cpu_incr(host1x, cdma, job->first_get, host1x_hw_cdma_timeout_cpu_incr(host1x, cdma, job->first_get,
syncpt_incrs, job->syncpt_end, syncpt_incrs, job->syncpt_end,
job->num_slots); job->num_slots);
}
dev_dbg(dev, "%s: finished sync_queue modification\n", __func__); dev_dbg(dev, "%s: finished sync_queue modification\n",
__func__);
}
/* roll back DMAGET and start up channel again */ /* roll back DMAGET and start up channel again */
host1x_hw_cdma_resume(host1x, cdma, restart_addr); host1x_hw_cdma_resume(host1x, cdma, restart_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment