<div dir="auto"><div dir="auto"><span style="font-family:sans-serif;font-size:11.008px">For the series:</span></div><div dir="auto"><span style="font-family:sans-serif;font-size:11.008px"><br></span></div><div><span style="font-family:sans-serif;font-size:11.008px">Reviewed-by: Marek Olšák <</span><a href="mailto:marek.olsak@amd.com" style="text-decoration:none;color:rgb(66,133,244);font-family:sans-serif;font-size:11.008px">marek.olsak@amd.com</a><span style="font-family:sans-serif;font-size:11.008px">></span><br><div class="gmail_extra"><br><div class="gmail_quote">On Jan 25, 2017 5:50 PM, "Nicolai Hähnle" <<a href="mailto:nhaehnle@gmail.com">nhaehnle@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Reviewed-by: Nicolai Hähnle <<a href="mailto:nicolai.haehnle@amd.com" target="_blank">nicolai.haehnle@amd.com</a>><div class="elided-text"><br>
<br>
On 25.01.2017 16:56, Samuel Pitoiset wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This new query returns the current visible usage of VRAM accessed<br>
by the CPU. It will return 0 on radeon because it's unimplemented.<br>
<br>
Signed-off-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com" target="_blank">samuel.pitoiset@gmail.com</a>><br>
---<br>
src/gallium/drivers/radeon/r6<wbr>00_query.c | 7 +++++++<br>
src/gallium/drivers/radeon/r6<wbr>00_query.h | 1 +<br>
src/gallium/drivers/radeon/ra<wbr>deon_winsys.h | 1 +<br>
src/gallium/winsys/amdgpu/<wbr>drm/amdgpu_winsys.c | 4 ++++<br>
src/gallium/winsys/radeon/<wbr>drm/radeon_drm_winsys.c | 1 +<br>
5 files changed, 14 insertions(+)<br>
<br>
diff --git a/src/gallium/drivers/radeon/r<wbr>600_query.c b/src/gallium/drivers/radeon/r<wbr>600_query.c<br>
index 96157cd40e..d4e41306a4 100644<br>
--- a/src/gallium/drivers/radeon/r<wbr>600_query.c<br>
+++ b/src/gallium/drivers/radeon/r<wbr>600_query.c<br>
@@ -71,6 +71,7 @@ static enum radeon_value_id winsys_id_from_type(unsigned type)<br>
case R600_QUERY_NUM_BYTES_MOVED: return RADEON_NUM_BYTES_MOVED;<br>
case R600_QUERY_NUM_EVICTIONS: return RADEON_NUM_EVICTIONS;<br>
case R600_QUERY_VRAM_USAGE: return RADEON_VRAM_USAGE;<br>
+ case R600_QUERY_VRAM_VIS_USAGE: return RADEON_VRAM_VIS_USAGE;<br>
case R600_QUERY_GTT_USAGE: return RADEON_GTT_USAGE;<br>
case R600_QUERY_GPU_TEMPERATURE: return RADEON_GPU_TEMPERATURE;<br>
case R600_QUERY_CURRENT_GPU_SCLK: return RADEON_CURRENT_SCLK;<br>
@@ -129,6 +130,7 @@ static bool r600_query_sw_begin(struct r600_common_context *rctx,<br>
case R600_QUERY_MAPPED_VRAM:<br>
case R600_QUERY_MAPPED_GTT:<br>
case R600_QUERY_VRAM_USAGE:<br>
+ case R600_QUERY_VRAM_VIS_USAGE:<br>
case R600_QUERY_GTT_USAGE:<br>
case R600_QUERY_GPU_TEMPERATURE:<br>
case R600_QUERY_CURRENT_GPU_SCLK:<br>
@@ -238,6 +240,7 @@ static bool r600_query_sw_end(struct r600_common_context *rctx,<br>
case R600_QUERY_MAPPED_VRAM:<br>
case R600_QUERY_MAPPED_GTT:<br>
case R600_QUERY_VRAM_USAGE:<br>
+ case R600_QUERY_VRAM_VIS_USAGE:<br>
case R600_QUERY_GTT_USAGE:<br>
case R600_QUERY_GPU_TEMPERATURE:<br>
case R600_QUERY_CURRENT_GPU_SCLK:<br>
@@ -1731,6 +1734,7 @@ static struct pipe_driver_query_info r600_driver_query_list[] = {<br>
X("num-bytes-moved", NUM_BYTES_MOVED, BYTES, CUMULATIVE),<br>
X("num-evictions", NUM_EVICTIONS, UINT64, CUMULATIVE),<br>
X("VRAM-usage", VRAM_USAGE, BYTES, AVERAGE),<br>
+ X("VRAM-vis-usage", VRAM_VIS_USAGE, BYTES, AVERAGE),<br>
X("GTT-usage", GTT_USAGE, BYTES, AVERAGE),<br>
X("back-buffer-ps-draw-ratio",<wbr> BACK_BUFFER_PS_DRAW_RATIO, UINT64, AVERAGE),<br>
<br>
@@ -1814,6 +1818,9 @@ static int r600_get_driver_query_info(str<wbr>uct pipe_screen *screen,<br>
case R600_QUERY_GPU_TEMPERATURE:<br>
info->max_value.u64 = 125;<br>
break;<br>
+ case R600_QUERY_VRAM_VIS_USAGE:<br>
+ info->max_value.u64 = rscreen->info.vram_vis_size;<br>
+ break;<br>
}<br>
<br>
if (info->group_id != ~(unsigned)0 && rscreen->perfcounters)<br>
diff --git a/src/gallium/drivers/radeon/r<wbr>600_query.h b/src/gallium/drivers/radeon/r<wbr>600_query.h<br>
index 20856a5b2e..f2af9240d2 100644<br>
--- a/src/gallium/drivers/radeon/r<wbr>600_query.h<br>
+++ b/src/gallium/drivers/radeon/r<wbr>600_query.h<br>
@@ -66,6 +66,7 @@ enum {<br>
R600_QUERY_NUM_BYTES_MOVED,<br>
R600_QUERY_NUM_EVICTIONS,<br>
R600_QUERY_VRAM_USAGE,<br>
+ R600_QUERY_VRAM_VIS_USAGE,<br>
R600_QUERY_GTT_USAGE,<br>
R600_QUERY_GPU_TEMPERATURE,<br>
R600_QUERY_CURRENT_GPU_SCLK,<br>
diff --git a/src/gallium/drivers/radeon/r<wbr>adeon_winsys.h b/src/gallium/drivers/radeon/r<wbr>adeon_winsys.h<br>
index e373e2f0a1..881bd5f2e4 100644<br>
--- a/src/gallium/drivers/radeon/r<wbr>adeon_winsys.h<br>
+++ b/src/gallium/drivers/radeon/r<wbr>adeon_winsys.h<br>
@@ -88,6 +88,7 @@ enum radeon_value_id {<br>
RADEON_NUM_BYTES_MOVED,<br>
RADEON_NUM_EVICTIONS,<br>
RADEON_VRAM_USAGE,<br>
+ RADEON_VRAM_VIS_USAGE,<br>
RADEON_GTT_USAGE,<br>
RADEON_GPU_TEMPERATURE, /* DRM 2.42.0 */<br>
RADEON_CURRENT_SCLK,<br>
diff --git a/src/gallium/winsys/amdgpu/dr<wbr>m/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/dr<wbr>m/amdgpu_winsys.c<br>
index ea4d25476f..c3dfda53f0 100644<br>
--- a/src/gallium/winsys/amdgpu/dr<wbr>m/amdgpu_winsys.c<br>
+++ b/src/gallium/winsys/amdgpu/dr<wbr>m/amdgpu_winsys.c<br>
@@ -451,6 +451,10 @@ static uint64_t amdgpu_query_value(struct radeon_winsys *rws,<br>
case RADEON_VRAM_USAGE:<br>
amdgpu_query_heap_info(ws->de<wbr>v, AMDGPU_GEM_DOMAIN_VRAM, 0, &heap);<br>
return heap.heap_usage;<br>
+ case RADEON_VRAM_VIS_USAGE:<br>
+ amdgpu_query_heap_info(ws->dev<wbr>, AMDGPU_GEM_DOMAIN_VRAM,<br>
+ AMDGPU_GEM_CREATE_CPU_ACCESS_<wbr>REQUIRED, &heap);<br>
+ return heap.heap_usage;<br>
case RADEON_GTT_USAGE:<br>
amdgpu_query_heap_info(ws->de<wbr>v, AMDGPU_GEM_DOMAIN_GTT, 0, &heap);<br>
return heap.heap_usage;<br>
diff --git a/src/gallium/winsys/radeon/dr<wbr>m/radeon_drm_winsys.c b/src/gallium/winsys/radeon/dr<wbr>m/radeon_drm_winsys.c<br>
index ce5b7ffef1..3a92b588eb 100644<br>
--- a/src/gallium/winsys/radeon/dr<wbr>m/radeon_drm_winsys.c<br>
+++ b/src/gallium/winsys/radeon/dr<wbr>m/radeon_drm_winsys.c<br>
@@ -635,6 +635,7 @@ static uint64_t radeon_query_value(struct radeon_winsys *rws,<br>
"num-bytes-moved", (uint32_t*)&retval);<br>
return retval;<br>
case RADEON_NUM_EVICTIONS:<br>
+ case RADEON_VRAM_VIS_USAGE:<br>
return 0; /* unimplemented */<br>
case RADEON_VRAM_USAGE:<br>
radeon_get_drm_value(ws->fd, RADEON_INFO_VRAM_USAGE,<br>
<br>
</blockquote></div><div class="elided-text">
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</div></blockquote></div><br></div></div></div>