[Mesa-dev] [PATCH 4/7] radeonsi: rename shader resource decompress masks to their true meaning

Marek Olšák maraeo at gmail.com
Wed Jun 7 20:25:50 UTC 2017


On Wed, Jun 7, 2017 at 10:22 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
>
>
> On 06/07/2017 09:50 PM, Marek Olšák wrote:
>>
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> ---
>>   src/gallium/drivers/radeonsi/si_blit.c        | 12 ++++-----
>>   src/gallium/drivers/radeonsi/si_descriptors.c | 38
>> +++++++++++++--------------
>>   src/gallium/drivers/radeonsi/si_pipe.h        |  6 ++---
>>   3 files changed, 28 insertions(+), 28 deletions(-)
>>
>> diff --git a/src/gallium/drivers/radeonsi/si_blit.c
>> b/src/gallium/drivers/radeonsi/si_blit.c
>> index 46cb646..20b08b6 100644
>> --- a/src/gallium/drivers/radeonsi/si_blit.c
>> +++ b/src/gallium/drivers/radeonsi/si_blit.c
>> @@ -388,21 +388,21 @@ si_flush_depth_texture(struct si_context *sctx,
>>                         levels_z, levels_s,
>>                         first_layer, last_layer);
>>         }
>>   }
>>     static void
>>   si_flush_depth_textures(struct si_context *sctx,
>>                         struct si_textures_info *textures)
>>   {
>>         unsigned i;
>> -       unsigned mask = textures->depth_texture_mask;
>> +       unsigned mask = textures->needs_depth_decompress_mask;
>>         while (mask) {
>>                 struct pipe_sampler_view *view;
>>                 struct si_sampler_view *sview;
>>                 struct r600_texture *tex;
>>                 i = u_bit_scan(&mask);
>>                 view = textures->views.views[i];
>>                 assert(view);
>> @@ -500,21 +500,21 @@ si_decompress_color_texture(struct si_context *sctx,
>> struct r600_texture *tex,
>>         si_blit_decompress_color(&sctx->b.b, tex, first_level, last_level,
>> 0,
>>                                  util_max_layer(&tex->resource.b.b,
>> first_level),
>>                                  false);
>>   }
>>     static void
>>   si_decompress_sampler_color_textures(struct si_context *sctx,
>>                                      struct si_textures_info *textures)
>>   {
>>         unsigned i;
>> -       unsigned mask = textures->compressed_colortex_mask;
>> +       unsigned mask = textures->needs_color_decompress_mask;
>>         while (mask) {
>>                 struct pipe_sampler_view *view;
>>                 struct r600_texture *tex;
>>                 i = u_bit_scan(&mask);
>>                 view = textures->views.views[i];
>>                 assert(view);
>>   @@ -523,21 +523,21 @@ si_decompress_sampler_color_textures(struct
>> si_context *sctx,
>>                 si_decompress_color_texture(sctx, tex,
>> view->u.tex.first_level,
>>                                             view->u.tex.last_level);
>>         }
>>   }
>>     static void
>>   si_decompress_image_color_textures(struct si_context *sctx,
>>                                    struct si_images_info *images)
>>   {
>>         unsigned i;
>> -       unsigned mask = images->compressed_colortex_mask;
>> +       unsigned mask = images->needs_color_decompress_mask;
>>         while (mask) {
>>                 const struct pipe_image_view *view;
>>                 struct r600_texture *tex;
>>                 i = u_bit_scan(&mask);
>>                 view = &images->views[i];
>>                 assert(view->resource->target != PIPE_BUFFER);
>>   @@ -657,27 +657,27 @@ static void si_decompress_textures(struct
>> si_context *sctx, unsigned shader_mask
>>         if (compressed_colortex_counter !=
>> sctx->b.last_compressed_colortex_counter) {
>>                 sctx->b.last_compressed_colortex_counter =
>> compressed_colortex_counter;
>>                 si_update_compressed_colortex_masks(sctx);
>>         }
>>         /* Decompress color & depth textures if needed. */
>>         mask = sctx->compressed_tex_shader_mask & shader_mask;
>>         while (mask) {
>>                 unsigned i = u_bit_scan(&mask);
>>   -             if (sctx->samplers[i].depth_texture_mask) {
>> +               if (sctx->samplers[i].needs_depth_decompress_mask) {
>>                         si_flush_depth_textures(sctx, &sctx->samplers[i]);
>>                 }
>> -               if (sctx->samplers[i].compressed_colortex_mask) {
>> +               if (sctx->samplers[i].needs_color_decompress_mask) {
>>                         si_decompress_sampler_color_textures(sctx,
>> &sctx->samplers[i]);
>>                 }
>> -               if (sctx->images[i].compressed_colortex_mask) {
>> +               if (sctx->images[i].needs_color_decompress_mask) {
>>                         si_decompress_image_color_textures(sctx,
>> &sctx->images[i]);
>>                 }
>>         }
>>         si_check_render_feedback(sctx);
>>   }
>>     void si_decompress_graphics_textures(struct si_context *sctx)
>>   {
>>         si_decompress_textures(sctx, u_bit_consecutive(0,
>> SI_NUM_GRAPHICS_SHADERS));
>> diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c
>> b/src/gallium/drivers/radeonsi/si_descriptors.c
>> index 6955b9d..3aa2b9d 100644
>> --- a/src/gallium/drivers/radeonsi/si_descriptors.c
>> +++ b/src/gallium/drivers/radeonsi/si_descriptors.c
>> @@ -573,23 +573,23 @@ static bool depth_needs_decompression(struct
>> r600_texture *rtex,
>>                (!rtex->tc_compatible_htile ||
>>                 !r600_can_sample_zs(rtex, sview->is_stencil_sampler));
>>   }
>>     static void si_update_compressed_tex_shader_mask(struct si_context
>> *sctx,
>>                                                  unsigned shader)
>>   {
>>         struct si_textures_info *samplers = &sctx->samplers[shader];
>>         unsigned shader_bit = 1 << shader;
>>   -     if (samplers->depth_texture_mask ||
>> -           samplers->compressed_colortex_mask ||
>> -           sctx->images[shader].compressed_colortex_mask)
>> +       if (samplers->needs_depth_decompress_mask ||
>> +           samplers->needs_color_decompress_mask ||
>> +           sctx->images[shader].needs_color_decompress_mask)
>>                 sctx->compressed_tex_shader_mask |= shader_bit;
>>         else
>>                 sctx->compressed_tex_shader_mask &= ~shader_bit;
>>   }
>>     static void si_set_sampler_views(struct pipe_context *ctx,
>>                                  enum pipe_shader_type shader, unsigned
>> start,
>>                                    unsigned count,
>>                                  struct pipe_sampler_view **views)
>>   {
>> @@ -597,72 +597,72 @@ static void si_set_sampler_views(struct pipe_context
>> *ctx,
>>         struct si_textures_info *samplers = &sctx->samplers[shader];
>>         int i;
>>         if (!count || shader >= SI_NUM_SHADERS)
>>                 return;
>>         for (i = 0; i < count; i++) {
>>                 unsigned slot = start + i;
>>                 if (!views || !views[i]) {
>> -                       samplers->depth_texture_mask &= ~(1u << slot);
>> -                       samplers->compressed_colortex_mask &= ~(1u <<
>> slot);
>> +                       samplers->needs_depth_decompress_mask &= ~(1u <<
>> slot);
>> +                       samplers->needs_color_decompress_mask &= ~(1u <<
>> slot);
>>                         si_set_sampler_view(sctx, shader, slot, NULL,
>> false);
>>                         continue;
>>                 }
>>                 si_set_sampler_view(sctx, shader, slot, views[i], false);
>>                 if (views[i]->texture && views[i]->texture->target !=
>> PIPE_BUFFER) {
>>                         struct r600_texture *rtex =
>>                                 (struct r600_texture*)views[i]->texture;
>>                         struct si_sampler_view *rview = (struct
>> si_sampler_view *)views[i];
>>                         if (depth_needs_decompression(rtex, rview)) {
>> -                               samplers->depth_texture_mask |= 1u <<
>> slot;
>> +                               samplers->needs_depth_decompress_mask |=
>> 1u << slot;
>>                         } else {
>> -                               samplers->depth_texture_mask &= ~(1u <<
>> slot);
>> +                               samplers->needs_depth_decompress_mask &=
>> ~(1u << slot);
>>                         }
>>                         if (color_needs_decompression(rtex)) {
>> -                               samplers->compressed_colortex_mask |= 1u
>> << slot;
>> +                               samplers->needs_color_decompress_mask |=
>> 1u << slot;
>>                         } else {
>> -                               samplers->compressed_colortex_mask &= ~(1u
>> << slot);
>> +                               samplers->needs_color_decompress_mask &=
>> ~(1u << slot);
>>                         }
>>                         if (rtex->dcc_offset &&
>>                             p_atomic_read(&rtex->framebuffers_bound))
>>                                 sctx->need_check_render_feedback = true;
>>                 } else {
>> -                       samplers->depth_texture_mask &= ~(1u << slot);
>> -                       samplers->compressed_colortex_mask &= ~(1u <<
>> slot);
>> +                       samplers->needs_depth_decompress_mask &= ~(1u <<
>> slot);
>> +                       samplers->needs_color_decompress_mask &= ~(1u <<
>> slot);
>>                 }
>>         }
>>         si_update_compressed_tex_shader_mask(sctx, shader);
>>   }
>>     static void
>>   si_samplers_update_compressed_colortex_mask(struct si_textures_info
>> *samplers)
>
>
> si_samplers_update_color_decompress_mask(...) ?

That's left for a future patch.

Marek


More information about the mesa-dev mailing list