diff options
author | Martin Peres <martin.peres@labri.fr> | 2012-12-15 18:49:06 +0100 |
---|---|---|
committer | Martin Peres <martin.peres@labri.fr> | 2012-12-16 00:47:07 +0100 |
commit | 4a86cbbed0c6d74a8b68ec72b8de8e48905d4015 (patch) | |
tree | e987da5e79b471714df1a7ee847996f955085a79 /tests/name_from_fd.c | |
parent | 0980633afd9c7eecc0c75ef3bea4d3c6b7aa1898 (diff) |
drm: allow opening the drm device by type (control, render or render_only)
Signed-off-by: Martin Peres <martin.peres@labri.fr>
Diffstat (limited to 'tests/name_from_fd.c')
-rw-r--r-- | tests/name_from_fd.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/name_from_fd.c b/tests/name_from_fd.c index 330c8ff0..8e1a1978 100644 --- a/tests/name_from_fd.c +++ b/tests/name_from_fd.c @@ -41,17 +41,20 @@ int main(int argc, char **argv) { int fd, ret; drm_set_version_t sv, version; - const char *name = "/dev/dri/card0"; + const char *name[2] = { "/dev/dri/card0", "/dev/dri/renderD128" }; char *v; + int i; - fd = open("/dev/dri/card0", O_RDWR); - if (fd == -1) - return 0; + for (i = 0; i < 2; i++) { + fd = open(name[i], O_RDWR); + if (fd > 0) { + v = drmGetDeviceNameFromFd(fd); + close(fd); + assert(v != NULL); + assert(strcmp(name[i], v) == 0); + } + } - v = drmGetDeviceNameFromFd(fd); - close(fd); - - assert(strcmp(name, v) == 0); drmFree(v); return 0; |