News for hackers. Stuff that matters.
Re:Apple's CVDisplayLink Doesn't Link to Your Display by jchb on Sunday December 10, 2017 @01:05AM (#15890206)
If you use OpenGL or Metal with triple buffering (the blog post mentions MTLView which is a Metal view) I believe this doesn't matter. You'll only be using the CVDisplayLink timer events to generate frames spaced at a even interval - which is equal to the display vsync interval, depending how you configure CVDisplayLink. Then, the actual presentation of those frames will happen in sync with the actual display vsync.

See Metal Triple Buffering (https://developer.apple.com/library/content/documentation/3D...) and MTLCommandBuffer presentDrawable.

For OpenGL there are similar mechanisms, eg. NSOpenGLCPSwapInterval.

Re:Apple's CVDisplayLink Doesn't Link to Your Display by wtallis on Sunday December 10, 2017 @01:32AM (#15890268)
If you're aiming for the lowest latency possible, you will still want to have access to the actual display refresh timing information. But these days with variable refresh rate monitors growing in popularity, this gets pretty complicated.
Re:Apple's CVDisplayLink Doesn't Link to Your Display by izacus on Sunday December 10, 2017 @06:12AM (#15890927)
Does Apple even support any of the variable refresh rate standards?
Re:Apple's CVDisplayLink Doesn't Link to Your Display by tvararu on Sunday December 10, 2017 @08:44AM (#15891335)
Not sure about Apple, but on a hackintosh you can install Nvidia Geforce drivers that allow you to turn on GSync.
Re:Apple's CVDisplayLink Doesn't Link to Your Display by paxswill on Sunday December 10, 2017 @09:46AM (#15891579)
Which is kinda buggy last I checked, crashing if more than one display was attached.
Re:Apple's CVDisplayLink Doesn't Link to Your Display by seandougall on Sunday December 10, 2017 @12:04PM (#15892266)
If you set the swap interval to 1, my recollection is that glFlush() (or -[NSOpenGLContext flushBuffers]) will block until the frame is presented. I’ve never relied on that behavior, but I’ve always wondered if the display link timer was even necessary, or if you could just use a while loop.
Re:Apple's CVDisplayLink Doesn't Link to Your Display by jchb on Sunday December 10, 2017 @08:22PM (#15894551)
What's the scenario where you would want to do that? I understand there's a (theoretical?) scenario where you want to minimise latency between screen rendering (or input handling?) and presentation. But if you use double buffering, which a while loop that block until the frame is presented, then the CPU will sit idle while the GPU is doing it's work. Instead of preparing the next frame after that - which may result in the CPU preparing the next screen too late if the scene complexity is fluctuating.