Mesa (master): anv: query CS timestamp frequency from the kernel

Lionel Landwerlin llandwerlin at kemper.freedesktop.org
Mon Dec 4 18:05:56 UTC 2017


Module: Mesa
Branch: master
Commit: 2ead8f1690823bbb1acb8102bb6ceee26e8574b1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2ead8f1690823bbb1acb8102bb6ceee26e8574b1

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Mon Dec  4 15:22:12 2017 +0000

anv: query CS timestamp frequency from the kernel

The reference value in gen_device_info isn't going to be acurate on
Gen10+. We should query it from the kernel, which reads a couple of
register to compute the actual value.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli at intel.com>

---

 src/intel/vulkan/anv_device.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 258668fa0b..97124154b6 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -371,6 +371,19 @@ anv_physical_device_init(struct anv_physical_device *device,
 
    bool swizzled = anv_gem_get_bit6_swizzle(fd, I915_TILING_X);
 
+   /* Starting with Gen10, the timestamp frequency of the command streamer may
+    * vary from one part to another. We can query the value from the kernel.
+    */
+   if (device->info.gen >= 10) {
+      int timestamp_frequency =
+         anv_gem_get_param(fd, I915_PARAM_CS_TIMESTAMP_FREQUENCY);
+
+      if (timestamp_frequency < 0)
+         intel_logw("Kernel 4.16-rc1+ required to properly query CS timestamp frequency");
+      else
+         device->info.timestamp_frequency = timestamp_frequency;
+   }
+
    /* GENs prior to 8 do not support EU/Subslice info */
    if (device->info.gen >= 8) {
       device->subslice_total = anv_gem_get_param(fd, I915_PARAM_SUBSLICE_TOTAL);




More information about the mesa-commit mailing list