diff options
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/evergreen_compute.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_hw_context.c | 36 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.c | 17 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.h | 11 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state_common.c | 4 |
5 files changed, 13 insertions, 57 deletions
diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c index 489629f4612..d6b0a47cf26 100644 --- a/src/gallium/drivers/r600/evergreen_compute.c +++ b/src/gallium/drivers/r600/evergreen_compute.c @@ -463,7 +463,7 @@ static void compute_emit_cs(struct r600_context *ctx, const uint *block_layout, flush_flags |= RADEON_FLUSH_KEEP_TILING_FLAGS; } - ctx->ws->cs_flush(ctx->rings.gfx.cs, flush_flags); + ctx->ws->cs_flush(ctx->rings.gfx.cs, flush_flags, ctx->screen->cs_count++); ctx->flags = 0; diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c index b4fb3bf7933..3abce1ebde2 100644 --- a/src/gallium/drivers/r600/r600_hw_context.c +++ b/src/gallium/drivers/r600/r600_hw_context.c @@ -137,21 +137,17 @@ void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw, for (i = 0; i < R600_NUM_ATOMS; i++) { if (ctx->atoms[i] && ctx->atoms[i]->dirty) { num_dw += ctx->atoms[i]->num_dw; -#if R600_TRACE_CS if (ctx->screen->trace_bo) { num_dw += R600_TRACE_CS_DWORDS; } -#endif } } /* The upper-bound of how much space a draw command would take. */ num_dw += R600_MAX_FLUSH_CS_DWORDS + R600_MAX_DRAW_CS_DWORDS; -#if R600_TRACE_CS if (ctx->screen->trace_bo) { num_dw += R600_TRACE_CS_DWORDS; } -#endif } /* Count in queries_suspend. */ @@ -339,37 +335,7 @@ void r600_context_flush(struct r600_context *ctx, unsigned flags) } /* Flush the CS. */ -#if R600_TRACE_CS - if (ctx->screen->trace_bo) { - struct r600_screen *rscreen = ctx->screen; - unsigned i; - - for (i = 0; i < cs->cdw; i++) { - fprintf(stderr, "[%4d] [%5d] 0x%08x\n", rscreen->cs_count, i, cs->buf[i]); - } - rscreen->cs_count++; - } -#endif - ctx->ws->cs_flush(ctx->rings.gfx.cs, flags); -#if R600_TRACE_CS - if (ctx->screen->trace_bo) { - struct r600_screen *rscreen = ctx->screen; - unsigned i; - - for (i = 0; i < 10; i++) { - usleep(5); - if (!ctx->ws->buffer_is_busy(rscreen->trace_bo->buf, RADEON_USAGE_READWRITE)) { - break; - } - } - if (i == 10) { - fprintf(stderr, "timeout on cs lockup likely happen at cs %d dw %d\n", - rscreen->trace_ptr[1], rscreen->trace_ptr[0]); - } else { - fprintf(stderr, "cs %d executed in %dms\n", rscreen->trace_ptr[1], i * 5); - } - } -#endif + ctx->ws->cs_flush(ctx->rings.gfx.cs, flags, ctx->screen->cs_count++); } void r600_begin_new_cs(struct r600_context *ctx) diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 008539d7c0c..5a0ea8407c5 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -45,6 +45,7 @@ static const struct debug_named_value debug_options[] = { { "texdepth", DBG_TEX_DEPTH, "Print texture depth info" }, { "compute", DBG_COMPUTE, "Print compute info" }, { "vm", DBG_VM, "Print virtual addresses when creating resources" }, + { "trace_cs", DBG_TRACE_CS, "Trace cs and write rlockup_<csid>.c file with faulty cs" }, /* shaders */ { "fs", DBG_FS, "Print fetch shaders" }, @@ -212,7 +213,7 @@ static void r600_flush_dma_ring(void *ctx, unsigned flags) } rctx->rings.dma.flushing = true; - rctx->ws->cs_flush(cs, flags); + rctx->ws->cs_flush(cs, flags, 0); rctx->rings.dma.flushing = false; } @@ -430,14 +431,18 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void goto fail; } - rctx->rings.gfx.cs = rctx->ws->cs_create(rctx->ws, RING_GFX); + if (rscreen->trace_bo) { + rctx->rings.gfx.cs = rctx->ws->cs_create(rctx->ws, RING_GFX, rscreen->trace_bo->cs_buf); + } else { + rctx->rings.gfx.cs = rctx->ws->cs_create(rctx->ws, RING_GFX, NULL); + } rctx->rings.gfx.flush = r600_flush_gfx_ring; rctx->ws->cs_set_flush_callback(rctx->rings.gfx.cs, r600_flush_from_winsys, rctx); rctx->rings.gfx.flushing = false; rctx->rings.dma.cs = NULL; 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.cs = rctx->ws->cs_create(rctx->ws, RING_DMA, NULL); rctx->rings.dma.flush = r600_flush_dma_ring; rctx->ws->cs_set_flush_callback(rctx->rings.dma.cs, r600_flush_dma_from_winsys, rctx); rctx->rings.dma.flushing = false; @@ -958,12 +963,10 @@ static void r600_destroy_screen(struct pipe_screen* pscreen) rscreen->ws->buffer_unmap(rscreen->fences.bo->cs_buf); pipe_resource_reference((struct pipe_resource**)&rscreen->fences.bo, NULL); } -#if R600_TRACE_CS if (rscreen->trace_bo) { rscreen->ws->buffer_unmap(rscreen->trace_bo->cs_buf); pipe_resource_reference((struct pipe_resource**)&rscreen->trace_bo, NULL); } -#endif pipe_mutex_destroy(rscreen->fences.mutex); rscreen->ws->destroy(rscreen->ws); @@ -1308,9 +1311,8 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws) rscreen->global_pool = compute_memory_pool_new(rscreen); -#if R600_TRACE_CS rscreen->cs_count = 0; - if (rscreen->info.drm_minor >= 28) { + if (rscreen->info.drm_minor >= 28 && (rscreen->debug_flags & DBG_TRACE_CS)) { rscreen->trace_bo = (struct r600_resource*)pipe_buffer_create(&rscreen->screen, PIPE_BIND_CUSTOM, PIPE_USAGE_STAGING, @@ -1320,7 +1322,6 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws) PIPE_TRANSFER_UNSYNCHRONIZED); } } -#endif /* Create the auxiliary context. */ pipe_mutex_init(rscreen->aux_context_lock); diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 50861a12bce..39fd82be142 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -37,8 +37,6 @@ #define R600_NUM_ATOMS 41 -#define R600_TRACE_CS 0 - /* the number of CS dwords for flushing and drawing */ #define R600_MAX_FLUSH_CS_DWORDS 16 #define R600_MAX_DRAW_CS_DWORDS 34 @@ -245,7 +243,8 @@ typedef boolean (*r600g_dma_blit_t)(struct pipe_context *ctx, /* logging */ #define DBG_TEX_DEPTH (1 << 0) #define DBG_COMPUTE (1 << 1) -#define DBG_VM (1 << 2) +#define DBG_VM (1 << 2) +#define DBG_TRACE_CS (1 << 3) /* shaders */ #define DBG_FS (1 << 8) #define DBG_VS (1 << 9) @@ -284,11 +283,9 @@ struct r600_screen { * XXX: Not sure if this is the best place for global_pool. Also, * it's not thread safe, so it won't work with multiple contexts. */ struct compute_memory_pool *global_pool; -#if R600_TRACE_CS struct r600_resource *trace_bo; uint32_t *trace_ptr; unsigned cs_count; -#endif r600g_dma_blit_t dma_blit; /* Auxiliary context. Mainly used to initialize resources. @@ -654,19 +651,15 @@ static INLINE void r600_emit_command_buffer(struct radeon_winsys_cs *cs, cs->cdw += cb->num_dw; } -#if R600_TRACE_CS void r600_trace_emit(struct r600_context *rctx); -#endif static INLINE void r600_emit_atom(struct r600_context *rctx, struct r600_atom *atom) { atom->emit(rctx, atom); atom->dirty = false; -#if R600_TRACE_CS if (rctx->screen->trace_bo) { r600_trace_emit(rctx); } -#endif } static INLINE void r600_set_cso_state(struct r600_cso_state *state, void *cso) diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 8190873ce7b..87a2e2e55e7 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -1488,11 +1488,9 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info (info.count_from_stream_output ? S_0287F0_USE_OPAQUE(1) : 0); } -#if R600_TRACE_CS if (rctx->screen->trace_bo) { r600_trace_emit(rctx); } -#endif /* Set the depth buffer as dirty. */ if (rctx->framebuffer.state.zsbuf) { @@ -1764,7 +1762,6 @@ void r600_init_common_state_functions(struct r600_context *rctx) rctx->context.draw_vbo = r600_draw_vbo; } -#if R600_TRACE_CS void r600_trace_emit(struct r600_context *rctx) { struct r600_screen *rscreen = rctx->screen; @@ -1782,4 +1779,3 @@ void r600_trace_emit(struct r600_context *rctx) r600_write_value(cs, PKT3(PKT3_NOP, 0, 0)); r600_write_value(cs, reloc); } -#endif |