[1/9] panfrost: Get rid of ctx->job

Submitted by Boris Brezillon on Aug. 2, 2019, 10:12 a.m.

Details

Message ID 20190802101257.10495-2-boris.brezillon@collabora.com
State New
Headers show
Series "panfrost: Allocate the polygon lists on-demand" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Boris Brezillon Aug. 2, 2019, 10:12 a.m.
This field is never set to anything but NULL, which means the test
done in panfrost_free_job() and panfrost_get_job_for_fbo() will always
evaluate to false. Let's get rid of this field.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
 src/gallium/drivers/panfrost/pan_context.h | 3 +--
 src/gallium/drivers/panfrost/pan_job.c     | 8 --------
 2 files changed, 1 insertion(+), 10 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index d930f12a537b..a90dbb04e833 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -95,8 +95,7 @@  struct panfrost_context {
         /* Compiler context */
         struct midgard_screen compiler;
 
-        /* Bound job and map of panfrost_job_key to jobs */
-        struct panfrost_job *job;
+        /* Map of panfrost_job_key to jobs */
         struct hash_table *jobs;
 
         /* panfrost_resource -> panfrost_job */
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index 6339b39d29a0..960c8556e2f0 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -72,9 +72,6 @@  panfrost_free_job(struct panfrost_context *ctx, struct panfrost_job *job)
 
         _mesa_hash_table_remove_key(ctx->jobs, &job->key);
 
-        if (ctx->job == job)
-                ctx->job = NULL;
-
         ralloc_free(job);
 }
 
@@ -122,11 +119,6 @@  panfrost_get_job_for_fbo(struct panfrost_context *ctx)
         if (ctx->wallpaper_batch)
                 return ctx->wallpaper_batch;
 
-        /* If we already began rendering, use that */
-
-        if (ctx->job)
-                return ctx->job;
-
         /* If not, look up the job */
 
         struct pipe_surface **cbufs = ctx->pipe_framebuffer.cbufs;

Comments


On Fri, 2 Aug 2019 07:59:02 -0700
Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> wrote:

> Theoretically we were supposed to set ctx->job to the current job, I
> guess cacheing the result of panfrost_get_job_for_fbo()
> 
> See v3d's implementation which this is a carbon clone of.

Okay, so it's something we want to have to avoid the search into the
hash table? If we do that, we should at least check that the keys match
before returning the current job.

> 
> On Fri, Aug 02, 2019 at 12:12:49PM +0200, Boris Brezillon wrote:
> > This field is never set to anything but NULL, which means the test
> > done in panfrost_free_job() and panfrost_get_job_for_fbo() will always
> > evaluate to false. Let's get rid of this field.
> > 
> > Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> > ---
> >  src/gallium/drivers/panfrost/pan_context.h | 3 +--
> >  src/gallium/drivers/panfrost/pan_job.c     | 8 --------
> >  2 files changed, 1 insertion(+), 10 deletions(-)
> > 
> > diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
> > index d930f12a537b..a90dbb04e833 100644
> > --- a/src/gallium/drivers/panfrost/pan_context.h
> > +++ b/src/gallium/drivers/panfrost/pan_context.h
> > @@ -95,8 +95,7 @@ struct panfrost_context {
> >          /* Compiler context */
> >          struct midgard_screen compiler;
> >  
> > -        /* Bound job and map of panfrost_job_key to jobs */
> > -        struct panfrost_job *job;
> > +        /* Map of panfrost_job_key to jobs */
> >          struct hash_table *jobs;
> >  
> >          /* panfrost_resource -> panfrost_job */
> > diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
> > index 6339b39d29a0..960c8556e2f0 100644
> > --- a/src/gallium/drivers/panfrost/pan_job.c
> > +++ b/src/gallium/drivers/panfrost/pan_job.c
> > @@ -72,9 +72,6 @@ panfrost_free_job(struct panfrost_context *ctx, struct panfrost_job *job)
> >  
> >          _mesa_hash_table_remove_key(ctx->jobs, &job->key);
> >  
> > -        if (ctx->job == job)
> > -                ctx->job = NULL;
> > -
> >          ralloc_free(job);
> >  }
> >  
> > @@ -122,11 +119,6 @@ panfrost_get_job_for_fbo(struct panfrost_context *ctx)
> >          if (ctx->wallpaper_batch)
> >                  return ctx->wallpaper_batch;
> >  
> > -        /* If we already began rendering, use that */
> > -
> > -        if (ctx->job)
> > -                return ctx->job;
> > -
> >          /* If not, look up the job */
> >  
> >          struct pipe_surface **cbufs = ctx->pipe_framebuffer.cbufs;
> > -- 
> > 2.21.0
> >