diff mbox series

[i-g-t,2/2] lib: Skip drmModeReources()

Message ID 20180913132432.4105-2-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [i-g-t,1/2] lib: Require drmModeResources() | expand

Commit Message

Chris Wilson Sept. 13, 2018, 1:24 p.m. UTC
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@chris-wilson.co.uk>
---
 lib/igt_kms.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

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);
 }