[Mesa-dev] [PATCH 2/2] gallium/radeon: pipe AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS into gallium HUD
Samuel Pitoiset
samuel.pitoiset at gmail.com
Wed May 17 20:48:28 UTC 2017
On 05/17/2017 10:45 PM, Marek Olšák wrote:
> On Wed, May 17, 2017 at 9:19 PM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>>
>>
>> On 05/17/2017 09:15 PM, Marek Olšák wrote:
>>>
>>> From: Marek Olšák <marek.olsak at amd.com>
>>>
>>> ---
>>> src/gallium/drivers/radeon/r600_query.c | 8 ++++++--
>>> src/gallium/drivers/radeon/r600_query.h | 1 +
>>> src/gallium/drivers/radeon/radeon_winsys.h | 1 +
>>> src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 7 +++++++
>>> src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 1 +
>>> 5 files changed, 16 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/src/gallium/drivers/radeon/r600_query.c
>>> b/src/gallium/drivers/radeon/r600_query.c
>>> index 0d960bc..7edbb15 100644
>>> --- a/src/gallium/drivers/radeon/r600_query.c
>>> +++ b/src/gallium/drivers/radeon/r600_query.c
>>> @@ -66,20 +66,21 @@ static enum radeon_value_id
>>> winsys_id_from_type(unsigned type)
>>> case R600_QUERY_REQUESTED_VRAM: return
>>> RADEON_REQUESTED_VRAM_MEMORY;
>>> case R600_QUERY_REQUESTED_GTT: return RADEON_REQUESTED_GTT_MEMORY;
>>> case R600_QUERY_MAPPED_VRAM: return RADEON_MAPPED_VRAM;
>>> case R600_QUERY_MAPPED_GTT: return RADEON_MAPPED_GTT;
>>> case R600_QUERY_BUFFER_WAIT_TIME: return
>>> RADEON_BUFFER_WAIT_TIME_NS;
>>> case R600_QUERY_NUM_MAPPED_BUFFERS: return
>>> RADEON_NUM_MAPPED_BUFFERS;
>>> case R600_QUERY_NUM_GFX_IBS: return RADEON_NUM_GFX_IBS;
>>> case R600_QUERY_NUM_SDMA_IBS: return RADEON_NUM_SDMA_IBS;
>>> case R600_QUERY_NUM_BYTES_MOVED: return RADEON_NUM_BYTES_MOVED;
>>> case R600_QUERY_NUM_EVICTIONS: return RADEON_NUM_EVICTIONS;
>>> + case R600_QUERY_NUM_VRAM_CPU_PAGE_FAULTS: return
>>> RADEON_NUM_VRAM_CPU_PAGE_FAULTS;
>>> case R600_QUERY_VRAM_USAGE: return RADEON_VRAM_USAGE;
>>> case R600_QUERY_VRAM_VIS_USAGE: return RADEON_VRAM_VIS_USAGE;
>>> case R600_QUERY_GTT_USAGE: return RADEON_GTT_USAGE;
>>> case R600_QUERY_GPU_TEMPERATURE: return RADEON_GPU_TEMPERATURE;
>>> case R600_QUERY_CURRENT_GPU_SCLK: return RADEON_CURRENT_SCLK;
>>> case R600_QUERY_CURRENT_GPU_MCLK: return RADEON_CURRENT_MCLK;
>>> case R600_QUERY_CS_THREAD_BUSY: return RADEON_CS_THREAD_TIME;
>>> default: unreachable("query type does not correspond to winsys
>>> id");
>>> }
>>> }
>>> @@ -153,21 +154,22 @@ static bool r600_query_sw_begin(struct
>>> r600_common_context *rctx,
>>> case R600_QUERY_CURRENT_GPU_SCLK:
>>> case R600_QUERY_CURRENT_GPU_MCLK:
>>> case R600_QUERY_BACK_BUFFER_PS_DRAW_RATIO:
>>> case R600_QUERY_NUM_MAPPED_BUFFERS:
>>> query->begin_result = 0;
>>> break;
>>> case R600_QUERY_BUFFER_WAIT_TIME:
>>> case R600_QUERY_NUM_GFX_IBS:
>>> case R600_QUERY_NUM_SDMA_IBS:
>>> case R600_QUERY_NUM_BYTES_MOVED:
>>> - case R600_QUERY_NUM_EVICTIONS: {
>>> + case R600_QUERY_NUM_EVICTIONS:
>>> + case R600_QUERY_NUM_VRAM_CPU_PAGE_FAULTS: {
>>> enum radeon_value_id ws_id =
>>> winsys_id_from_type(query->b.type);
>>> query->begin_result = rctx->ws->query_value(rctx->ws,
>>> ws_id);
>>> break;
>>> }
>>> case R600_QUERY_CS_THREAD_BUSY:
>>> ws_id = winsys_id_from_type(query->b.type);
>>> query->begin_result = rctx->ws->query_value(rctx->ws,
>>> ws_id);
>>> query->begin_time = os_time_get_nano();
>>> break;
>>> case R600_QUERY_GALLIUM_THREAD_BUSY:
>>> @@ -291,21 +293,22 @@ static bool r600_query_sw_end(struct
>>> r600_common_context *rctx,
>>> case R600_QUERY_VRAM_VIS_USAGE:
>>> case R600_QUERY_GTT_USAGE:
>>> case R600_QUERY_GPU_TEMPERATURE:
>>> case R600_QUERY_CURRENT_GPU_SCLK:
>>> case R600_QUERY_CURRENT_GPU_MCLK:
>>> case R600_QUERY_BUFFER_WAIT_TIME:
>>> case R600_QUERY_NUM_MAPPED_BUFFERS:
>>> case R600_QUERY_NUM_GFX_IBS:
>>> case R600_QUERY_NUM_SDMA_IBS:
>>> case R600_QUERY_NUM_BYTES_MOVED:
>>> - case R600_QUERY_NUM_EVICTIONS: {
>>> + case R600_QUERY_NUM_EVICTIONS:
>>> + case R600_QUERY_NUM_VRAM_CPU_PAGE_FAULTS: {
>>> enum radeon_value_id ws_id =
>>> winsys_id_from_type(query->b.type);
>>> query->end_result = rctx->ws->query_value(rctx->ws,
>>> ws_id);
>>> break;
>>> }
>>> case R600_QUERY_CS_THREAD_BUSY:
>>> ws_id = winsys_id_from_type(query->b.type);
>>> query->end_result = rctx->ws->query_value(rctx->ws,
>>> ws_id);
>>> query->end_time = os_time_get_nano();
>>> break;
>>> case R600_QUERY_GALLIUM_THREAD_BUSY:
>>> @@ -1839,20 +1842,21 @@ static struct pipe_driver_query_info
>>> r600_driver_query_list[] = {
>>> X("requested-VRAM", REQUESTED_VRAM, BYTES,
>>> AVERAGE),
>>> X("requested-GTT", REQUESTED_GTT, BYTES,
>>> AVERAGE),
>>> X("mapped-VRAM", MAPPED_VRAM, BYTES,
>>> AVERAGE),
>>> X("mapped-GTT", MAPPED_GTT, BYTES,
>>> AVERAGE),
>>> X("buffer-wait-time", BUFFER_WAIT_TIME,
>>> MICROSECONDS, CUMULATIVE),
>>> X("num-mapped-buffers", NUM_MAPPED_BUFFERS, UINT64,
>>> AVERAGE),
>>> X("num-GFX-IBs", NUM_GFX_IBS, UINT64,
>>> AVERAGE),
>>> X("num-SDMA-IBs", NUM_SDMA_IBS, UINT64,
>>> AVERAGE),
>>> X("num-bytes-moved", NUM_BYTES_MOVED, BYTES,
>>> CUMULATIVE),
>>> X("num-evictions", NUM_EVICTIONS, UINT64,
>>> CUMULATIVE),
>>> + X("TTM-num-VRAM-CPU-page-faults", NUM_VRAM_CPU_PAGE_FAULTS,
>>> UINT64, CUMULATIVE),
>>
>>
>> VRAM-CPU-page-faults is enough, no?
>
> Well, it's my personal preference. That said, the string can be
> renamed using the GALLIUM_HUD variable, so it doesn't matter much.
Sure, but usually the query name follows the constant name.
>
> Marek
>
More information about the mesa-dev
mailing list