summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-01-22 02:02:18 +0100
committerMarek Olšák <[email protected]>2014-01-28 01:39:42 +0100
commita4c218f398a6176f2ecbe7e295020d348670a957 (patch)
treeda191a95391994e2c698c04451ff5d76c8277c17 /src/gallium/drivers/radeonsi
parentba0c16f7b2283db9dbeef036cf54dd6b694e4eaa (diff)
r600g,radeonsi: consolidate variables for CS tracing
Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r--src/gallium/drivers/radeonsi/si_hw_context.c22
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.c14
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.h5
-rw-r--r--src/gallium/drivers/radeonsi/si_pm4.c4
-rw-r--r--src/gallium/drivers/radeonsi/si_state_draw.c2
5 files changed, 21 insertions, 26 deletions
diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c
index a7536e3fbbf..bb3d0809e22 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -71,7 +71,7 @@ void si_need_cs_space(struct si_context *ctx, unsigned num_dw,
num_dw += ctx->atoms.cache_flush->num_dw;
#if SI_TRACE_CS
- if (ctx->screen->trace_bo) {
+ if (ctx->screen->b.trace_bo) {
num_dw += SI_TRACE_CS_DWORDS;
}
#endif
@@ -118,14 +118,14 @@ void si_context_flush(struct si_context *ctx, unsigned flags)
flags |= RADEON_FLUSH_KEEP_TILING_FLAGS;
#if SI_TRACE_CS
- if (ctx->screen->trace_bo) {
+ if (ctx->screen->b.trace_bo) {
struct si_screen *sscreen = ctx->screen;
unsigned i;
for (i = 0; i < cs->cdw; i++) {
- fprintf(stderr, "[%4d] [%5d] 0x%08x\n", sscreen->cs_count, i, cs->buf[i]);
+ fprintf(stderr, "[%4d] [%5d] 0x%08x\n", sscreen->b.cs_count, i, cs->buf[i]);
}
- sscreen->cs_count++;
+ sscreen->b.cs_count++;
}
#endif
@@ -133,21 +133,21 @@ void si_context_flush(struct si_context *ctx, unsigned flags)
ctx->b.ws->cs_flush(ctx->b.rings.gfx.cs, flags, 0);
#if SI_TRACE_CS
- if (ctx->screen->trace_bo) {
+ if (ctx->screen->b.trace_bo) {
struct si_screen *sscreen = ctx->screen;
unsigned i;
for (i = 0; i < 10; i++) {
usleep(5);
- if (!ctx->ws->buffer_is_busy(sscreen->trace_bo->buf, RADEON_USAGE_READWRITE)) {
+ if (!ctx->ws->buffer_is_busy(sscreen->b.trace_bo->buf, RADEON_USAGE_READWRITE)) {
break;
}
}
if (i == 10) {
fprintf(stderr, "timeout on cs lockup likely happen at cs %d dw %d\n",
- sscreen->trace_ptr[1], sscreen->trace_ptr[0]);
+ sscreen->b.trace_ptr[1], sscreen->b.trace_ptr[0]);
} else {
- fprintf(stderr, "cs %d executed in %dms\n", sscreen->trace_ptr[1], i * 5);
+ fprintf(stderr, "cs %d executed in %dms\n", sscreen->b.trace_ptr[1], i * 5);
}
}
#endif
@@ -193,8 +193,8 @@ void si_trace_emit(struct si_context *sctx)
struct radeon_winsys_cs *cs = sctx->cs;
uint64_t va;
- va = r600_resource_va(&sscreen->screen, (void*)sscreen->trace_bo);
- r600_context_bo_reloc(sctx, sscreen->trace_bo, RADEON_USAGE_READWRITE);
+ va = r600_resource_va(&sscreen->screen, (void*)sscreen->b.trace_bo);
+ r600_context_bo_reloc(sctx, sscreen->b.trace_bo, RADEON_USAGE_READWRITE);
cs->buf[cs->cdw++] = PKT3(PKT3_WRITE_DATA, 4, 0);
cs->buf[cs->cdw++] = PKT3_WRITE_DATA_DST_SEL(PKT3_WRITE_DATA_DST_SEL_MEM_SYNC) |
PKT3_WRITE_DATA_WR_CONFIRM |
@@ -202,6 +202,6 @@ void si_trace_emit(struct si_context *sctx)
cs->buf[cs->cdw++] = va & 0xFFFFFFFFUL;
cs->buf[cs->cdw++] = (va >> 32UL) & 0xFFFFFFFFUL;
cs->buf[cs->cdw++] = cs->cdw;
- cs->buf[cs->cdw++] = sscreen->cs_count;
+ cs->buf[cs->cdw++] = sscreen->b.cs_count;
}
#endif
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 8666b5b071c..6aaf59568c4 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -564,9 +564,9 @@ static void si_destroy_screen(struct pipe_screen* pscreen)
r600_common_screen_cleanup(&sscreen->b);
#if SI_TRACE_CS
- if (sscreen->trace_bo) {
- sscreen->ws->buffer_unmap(sscreen->trace_bo->cs_buf);
- pipe_resource_reference((struct pipe_resource**)&sscreen->trace_bo, NULL);
+ if (sscreen->b.trace_bo) {
+ sscreen->ws->buffer_unmap(sscreen->b.trace_bo->cs_buf);
+ pipe_resource_reference((struct pipe_resource**)&sscreen->b.trace_bo, NULL);
}
#endif
@@ -611,14 +611,14 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws)
sscreen->b.debug_flags |= DBG_FS | DBG_VS | DBG_GS | DBG_PS | DBG_CS;
#if SI_TRACE_CS
- sscreen->cs_count = 0;
+ sscreen->b.cs_count = 0;
if (sscreen->info.drm_minor >= 28) {
- sscreen->trace_bo = (struct r600_resource*)pipe_buffer_create(&sscreen->screen,
+ sscreen->b.trace_bo = (struct r600_resource*)pipe_buffer_create(&sscreen->screen,
PIPE_BIND_CUSTOM,
PIPE_USAGE_STAGING,
4096);
- if (sscreen->trace_bo) {
- sscreen->trace_ptr = sscreen->ws->buffer_map(sscreen->trace_bo->cs_buf, NULL,
+ if (sscreen->b.trace_bo) {
+ sscreen->b.trace_ptr = sscreen->ws->buffer_map(sscreen->b.trace_bo->cs_buf, NULL,
PIPE_TRANSFER_UNSYNCHRONIZED);
}
}
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index aa62852b093..e137bfc58d4 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -55,11 +55,6 @@ struct si_pipe_compute;
struct si_screen {
struct r600_common_screen b;
-#if SI_TRACE_CS
- struct r600_resource *trace_bo;
- uint32_t *trace_ptr;
- unsigned cs_count;
-#endif
};
struct si_pipe_sampler_view {
diff --git a/src/gallium/drivers/radeonsi/si_pm4.c b/src/gallium/drivers/radeonsi/si_pm4.c
index 5b132850272..c8769370db0 100644
--- a/src/gallium/drivers/radeonsi/si_pm4.c
+++ b/src/gallium/drivers/radeonsi/si_pm4.c
@@ -202,7 +202,7 @@ unsigned si_pm4_dirty_dw(struct si_context *sctx)
count += state->ndw;
#if SI_TRACE_CS
/* for tracing each states */
- if (sctx->screen->trace_bo) {
+ if (sctx->screen->b.trace_bo) {
count += SI_TRACE_CS_DWORDS;
}
#endif
@@ -228,7 +228,7 @@ void si_pm4_emit(struct si_context *sctx, struct si_pm4_state *state)
cs->cdw += state->ndw;
#if SI_TRACE_CS
- if (sctx->screen->trace_bo) {
+ if (sctx->screen->b.trace_bo) {
si_trace_emit(sctx);
}
#endif
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 5c2ff8a249e..45dd4baa470 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -750,7 +750,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
sctx->pm4_dirty_cdwords = 0;
#if SI_TRACE_CS
- if (sctx->screen->trace_bo) {
+ if (sctx->screen->b.trace_bo) {
si_trace_emit(sctx);
}
#endif