[Mesa-dev] [PATCH v3 15/17] panfrost: Rename ctx->batches into ctx->fbo_to_batch

Alyssa Rosenzweig alyssa at rosenzweig.io
Fri Sep 20 21:09:42 UTC 2019


R-b
On Wed, Sep 18, 2019 at 03:24:37PM +0200, Boris Brezillon wrote:
> We are about to add a batch queue to keep track of submission order.
> Let's rename the existing batches hash table (which is used to get the
> batch attached to an FBO) into fbo_to_batch to avoid confusion.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
> ---
>  src/gallium/drivers/panfrost/pan_context.c  |  2 +-
>  src/gallium/drivers/panfrost/pan_context.h  |  2 +-
>  src/gallium/drivers/panfrost/pan_job.c      | 21 +++++++++++----------
>  src/gallium/drivers/panfrost/pan_resource.c | 16 ++++++++--------
>  4 files changed, 21 insertions(+), 20 deletions(-)
> 
> diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
> index 07bafad58a00..0330b5852676 100644
> --- a/src/gallium/drivers/panfrost/pan_context.c
> +++ b/src/gallium/drivers/panfrost/pan_context.c
> @@ -1355,7 +1355,7 @@ panfrost_flush(
>           */
>          if (fence) {
>                  util_dynarray_init(&fences, NULL);
> -                hash_table_foreach(ctx->batches, hentry) {
> +                hash_table_foreach(ctx->fbo_to_batch, hentry) {
>                          struct panfrost_batch *batch = hentry->data;
>  
>                          panfrost_batch_fence_reference(batch->out_sync);
> diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
> index d50ed57d5d8a..f13967f51b46 100644
> --- a/src/gallium/drivers/panfrost/pan_context.h
> +++ b/src/gallium/drivers/panfrost/pan_context.h
> @@ -112,7 +112,7 @@ struct panfrost_context {
>  
>          /* Bound job batch and map of panfrost_batch_key to job batches */
>          struct panfrost_batch *batch;
> -        struct hash_table *batches;
> +        struct hash_table *fbo_to_batch;
>  
>          /* panfrost_bo -> panfrost_bo_access */
>          struct hash_table *accessed_bos;
> diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
> index a56f4044fda0..45f9d9d24b41 100644
> --- a/src/gallium/drivers/panfrost/pan_job.c
> +++ b/src/gallium/drivers/panfrost/pan_job.c
> @@ -132,9 +132,9 @@ panfrost_freeze_batch(struct panfrost_batch *batch)
>           * matches. This way, next draws/clears targeting this FBO will trigger
>           * the creation of a new batch.
>           */
> -        entry = _mesa_hash_table_search(ctx->batches, &batch->key);
> +        entry = _mesa_hash_table_search(ctx->fbo_to_batch, &batch->key);
>          if (entry && entry->data == batch)
> -                _mesa_hash_table_remove(ctx->batches, entry);
> +                _mesa_hash_table_remove(ctx->fbo_to_batch, entry);
>  
>          /* If this is the bound batch, the panfrost_context parameters are
>           * relevant so submitting it invalidates those parameters, but if it's
> @@ -153,7 +153,7 @@ static bool panfrost_batch_is_frozen(struct panfrost_batch *batch)
>          struct panfrost_context *ctx = batch->ctx;
>          struct hash_entry *entry;
>  
> -        entry = _mesa_hash_table_search(ctx->batches, &batch->key);
> +        entry = _mesa_hash_table_search(ctx->fbo_to_batch, &batch->key);
>          if (entry && entry->data == batch)
>                  return false;
>  
> @@ -248,7 +248,8 @@ panfrost_get_batch(struct panfrost_context *ctx,
>                     const struct pipe_framebuffer_state *key)
>  {
>          /* Lookup the job first */
> -        struct hash_entry *entry = _mesa_hash_table_search(ctx->batches, key);
> +        struct hash_entry *entry = _mesa_hash_table_search(ctx->fbo_to_batch,
> +                                                           key);
>  
>          if (entry)
>                  return entry->data;
> @@ -258,7 +259,7 @@ panfrost_get_batch(struct panfrost_context *ctx,
>          struct panfrost_batch *batch = panfrost_create_batch(ctx, key);
>  
>          /* Save the created job */
> -        _mesa_hash_table_insert(ctx->batches, &batch->key, batch);
> +        _mesa_hash_table_insert(ctx->fbo_to_batch, &batch->key, batch);
>  
>          return batch;
>  }
> @@ -915,7 +916,7 @@ panfrost_flush_all_batches(struct panfrost_context *ctx, bool wait)
>                  util_dynarray_init(&syncobjs, NULL);
>          }
>  
> -        hash_table_foreach(ctx->batches, hentry) {
> +        hash_table_foreach(ctx->fbo_to_batch, hentry) {
>                  struct panfrost_batch *batch = hentry->data;
>  
>                  assert(batch);
> @@ -931,7 +932,7 @@ panfrost_flush_all_batches(struct panfrost_context *ctx, bool wait)
>                  panfrost_batch_submit(batch);
>          }
>  
> -        assert(!ctx->batches->entries);
> +        assert(!ctx->fbo_to_batch->entries);
>  
>          /* Collect batch fences before returning */
>          panfrost_gc_fences(ctx);
> @@ -1183,9 +1184,9 @@ panfrost_batch_is_scanout(struct panfrost_batch *batch)
>  void
>  panfrost_batch_init(struct panfrost_context *ctx)
>  {
> -        ctx->batches = _mesa_hash_table_create(ctx,
> -                                               panfrost_batch_hash,
> -                                               panfrost_batch_compare);
> +        ctx->fbo_to_batch = _mesa_hash_table_create(ctx,
> +                                                    panfrost_batch_hash,
> +                                                    panfrost_batch_compare);
>          ctx->accessed_bos = _mesa_hash_table_create(ctx, _mesa_hash_pointer,
>                                                      _mesa_key_pointer_equal);
>  }
> diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
> index d59529ff15b7..49088618ae4b 100644
> --- a/src/gallium/drivers/panfrost/pan_resource.c
> +++ b/src/gallium/drivers/panfrost/pan_resource.c
> @@ -592,11 +592,11 @@ panfrost_transfer_map(struct pipe_context *pctx,
>                  /* No flush for writes to uninitialized */
>          } else if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) {
>                  if (usage & PIPE_TRANSFER_WRITE) {
> -                        panfrost_flush_batches_accessing_bo(ctx, bo, PAN_BO_GPU_ACCESS_RW);
> -                        panfrost_bo_wait(bo, INT64_MAX, PAN_BO_GPU_ACCESS_RW);
> +                        panfrost_flush_batches_accessing_bo(ctx, bo, PAN_BO_ACCESS_RW);
> +                        panfrost_bo_wait(bo, INT64_MAX, PAN_BO_ACCESS_RW);
>                  } else if (usage & PIPE_TRANSFER_READ) {
> -                        panfrost_flush_batches_accessing_bo(ctx, bo, PAN_BO_GPU_ACCESS_WRITE);
> -                        panfrost_bo_wait(bo, INT64_MAX, PAN_BO_GPU_ACCESS_WRITE);
> +                        panfrost_flush_batches_accessing_bo(ctx, bo, PAN_BO_ACCESS_WRITE);
> +                        panfrost_bo_wait(bo, INT64_MAX, PAN_BO_ACCESS_WRITE);
>                  } else {
>                          /* Why are you even mapping?! */
>                  }
> @@ -746,8 +746,8 @@ panfrost_generate_mipmap(
>           * reorder-type optimizations in place. But for now prioritize
>           * correctness. */
>  
> -        panfrost_flush_batches_accessing_bo(ctx, rsrc->bo, PAN_BO_GPU_ACCESS_RW);
> -        panfrost_bo_wait(rsrc->bo, INT64_MAX, PAN_BO_GPU_ACCESS_RW);
> +        panfrost_flush_batches_accessing_bo(ctx, rsrc->bo, PAN_BO_ACCESS_RW);
> +        panfrost_bo_wait(rsrc->bo, INT64_MAX, PAN_BO_ACCESS_RW);
>  
>          /* We've flushed the original buffer if needed, now trigger a blit */
>  
> @@ -761,8 +761,8 @@ panfrost_generate_mipmap(
>           * the state tracker deal with it. */
>  
>          if (blit_res) {
> -                panfrost_flush_batches_accessing_bo(ctx, rsrc->bo, PAN_BO_GPU_ACCESS_WRITE);
> -                panfrost_bo_wait(rsrc->bo, INT64_MAX, PAN_BO_GPU_ACCESS_WRITE);
> +                panfrost_flush_batches_accessing_bo(ctx, rsrc->bo, PAN_BO_ACCESS_WRITE);
> +                panfrost_bo_wait(rsrc->bo, INT64_MAX, PAN_BO_ACCESS_WRITE);
>          }
>  
>          return blit_res;
> -- 
> 2.21.0


More information about the mesa-dev mailing list