Windows and Linux- NVIDIA issue?: vsync not fully syncing with multiple windows

Hello, I’m new here, and I’ve been able to resolve most of my issues by just seaching these forums, but I may now be encountering an issue that no one else seems to have discussed.

I’m developing under both Windows and Linux with a Quadro FX 3400. With vsync enabled, if I draw to a single window, as one would expect, I get no tearing. If I draw to two or more windows, all of my windows tear at about the same physical location down the screen (about 1/6th to 1/5th of the way from the top of the screen). If I drag the windows below that area, then I don’t see the tear. This happens all on one monitor, in single-monitor mode.

The PC itself is a dual-CPU machine, and each window has its own thread, and therefore its own SwapBuffers () call. The threads are synchronized to a main control thread using semaphores.

The logic under Windows looks like this:

control_thread:
[list=a][li]spawn threads[1,2][]loop forever:[]* block until threads[1,2] signal “finish” semaphores.[] release “start” semaphores for threads[1,2][/LIST][/li]thread[n]:
[list=a][li]create and initialize window and context[]loop forever:[]* draw stuff[] swapbuffers[] issue paint message[] handle paint message[] release “finish” semaphores[] wait for “start” semaphore[/LIST][/li]With vsync on, this whole program is effectively synchronized to the refresh rate, but with multiple windows, I still get tearing. Does anyone have any advice on how I can get rid of the tearing? Thanks.

cpu/gpu over use ? scheduling priority not suffisant ?

Originally posted by jide:
cpu/gpu over use ? scheduling priority not suffisant ?
In my test application, the threads only clear the color buffer and draw a single colored quad. I would hope that doesn’t overload the CPU or GPU. =) (CPU utilization is over 99% idle on average. I can take a quantifiable measurement if anyone thinks that would matter.).

I see the tearing when my application runs at Normal or AboveNormal priority. Have not yet tested High priority.

I would rework the application to be single-threaded, but then I have to call SwapBuffers multiple times per frame in my one thread, which would force me down to a overall framerate of 0.5 * vsync.

Maybe you ca use some specific WGL extension…
Check WGL_NV_swap_group in http://sparrow.cs.unc.edu/Research/ootf/FAQs/nVidia/FrameLock-V1.0C.pdf

yooyo

Thanks for the response. I checked out WGL_NV_swap_group, but unfortunately it requires additional hardware that I don’t have. For the heck of it, I tried calling it anyway and setting up a swap group for my windows… The machine slowed down to a crawl right before blue-screening on me. I appreciate the suggestion at any rate, though.

Another bit of info… if I stack my windows right on top of each other, the sync problem goes away. As soon as I move the top window and expose any of the underlying windows, the tearing reappears. It just smells of a driver issue.