panfrost: Add the sampled texture BO to the job
authorBoris Brezillon <boris.brezillon@collabora.com>
Mon, 1 Jul 2019 15:22:26 +0000 (17:22 +0200)
committerBoris Brezillon <boris.brezillon@collabora.com>
Tue, 2 Jul 2019 12:57:35 +0000 (14:57 +0200)
Otherwise we get random use-after-{free,unmap} errors.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
Changes in v2:
- Move the panfrost_job_add_bo() call out of the loop

src/gallium/drivers/panfrost/pan_context.c

index 88e70c9788189d1cff410a4cc8bc63400581646e..c78042d412d01458f13239917cd211bd2f49c111 100644 (file)
@@ -801,6 +801,10 @@ panfrost_upload_tex(
         bool is_zs = rsrc->base.bind & PIPE_BIND_DEPTH_STENCIL;
         unsigned afbc_bit = (is_afbc && !is_zs) ? 1 : 0;
 
+       /* Add the BO to the job so it's retained until the job is done. */
+        struct panfrost_job *job = panfrost_get_job_for_fbo(ctx);
+        panfrost_job_add_bo(job, rsrc->bo);
+
         /* Inject the addresses in, interleaving mip levels, cube faces, and
          * strides in that order */