[Mesa-dev] [PATCH 02/10] i965: Reduce the scope of input in buffer tex setup

Pohjolainen, Topi topi.pohjolainen at intel.com
Wed Jul 15 00:08:41 PDT 2015


On Tue, Jul 14, 2015 at 04:48:19PM -0700, Ben Widawsky wrote:
> On Wed, Jul 01, 2015 at 02:46:32PM +0300, Topi Pohjolainen wrote:
> > Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> 
> I swear I am not trying to nitpick but I don't actually understand what your
> goal of the patch is. Could you maybe elaborate a bit on what "reduce the scope
> of input in.."

That does reserve an explanation. Before this patch the call was given
the texture unit and the call resolved the texture object using it. Now,
the texture object is given directly and hence the scope of input arguments
can be thought to shrink as the call isn't aware of the set of texture
objects anymore.

I agree that the title is misleading and should be instead something on the
lines:

    i965: Pass the tex object directly to surface setup

> 
> > ---
> >  src/mesa/drivers/dri/i965/brw_context.h           | 4 ++--
> >  src/mesa/drivers/dri/i965/brw_wm_surface_state.c  | 8 +++-----
> >  src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 2 +-
> >  src/mesa/drivers/dri/i965/gen8_surface_state.c    | 2 +-
> >  4 files changed, 7 insertions(+), 9 deletions(-)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
> > index ae29798..da018bf 100644
> > --- a/src/mesa/drivers/dri/i965/brw_context.h
> > +++ b/src/mesa/drivers/dri/i965/brw_context.h
> > @@ -1710,8 +1710,8 @@ void brw_create_constant_surface(struct brw_context *brw,
> >                                   uint32_t size,
> >                                   uint32_t *out_offset,
> >                                   bool dword_pitch);
> > -void brw_update_buffer_texture_surface(struct gl_context *ctx,
> > -                                       unsigned unit,
> > +void brw_update_buffer_texture_surface(struct brw_context *brw,
> > +                                       struct gl_texture_object *tObj,
> >                                         uint32_t *surf_offset);
> >  void
> >  brw_update_sol_surface(struct brw_context *brw,
> > diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> > index 72aad96..73aa719 100644
> > --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> > +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> > @@ -276,12 +276,10 @@ gen4_emit_buffer_surface_state(struct brw_context *brw,
> >  }
> >  
> >  void
> > -brw_update_buffer_texture_surface(struct gl_context *ctx,
> > -                                  unsigned unit,
> > +brw_update_buffer_texture_surface(struct brw_context *brw,
> > +                                  struct gl_texture_object *tObj,
> >                                    uint32_t *surf_offset)
> >  {
> > -   struct brw_context *brw = brw_context(ctx);
> > -   struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
> >     struct intel_buffer_object *intel_obj =
> >        intel_buffer_object(tObj->BufferObject);
> >     uint32_t size = tObj->BufferSize;
> > @@ -323,7 +321,7 @@ brw_update_texture_surface(struct gl_context *ctx,
> >  
> >     /* BRW_NEW_TEXTURE_BUFFER */
> >     if (tObj->Target == GL_TEXTURE_BUFFER) {
> > -      brw_update_buffer_texture_surface(ctx, unit, surf_offset);
> > +      brw_update_buffer_texture_surface(brw, tObj, surf_offset);
> >        return;
> >     }
> >  
> > diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> > index 494bc22..6aa8299 100644
> > --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> > +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> > @@ -357,7 +357,7 @@ gen7_update_texture_surface(struct gl_context *ctx,
> >     struct gl_texture_object *obj = ctx->Texture.Unit[unit]._Current;
> >  
> >     if (obj->Target == GL_TEXTURE_BUFFER) {
> > -      brw_update_buffer_texture_surface(ctx, unit, surf_offset);
> > +      brw_update_buffer_texture_surface(brw, obj, surf_offset);
> >  
> >     } else {
> >        struct intel_texture_object *intel_obj = intel_texture_object(obj);
> > diff --git a/src/mesa/drivers/dri/i965/gen8_surface_state.c b/src/mesa/drivers/dri/i965/gen8_surface_state.c
> > index c595ec3..11defd1 100644
> > --- a/src/mesa/drivers/dri/i965/gen8_surface_state.c
> > +++ b/src/mesa/drivers/dri/i965/gen8_surface_state.c
> > @@ -308,7 +308,7 @@ gen8_update_texture_surface(struct gl_context *ctx,
> >     struct gl_texture_object *obj = ctx->Texture.Unit[unit]._Current;
> >  
> >     if (obj->Target == GL_TEXTURE_BUFFER) {
> > -      brw_update_buffer_texture_surface(ctx, unit, surf_offset);
> > +      brw_update_buffer_texture_surface(brw, obj, surf_offset);
> >  
> >     } else {
> >        struct gl_texture_image *firstImage = obj->Image[0][obj->BaseLevel];
> > -- 
> > 1.9.3
> > 
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list