modetest: move basic args check before open()

Don't bother opening the device node, if the args combination is invalid

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
main
Emil Velikov 2020-04-10 20:17:07 +01:00 committed by Emil Velikov
parent 24c0c44c8d
commit 69f25d6a29
1 changed files with 5 additions and 5 deletions

View File

@ -2013,6 +2013,11 @@ int main(int argc, char **argv)
if (!args) if (!args)
encoders = connectors = crtcs = planes = framebuffers = 1; encoders = connectors = crtcs = planes = framebuffers = 1;
if (test_vsync && !count) {
fprintf(stderr, "page flipping requires at least one -s option.\n");
return -1;
}
dev.fd = util_open(device, module); dev.fd = util_open(device, module);
if (dev.fd < 0) if (dev.fd < 0)
return -1; return -1;
@ -2026,11 +2031,6 @@ int main(int argc, char **argv)
dev.use_atomic = use_atomic; dev.use_atomic = use_atomic;
if (test_vsync && !count) {
fprintf(stderr, "page flipping requires at least one -s option.\n");
return -1;
}
dev.resources = get_resources(&dev); dev.resources = get_resources(&dev);
if (!dev.resources) { if (!dev.resources) {
drmClose(dev.fd); drmClose(dev.fd);