[Mesa-dev] [PATCH mesa] anv: only read the env once per process

Eric Engestrom eric.engestrom at intel.com
Tue Oct 30 16:09:49 UTC 2018


Suggested-by: Emil Velikov <emil.l.velikov at gmail.com>
Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
---
 src/intel/vulkan/anv_device.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index ee35e013329005671391..d0e83546b1197e362874 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -2064,7 +2064,13 @@ _anv_device_set_lost(struct anv_device *device,
                      VK_ERROR_DEVICE_LOST, file, line, msg, ap);
    va_end(ap);
 
-   if (env_var_as_boolean("ANV_ABORT_ON_DEVICE_LOSS", false))
+   static bool abort_on_device_loss, env_read;
+   if (!env_read) {
+      abort_on_device_loss = env_var_as_boolean("ANV_ABORT_ON_DEVICE_LOSS", false);
+      env_read = true;
+   }
+
+   if (abort_on_device_loss)
       abort();
 
    return err;
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list