https://bugs.freedesktop.org/show_bug.cgi?id=38800
--- Comment #30 from Jerome Glisse glisse@freedesktop.org 2011-07-07 06:36:38 PDT --- This flip stuff is hairy. I think best is :
flip ioctl: - pin new front - delay work to bo fence (if no fence use the oldest alive fence) - return
fence handler: - on flip work wait for outside vblank - write reg
irq handler: - report timestamp + cleanup (unpin old front)
So wait for bo to be idle before waiting to be out of vblank
Note that as long as we don't introduce new ioctl we can't properly handle the case where reminder != 0 in the oml extension
" if the current MSC is greater than or equal to <target_msc>, the buffer swap will occur the next time the MSC value is incremented to a value such that MSC % <divisor> = <remainder>. If <divisor> = 0, the swap will occur when MSC becomes greater than or equal to <target_msc>. "