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

Eric Engestrom eric.engestrom at intel.com
Tue Oct 30 16:13:26 UTC 2018


On Tuesday, 2018-10-30 16:09:49 +0000, Eric Engestrom wrote:
> Suggested-by: Emil Velikov <emil.l.velikov at gmail.com>
> Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
> ---

Sent the patch for the discussion, but I'm not sure this is that
important; this code is for when a device is lost, which is not very
common to say the least, and shaving off a few usec here isn't really
useful... come to think of it, this isn't worth the code complexity,
so I'm voting "leave it as is".

>  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