panfrost: Add the sampled texture BO to the job

Submitted by Boris Brezillon on July 1, 2019, 3:23 p.m.

Details

Message ID 20190701152347.4595-1-boris.brezillon@collabora.com
State New
Headers show
Series "panfrost: Add the sampled texture BO to the job" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Boris Brezillon July 1, 2019, 3:23 p.m.
Otherwise we get random use-after-{free,unmap} errors.

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

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 bf98d3853f16..37207398e82b 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -816,6 +816,8 @@  panfrost_upload_tex(
                 struct panfrost_context *ctx,
                 struct panfrost_sampler_view *view)
 {
+        struct panfrost_job *job = panfrost_get_job_for_fbo(ctx);
+
         if (!view)
                 return (mali_ptr) NULL;
 
@@ -848,6 +850,7 @@  panfrost_upload_tex(
         for (unsigned l = first_level; l <= last_level; ++l) {
                 for (unsigned f = first_layer; f <= last_layer; ++f) {
 
+                        panfrost_job_add_bo(job, rsrc->bo);
                         view->hw.payload[idx++] =
                                 panfrost_get_texture_address(rsrc, l, f) + afbc_bit;
 

Comments


On Mon, 1 Jul 2019 08:28:03 -0700
Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> wrote:

> >  
> > @@ -848,6 +850,7 @@ panfrost_upload_tex(
> >          for (unsigned l = first_level; l <= last_level; ++l) {
> >                  for (unsigned f = first_layer; f <= last_layer; ++f) {
> >  
> > +                        panfrost_job_add_bo(job, rsrc->bo);
> >                          view->hw.payload[idx++] =
> >                                  panfrost_get_texture_address(rsrc, l, f) + afbc_bit;  
> 
> The bo is guaranteed to be the same for all levels and layers. So this
> should be pulled out of both loops.

Absolutely, guess I was to prompt at sending the patch.