From: Marek Olšák <marek.ol...@amd.com>

---
 src/gallium/drivers/radeonsi/si_blit.c | 35 +++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_blit.c 
b/src/gallium/drivers/radeonsi/si_blit.c
index f0abfdc..0993ebd 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -1142,31 +1142,45 @@ void si_resource_copy_region(struct pipe_context *ctx,
        util_blitter_blit_generic(sctx->blitter, dst_view, &dstbox,
                                  src_view, src_box, src_width0, src_height0,
                                  PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, 
NULL,
                                  false);
        si_blitter_end(ctx);
 
        pipe_surface_reference(&dst_view, NULL);
        pipe_sampler_view_reference(&src_view, NULL);
 }
 
+static void si_do_CB_resolve(struct si_context *sctx,
+                            const struct pipe_blit_info *info,
+                            struct pipe_resource *dst,
+                            unsigned dst_level, unsigned dst_z,
+                            enum pipe_format format)
+{
+       si_blitter_begin(&sctx->b.b, SI_COLOR_RESOLVE |
+                        (info->render_condition_enable ? 0 : 
SI_DISABLE_RENDER_COND));
+       util_blitter_custom_resolve_color(sctx->blitter, dst, dst_level, dst_z,
+                                         info->src.resource, info->src.box.z,
+                                         ~0, sctx->custom_blend_resolve,
+                                         format);
+       si_blitter_end(&sctx->b.b);
+}
+
 static bool do_hardware_msaa_resolve(struct pipe_context *ctx,
                                     const struct pipe_blit_info *info)
 {
        struct si_context *sctx = (struct si_context*)ctx;
        struct r600_texture *src = (struct r600_texture*)info->src.resource;
        struct r600_texture *dst = (struct r600_texture*)info->dst.resource;
        MAYBE_UNUSED struct r600_texture *rtmp;
        unsigned dst_width = u_minify(info->dst.resource->width0, 
info->dst.level);
        unsigned dst_height = u_minify(info->dst.resource->height0, 
info->dst.level);
        enum pipe_format format = info->src.format;
-       unsigned sample_mask = ~0;
        struct pipe_resource *tmp, templ;
        struct pipe_blit_info blit;
 
        /* Check basic requirements for hw resolve. */
        if (!(info->src.resource->nr_samples > 1 &&
              info->dst.resource->nr_samples <= 1 &&
              !util_format_is_pure_integer(format) &&
              !util_format_is_depth_or_stencil(format) &&
              util_max_layer(info->src.resource, 0) == 0))
                return false;
@@ -1219,29 +1233,22 @@ static bool do_hardware_msaa_resolve(struct 
pipe_context *ctx,
                        if (sctx->b.chip_class >= GFX9 &&
                            info->dst.resource->last_level != 0)
                                goto resolve_to_temp;
 
                        vi_dcc_clear_level(&sctx->b, dst, info->dst.level,
                                           0xFFFFFFFF);
                        dst->dirty_level_mask &= ~(1 << info->dst.level);
                }
 
                /* Resolve directly from src to dst. */
-               si_blitter_begin(ctx, SI_COLOR_RESOLVE |
-                                (info->render_condition_enable ? 0 : 
SI_DISABLE_RENDER_COND));
-               util_blitter_custom_resolve_color(sctx->blitter,
-                                                 info->dst.resource, 
info->dst.level,
-                                                 info->dst.box.z,
-                                                 info->src.resource, 
info->src.box.z,
-                                                 sample_mask, 
sctx->custom_blend_resolve,
-                                                 format);
-               si_blitter_end(ctx);
+               si_do_CB_resolve(sctx, info, info->dst.resource,
+                                info->dst.level, info->dst.box.z, format);
                return true;
        }
 
 resolve_to_temp:
        /* Shader-based resolve is VERY SLOW. Instead, resolve into
         * a temporary texture and blit.
         */
        memset(&templ, 0, sizeof(templ));
        templ.target = PIPE_TEXTURE_2D;
        templ.format = info->src.resource->format;
@@ -1261,27 +1268,21 @@ resolve_to_temp:
 
        tmp = ctx->screen->resource_create(ctx->screen, &templ);
        if (!tmp)
                return false;
        rtmp = (struct r600_texture*)tmp;
 
        assert(!rtmp->surface.is_linear);
        assert(src->surface.micro_tile_mode == rtmp->surface.micro_tile_mode);
 
        /* resolve */
-       si_blitter_begin(ctx, SI_COLOR_RESOLVE |
-                        (info->render_condition_enable ? 0 : 
SI_DISABLE_RENDER_COND));
-       util_blitter_custom_resolve_color(sctx->blitter, tmp, 0, 0,
-                                         info->src.resource, info->src.box.z,
-                                         sample_mask, 
sctx->custom_blend_resolve,
-                                         format);
-       si_blitter_end(ctx);
+       si_do_CB_resolve(sctx, info, tmp, 0, 0, format);
 
        /* blit */
        blit = *info;
        blit.src.resource = tmp;
        blit.src.box.z = 0;
 
        si_blitter_begin(ctx, SI_BLIT |
                         (info->render_condition_enable ? 0 : 
SI_DISABLE_RENDER_COND));
        util_blitter_blit(sctx->blitter, &blit);
        si_blitter_end(ctx);
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to