panfrost: Fix tiler job injection

When injecting a tiler job, we shouln't make it depend on the last tiler
job, but instead make the first tiler job depend on it.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7206>
This commit is contained in:
Boris Brezillon 2020-10-17 10:51:24 +02:00 committed by Marge Bot
parent 519643bbe0
commit 2f1947b39c
2 changed files with 30 additions and 5 deletions

View File

@ -115,6 +115,7 @@ panfrost_add_job(
const struct panfrost_transfer *job,
bool inject)
{
bool is_bifrost = !!(pool->dev->quirks & IS_BIFROST);
unsigned global_dep = 0;
if (type == MALI_JOB_TYPE_TILER) {
@ -122,12 +123,13 @@ panfrost_add_job(
* job must depend on the write value job, whose index we
* reserve now */
if (scoreboard->tiler_dep)
global_dep = scoreboard->tiler_dep;
else if (!(pool->dev->quirks & IS_BIFROST)) {
if (is_bifrost && !scoreboard->write_value_index)
scoreboard->write_value_index = ++scoreboard->job_index;
if (scoreboard->tiler_dep && !inject)
global_dep = scoreboard->tiler_dep;
else if (is_bifrost)
global_dep = scoreboard->write_value_index;
}
}
/* Assign the index */
@ -145,13 +147,30 @@ panfrost_add_job(
}
if (inject) {
if (type == MALI_JOB_TYPE_TILER) {
if (scoreboard->first_tiler) {
/* Manual update of the dep2 field. This is bad,
* don't copy this pattern.
*/
scoreboard->first_tiler->opaque[5] =
scoreboard->first_tiler_dep1 | (index << 16);
}
scoreboard->first_tiler = (void *)job->cpu;
scoreboard->first_tiler_dep1 = local_dep;
}
scoreboard->first_job = job->gpu;
return index;
}
/* Form a chain */
if (type == MALI_JOB_TYPE_TILER)
if (type == MALI_JOB_TYPE_TILER) {
if (!scoreboard->first_tiler) {
scoreboard->first_tiler = (void *)job->cpu;
scoreboard->first_tiler_dep1 = local_dep;
}
scoreboard->tiler_dep = index;
}
if (scoreboard->prev_job) {
/* Manual update of the next pointer. This is bad, don't copy

View File

@ -40,6 +40,12 @@ struct pan_scoreboard {
/* A CPU-side pointer to the previous job for next_job linking */
struct mali_job_header_packed *prev_job;
/* A CPU-side pointer to the first tiler job for dep updates when
* injecting a reload tiler job.
*/
struct mali_job_header_packed *first_tiler;
uint32_t first_tiler_dep1;
/* The dependency for tiler jobs (i.e. the index of the last emitted
* tiler job, or zero if none have been emitted) */
unsigned tiler_dep;