intel/vulkan: Support INTEL_NO_HW environment variable
authorJordan Justen <jordan.l.justen@intel.com>
Sat, 10 Feb 2018 02:36:43 +0000 (18:36 -0800)
committerJordan Justen <jordan.l.justen@intel.com>
Tue, 27 Feb 2018 19:15:10 +0000 (11:15 -0800)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_private.h
src/intel/vulkan/anv_queue.c

index a83b7a39f6af5ee5e2ec66284b4d92b1ea56d3ff..dd5f2f492860b3be5905131724a893e8b2687d0b 100644 (file)
@@ -294,6 +294,8 @@ anv_physical_device_init(struct anv_physical_device *device,
    assert(strlen(path) < ARRAY_SIZE(device->path));
    strncpy(device->path, path, ARRAY_SIZE(device->path));
 
+   device->no_hw = getenv("INTEL_NO_HW") != NULL;
+
    device->chipset_id = anv_gem_get_param(fd, I915_PARAM_CHIPSET_ID);
    if (!device->chipset_id) {
       result = vk_error(VK_ERROR_INCOMPATIBLE_DRIVER);
@@ -1368,6 +1370,7 @@ VkResult anv_CreateDevice(
    device->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
    device->instance = physical_device->instance;
    device->chipset_id = physical_device->chipset_id;
+   device->no_hw = physical_device->no_hw;
    device->lost = false;
 
    if (pAllocator)
index 104b28ee5db503e55e5109064403ffb492af21c1..fb4fd19178d162f6a5bf3dd2b8e577066e3eeef4 100644 (file)
@@ -749,6 +749,7 @@ struct anv_physical_device {
 
     struct anv_instance *                       instance;
     uint32_t                                    chipset_id;
+    bool                                        no_hw;
     char                                        path[20];
     const char *                                name;
     struct gen_device_info                      info;
@@ -852,6 +853,7 @@ struct anv_device {
 
     struct anv_instance *                       instance;
     uint32_t                                    chipset_id;
+    bool                                        no_hw;
     struct gen_device_info                      info;
     struct isl_device                           isl_dev;
     int                                         context_id;
index c6b2e01c6281fb11342bbd2d7143d62dde8ea932..b0dcc882edc77de989779485b278db3d9282454a 100644 (file)
@@ -39,7 +39,7 @@ anv_device_execbuf(struct anv_device *device,
                    struct drm_i915_gem_execbuffer2 *execbuf,
                    struct anv_bo **execbuf_bos)
 {
-   int ret = anv_gem_execbuffer(device, execbuf);
+   int ret = device->no_hw ? 0 : anv_gem_execbuffer(device, execbuf);
    if (ret != 0) {
       /* We don't know the real error. */
       device->lost = true;