iris: return max counter value for AMD_performance_monitor
authorMarcin Ślusarz <marcin.slusarz@intel.com>
Mon, 15 Jun 2020 12:26:26 +0000 (14:26 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 6 Jul 2020 08:40:32 +0000 (08:40 +0000)
glGetPerfMonitorCounterInfoAMD(..., ..., GL_COUNTER_RANGE_AMD, ...)
returned NAN (binary representation of uint64_t(-1) as float) as
a max value.

Fixes: 0fd4359733e6 ("iris/perf: implement routines to return counter info")
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5473>

src/gallium/drivers/iris/iris_monitor.c

index c4194052defaf7a749a0ebc506d80f7705d05143..a8409607c7a94c464bc8cf5b625f9a25f5c2313f 100644 (file)
@@ -72,16 +72,17 @@ iris_get_monitor_info(struct pipe_screen *pscreen, unsigned index,
    case GEN_PERF_COUNTER_DATA_TYPE_BOOL32:
    case GEN_PERF_COUNTER_DATA_TYPE_UINT32:
       info->type = PIPE_DRIVER_QUERY_TYPE_UINT;
-      info->max_value.u32 = 0;
+      assert(counter->raw_max <= UINT32_MAX);
+      info->max_value.u32 = (uint32_t)counter->raw_max;
       break;
    case GEN_PERF_COUNTER_DATA_TYPE_UINT64:
       info->type = PIPE_DRIVER_QUERY_TYPE_UINT64;
-      info->max_value.u64 = 0;
+      info->max_value.u64 = counter->raw_max;
       break;
    case GEN_PERF_COUNTER_DATA_TYPE_FLOAT:
    case GEN_PERF_COUNTER_DATA_TYPE_DOUBLE:
       info->type = PIPE_DRIVER_QUERY_TYPE_FLOAT;
-      info->max_value.u64 = -1;
+      info->max_value.f = counter->raw_max;
       break;
    default:
       assert(false);