diff options
-rw-r--r-- | tests/atomictest/atomictest.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/atomictest/atomictest.c b/tests/atomictest/atomictest.c index a393b01b..5e94432b 100644 --- a/tests/atomictest/atomictest.c +++ b/tests/atomictest/atomictest.c @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) uint32_t *plane_w = NULL, *plane_h = NULL; struct sp_dev *dev; struct sp_plane **plane = NULL; - struct sp_crtc *test_crtc; + struct sp_crtc *test_crtc = NULL; fd_set fds; drmModeAtomicReqPtr pset; drmEventContext event_context = { @@ -66,7 +66,14 @@ int main(int argc, char *argv[]) printf("Failed to initialize screens\n"); goto out; } - test_crtc = &dev->crtcs[0]; + + for (i = 0; i < dev->num_crtcs; i++) { + if (!dev->crtcs[i].crtc->mode.hdisplay) + continue; + test_crtc = &dev->crtcs[i]; + } + if (!test_crtc) + goto out; plane = calloc(dev->num_planes, sizeof(*plane)); if (!plane) { |