const struct pipe_framebuffer_state *key)
{
struct panfrost_batch *batch = rzalloc(ctx, struct panfrost_batch);
+ struct panfrost_device *dev = pan_device(ctx->base.screen);
batch->ctx = ctx;
batch->out_sync = panfrost_create_batch_fence(batch);
util_copy_framebuffer_state(&batch->key, key);
- batch->pool = panfrost_create_pool(batch, pan_device(ctx->base.screen), 0, true);
+ /* Preallocate the main pool, since every batch has at least one job
+ * structure so it will be used */
+ batch->pool = panfrost_create_pool(batch, dev, 0, true);
+
+ /* Don't preallocate the invisible pool, since not every batch will use
+ * the pre-allocation, particularly if the varyings are larger than the
+ * preallocation and a reallocation is needed after anyway. */
+ batch->invisible_pool =
+ panfrost_create_pool(batch, dev, PAN_BO_INVISIBLE, false);
panfrost_batch_add_fbo_bos(batch);
hash_table_foreach(batch->pool.bos, entry)
panfrost_bo_unreference((struct panfrost_bo *)entry->key);
+ hash_table_foreach(batch->invisible_pool.bos, entry)
+ panfrost_bo_unreference((struct panfrost_bo *)entry->key);
+
util_dynarray_foreach(&batch->dependencies,
struct panfrost_batch_fence *, dep) {
panfrost_batch_fence_unreference(*dep);
submit.jc = first_job_desc;
submit.requirements = reqs;
- bo_handles = calloc(batch->pool.bos->entries + batch->bos->entries, sizeof(*bo_handles));
+ bo_handles = calloc(batch->pool.bos->entries + batch->invisible_pool.bos->entries + batch->bos->entries, sizeof(*bo_handles));
assert(bo_handles);
hash_table_foreach(batch->bos, entry)
hash_table_foreach(batch->pool.bos, entry)
panfrost_batch_record_bo(entry, bo_handles, submit.bo_handle_count++);
+ hash_table_foreach(batch->invisible_pool.bos, entry)
+ panfrost_batch_record_bo(entry, bo_handles, submit.bo_handle_count++);
+
submit.bo_handles = (u64) (uintptr_t) bo_handles;
ret = drmIoctl(dev->fd, DRM_IOCTL_PANFROST_SUBMIT, &submit);
free(bo_handles);