[Intel-gfx] [PATCH i-g-t] lib/chipset: Cache devid

Daniel Vetter daniel.vetter at ffwll.ch
Tue Feb 10 13:59:16 PST 2015


Chris Wilson complained that this adds a lot of noise to the test
startup when full debugging is enabled, so let's cache it. We can do
that since there's only ever one intel gpu in a given system.

Cc: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 lib/intel_chipset.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/intel_chipset.c b/lib/intel_chipset.c
index fafd232f89c0..64d66eb29bae 100644
--- a/lib/intel_chipset.c
+++ b/lib/intel_chipset.c
@@ -125,9 +125,12 @@ intel_get_pci_device(void)
 uint32_t
 intel_get_drm_devid(int fd)
 {
-	uint32_t devid = 0;
+	static uint32_t devid = 0;
 	const char *override;
 
+	if (devid)
+		return devid;
+
 	override = getenv("INTEL_DEVID_OVERRIDE");
 	if (override) {
 		devid = strtod(override, NULL);
-- 
2.1.4



More information about the Intel-gfx mailing list