From e4e655fd1173fbf7f8cf734217b10e8c3695964e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 5 Mar 2013 01:15:45 +0100 Subject: [PATCH] r600g: add debug options disabling various copy-buffer-related features This will be invaluable for debugging and bug reports. --- src/gallium/drivers/r600/r600_buffer.c | 1 + src/gallium/drivers/r600/r600_pipe.c | 9 +++++++-- src/gallium/drivers/r600/r600_pipe.h | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 4dbe363da82..e46f7fd4bfc 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -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. */ diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 8c853dc53eb..60a0247d5dd 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -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); diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 7e0f242051d..285d45fd371 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -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; -- 2.30.2