panfrost: Hoist add_fbo_bo call
[mesa.git] / src / gallium / drivers / panfrost / pan_job.c
index 0b6ffd0d329b456ffca7d07c14e9331129a16a26..b0665da6b6ea44e3a06c06d1ca4a150a0339576d 100644 (file)
@@ -92,6 +92,9 @@ panfrost_batch_fence_reference(struct panfrost_batch_fence *fence)
         pipe_reference(NULL, &fence->reference);
 }
 
+static void
+panfrost_batch_add_fbo_bos(struct panfrost_batch *batch);
+
 static struct panfrost_batch *
 panfrost_create_batch(struct panfrost_context *ctx,
                       const struct pipe_framebuffer_state *key)
@@ -111,6 +114,8 @@ panfrost_create_batch(struct panfrost_context *ctx,
 
         batch->pool = panfrost_create_pool(batch, pan_device(ctx->base.screen));
 
+        panfrost_batch_add_fbo_bos(batch);
+
         return batch;
 }
 
@@ -121,22 +126,15 @@ panfrost_freeze_batch(struct panfrost_batch *batch)
         struct hash_entry *entry;
 
         /* Remove the entry in the FBO -> batch hash table if the batch
-         * matches. This way, next draws/clears targeting this FBO will trigger
-         * the creation of a new batch.
+         * matches and drop the context reference. 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);
         if (entry && entry->data == batch)
                 _mesa_hash_table_remove(ctx->batches, entry);
 
-        /* If this is the bound batch, the panfrost_context parameters are
-         * relevant so submitting it invalidates those parameters, but if it's
-         * not bound, the context parameters are for some other batch so we
-         * can't invalidate them.
-         */
-        if (ctx->batch == batch) {
-                panfrost_invalidate_frame(ctx);
+        if (ctx->batch == batch)
                 ctx->batch = NULL;
-        }
 }
 
 #ifdef PAN_BATCH_DEBUG
@@ -566,7 +564,8 @@ panfrost_batch_add_resource_bos(struct panfrost_batch *batch,
                 panfrost_batch_add_bo(batch, rsrc->separate_stencil->bo, flags);
 }
 
-void panfrost_batch_add_fbo_bos(struct panfrost_batch *batch)
+static void
+panfrost_batch_add_fbo_bos(struct panfrost_batch *batch)
 {
         uint32_t flags = PAN_BO_ACCESS_SHARED | PAN_BO_ACCESS_WRITE |
                          PAN_BO_ACCESS_VERTEX_TILER |
@@ -836,15 +835,15 @@ panfrost_load_surface(struct panfrost_batch *batch, struct pipe_surface *surf, u
                 format = util_format_stencil_only(format);
         }
 
-        enum mali_texture_type type =
-                panfrost_translate_texture_type(rsrc->base.target);
+        enum mali_texture_dimension dim =
+                panfrost_translate_texture_dimension(rsrc->base.target);
 
         struct pan_image img = {
                 .width0 = rsrc->base.width0,
                 .height0 = rsrc->base.height0,
                 .depth0 = rsrc->base.depth0,
                 .format = format,
-                .type = type,
+                .dim = dim,
                 .modifier = rsrc->modifier,
                 .array_size = rsrc->base.array_size,
                 .first_level = level,
@@ -1208,7 +1207,7 @@ panfrost_batch_set_requirements(struct panfrost_batch *batch)
 {
         struct panfrost_context *ctx = batch->ctx;
 
-        if (ctx->rasterizer && ctx->rasterizer->base.multisample)
+        if (ctx->rasterizer->base.multisample)
                 batch->requirements |= PAN_REQ_MSAA;
 
         if (ctx->depth_stencil && ctx->depth_stencil->base.depth.writemask) {