intel/dump_gpu: Handle a bunch of getparam in the no-HW case
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 19 Mar 2020 21:45:19 +0000 (16:45 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 24 Mar 2020 06:28:29 +0000 (06:28 +0000)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4250>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4250>

src/intel/tools/intel_dump_gpu.c

index fabbf4f73d8f82e863d782c2ef79b55d88c093f8..24dd1dffcaa596b86653769459eced47eaa03482 100644 (file)
@@ -481,8 +481,53 @@ ioctl(int fd, unsigned long request, ...)
          if (getparam->param == I915_PARAM_CHIPSET_ID)
             return get_pci_id(fd, getparam->value);
 
-         if (device_override)
-            return -1;
+         if (device_override) {
+            switch (getparam->param) {
+            case I915_PARAM_CS_TIMESTAMP_FREQUENCY:
+               *getparam->value = devinfo.timestamp_frequency;
+               return 0;
+
+            case I915_PARAM_HAS_WAIT_TIMEOUT:
+            case I915_PARAM_HAS_EXECBUF2:
+            case I915_PARAM_MMAP_VERSION:
+            case I915_PARAM_HAS_EXEC_ASYNC:
+            case I915_PARAM_HAS_EXEC_FENCE:
+            case I915_PARAM_HAS_EXEC_FENCE_ARRAY:
+               *getparam->value = 1;
+               return 0;
+
+            case I915_PARAM_HAS_EXEC_SOFTPIN:
+               *getparam->value = devinfo.gen >= 8 && !devinfo.is_cherryview;
+               return 0;
+
+            default:
+               return -1;
+            }
+         }
+
+         return libc_ioctl(fd, request, argp);
+      }
+
+      case DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM: {
+         struct drm_i915_gem_context_param *getparam = argp;
+
+         ensure_device_info(fd);
+
+         if (device_override) {
+            switch (getparam->param) {
+            case I915_CONTEXT_PARAM_GTT_SIZE:
+               if (devinfo.is_elkhartlake)
+                  getparam->value = 1ull << 36;
+               else if (devinfo.gen >= 8 && !devinfo.is_cherryview)
+                  getparam->value = 1ull << 48;
+               else
+                  getparam->value = 1ull << 31;
+               return 0;
+
+            default:
+               return -1;
+            }
+         }
 
          return libc_ioctl(fd, request, argp);
       }