flip dontsync=1 broken?

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
Check whether this message answers your question.

http://tech.groups.yahoo.com/group/psychtoolbox/message/7498

Xiangrui

--- In 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
>
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, "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, "Xiangrui Li" <xrli@> wrote:
> >
> > Check whether this message answers your question.
> >
> > http://tech.groups.yahoo.com/group/psychtoolbox/message/7498
> >
> > Xiangrui
> >
> > --- In 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
> > >
> >
>
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, "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, "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, "Xiangrui Li" <xrli@> wrote:
> > >
> > > Check whether this message answers your question.
> > >
> > > http://tech.groups.yahoo.com/group/psychtoolbox/message/7498
> > >
> > > Xiangrui
> > >
> > > --- In 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
> > > >
> > >
> >
>