How to Query Vsync Phase in Linux

How to query Vsync phase in Linux

When you search for FBIO_WAITFORVSYNC in the Linux kernel sources, you can see, that it is implemented only for a few graphics cards, but not for all.

So, if you happen to have one of the many other cards, you get "Inappropriate ioctl for device", which just means not implemented for this graphics card driver.

Maybe How to wait for VSYNC in Xlib app? gives you some hint into the right direction.

SFML vsync always on?

It's a buggy driver. glXSwapIntervalMESA works. The pointer returned for glXSwapIntervalSGI is valid, so SFML can't detect this issue without taking an approach similiar to SDL's.

Qt: vsync - missing rendered frames

I got help of some experts from the qt-forum. You can follow the whole discussion here. At the end, this was the result:

"
V-sync is hard ;) Basically it's fighting with the inherent noisiness of the system. If the output shows 16-17 ms then that's the problem. 17 ms is too much. That's the skipping you see.

Couple of things to reduce that noise:

  • Don't do I/O in the render loop! qDebug()is I/O and it can block on all kinds of buffering shenanigans.
  • Testing V-sync under a debugger is useless. Debugging introduces all kinds of noise into your app. You should be testing v-sync in Release mode without debugger attached.
  • try not to use signals/slots/events if you can help it. They can be noisy i.e. call update() manually at the end of paintGL. You skip some overhead this way (not much but every bit counts).
  • If all you need is a flickering screen avoid QPainter. It's not exactly slow, but drop into the begin() method of it and see how much it actually does. OpenGL has fast, dedicated facilities to fill the buffer with a color. You might as well use it.

Not directly related, but it will make your code cleaner:

  • Use QElapsedTimer instead of manually calculating time intervals. Why re-invent the wheel.

Applying these bits I was able to remove the skipping from your example. Note that the skipping will occur in some circumstances, e.g. when you move/resize the window or when OS/other apps are busy doing something . You have no control over that.
"



Related Topics



Leave a reply



Submit