radeonsi: add GFX-IB-size query to the HUD
authorMarek Olšák <marek.olsak@amd.com>
Sat, 7 Oct 2017 22:35:59 +0000 (00:35 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 17 Oct 2017 20:03:03 +0000 (22:03 +0200)
It shows the sum of all IBs per frame.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeon/r600_query.c
src/gallium/drivers/radeon/r600_query.h
src/gallium/drivers/radeon/radeon_winsys.h
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c

index b2809f84dfa596640498857dfa5fbab3779f6b27..aedf950ff2decbaf8e89cc35d1241a175eb00ae4 100644 (file)
@@ -79,6 +79,7 @@ static enum radeon_value_id winsys_id_from_type(unsigned type)
        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_GFX_BO_LIST_SIZE: return RADEON_GFX_BO_LIST_COUNTER;
+       case R600_QUERY_GFX_IB_SIZE: return RADEON_GFX_IB_SIZE_COUNTER;
        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;
@@ -178,6 +179,7 @@ static bool r600_query_sw_begin(struct r600_common_context *rctx,
                query->begin_result = 0;
                break;
        case R600_QUERY_BUFFER_WAIT_TIME:
+       case R600_QUERY_GFX_IB_SIZE:
        case R600_QUERY_NUM_GFX_IBS:
        case R600_QUERY_NUM_SDMA_IBS:
        case R600_QUERY_NUM_BYTES_MOVED:
@@ -333,6 +335,7 @@ static bool r600_query_sw_end(struct r600_common_context *rctx,
        case R600_QUERY_CURRENT_GPU_SCLK:
        case R600_QUERY_CURRENT_GPU_MCLK:
        case R600_QUERY_BUFFER_WAIT_TIME:
+       case R600_QUERY_GFX_IB_SIZE:
        case R600_QUERY_NUM_MAPPED_BUFFERS:
        case R600_QUERY_NUM_GFX_IBS:
        case R600_QUERY_NUM_SDMA_IBS:
@@ -1933,6 +1936,7 @@ static struct pipe_driver_query_info r600_driver_query_list[] = {
        X("num-GFX-IBs",                NUM_GFX_IBS,            UINT64, AVERAGE),
        X("num-SDMA-IBs",               NUM_SDMA_IBS,           UINT64, AVERAGE),
        X("GFX-BO-list-size",           GFX_BO_LIST_SIZE,       UINT64, AVERAGE),
+       X("GFX-IB-size",                GFX_IB_SIZE,            UINT64, AVERAGE),
        X("num-bytes-moved",            NUM_BYTES_MOVED,        BYTES, CUMULATIVE),
        X("num-evictions",              NUM_EVICTIONS,          UINT64, CUMULATIVE),
        X("VRAM-CPU-page-faults",       NUM_VRAM_CPU_PAGE_FAULTS, UINT64, CUMULATIVE),
index a20da075c682ffd0295e5339aebceafeeee2ed38..04943da36fdaec58973453f84affcdb6638641cc 100644 (file)
@@ -72,6 +72,7 @@ enum {
        R600_QUERY_NUM_GFX_IBS,
        R600_QUERY_NUM_SDMA_IBS,
        R600_QUERY_GFX_BO_LIST_SIZE,
+       R600_QUERY_GFX_IB_SIZE,
        R600_QUERY_NUM_BYTES_MOVED,
        R600_QUERY_NUM_EVICTIONS,
        R600_QUERY_NUM_VRAM_CPU_PAGE_FAULTS,
index 2438ec222506f1ab176a384e5c58b504c0f6c98c..2d3f646dc65ab2bc52a3098d2be2248a1ca496e5 100644 (file)
@@ -92,6 +92,7 @@ enum radeon_value_id {
     RADEON_NUM_GFX_IBS,
     RADEON_NUM_SDMA_IBS,
     RADEON_GFX_BO_LIST_COUNTER, /* number of BOs submitted in gfx IBs */
+    RADEON_GFX_IB_SIZE_COUNTER,
     RADEON_NUM_BYTES_MOVED,
     RADEON_NUM_EVICTIONS,
     RADEON_NUM_VRAM_CPU_PAGE_FAULTS,
index 8fbe8ae5fd31b28a7fae8697a3ebd97053872608..8f43e9364698d03cb3d8cbcb4bea76d3a45c6c77 100644 (file)
@@ -1423,6 +1423,7 @@ static int amdgpu_cs_flush(struct radeon_winsys_cs *rcs,
          while (rcs->current.cdw & 7)
             radeon_emit(rcs, 0xffff1000); /* type3 nop packet */
       }
+      ws->gfx_ib_size_counter += (rcs->prev_dw + rcs->current.cdw) * 4;
       break;
    case RING_UVD:
       while (rcs->current.cdw & 15)
index 5e0c1fd8d8fc2b72aa2ed74c0247218e4b57b193..a210a270431082fd09b98d2847aa02b1e7bf4248 100644 (file)
@@ -145,6 +145,8 @@ static uint64_t amdgpu_query_value(struct radeon_winsys *rws,
       return ws->num_sdma_IBs;
    case RADEON_GFX_BO_LIST_COUNTER:
       return ws->gfx_bo_list_counter;
+   case RADEON_GFX_IB_SIZE_COUNTER:
+      return ws->gfx_ib_size_counter;
    case RADEON_NUM_BYTES_MOVED:
       amdgpu_query_info(ws->dev, AMDGPU_INFO_NUM_BYTES_MOVED, 8, &retval);
       return retval;
index de54470ede2eef9853b900a6639c0a5881c9861c..8b62e2dbe34790813e5913aa2253a5eff0915ba0 100644 (file)
@@ -69,6 +69,7 @@ struct amdgpu_winsys {
    uint64_t num_sdma_IBs;
    uint64_t num_mapped_buffers;
    uint64_t gfx_bo_list_counter;
+   uint64_t gfx_ib_size_counter;
 
    struct radeon_info info;
 
index 542e5494bebc6890aadacc46f2422915446455d3..c61f3d97957a07016777207584aba02ca9c1fd3a 100644 (file)
@@ -632,6 +632,7 @@ static uint64_t radeon_query_value(struct radeon_winsys *rws,
     case RADEON_NUM_VRAM_CPU_PAGE_FAULTS:
     case RADEON_VRAM_VIS_USAGE:
     case RADEON_GFX_BO_LIST_COUNTER:
+    case RADEON_GFX_IB_SIZE_COUNTER:
         return 0; /* unimplemented */
     case RADEON_VRAM_USAGE:
         radeon_get_drm_value(ws->fd, RADEON_INFO_VRAM_USAGE,