r600g,radeonsi: add debug option which forces DMA for copy_region and blit
authorMarek Olšák <marek.olsak@amd.com>
Sat, 6 Sep 2014 15:07:50 +0000 (17:07 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 12 Sep 2014 20:51:28 +0000 (22:51 +0200)
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/radeon/r600_pipe_common.c
src/gallium/drivers/radeon/r600_pipe_common.h
src/gallium/drivers/radeonsi/si_blit.c
src/gallium/drivers/radeonsi/si_dma.c
src/gallium/drivers/radeonsi/si_pipe.c
src/gallium/drivers/radeonsi/si_pipe.h

index e7faeaf4a0ba768cdf6c66e935db35feadc6a7c1..27a9ad9e39608c2ea1538398b42e9e591a77f4d3 100644 (file)
@@ -3365,7 +3365,7 @@ static void evergreen_dma_copy(struct pipe_context *ctx,
        return;
 
 fallback:
-       ctx->resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
+       r600_resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
                                  src, src_level, src_box);
 }
 
index f766e37f2b23ca7a000d0f14845f776f8ceaad56..1e18d87e6ff6567b32ea097fd4e01b339417280c 100644 (file)
@@ -565,13 +565,13 @@ static void r600_clear_buffer(struct pipe_context *ctx, struct pipe_resource *ds
        }
 }
 
-static void r600_resource_copy_region(struct pipe_context *ctx,
-                                     struct pipe_resource *dst,
-                                     unsigned dst_level,
-                                     unsigned dstx, unsigned dsty, unsigned dstz,
-                                     struct pipe_resource *src,
-                                     unsigned src_level,
-                                     const struct pipe_box *src_box)
+void r600_resource_copy_region(struct pipe_context *ctx,
+                              struct pipe_resource *dst,
+                              unsigned dst_level,
+                              unsigned dstx, unsigned dsty, unsigned dstz,
+                              struct pipe_resource *src,
+                              unsigned src_level,
+                              const struct pipe_box *src_box)
 {
        struct r600_context *rctx = (struct r600_context *)ctx;
        struct pipe_surface *dst_view, dst_templ;
@@ -815,6 +815,10 @@ static void r600_blit(struct pipe_context *ctx,
                return; /* error */
        }
 
+       if (rctx->screen->b.debug_flags & DBG_FORCE_DMA &&
+           util_try_blit_via_copy_region(ctx, info))
+               return;
+
        r600_blitter_begin(ctx, R600_BLIT |
                           (info->render_condition_enable ? 0 : R600_DISABLE_RENDER_COND));
        util_blitter_blit(rctx->blitter, info);
index 73c6e3543afdca8246073ab3831bc4a0e72b294e..c6459d81209c98b110d3b5d920579abe1372db17 100644 (file)
@@ -191,6 +191,9 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
        if (!rctx->isa || r600_isa_init(rctx, rctx->isa))
                goto fail;
 
+       if (rscreen->b.debug_flags & DBG_FORCE_DMA)
+               rctx->b.b.resource_copy_region = rctx->b.dma_copy;
+
        rctx->blitter = util_blitter_create(&rctx->b.b);
        if (rctx->blitter == NULL)
                goto fail;
index 8907d41a37725b1472290a4d9742545bddfb530b..2df168f01b53b53ef33ea510202f4bd9543e46bf 100644 (file)
@@ -195,8 +195,8 @@ struct r600_gs_rings_state {
 
 /* This must start from 16. */
 /* features */
-#define DBG_LLVM               (1 << 17)
-#define DBG_NO_CP_DMA          (1 << 18)
+#define DBG_LLVM               (1 << 29)
+#define DBG_NO_CP_DMA          (1 << 30)
 /* shader backend */
 #define DBG_NO_SB              (1 << 21)
 #define DBG_SB_CS              (1 << 22)
@@ -551,6 +551,13 @@ void r600_decompress_depth_textures(struct r600_context *rctx,
                                    struct r600_samplerview_state *textures);
 void r600_decompress_color_textures(struct r600_context *rctx,
                                    struct r600_samplerview_state *textures);
+void r600_resource_copy_region(struct pipe_context *ctx,
+                              struct pipe_resource *dst,
+                              unsigned dst_level,
+                              unsigned dstx, unsigned dsty, unsigned dstz,
+                              struct pipe_resource *src,
+                              unsigned src_level,
+                              const struct pipe_box *src_box);
 
 /* r600_shader.c */
 int r600_pipe_shader_create(struct pipe_context *ctx,
index 36f7750314199bddfb44f1f954b810cf2c0b4b48..9ca61718aba327dc7b4a5e2cc6ff723260a596a8 100644 (file)
@@ -2966,7 +2966,7 @@ static void r600_dma_copy(struct pipe_context *ctx,
        return;
 
 fallback:
-       ctx->resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
+       r600_resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
                                  src, src_level, src_box);
 }
 
index dec80639d1d65d2479556b91f492edcff4c682cd..ae203b66855a0c54223178422d9cb434d53f5b54 100644 (file)
@@ -320,6 +320,7 @@ static const struct debug_named_value common_debug_options[] = {
        { "no2d", DBG_NO_2D_TILING, "Disable 2D tiling" },
        { "notiling", DBG_NO_TILING, "Disable tiling" },
        { "switch_on_eop", DBG_SWITCH_ON_EOP, "Program WD/IA to switch on end-of-packet." },
+       { "forcedma", DBG_FORCE_DMA, "Use asynchronous DMA for all operations when possible." },
 
        DEBUG_NAMED_VALUE_END /* must be last */
 };
index b9a35c76633b796a1804968a248bf8b95dd1c514..beaa312b48ddc95600d5448ecc5e8e1db9312ef3 100644 (file)
@@ -98,7 +98,8 @@
 #define DBG_NO_2D_TILING       (1 << 13)
 #define DBG_NO_TILING          (1 << 14)
 #define DBG_SWITCH_ON_EOP      (1 << 15)
-/* The maximum allowed bit is 15. */
+#define DBG_FORCE_DMA          (1 << 16)
+/* The maximum allowed bit is 20. */
 
 #define R600_MAP_BUFFER_ALIGNMENT 64
 
index 96d27ec062f97a0957042d54c33cdac5c3babd13..9f95a8a08a7a95c9bf6c9a744f0487962208c232 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "si_pipe.h"
 #include "util/u_format.h"
+#include "util/u_surface.h"
 
 enum si_blitter_op /* bitmask */
 {
@@ -531,13 +532,13 @@ static void si_reset_blittable_to_orig(struct pipe_resource *tex,
        rtex->mipmap_shift = 0;
 }
 
-static void si_resource_copy_region(struct pipe_context *ctx,
-                                   struct pipe_resource *dst,
-                                   unsigned dst_level,
-                                   unsigned dstx, unsigned dsty, unsigned dstz,
-                                   struct pipe_resource *src,
-                                   unsigned src_level,
-                                   const struct pipe_box *src_box)
+void si_resource_copy_region(struct pipe_context *ctx,
+                            struct pipe_resource *dst,
+                            unsigned dst_level,
+                            unsigned dstx, unsigned dsty, unsigned dstz,
+                            struct pipe_resource *src,
+                            unsigned src_level,
+                            const struct pipe_box *src_box)
 {
        struct si_context *sctx = (struct si_context *)ctx;
        struct r600_texture *rdst = (struct r600_texture*)dst;
@@ -770,6 +771,10 @@ static void si_blit(struct pipe_context *ctx,
                                  info->src.box.z,
                                  info->src.box.z + info->src.box.depth - 1);
 
+       if (sctx->screen->b.debug_flags & DBG_FORCE_DMA &&
+           util_try_blit_via_copy_region(ctx, info))
+               return;
+
        si_blitter_begin(ctx, SI_BLIT |
                         (info->render_condition_enable ? 0 : SI_DISABLE_RENDER_COND));
        util_blitter_blit(sctx->blitter, info);
index c02b01eca6d86a1a55f78f77d3e62990781e8323..c067cd9c1243d6621404ed35a1449a30c837c239 100644 (file)
@@ -310,6 +310,6 @@ void si_dma_copy(struct pipe_context *ctx,
        return;
 
 fallback:
-       ctx->resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
-                                 src, src_level, src_box);
+       si_resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
+                               src, src_level, src_box);
 }
index 5762ca7702f3f1378aaa0319a9a5d726c57deb4a..4f9c87681520362d776b2ac0b2cd3235ab4049df 100644 (file)
@@ -118,6 +118,9 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, void *
                goto fail;
        }
 
+       if (sscreen->b.debug_flags & DBG_FORCE_DMA)
+               sctx->b.b.resource_copy_region = sctx->b.dma_copy;
+
        sctx->blitter = util_blitter_create(&sctx->b.b);
        if (sctx->blitter == NULL)
                goto fail;
index 55643d6eb7dc8018e1fc119a7dffc81b34014f7f..6ec8d5dba9d7334c57766112bd9721765c8a3930 100644 (file)
@@ -174,6 +174,13 @@ void si_flush_depth_textures(struct si_context *sctx,
                             struct si_textures_info *textures);
 void si_decompress_color_textures(struct si_context *sctx,
                                  struct si_textures_info *textures);
+void si_resource_copy_region(struct pipe_context *ctx,
+                            struct pipe_resource *dst,
+                            unsigned dst_level,
+                            unsigned dstx, unsigned dsty, unsigned dstz,
+                            struct pipe_resource *src,
+                            unsigned src_level,
+                            const struct pipe_box *src_box);
 
 /* si_dma.c */
 void si_dma_copy(struct pipe_context *ctx,