From 519003cace0c32aa226005dc7409544e26c243c2 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 3 Oct 2018 20:43:49 +0100 Subject: igt: Check drmModeGetResources() If KMS is not supported on the device, drmModeGetResources() will return NULL, often this is an indication that we should not attempt to run the test. Although it would be preferred to use something like igt_require_display() as the canonical check and assert that drmModeGetResources() did not hit an error, it is not always practical as the tests do not utilize the common igt_display abstraction. Signed-off-by: Chris Wilson Reviewed-by: Arkadiusz Hiler --- tests/testdisplay.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tests/testdisplay.c') diff --git a/tests/testdisplay.c b/tests/testdisplay.c index 0ff98a2b..b13c3d70 100644 --- a/tests/testdisplay.c +++ b/tests/testdisplay.c @@ -156,12 +156,15 @@ static void dump_connectors_fd(int drmfd) static void dump_crtcs_fd(int drmfd) { - int i; - drmModeRes *mode_resources = drmModeGetResources(drmfd); + drmModeRes *mode_resources; + + mode_resources = drmModeGetResources(drmfd); + if (!mode_resources) + return; igt_info("CRTCs:\n"); igt_info("id\tfb\tpos\tsize\n"); - for (i = 0; i < mode_resources->count_crtcs; i++) { + for (int i = 0; i < mode_resources->count_crtcs; i++) { drmModeCrtc *crtc; crtc = drmModeGetCrtc(drmfd, mode_resources->crtcs[i]); -- cgit v1.2.3