Vertical Sync routine

I have an LCD panel connected to the BeagleBoard and I need to execute a tiny bit of code during each Vertical Blank.

I’m using kernel: Linux version 2.6.28-rc9-omap1

I’ve tried the following in a general routine, but I always get -1 returned:

if (ioctl(privateData->mFramebufferFD, FBIO_WAITFORVSYNC, &dummy) == -1)
printf(“Could not wait for VSync…\n”);

I know that mFramebufferFD is valid.

Ideally I’m looking for a way to install a function that will just be called when the driver knows it’s in Vertical Blank. I’ve tried digging through the various source files of the drivers and such and honestly just get lost.

-Stevo Brock
Sunset Magicwerks