summaryrefslogtreecommitdiff
path: root/tests/modetest
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2015-12-09 18:37:46 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2015-12-18 17:44:16 +0000
commitc26266fcd082a8b67d1f32f5e5351cfa82c7accb (patch)
treebf2eb069d21895ab6de12939137b4c31f45e165f /tests/modetest
parente744b02375e939e853b4c83979f170bfc89e482c (diff)
downloadlibdrm-c26266fcd082a8b67d1f32f5e5351cfa82c7accb.tar.gz
libdrm-c26266fcd082a8b67d1f32f5e5351cfa82c7accb.tar.bz2
libdrm-c26266fcd082a8b67d1f32f5e5351cfa82c7accb.zip
modetest: Use util_open()
Use the new util_open() helper instead of open-coding the method for finding a usable device. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'tests/modetest')
-rw-r--r--tests/modetest/modetest.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index 0e009d87..22e3e81b 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -1503,7 +1503,6 @@ int main(int argc, char **argv)
int drop_master = 0;
int test_vsync = 0;
int test_cursor = 0;
- const char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "omapdrm", "exynos", "tilcdc", "msm", "sti", "tegra", "imx-drm", "rockchip", "atmel-hlcdc" };
char *device = NULL;
char *module = NULL;
unsigned int i;
@@ -1604,29 +1603,9 @@ int main(int argc, char **argv)
if (!args)
encoders = connectors = crtcs = planes = framebuffers = 1;
- if (module) {
- dev.fd = drmOpen(module, device);
- if (dev.fd < 0) {
- fprintf(stderr, "failed to open device '%s'.\n", module);
- return 1;
- }
- } else {
- for (i = 0; i < ARRAY_SIZE(modules); i++) {
- printf("trying to open device '%s'...", modules[i]);
- dev.fd = drmOpen(modules[i], device);
- if (dev.fd < 0) {
- printf("failed.\n");
- } else {
- printf("success.\n");
- break;
- }
- }
-
- if (dev.fd < 0) {
- fprintf(stderr, "no device found.\n");
- return 1;
- }
- }
+ dev.fd = util_open(module, device);
+ if (dev.fd < 0)
+ return -1;
if (test_vsync && !page_flipping_supported()) {
fprintf(stderr, "page flipping not supported by drm.\n");