summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/radeon/drm
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-01-23 21:44:45 +0100
committerSamuel Pitoiset <[email protected]>2017-01-25 15:19:21 +0100
commitcff199ceb7c68db51efc85f34cd45ccede790d4a (patch)
treea1e2b3390ab294abbeb2a8237c0276c657f567cd /src/gallium/winsys/radeon/drm
parent56495080ed910c8fb7cd02aa5e3b14e0fb823c6d (diff)
gallium/radeon: add a new HUD query for the number of mapped buffers
Useful when debugging applications which map a ton of buffers and also because we used to run into Linux's limit on the number of simultaneous mmap() calls. v2: - update the commit message Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/winsys/radeon/drm')
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_bo.c3
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_winsys.c2
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_winsys.h1
3 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index a15d559b015..9872861525c 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -382,6 +382,7 @@ void radeon_bo_destroy(struct pb_buffer *_buf)
bo->rws->mapped_vram -= bo->base.size;
else
bo->rws->mapped_gtt -= bo->base.size;
+ bo->rws->num_mapped_buffers--;
}
FREE(bo);
@@ -458,6 +459,7 @@ void *radeon_bo_do_map(struct radeon_bo *bo)
bo->rws->mapped_vram += bo->base.size;
else
bo->rws->mapped_gtt += bo->base.size;
+ bo->rws->num_mapped_buffers++;
pipe_mutex_unlock(bo->u.real.map_mutex);
return (uint8_t*)bo->u.real.ptr + offset;
@@ -570,6 +572,7 @@ static void radeon_bo_unmap(struct pb_buffer *_buf)
bo->rws->mapped_vram -= bo->base.size;
else
bo->rws->mapped_gtt -= bo->base.size;
+ bo->rws->num_mapped_buffers--;
pipe_mutex_unlock(bo->u.real.map_mutex);
}
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
index c85e427a216..f5de66e8bdd 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -614,6 +614,8 @@ static uint64_t radeon_query_value(struct radeon_winsys *rws,
return ws->mapped_gtt;
case RADEON_BUFFER_WAIT_TIME_NS:
return ws->buffer_wait_time;
+ case RADEON_NUM_MAPPED_BUFFERS:
+ return ws->num_mapped_buffers;
case RADEON_TIMESTAMP:
if (ws->info.drm_minor < 20 || ws->gen < DRV_R600) {
assert(0);
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h
index ac623a1b311..7f2d99d372c 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h
@@ -81,6 +81,7 @@ struct radeon_drm_winsys {
uint64_t buffer_wait_time; /* time spent in buffer_wait in ns */
uint64_t num_gfx_IBs;
uint64_t num_sdma_IBs;
+ uint64_t num_mapped_buffers;
uint32_t next_bo_hash;
enum radeon_generation gen;