Skip to content

mesa: Fix AMD performance monitor implementation

Trigger Huang requested to merge Trigger.Huang/mesa:amd-perfmonitor-fix into main

What does this MR do and why?

mesa: Fix AMD performance monitor implementation

For cmd GL_PERFMON_RESULT_SIZE_AMD and GL_PERFMON_RESULT_AMD of
glGetPerfMonitorCounterDataAMD(), the current implementation will
return 0 if the result is not available on HW, but according to the
sepc, if cmd is PERFMON_RESULT_SIZE_AMD, <data> will contain actual
size of all counter results being sampled, instead of 0. And if cmd is
PERFMON_RESULT_AMD, <data> will contain results. The spec doesn't
require the application to wait for the result available on HW before
executing cmd PERFMON_RESULT_SIZE_AMD and PERFMON_RESULT_AMD. So for
cmd PERFMON_RESULT_SIZE_AMD, it should immediately return the correct
result size for the counters enabled by
glSelectPerfMonitorCountersAMD(), and for cmd PERFMON_RESULT_AMD, it
should wait until the result is available on HW and then return the
result.

Without this fix, the Sample Usage in the spec will not work properly
as it always gets size 0 when calling the cmd PERFMON_RESULT_SIZE_AMD

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>

Merge request reports

Loading