Merge branch 'vendor/OPENSSH'
[dragonfly.git] / test / debug / testvblank.c
1
2 /*
3  * cc testvblank.c -o ~/bin/testvblank -I/usr/src/sys/dev/drm/include
4  *
5  * Should print one 'x' every 10 vblanks (6/sec @ 60Hz, 3/sec @ 30Hz).
6  * Uses DRM ioctl.
7  */
8 #include <sys/types.h>
9 #include <sys/ioctl.h>
10 #include <sys/file.h>
11 #include <uapi_drm/drm.h>
12 #include <stdio.h>
13 #include <string.h>
14 #include <unistd.h>
15
16 int
17 main(int ac, char **av)
18 {
19     union drm_wait_vblank vblank;
20     int fd;
21
22     fd = open("/dev/dri/card0", O_RDWR);
23     printf("should print one 'x' every 10 vblanks\n");
24     for (;;) {
25         bzero(&vblank, sizeof(vblank));
26         vblank.request.type = _DRM_VBLANK_RELATIVE;
27         vblank.request.sequence = 10;
28
29         if (ioctl(fd, DRM_IOCTL_WAIT_VBLANK, &vblank) < 0)
30                 perror("ioctl");
31         write(1, "x", 1);
32     }
33
34     return 0;
35 }