I'm racing two threads.

One does:

wait_for_signal()
for (...) *p++ = color

The other does:

bzero()
color = purple  // you don't see this one
signal_other_thread_to_start()
color = red
wait_for_other_thread_to_start()
color = green
poll_for_XPending()
color = halfgreen
glClear()
color = blue
upload_texture_to_video_card()

I've cherry-picked the frame here to catch a glitch on purpose because it's interesting to look at.

Most of the frames come out intact, and if you wanted to use this method to measure timings, you'd really want to build a distribution etc etc. When it's animated, Intel Turbo Boost becomes really obvious.

nVidia recommends that I use GL_BGRA as the format in memory. I do the wrong thing on purpose and use GL_RGBA to force the video card to swizzle. This induces the glitches.

Unlike a VGA framebuffer, in OpenGL, positive Y is upwards.