[Intel-gfx] [PATCH i-g-t 2/2] lib: Skip drmModeReources()

Chris Wilson chris at chris-wilson.co.uk
Thu Sep 13 13:24:32 UTC 2018


An alternative to requiring the display is to mark the attached display
as empty (no available CRTC, no outputs) and let the tests skip if they
required any output. This allows the binary to open the display once in
its global fixture, even if it doesn't use the display in every subtest
and so avoid skipping the subtests that didn't require the display.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 lib/igt_kms.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 0e6f91475..b38d64415 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1857,7 +1857,8 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 	display->drm_fd = drm_fd;
 
 	resources = drmModeGetResources(display->drm_fd);
-	igt_require(resources);
+	if (!resources)
+		goto out;
 
 	/*
 	 * We cache the number of pipes, that number is a physical limit of the
@@ -2005,6 +2006,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 	igt_display_reset(display);
 	igt_kms_disallow_hotplug(drm_fd);
 
+out:
 	LOG_UNINDENT(display);
 }
 
-- 
2.19.0



More information about the Intel-gfx mailing list