Mesa (staging/20.1): iris: return max counter value for AMD_performance_monitor

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 6 20:42:14 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: 921154a5353897026eddfb62c77446245ea95818
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=921154a5353897026eddfb62c77446245ea95818

Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date:   Mon Jun 15 14:26:26 2020 +0200

iris: return max counter value for AMD_performance_monitor

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 at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5473>
(cherry picked from commit 00d3b13837c5edd299dc40cbd84505c8d1d5927f)

---

 .pick_status.json                       | 2 +-
 src/gallium/drivers/iris/iris_monitor.c | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 76b22a1f223..fabac8f0130 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -193,7 +193,7 @@
         "description": "iris: return max counter value for AMD_performance_monitor",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "0fd4359733e6920d5cac9596eeada753a587a246"
     },
diff --git a/src/gallium/drivers/iris/iris_monitor.c b/src/gallium/drivers/iris/iris_monitor.c
index f2c0774b1c3..838c0891b5f 100644
--- a/src/gallium/drivers/iris/iris_monitor.c
+++ b/src/gallium/drivers/iris/iris_monitor.c
@@ -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);



More information about the mesa-commit mailing list