r600g: add debug options disabling various copy-buffer-related features
authorMarek Olšák <maraeo@gmail.com>
Tue, 5 Mar 2013 00:15:45 +0000 (01:15 +0100)
committerMarek Olšák <maraeo@gmail.com>
Mon, 11 Mar 2013 12:44:46 +0000 (13:44 +0100)
This will be invaluable for debugging and bug reports.

src/gallium/drivers/r600/r600_buffer.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/r600/r600_pipe.h

index 4dbe363..e46f7fd 100644 (file)
@@ -150,6 +150,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx,
        }
        else if ((usage & PIPE_TRANSFER_DISCARD_RANGE) &&
                 !(usage & PIPE_TRANSFER_UNSYNCHRONIZED) &&
+                !(rctx->screen->debug_flags & DBG_NO_DISCARD_RANGE) &&
                 (rctx->screen->has_cp_dma ||
                  (rctx->screen->has_streamout &&
                   /* The buffer range must be aligned to 4 with streamout. */
index 8c853dc..60a0247 100644 (file)
@@ -56,6 +56,10 @@ static const struct debug_named_value debug_options[] = {
 #if defined(R600_USE_LLVM)
        { "nollvm", DBG_NO_LLVM, "Disable the LLVM shader compiler" },
 #endif
+       { "nocpdma", DBG_NO_CP_DMA, "Disable CP DMA" },
+       { "nodma", DBG_NO_ASYNC_DMA, "Disable asynchronous DMA" },
+       /* GL uses the word INVALIDATE, gallium uses the word DISCARD */
+       { "noinvalrange", DBG_NO_DISCARD_RANGE, "Disable handling of INVALIDATE_RANGE map flags" },
 
        DEBUG_NAMED_VALUE_END /* must be last */
 };
@@ -425,7 +429,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
        rctx->rings.gfx.flushing = false;
 
        rctx->rings.dma.cs = NULL;
-       if (rscreen->info.r600_has_dma) {
+       if (rscreen->info.r600_has_dma && !(rscreen->debug_flags & DBG_NO_ASYNC_DMA)) {
                rctx->rings.dma.cs = rctx->ws->cs_create(rctx->ws, RING_DMA);
                rctx->rings.dma.flush = r600_flush_dma_ring;
                rctx->ws->cs_set_flush_callback(rctx->rings.dma.cs, r600_flush_dma_from_winsys, rctx);
@@ -1136,7 +1140,8 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
                break;
        }
 
-       rscreen->has_cp_dma = rscreen->info.drm_minor >= 27;
+       rscreen->has_cp_dma = rscreen->info.drm_minor >= 27 &&
+                             !(rscreen->debug_flags & DBG_NO_CP_DMA);
 
        if (r600_init_tiling(rscreen)) {
                FREE(rscreen);
index 7e0f242..285d45f 100644 (file)
@@ -249,6 +249,9 @@ typedef boolean (*r600g_dma_blit_t)(struct pipe_context *ctx,
 /* features */
 #define DBG_NO_HYPERZ          (1 << 16)
 #define DBG_NO_LLVM            (1 << 17)
+#define DBG_NO_CP_DMA          (1 << 18)
+#define DBG_NO_ASYNC_DMA       (1 << 19)
+#define DBG_NO_DISCARD_RANGE   (1 << 20)
 
 struct r600_tiling_info {
        unsigned num_channels;