intel: Use env_var_as_boolean for INTEL_NO_HW

The prior method of checking the result of getenv() for NULL would cause
the feature to be enabled for INTEL_NO_HW=0.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12007>
This commit is contained in:
Nanley Chery
2021-07-21 14:37:04 -07:00
committed by Marge Bot
parent e245468eb4
commit 7d59a66e3a
6 changed files with 9 additions and 12 deletions
+2 -2
View File
@@ -236,8 +236,8 @@ i945/i965 driver environment variables (non-Gallium)
----------------------------------------------------
:envvar:`INTEL_NO_HW`
if set to 1, prevents batches from being submitted to the hardware.
This is useful for debugging hangs, etc.
if set to 1, true or yes, prevents batches from being submitted to the
hardware. This is useful for debugging hangs, etc.
:envvar:`INTEL_DEBUG`
a comma-separated list of named flags, which do various things:
+1 -2
View File
@@ -762,8 +762,7 @@ crocus_screen_create(int fd, const struct pipe_screen_config *config)
screen->aperture_bytes = get_aperture_size(fd);
if (getenv("INTEL_NO_HW") != NULL)
screen->no_hw = true;
screen->no_hw = env_var_as_boolean("INTEL_NO_HW", false);
driParseConfigFiles(config->options, config->options_info, 0, "crocus",
NULL, NULL, NULL, 0, NULL, 0);
+1 -2
View File
@@ -831,8 +831,7 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
screen->fd = iris_bufmgr_get_fd(screen->bufmgr);
screen->winsys_fd = fd;
if (getenv("INTEL_NO_HW") != NULL)
screen->no_hw = true;
screen->no_hw = env_var_as_boolean("INTEL_NO_HW", false);
screen->workaround_bo =
iris_bo_alloc(screen->bufmgr, "workaround", 4096, 1,
+2 -3
View File
@@ -812,9 +812,8 @@ anv_physical_device_try_create(struct anv_instance *instance,
device->info = devinfo;
device->no_hw = device->info.no_hw;
if (getenv("INTEL_NO_HW") != NULL)
device->no_hw = true;
device->no_hw =
device->info.no_hw || env_var_as_boolean("INTEL_NO_HW", false);
device->pci_info.domain = drm_device->businfo.pci->domain;
device->pci_info.bus = drm_device->businfo.pci->bus;
+2 -1
View File
@@ -40,6 +40,7 @@
#include "swrast/s_renderbuffer.h"
#include "utils.h"
#include "util/debug.h"
#include "util/driconf.h"
#include "util/u_memory.h"
@@ -1019,7 +1020,7 @@ intel_init_bufmgr(struct intel_screen *intelScreen)
{
__DRIscreen *spriv = intelScreen->driScrnPriv;
intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL;
intelScreen->no_hw = env_var_as_boolean("INTEL_NO_HW", false);
intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ);
if (intelScreen->bufmgr == NULL) {
+1 -2
View File
@@ -1889,8 +1889,7 @@ brw_init_bufmgr(struct brw_screen *screen)
{
__DRIscreen *dri_screen = screen->driScrnPriv;
if (getenv("INTEL_NO_HW") != NULL)
screen->no_hw = true;
screen->no_hw = env_var_as_boolean("INTEL_NO_HW", false);
bool bo_reuse = false;
int bo_reuse_mode = driQueryOptioni(&screen->optionCache, "bo_reuse");