[Mesa-dev] [PATCH v2 30/37] panfrost: Add a panfrost_flush_all_batches() helper

Alyssa Rosenzweig alyssa at rosenzweig.io
Mon Sep 16 20:23:33 UTC 2019


> diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c
> index 4639c1b03c38..036dffbb17be 100644
> --- a/src/gallium/drivers/panfrost/pan_compute.c
> +++ b/src/gallium/drivers/panfrost/pan_compute.c
> @@ -133,7 +133,7 @@ panfrost_launch_grid(struct pipe_context *pipe,
>          /* Queue the job */
>          panfrost_scoreboard_queue_compute_job(batch, transfer);
>  
> -        panfrost_flush(pipe, NULL, PIPE_FLUSH_END_OF_FRAME);
> +        panfrost_flush_all_batches(ctx, true);

This flush should probably go away...?

Originally, the issue is that we would submit a compute batch and then
read the results (SSBO) immediately after, and it wouldn't be ready.

But now, I think, doing a transfer_map() on the SSBO causes all the
batches writing that SSBO to be flushed, so we get this for free.

Though for now this is fine, just don't want this to get forgotten
about.

>          case PIPE_QUERY_OCCLUSION_PREDICATE:
>          case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
>                  /* Flush first */
> -                panfrost_flush(pipe, NULL, PIPE_FLUSH_END_OF_FRAME);
> +                panfrost_flush_all_batches(ctx, true);
>  
>                  /* Read back the query results */
>                  unsigned *result = (unsigned *) query->transfer.cpu;
> @@ -2583,7 +2588,7 @@ panfrost_get_query_result(struct pipe_context *pipe,
>  
>          case PIPE_QUERY_PRIMITIVES_GENERATED:
>          case PIPE_QUERY_PRIMITIVES_EMITTED:
> -                panfrost_flush(pipe, NULL, PIPE_FLUSH_END_OF_FRAME);
> +                panfrost_flush_all_batches(ctx, true);
>                  vresult->u64 = query->end - query->start;
>                  break;

Oh gosh this is so bad don't remind me I wrote this awful code >.<

> +                }
> +                panfrost_batch_submit(batch);

Nit: blank line between.


---

So uh R-b I guess :p


More information about the mesa-dev mailing list