[v2,35/37] panfrost: Rename ctx->batches into ctx->fbo_to_batch

Submitted by Boris Brezillon on Sept. 16, 2019, 9:37 a.m.

Details

Message ID 20190916093715.32203-36-boris.brezillon@collabora.com
State New
Headers show
Series "panfrost: Support batch pipelining" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Boris Brezillon Sept. 16, 2019, 9:37 a.m.
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@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 +++++++++++----------
 3 files changed, 13 insertions(+), 12 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 90c7512b105f..b8f653bf8e72 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1361,7 +1361,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 df92b791a1f2..13d7e8086e62 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -134,9 +134,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
@@ -155,7 +155,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;
 
@@ -245,7 +245,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;
@@ -255,7 +256,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;
 }
@@ -877,7 +878,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);
@@ -892,7 +893,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);
@@ -1144,9 +1145,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);
 }

Comments

R-b

On Mon, Sep 16, 2019 at 11:37:13AM +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@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 +++++++++++----------
>  3 files changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
> index 90c7512b105f..b8f653bf8e72 100644
> --- a/src/gallium/drivers/panfrost/pan_context.c
> +++ b/src/gallium/drivers/panfrost/pan_context.c
> @@ -1361,7 +1361,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 df92b791a1f2..13d7e8086e62 100644
> --- a/src/gallium/drivers/panfrost/pan_job.c
> +++ b/src/gallium/drivers/panfrost/pan_job.c
> @@ -134,9 +134,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
> @@ -155,7 +155,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;
>  
> @@ -245,7 +245,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;
> @@ -255,7 +256,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;
>  }
> @@ -877,7 +878,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);
> @@ -892,7 +893,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);
> @@ -1144,9 +1145,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);
>  }
> -- 
> 2.21.0