From 0eb84eb7023432e20a151d5742e7168faefdafde Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 13 Dec 2019 14:12:48 -0500 Subject: [PATCH] panfrost: Don't double-create scratchpad Signed-off-by: Alyssa Rosenzweig Fixes: 4f7fddbd716 ("panfrost: Pass size to panfrost_batch_get_scratchpad") Tested-by: Marge Bot Part-of: --- src/gallium/drivers/panfrost/pan_job.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index 5722f4a1f31..b193ce6fa76 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -646,12 +646,18 @@ panfrost_batch_get_scratchpad(struct panfrost_batch *batch, thread_tls_alloc, core_count); - return panfrost_batch_create_bo(batch, size, + if (batch->scratchpad) { + assert(batch->scratchpad->size >= size); + } else { + batch->scratchpad = panfrost_batch_create_bo(batch, size, PAN_BO_INVISIBLE, PAN_BO_ACCESS_PRIVATE | PAN_BO_ACCESS_RW | PAN_BO_ACCESS_VERTEX_TILER | PAN_BO_ACCESS_FRAGMENT); + } + + return batch->scratchpad; } struct panfrost_bo * -- 2.30.2