[Mesa-dev] [PATCH 3/5] gallium/u_blitter: use TEX_LZ if it's supported

Marek Olšák maraeo at gmail.com
Tue May 30 22:46:45 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

The sampler views always have first_level == last_level.
Now radeonsi doesn't have to use the WQM. (a few SALU removed)
---
 src/gallium/auxiliary/util/u_blitter.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 1aef013..21f0686 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -125,20 +125,21 @@ struct blitter_context_priv
    /* Destination surface dimensions. */
    unsigned dst_width;
    unsigned dst_height;
 
    boolean has_geometry_shader;
    boolean has_tessellation;
    boolean has_layered;
    boolean has_stream_out;
    boolean has_stencil_export;
    boolean has_texture_multisample;
+   boolean has_tex_lz;
    boolean cached_all_shaders;
 
    /* The Draw module overrides these functions.
     * Always create the blitter before Draw. */
    void   (*bind_fs_state)(struct pipe_context *, void *);
    void   (*delete_fs_state)(struct pipe_context *, void *);
 };
 
 static struct pipe_surface *
 util_blitter_get_next_surface_layer(struct pipe_context *pipe,
@@ -190,20 +191,23 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
       pipe->screen->get_param(pipe->screen,
                               PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS) != 0;
 
    ctx->has_stencil_export =
          pipe->screen->get_param(pipe->screen,
                                  PIPE_CAP_SHADER_STENCIL_EXPORT);
 
    ctx->has_texture_multisample =
       pipe->screen->get_param(pipe->screen, PIPE_CAP_TEXTURE_MULTISAMPLE);
 
+   ctx->has_tex_lz = pipe->screen->get_param(pipe->screen,
+                                             PIPE_CAP_TGSI_TEX_TXF_LZ);
+
    /* blend state objects */
    memset(&blend, 0, sizeof(blend));
 
    for (i = 0; i <= PIPE_MASK_RGBA; i++) {
       for (j = 0; j < 2; j++) {
          memset(&blend.rt[0], 0, sizeof(blend.rt[0]));
          blend.rt[0].colormask = i;
          if (j) {
             blend.rt[0].blend_enable = 1;
             blend.rt[0].rgb_func = PIPE_BLEND_ADD;
@@ -946,21 +950,21 @@ static void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx,
       return *shader;
    } else {
       void **shader = &ctx->fs_texfetch_col[type][target];
 
       /* Create the fragment shader on-demand. */
       if (!*shader) {
          assert(!ctx->cached_all_shaders);
          *shader = util_make_fragment_tex_shader(pipe, tgsi_tex,
                                                  TGSI_INTERPOLATE_LINEAR,
                                                  stype, dtype,
-                                                 false, false);
+                                                 ctx->has_tex_lz, false);
       }
 
       return *shader;
    }
 }
 
 static inline
 void *blitter_get_fs_texfetch_depth(struct blitter_context_priv *ctx,
                                     enum pipe_texture_target target,
                                     unsigned nr_samples)
@@ -985,21 +989,21 @@ void *blitter_get_fs_texfetch_depth(struct blitter_context_priv *ctx,
       void **shader = &ctx->fs_texfetch_depth[target];
 
       /* Create the fragment shader on-demand. */
       if (!*shader) {
          unsigned tgsi_tex;
          assert(!ctx->cached_all_shaders);
          tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
          *shader =
             util_make_fragment_tex_shader_writedepth(pipe, tgsi_tex,
                                                      TGSI_INTERPOLATE_LINEAR,
-                                                     false, false);
+                                                     ctx->has_tex_lz, false);
       }
 
       return *shader;
    }
 }
 
 static inline
 void *blitter_get_fs_texfetch_depthstencil(struct blitter_context_priv *ctx,
                                            enum pipe_texture_target target,
                                            unsigned nr_samples)
@@ -1024,21 +1028,21 @@ void *blitter_get_fs_texfetch_depthstencil(struct blitter_context_priv *ctx,
       void **shader = &ctx->fs_texfetch_depthstencil[target];
 
       /* Create the fragment shader on-demand. */
       if (!*shader) {
          unsigned tgsi_tex;
          assert(!ctx->cached_all_shaders);
          tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
          *shader =
             util_make_fragment_tex_shader_writedepthstencil(pipe, tgsi_tex,
                                                             TGSI_INTERPOLATE_LINEAR,
-                                                            false,
+                                                            ctx->has_tex_lz,
                                                             false);
       }
 
       return *shader;
    }
 }
 
 static inline
 void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx,
                                       enum pipe_texture_target target,
@@ -1064,21 +1068,21 @@ void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx,
       void **shader = &ctx->fs_texfetch_stencil[target];
 
       /* Create the fragment shader on-demand. */
       if (!*shader) {
          unsigned tgsi_tex;
          assert(!ctx->cached_all_shaders);
          tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
          *shader =
             util_make_fragment_tex_shader_writestencil(pipe, tgsi_tex,
                                                        TGSI_INTERPOLATE_LINEAR,
-                                                       false, false);
+                                                       ctx->has_tex_lz, false);
       }
 
       return *shader;
    }
 }
 
 
 /**
  * Generate and save all fragment shaders that we will ever need for
  * blitting.  Drivers which use the 'draw' fallbacks will typically use
-- 
2.7.4



More information about the mesa-dev mailing list