PDA

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



Resident
01-26-2006, 09:12 AM
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:
spawn threads[1,2] loop forever: * block until threads[1,2] signal "finish" semaphores. * release "start" semaphores for threads[1,2]
thread[n]:
create and initialize window and context loop forever: * draw stuff * swapbuffers * issue paint message * handle paint message * release "finish" semaphores * wait for "start" semaphore
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.

jide
01-26-2006, 09:38 AM
cpu/gpu over use ? scheduling priority not suffisant ?

Resident
01-26-2006, 12:09 PM
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.

yooyo
01-27-2006, 09:36 AM
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

Resident
01-30-2006, 02:25 PM
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.