[v2,03/37] panfrost: Add missing panfrost_batch_add_bo() calls

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

Details

Message ID 20190916093715.32203-4-boris.brezillon@collabora.com
State Accepted
Commit c16fb1f48dc349b0eb54bf12aab13a113fb2f29e
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:36 a.m.
Some BOs are used by batches but never explicitly added to the BO set.
This is currently not a problem because we wait for the execution of
a batch to be finished before releasing a BO, but we will soon relax
this rule.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
 src/gallium/drivers/panfrost/pan_context.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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 a063c16ab019..06a12662dd36 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -794,11 +794,12 @@  panfrost_map_constant_buffer_gpu(
 {
         struct pipe_constant_buffer *cb = &buf->cb[index];
         struct panfrost_resource *rsrc = pan_resource(cb->buffer);
+        struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
 
         if (rsrc) {
+                panfrost_batch_add_bo(batch, rsrc->bo);
                 return rsrc->bo->gpu;
 	} else if (cb->user_buffer) {
-                struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
                 return panfrost_upload_transient(batch, cb->user_buffer, cb->buffer_size);
 	} else {
                 unreachable("No constant buffer");
@@ -1113,6 +1114,8 @@  panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
 
                 struct panfrost_shader_state *ss = &all->variants[all->active_variant];
 
+                panfrost_batch_add_bo(batch, ss->bo);
+
                 /* Uniforms are implicitly UBO #0 */
                 bool has_uniforms = buf->enabled_mask & (1 << 0);
 

Comments

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>

On Mon, Sep 16, 2019 at 11:36:41AM +0200, Boris Brezillon wrote:
> Some BOs are used by batches but never explicitly added to the BO set.
> This is currently not a problem because we wait for the execution of
> a batch to be finished before releasing a BO, but we will soon relax
> this rule.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
>  src/gallium/drivers/panfrost/pan_context.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
> index a063c16ab019..06a12662dd36 100644
> --- a/src/gallium/drivers/panfrost/pan_context.c
> +++ b/src/gallium/drivers/panfrost/pan_context.c
> @@ -794,11 +794,12 @@ panfrost_map_constant_buffer_gpu(
>  {
>          struct pipe_constant_buffer *cb = &buf->cb[index];
>          struct panfrost_resource *rsrc = pan_resource(cb->buffer);
> +        struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
>  
>          if (rsrc) {
> +                panfrost_batch_add_bo(batch, rsrc->bo);
>                  return rsrc->bo->gpu;
>  	} else if (cb->user_buffer) {
> -                struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
>                  return panfrost_upload_transient(batch, cb->user_buffer, cb->buffer_size);
>  	} else {
>                  unreachable("No constant buffer");
> @@ -1113,6 +1114,8 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
>  
>                  struct panfrost_shader_state *ss = &all->variants[all->active_variant];
>  
> +                panfrost_batch_add_bo(batch, ss->bo);
> +
>                  /* Uniforms are implicitly UBO #0 */
>                  bool has_uniforms = buf->enabled_mask & (1 << 0);
>  
> -- 
> 2.21.0