vbltest: Check error codes returned from libdrm

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
main
Jakob Bornecrantz 2011-09-28 17:27:07 +02:00
parent dc11db2e28
commit c2925e5197
1 changed files with 16 additions and 4 deletions

View File

@ -102,7 +102,7 @@ static void usage(char *name)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int i, c, fd; int i, c, fd, ret;
char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx" }; char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx" };
drmVBlank vbl; drmVBlank vbl;
drmEventContext evctx; drmEventContext evctx;
@ -141,7 +141,11 @@ int main(int argc, char **argv)
if (secondary) if (secondary)
vbl.request.type |= DRM_VBLANK_SECONDARY; vbl.request.type |= DRM_VBLANK_SECONDARY;
vbl.request.sequence = 0; vbl.request.sequence = 0;
drmWaitVBlank(fd, &vbl); ret = drmWaitVBlank(fd, &vbl);
if (ret != 0) {
printf("drmWaitVBlank (relative) failed ret: %i\n", ret);
return -1;
}
printf("starting count: %d\n", vbl.request.sequence); printf("starting count: %d\n", vbl.request.sequence);
@ -154,7 +158,11 @@ int main(int argc, char **argv)
vbl.request.type |= DRM_VBLANK_SECONDARY; vbl.request.type |= DRM_VBLANK_SECONDARY;
vbl.request.sequence = 1; vbl.request.sequence = 1;
vbl.request.signal = (unsigned long)&handler_info; vbl.request.signal = (unsigned long)&handler_info;
drmWaitVBlank(fd, &vbl); ret = drmWaitVBlank(fd, &vbl);
if (ret != 0) {
printf("drmWaitVBlank (relative, event) failed ret: %i\n", ret);
return -1;
}
/* Set up our event handler */ /* Set up our event handler */
memset(&evctx, 0, sizeof evctx); memset(&evctx, 0, sizeof evctx);
@ -181,7 +189,11 @@ int main(int argc, char **argv)
break; break;
} }
drmHandleEvent(fd, &evctx); ret = drmHandleEvent(fd, &evctx);
if (ret != 0) {
printf("drmHandleEvent failed: %i\n", ret);
return -1;
}
} }
return 0; return 0;