[Mesa-dev] [PATCH 08/18] i965: Move tex miptree and format resolving into dispatcher

Matt Turner mattst88 at gmail.com
Thu Apr 23 11:53:35 PDT 2015


On Wed, Apr 22, 2015 at 1:47 PM, Topi Pohjolainen
<topi.pohjolainen at intel.com> wrote:
> All hardware platforms have this in common, so do it in the
> hardware independent dispatcher.
>
> Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_context.h           |  4 ++-
>  src/mesa/drivers/dri/i965/brw_wm_surface_state.c  | 30 ++++++++++++++++-------
>  src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 11 +++------
>  src/mesa/drivers/dri/i965/gen8_surface_state.c    | 16 +++---------
>  4 files changed, 30 insertions(+), 31 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
> index 76d4630..096bc4d 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -963,7 +963,9 @@ struct brw_context
>     struct
>     {
>        void (*update_texture_surface)(struct gl_context *ctx,
> -                                     unsigned unit,
> +                                     const struct intel_mipmap_tree *mt,
> +                                     struct gl_texture_object *tObj,
> +                                     uint32_t tex_format,
>                                       uint32_t *surf_offset,
>                                       bool for_gather);
>        uint32_t (*update_renderbuffer_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 0f739bb..d8faf82 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -309,23 +309,19 @@ update_buffer_texture_surface(struct gl_context *ctx,
>
>  static void
>  brw_update_texture_surface(struct gl_context *ctx,
> -                           unsigned unit,
> +                           const struct intel_mipmap_tree *mt,
> +                           struct gl_texture_object *tObj,
> +                           uint32_t tex_format,
>                             uint32_t *surf_offset,
>                             bool for_gather)
>  {
>     struct brw_context *brw = brw_context(ctx);
> -   struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
>     struct intel_texture_object *intelObj = intel_texture_object(tObj);
> -   struct intel_mipmap_tree *mt = intelObj->mt;
> -   struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);
>     uint32_t *surf;
>
>     surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE,
>                           6 * 4, 32, surf_offset);
>
> -   uint32_t tex_format = translate_tex_format(brw, mt->format,
> -                                              sampler->sRGBDecode);
> -
>     if (for_gather) {
>        /* Sandybridge's gather4 message is broken for integer formats.
>         * To work around this, we pretend the surface is UNORM for
> @@ -796,14 +792,30 @@ update_texture_surface(struct gl_context *ctx,
>                         bool for_gather)
>  {
>     struct brw_context *brw = brw_context(ctx);
> -   const struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
> +   struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
> +   struct intel_texture_object *intelObj = intel_texture_object(tObj);
> +   const struct intel_mipmap_tree *mt = intelObj->mt;
> +   const struct gl_texture_image *firstImage = tObj->Image[0][tObj->BaseLevel];
> +   const struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);
>
>     if (tObj->Target == GL_TEXTURE_BUFFER) {
>        update_buffer_texture_surface(ctx, unit, surf_offset);
>        return;
>     }
>
> -   brw->vtbl.update_texture_surface(ctx, unit, surf_offset, for_gather);
> +   mesa_format format = intelObj->_Format;
> +   if (tObj->StencilSampling && firstImage->_BaseFormat == GL_DEPTH_STENCIL) {
> +      assert(brw->gen >= 8);
> +      mt = mt->stencil_mt;
> +      assert(mt->format == MESA_FORMAT_S_UINT8);
> +      format = mt->format;
> +   }
> +

Extra whitespace on this line.


More information about the mesa-dev mailing list