[Mesa-dev] [PATCH 2/2] gallium/radeon: add VRAM-vis-usage HUD query

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Jan 27 09:26:07 UTC 2017



On 01/27/2017 05:34 AM, Dieter Nützel wrote:
> Question more about the first one
> [Mesa-dev] [PATCH 1/2] gallium/radeon: query the CPU accessible    size
> of VRAM
>
> Is vram_vis_size > vram_size valid?
>
> After some time I get this on r600/Turks XT/6670/2 GB:
>
> /opt/mesa> setenv R600_DEBUG info
> /opt/mesa> glxgears
> pci_id = 0x6758
> family = 45 (AMD TURKS)
> chip_class = 6
> gart_size = 1022 MB
> vram_size = 2048 MB
> vram_vis_size = 2085 MB
> max_alloc_size = 1434 MB
> has_virtual_memory = 0
> gfx_ib_pad_with_type2 = 1
> has_sdma = 1
> has_uvd = 1
> me_fw_version = 0
> pfp_fw_version = 0
> ce_fw_version = 0
> vce_fw_version = 0
> vce_harvest_config = 0
> clock_crystal_freq = 27000
> drm = 2.48.0
> has_userptr = 1
> r600_max_quad_pipes = 4
> max_shader_clock = 800
> num_good_compute_units = 6
> max_se = 1
> max_sh_per_se = 0
> r600_gb_backend_map = 0
> r600_gb_backend_map_valid = 1
> r600_num_banks = 8
> num_render_backends = 2
> num_tile_pipes = 4
> pipe_interleave_bytes = 256
> Running synchronized to the vertical refresh.  The framerate should be
> approximately the same as the monitor refresh rate.
>
> Look GOOD?

No, looks weird. vram_vis_size should be around 256MB. This is radeon 
kernel driver though, not amdgpu (it works there).

>
> Thanks,
>   Dieter
>
> Am 26.01.2017 19:31, schrieb Marek Olšák:
>> For the series:
>>
>> Reviewed-by: Marek Olšák <marek.olsak at amd.com>
>>
>> On Jan 25, 2017 5:50 PM, "Nicolai Hähnle" <nhaehnle at gmail.com> wrote:
>>
>>> Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
>>>
>>> On 25.01.2017 16:56, Samuel Pitoiset wrote:
>>>
>>>> This new query returns the current visible usage of VRAM accessed
>>>> by the CPU. It will return 0 on radeon because it's unimplemented.
>>>>
>>>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>>>> ---
>>>> src/gallium/drivers/radeon/r600_query.c           | 7 +++++++
>>>> src/gallium/drivers/radeon/r600_query.h           | 1 +
>>>> src/gallium/drivers/radeon/radeon_winsys.h        | 1 +
>>>> src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c     | 4 ++++
>>>> src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 1 +
>>>> 5 files changed, 14 insertions(+)
>>>>
>>>> diff --git a/src/gallium/drivers/radeon/r600_query.c
>>>> b/src/gallium/drivers/radeon/r600_query.c
>>>> index 96157cd40e..d4e41306a4 100644
>>>> --- a/src/gallium/drivers/radeon/r600_query.c
>>>> +++ b/src/gallium/drivers/radeon/r600_query.c
>>>> @@ -71,6 +71,7 @@ static enum radeon_value_id
>>>> winsys_id_from_type(unsigned type)
>>>> case R600_QUERY_NUM_BYTES_MOVED: return
>>>> RADEON_NUM_BYTES_MOVED;
>>>> case R600_QUERY_NUM_EVICTIONS: return
>>>> RADEON_NUM_EVICTIONS;
>>>> 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;
>>>> @@ -129,6 +130,7 @@ static bool r600_query_sw_begin(struct
>>>> r600_common_context *rctx,
>>>> case R600_QUERY_MAPPED_VRAM:
>>>> case R600_QUERY_MAPPED_GTT:
>>>> case R600_QUERY_VRAM_USAGE:
>>>> +       case R600_QUERY_VRAM_VIS_USAGE:
>>>> case R600_QUERY_GTT_USAGE:
>>>> case R600_QUERY_GPU_TEMPERATURE:
>>>> case R600_QUERY_CURRENT_GPU_SCLK:
>>>> @@ -238,6 +240,7 @@ static bool r600_query_sw_end(struct
>>>> r600_common_context *rctx,
>>>> case R600_QUERY_MAPPED_VRAM:
>>>> case R600_QUERY_MAPPED_GTT:
>>>> case R600_QUERY_VRAM_USAGE:
>>>> +       case R600_QUERY_VRAM_VIS_USAGE:
>>>> case R600_QUERY_GTT_USAGE:
>>>> case R600_QUERY_GPU_TEMPERATURE:
>>>> case R600_QUERY_CURRENT_GPU_SCLK:
>>>> @@ -1731,6 +1734,7 @@ static struct pipe_driver_query_info
>>>> r600_driver_query_list[] = {
>>>> X("num-bytes-moved",            NUM_BYTES_MOVED,
>>>> BYTES, CUMULATIVE),
>>>> X("num-evictions",              NUM_EVICTIONS,
>>>> UINT64, CUMULATIVE),
>>>> X("VRAM-usage",                 VRAM_USAGE,
>>>> BYTES, AVERAGE),
>>>> +       X("VRAM-vis-usage",             VRAM_VIS_USAGE,
>>>> BYTES, AVERAGE),
>>>> X("GTT-usage",                  GTT_USAGE,
>>>> BYTES, AVERAGE),
>>>> X("back-buffer-ps-draw-ratio",  BACK_BUFFER_PS_DRAW_RATIO,
>>>> UINT64, AVERAGE),
>>>>
>>>> @@ -1814,6 +1818,9 @@ static int r600_get_driver_query_info(struct
>>>> pipe_screen *screen,
>>>> case R600_QUERY_GPU_TEMPERATURE:
>>>> info->max_value.u64 = 125;
>>>> break;
>>>> +       case R600_QUERY_VRAM_VIS_USAGE:
>>>> +               info->max_value.u64 = rscreen->info.vram_vis_size;
>>>> +               break;
>>>> }
>>>>
>>>> if (info->group_id != ~(unsigned)0 &&
>>>> rscreen->perfcounters)
>>>> diff --git a/src/gallium/drivers/radeon/r600_query.h
>>>> b/src/gallium/drivers/radeon/r600_query.h
>>>> index 20856a5b2e..f2af9240d2 100644
>>>> --- a/src/gallium/drivers/radeon/r600_query.h
>>>> +++ b/src/gallium/drivers/radeon/r600_query.h
>>>> @@ -66,6 +66,7 @@ enum {
>>>> R600_QUERY_NUM_BYTES_MOVED,
>>>> R600_QUERY_NUM_EVICTIONS,
>>>> R600_QUERY_VRAM_USAGE,
>>>> +       R600_QUERY_VRAM_VIS_USAGE,
>>>> R600_QUERY_GTT_USAGE,
>>>> R600_QUERY_GPU_TEMPERATURE,
>>>> R600_QUERY_CURRENT_GPU_SCLK,
>>>> diff --git a/src/gallium/drivers/radeon/radeon_winsys.h
>>>> b/src/gallium/drivers/radeon/radeon_winsys.h
>>>> index e373e2f0a1..881bd5f2e4 100644
>>>> --- a/src/gallium/drivers/radeon/radeon_winsys.h
>>>> +++ b/src/gallium/drivers/radeon/radeon_winsys.h
>>>> @@ -88,6 +88,7 @@ enum radeon_value_id {
>>>> RADEON_NUM_BYTES_MOVED,
>>>> RADEON_NUM_EVICTIONS,
>>>> RADEON_VRAM_USAGE,
>>>> +    RADEON_VRAM_VIS_USAGE,
>>>> RADEON_GTT_USAGE,
>>>> RADEON_GPU_TEMPERATURE, /* DRM 2.42.0 */
>>>> RADEON_CURRENT_SCLK,
>>>> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
>>>> b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
>>>> index ea4d25476f..c3dfda53f0 100644
>>>> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
>>>> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
>>>> @@ -451,6 +451,10 @@ static uint64_t amdgpu_query_value(struct
>>>> radeon_winsys *rws,
>>>> case RADEON_VRAM_USAGE:
>>>> amdgpu_query_heap_info(ws->dev, AMDGPU_GEM_DOMAIN_VRAM, 0,
>>>> &heap);
>>>> return heap.heap_usage;
>>>> +   case RADEON_VRAM_VIS_USAGE:
>>>> +      amdgpu_query_heap_info(ws->dev, AMDGPU_GEM_DOMAIN_VRAM,
>>>> +
>>>> AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, &heap);
>>>> +      return heap.heap_usage;
>>>> case RADEON_GTT_USAGE:
>>>> amdgpu_query_heap_info(ws->dev, AMDGPU_GEM_DOMAIN_GTT, 0,
>>>> &heap);
>>>> return heap.heap_usage;
>>>> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
>>>> b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
>>>> index ce5b7ffef1..3a92b588eb 100644
>>>> --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
>>>> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
>>>> @@ -635,6 +635,7 @@ static uint64_t radeon_query_value(struct
>>>> radeon_winsys *rws,
>>>> "num-bytes-moved",
>>>> (uint32_t*)&retval);
>>>> return retval;
>>>> case RADEON_NUM_EVICTIONS:
>>>> +    case RADEON_VRAM_VIS_USAGE:
>>>> return 0; /* unimplemented */
>>>> case RADEON_VRAM_USAGE:
>>>> radeon_get_drm_value(ws->fd, RADEON_INFO_VRAM_USAGE,
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev [1]
>>
>>
>>
>> Links:
>> ------
>> [1] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>> _______________________________________________
>> 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