[Mesa-dev] [PATCH 2/3] radeon/winsys: keep track of the last CS a BO was used in
Christian König
deathsimple at vodafone.de
Thu Sep 18 08:34:22 PDT 2014
From: Christian König <christian.koenig at amd.com>
Signed-off-by: Christian König <christian.koenig at amd.com>
---
src/gallium/winsys/radeon/drm/radeon_drm_bo.h | 3 +++
src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 11 +++++++++--
src/gallium/winsys/radeon/drm/radeon_drm_cs.h | 2 +-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.h b/src/gallium/winsys/radeon/drm/radeon_drm_bo.h
index 1c00a13..393c53c 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.h
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.h
@@ -65,6 +65,9 @@ struct radeon_bo {
/* how many command streams, which are being emitted in a separate
* thread, is this bo referenced in? */
int num_active_ioctls;
+
+ /* the ID of the last command submission this buffer was used with */
+ uint64_t last_cs_id;
};
struct pb_manager *radeon_bomgr_create(struct radeon_drm_winsys *rws);
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index 0aa54c2..e821b6f 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -107,7 +107,7 @@ static boolean radeon_init_cs_context(struct radeon_cs_context *csc,
csc->chunks[1].length_dw = 0;
csc->chunks[1].chunk_data = (uint64_t)(uintptr_t)csc->relocs;
csc->chunks[2].chunk_id = RADEON_CHUNK_ID_FLAGS;
- csc->chunks[2].length_dw = 2;
+ csc->chunks[2].length_dw = 5;
csc->chunks[2].chunk_data = (uint64_t)(uintptr_t)&csc->flags;
csc->chunk_array[0] = (uint64_t)(uintptr_t)&csc->chunks[0];
@@ -382,6 +382,7 @@ static boolean radeon_drm_cs_memory_below_limit(struct radeon_winsys_cs *rcs, ui
void radeon_drm_cs_emit_ioctl_oneshot(struct radeon_drm_cs *cs, struct radeon_cs_context *csc)
{
+ uint64_t id;
unsigned i;
if (drmCommandWriteRead(csc->fd, DRM_RADEON_CS,
@@ -403,8 +404,11 @@ void radeon_drm_cs_emit_ioctl_oneshot(struct radeon_drm_cs *cs, struct radeon_cs
radeon_dump_cs_on_lockup(cs, csc);
}
- for (i = 0; i < csc->crelocs; i++)
+ id = *((uint64_t *)&csc->flags[3]);
+ for (i = 0; i < csc->crelocs; i++) {
p_atomic_dec(&csc->relocs_bo[i]->num_active_ioctls);
+ csc->relocs_bo[i]->last_cs_id = id;
+ }
radeon_cs_context_cleanup(csc);
}
@@ -533,6 +537,9 @@ static void radeon_drm_cs_flush(struct radeon_winsys_cs *rcs,
}
break;
}
+ cs->cst->flags[2] = 0;
+ cs->cst->flags[3] = 0;
+ cs->cst->flags[4] = 0;
if (cs->ws->thread) {
pipe_semaphore_wait(&cs->flush_completed);
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.h b/src/gallium/winsys/radeon/drm/radeon_drm_cs.h
index 089494e..1d0bc64 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.h
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.h
@@ -37,7 +37,7 @@ struct radeon_cs_context {
struct drm_radeon_cs cs;
struct drm_radeon_cs_chunk chunks[3];
uint64_t chunk_array[3];
- uint32_t flags[2];
+ uint32_t flags[5];
uint32_t cs_trace_id;
--
1.9.1
More information about the mesa-dev
mailing list