[Mesa-dev] [PATCH 2/2] radeonsi: Decompress DCC textures in a render feedback loop.

Marek Olšák maraeo at gmail.com
Tue May 31 16:31:07 UTC 2016


On Tue, May 31, 2016 at 6:04 PM, Bas Nieuwenhuizen
<bas at basnieuwenhuizen.nl> wrote:
> By using a counter to quickly reject textures that are not
> bound to a framebuffer, the performance impact when binding
> sampler_views/images is not too large.
>
> Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
> ---
>  src/gallium/drivers/radeonsi/si_blit.c        | 99 +++++++++++++++++++++++++++
>  src/gallium/drivers/radeonsi/si_descriptors.c |  8 +++
>  src/gallium/drivers/radeonsi/si_pipe.h        |  3 +
>  src/gallium/drivers/radeonsi/si_state.c       |  2 +
>  4 files changed, 112 insertions(+)
>
> diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
> index 716a522..262c6a4 100644
> --- a/src/gallium/drivers/radeonsi/si_blit.c
> +++ b/src/gallium/drivers/radeonsi/si_blit.c
> @@ -412,6 +412,103 @@ si_decompress_image_color_textures(struct si_context *sctx,
>         }
>  }
>
> +static void si_check_render_feedback_textures(struct si_context *sctx,
> +                                              struct si_textures_info *textures)
> +{
> +       uint32_t mask = textures->views.desc.enabled_mask;
> +
> +       while (mask) {
> +               const struct pipe_sampler_view *view;
> +               struct r600_texture *tex;
> +               bool render_feedback = false;
> +
> +               unsigned i = u_bit_scan(&mask);
> +
> +               view = textures->views.views[i];
> +               if(view->texture->target == PIPE_BUFFER)
> +                       continue;
> +
> +               tex = (struct r600_texture *)view->texture;
> +               if (!tex->dcc_offset)
> +                       continue;
> +
> +               for (unsigned j = 0; j < sctx->framebuffer.state.nr_cbufs; ++j) {
> +                       struct r600_surface * surf;
> +
> +                       if (!sctx->framebuffer.state.cbufs[j])
> +                               continue;
> +
> +                       surf = (struct r600_surface*)sctx->framebuffer.state.cbufs[j];
> +
> +                       if (tex == (struct r600_texture*)surf->base.texture &&
> +                           surf->base.u.tex.level >= view->u.tex.first_level &&
> +                           surf->base.u.tex.level <= view->u.tex.last_level &&
> +                           surf->base.u.tex.first_layer <= view->u.tex.last_layer &&
> +                           surf->base.u.tex.last_layer >= view->u.tex.first_layer)
> +                               render_feedback = true;
> +               }
> +
> +               if (render_feedback) {
> +                       struct si_screen *screen = sctx->screen;
> +                       r600_texture_disable_dcc(&screen->b, tex);
> +               }
> +       }
> +}
> +
> +static void si_check_render_feedback_images(struct si_context *sctx,
> +                                            struct si_images_info *images)
> +{
> +       uint32_t mask = images->desc.enabled_mask;
> +
> +       while (mask) {
> +               const struct pipe_image_view *view;
> +               struct r600_texture *tex;
> +               bool render_feedback = false;
> +
> +               unsigned i = u_bit_scan(&mask);
> +
> +               view = &images->views[i];
> +               if (view->resource->target == PIPE_BUFFER)
> +                       continue;
> +
> +               tex = (struct r600_texture *)view->resource;
> +               if (!tex->dcc_offset)
> +                       continue;
> +
> +               for (unsigned j = 0; j < sctx->framebuffer.state.nr_cbufs; ++j) {
> +                       struct r600_surface * surf;
> +
> +                       if (!sctx->framebuffer.state.cbufs[j])
> +                               continue;
> +
> +                       surf = (struct r600_surface*)sctx->framebuffer.state.cbufs[j];
> +
> +                       if (tex == (struct r600_texture*)surf->base.texture &&
> +                           surf->base.u.tex.level == view->u.tex.level &&
> +                           surf->base.u.tex.first_layer <= view->u.tex.last_layer &&
> +                           surf->base.u.tex.last_layer >= view->u.tex.first_layer)
> +                               render_feedback = true;
> +               }
> +
> +               if (render_feedback) {
> +                       struct si_screen *screen = sctx->screen;
> +                       r600_texture_disable_dcc(&screen->b, tex);
> +               }
> +       }
> +}
> +
> +static void si_check_render_feedback(struct si_context *sctx) {
> +

{ on the new line please.

Other than that and my comment on patch 1, the series is:

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek


More information about the mesa-dev mailing list