# flip dontsync=1 broken?

**URL:** <https://psychtoolbox.discourse.group/t/flip-dontsync-1-broken/1103>\
**Category:** Uncategorized\
**Created:** [October 19, 2008, 11:47pm UTC](https://psychtoolbox.discourse.group/t/flip-dontsync-1-broken/1103 "2008-10-19T23:47:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [October 19, 2008, 11:47pm UTC](https://psychtoolbox.discourse.group/t/flip-dontsync-1-broken/1103/1 "2008-10-19T23:47:13Z")

</div>

Hi,  
  
Recently upgraded to Matlab 2008a and the latest PTB beta. Perhaps  
I'm missing something, but it seems like flip is still waiting for VBL  
when called with the flag dontsync=1. I see this in my own routines,  
but also just modifying VBLSyncTest.m with the flag.   
  
dontsync=2 still lets me loop over flip \>\> 60Hz, but of course yields  
nasty tearing artifacts.  
  
So far I'm seeing this in XP and Ubuntu 8.04 (in failsafe Gnome) on  
the same Dell Latitude D620 with the nvidia card (Quadro NVS 110?) and  
updated drivers. In Ubuntu, dontsync=2 also does not seem to work  
properly (ie it actually syncs!). Haven't tried on other machines yet.  
  
Any one else see this?   
  
Thanks,  
Scott

---

<div class="post-metadata">

**Author:** ![xrli2002](https://avatars.discourse-cdn.com/v4/letter/x/48db29/32.png) [@xrli2002](https://psychtoolbox.discourse.group/u/xrli2002)\
**Post date:** [October 20, 2008, 10:48pm UTC](https://psychtoolbox.discourse.group/t/flip-dontsync-1-broken/1103/2 "2008-10-20T22:48:33Z")

</div>

Check whether this message answers your question.  
  
[http://tech.groups.yahoo.com/group/psychtoolbox/message/7498](http://tech.groups.yahoo.com/group/psychtoolbox/message/7498)  
  
Xiangrui  
  
--- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "stuckdoingwork" \<gorlins@...\>   
wrote:  

> \>  
> \> Hi,  
> \>   
> \> Recently upgraded to Matlab 2008a and the latest PTB beta. Perhaps  
> \> I'm missing something, but it seems like flip is still waiting for

VBL  

> \> when called with the flag dontsync=1. I see this in my own

routines,  

> \> but also just modifying VBLSyncTest.m with the flag.   
> \>   
> \> dontsync=2 still lets me loop over flip \>\> 60Hz, but of course

yields  

> \> nasty tearing artifacts.  
> \>   
> \> So far I'm seeing this in XP and Ubuntu 8.04 (in failsafe Gnome) on  
> \> the same Dell Latitude D620 with the nvidia card (Quadro NVS 110?)

and  

> \> updated drivers. In Ubuntu, dontsync=2 also does not seem to work  
> \> properly (ie it actually syncs!). Haven't tried on other machines

yet.  

> \>   
> \> Any one else see this?   
> \>   
> \> Thanks,  
> \> Scott  
> \>

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [October 21, 2008, 1:04am UTC](https://psychtoolbox.discourse.group/t/flip-dontsync-1-broken/1103/3 "2008-10-21T01:04:11Z")

</div>

That won't work either. If you test the timing for  
multiple invocations of flip with dontsync=1 you'll  
see that it probably behaves as you expect during  
the 1st invocation, ie. Screen('Flip') returns after a  
fraction of a millisecond.  
  
However, the GPU must wait until the bufferswap has  
happened before it can execute all drawing commands  
after that Screen('Flip') so it will queue up all further  
drawing/OpenGL commands in an internal queue until  
bufferswap has happened. That queue has a limited  
capacity, so sooner or later the code will have to block/  
wait until a bufferswap has happened and the queue  
could be partially emptied.  
  
How much drawing work you can do after dontsync=1  
flip depends on operating system, driver and graphics  
card, but often not more than 1 frame worth of drawing.  
  
This is a hardware limitation, not much we could do here.  
  
Short term, Matlabs execution is decoupled from  
stimulus onset, allowing you to do a bit of work  
for the next presentation loop iteration while bufferswap  
is still waiting for display retrace to happen, but on  
average, you'll still be limited to your 60 Hz on average.  
  
Screen('AsyncFlipBegin') and 'AsyncFlipEnd' may help  
in some situations on Linux and OS/X (unsupported on  
Windoze), but on average you'll always be limited to  
the display refresh rate if you want tear-free display.  
  
-mario  
  

> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "stuckdoingwork" \<gorlins@...\> wrote:  
> \>  
> \> No, I mean when when=0. in a continuous flip loop, the code should  
> \> execute \>\> say, 60Hz when dontsync=1. That is, flip is still blocking  
> \> when it should immediately return - the duration of the flip command  
> \> itself is still ~ 16ms on a 60Hz monitor  
> \>   
> \> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "Xiangrui Li" \<xrli@\> wrote:  
> \> \>  
> \> \> Check whether this message answers your question.  
> \> \>   
> \> \> [http://tech.groups.yahoo.com/group/psychtoolbox/message/7498](http://tech.groups.yahoo.com/group/psychtoolbox/message/7498)  
> \> \>   
> \> \> Xiangrui  
> \> \>   
> \> \> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "stuckdoingwork" \<gorlins@\>   
> \> \> wrote:  
> \> \> \>  
> \> \> \> Hi,  
> \> \> \>   
> \> \> \> Recently upgraded to Matlab 2008a and the latest PTB beta. Perhaps  
> \> \> \> I'm missing something, but it seems like flip is still waiting for   
> \> \> VBL  
> \> \> \> when called with the flag dontsync=1. I see this in my own   
> \> \> routines,  
> \> \> \> but also just modifying VBLSyncTest.m with the flag.   
> \> \> \>   
> \> \> \> dontsync=2 still lets me loop over flip \>\> 60Hz, but of course   
> \> \> yields  
> \> \> \> nasty tearing artifacts.  
> \> \> \>   
> \> \> \> So far I'm seeing this in XP and Ubuntu 8.04 (in failsafe Gnome) on  
> \> \> \> the same Dell Latitude D620 with the nvidia card (Quadro NVS 110?)   
> \> \> and  
> \> \> \> updated drivers. In Ubuntu, dontsync=2 also does not seem to work  
> \> \> \> properly (ie it actually syncs!). Haven't tried on other machines   
> \> \> yet.  
> \> \> \>   
> \> \> \> Any one else see this?   
> \> \> \>   
> \> \> \> Thanks,  
> \> \> \> Scott  
> \> \> \>  
> \> \>  
> \>

---

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [October 21, 2008, 3:59am UTC](https://psychtoolbox.discourse.group/t/flip-dontsync-1-broken/1103/4 "2008-10-21T03:59:23Z")

</div>

ah, i see... for some reason I thought it just overwrote the back  
buffer, and i thought i recalled previous versions getting more than  
60 'flips'/second. i must have been mistaken.  
  
thanks mario!  
  
-s  
--- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "Mario Kleiner"  
\<mario.kleiner@...\> wrote:  

> \>  
> \> That won't work either. If you test the timing for  
> \> multiple invocations of flip with dontsync=1 you'll  
> \> see that it probably behaves as you expect during  
> \> the 1st invocation, ie. Screen('Flip') returns after a  
> \> fraction of a millisecond.  
> \>   
> \> However, the GPU must wait until the bufferswap has  
> \> happened before it can execute all drawing commands  
> \> after that Screen('Flip') so it will queue up all further  
> \> drawing/OpenGL commands in an internal queue until  
> \> bufferswap has happened. That queue has a limited  
> \> capacity, so sooner or later the code will have to block/  
> \> wait until a bufferswap has happened and the queue  
> \> could be partially emptied.  
> \>   
> \> How much drawing work you can do after dontsync=1  
> \> flip depends on operating system, driver and graphics  
> \> card, but often not more than 1 frame worth of drawing.  
> \>   
> \> This is a hardware limitation, not much we could do here.  
> \>   
> \> Short term, Matlabs execution is decoupled from  
> \> stimulus onset, allowing you to do a bit of work  
> \> for the next presentation loop iteration while bufferswap  
> \> is still waiting for display retrace to happen, but on  
> \> average, you'll still be limited to your 60 Hz on average.  
> \>   
> \> Screen('AsyncFlipBegin') and 'AsyncFlipEnd' may help  
> \> in some situations on Linux and OS/X (unsupported on  
> \> Windoze), but on average you'll always be limited to  
> \> the display refresh rate if you want tear-free display.  
> \>   
> \> -mario  
> \>   
> \> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "stuckdoingwork" \<gorlins@\> wrote:  
> \> \>  
> \> \> No, I mean when when=0. in a continuous flip loop, the code should  
> \> \> execute \>\> say, 60Hz when dontsync=1. That is, flip is still blocking  
> \> \> when it should immediately return - the duration of the flip command  
> \> \> itself is still ~ 16ms on a 60Hz monitor  
> \> \>   
> \> \> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "Xiangrui Li" \<xrli@\> wrote:  
> \> \> \>  
> \> \> \> Check whether this message answers your question.  
> \> \> \>   
> \> \> \> [http://tech.groups.yahoo.com/group/psychtoolbox/message/7498](http://tech.groups.yahoo.com/group/psychtoolbox/message/7498)  
> \> \> \>   
> \> \> \> Xiangrui  
> \> \> \>   
> \> \> \> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "stuckdoingwork" \<gorlins@\>   
> \> \> \> wrote:  
> \> \> \> \>  
> \> \> \> \> Hi,  
> \> \> \> \>   
> \> \> \> \> Recently upgraded to Matlab 2008a and the latest PTB beta.

Perhaps  

> \> \> \> \> I'm missing something, but it seems like flip is still waiting

for   

> \> \> \> VBL  
> \> \> \> \> when called with the flag dontsync=1. I see this in my own   
> \> \> \> routines,  
> \> \> \> \> but also just modifying VBLSyncTest.m with the flag.   
> \> \> \> \>   
> \> \> \> \> dontsync=2 still lets me loop over flip \>\> 60Hz, but of course   
> \> \> \> yields  
> \> \> \> \> nasty tearing artifacts.  
> \> \> \> \>   
> \> \> \> \> So far I'm seeing this in XP and Ubuntu 8.04 (in failsafe

Gnome) on  

> \> \> \> \> the same Dell Latitude D620 with the nvidia card (Quadro NVS

110?)   

> \> \> \> and  
> \> \> \> \> updated drivers. In Ubuntu, dontsync=2 also does not seem to work  
> \> \> \> \> properly (ie it actually syncs!). Haven't tried on other

machines   

> \> \> \> yet.  
> \> \> \> \>   
> \> \> \> \> Any one else see this?   
> \> \> \> \>   
> \> \> \> \> Thanks,  
> \> \> \> \> Scott  
> \> \> \> \>  
> \> \> \>  
> \> \>  
> \>
