anv: query CS timestamp frequency from the kernel
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 4 Dec 2017 15:22:12 +0000 (15:22 +0000)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 4 Dec 2017 18:05:20 +0000 (18:05 +0000)
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@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
src/intel/vulkan/anv_device.c

index 258668fa0b097db5efc48bd486269dd254d74df4..97124154b690b4d942aaf3e852094bd6d2494d2f 100644 (file)
@@ -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);