[Mesa-dev] [PATCH] gallium/radeon: add a new HUD query for the number of resident handles
Marek Olšák
maraeo at gmail.com
Wed Jun 14 18:18:16 UTC 2017
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Wed, Jun 14, 2017 at 11:40 AM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Useful for debugging performance issues when ARB_bindless_texture
> is enabled. This query doesn't make a distinction between texture
> and image handles.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/gallium/drivers/radeon/r600_pipe_common.h | 1 +
> src/gallium/drivers/radeon/r600_query.c | 7 +++++++
> src/gallium/drivers/radeon/r600_query.h | 1 +
> src/gallium/drivers/radeonsi/si_descriptors.c | 3 +++
> 4 files changed, 12 insertions(+)
>
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
> index 45ed5bab74b..006b795fe29 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.h
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.h
> @@ -598,6 +598,7 @@ struct r600_common_context {
> unsigned num_fb_cache_flushes;
> unsigned num_L2_invalidates;
> unsigned num_L2_writebacks;
> + unsigned num_resident_handles;
> uint64_t num_alloc_tex_transfer_bytes;
> unsigned last_tex_ps_draw_ratio; /* for query */
>
> diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c
> index bce43171e30..8bd94e6a940 100644
> --- a/src/gallium/drivers/radeon/r600_query.c
> +++ b/src/gallium/drivers/radeon/r600_query.c
> @@ -134,6 +134,9 @@ static bool r600_query_sw_begin(struct r600_common_context *rctx,
> case R600_QUERY_NUM_L2_WRITEBACKS:
> query->begin_result = rctx->num_L2_writebacks;
> break;
> + case R600_QUERY_NUM_RESIDENT_HANDLES:
> + query->begin_result = rctx->num_resident_handles;
> + break;
> case R600_QUERY_TC_OFFLOADED_SLOTS:
> query->begin_result = rctx->tc ? rctx->tc->num_offloaded_slots : 0;
> break;
> @@ -276,6 +279,9 @@ static bool r600_query_sw_end(struct r600_common_context *rctx,
> case R600_QUERY_NUM_L2_WRITEBACKS:
> query->end_result = rctx->num_L2_writebacks;
> break;
> + case R600_QUERY_NUM_RESIDENT_HANDLES:
> + query->end_result = rctx->num_resident_handles;
> + break;
> case R600_QUERY_TC_OFFLOADED_SLOTS:
> query->end_result = rctx->tc ? rctx->tc->num_offloaded_slots : 0;
> break;
> @@ -1834,6 +1840,7 @@ static struct pipe_driver_query_info r600_driver_query_list[] = {
> X("num-fb-cache-flushes", NUM_FB_CACHE_FLUSHES, UINT64, AVERAGE),
> X("num-L2-invalidates", NUM_L2_INVALIDATES, UINT64, AVERAGE),
> X("num-L2-writebacks", NUM_L2_WRITEBACKS, UINT64, AVERAGE),
> + X("num-resident-handles", NUM_RESIDENT_HANDLES, UINT64, AVERAGE),
> X("tc-offloaded-slots", TC_OFFLOADED_SLOTS, UINT64, AVERAGE),
> X("tc-direct-slots", TC_DIRECT_SLOTS, UINT64, AVERAGE),
> X("tc-num-syncs", TC_NUM_SYNCS, UINT64, AVERAGE),
> diff --git a/src/gallium/drivers/radeon/r600_query.h b/src/gallium/drivers/radeon/r600_query.h
> index ed607ec199b..9e6617f342a 100644
> --- a/src/gallium/drivers/radeon/r600_query.h
> +++ b/src/gallium/drivers/radeon/r600_query.h
> @@ -54,6 +54,7 @@ enum {
> R600_QUERY_NUM_FB_CACHE_FLUSHES,
> R600_QUERY_NUM_L2_INVALIDATES,
> R600_QUERY_NUM_L2_WRITEBACKS,
> + R600_QUERY_NUM_RESIDENT_HANDLES,
> R600_QUERY_TC_OFFLOADED_SLOTS,
> R600_QUERY_TC_DIRECT_SLOTS,
> R600_QUERY_TC_NUM_SYNCS,
> diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
> index 375bcaea937..41f6e054615 100644
> --- a/src/gallium/drivers/radeonsi/si_descriptors.c
> +++ b/src/gallium/drivers/radeonsi/si_descriptors.c
> @@ -2595,6 +2595,9 @@ void si_all_resident_buffers_begin_new_cs(struct si_context *sctx)
> RADEON_USAGE_READWRITE,
> false, false);
> }
> +
> + sctx->b.num_resident_handles += num_resident_tex_handles +
> + num_resident_img_handles;
> }
>
> /* INIT/DEINIT/UPLOAD */
> --
> 2.13.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list