Xpra: Ticket #981: sync paint updates to the video

Follow up from #792.

Painting all the updates together helps, allows us to reach a higher framerate, but we should not have to slow down displaying the video region just because there are other paint events coming through.

We should send those with a higher flush value and rely on the video paint to flush everything.

Mon, 14 Sep 2015 11:07:59 GMT - Antoine Martin: attachment set

attempt at implementing this

Mon, 14 Sep 2015 11:10:55 GMT - Antoine Martin: status changed

The patch above attempts to implement this feature, but doesn't seem to be making things better... maybe worse if anything!?

Thu, 08 Oct 2015 14:35:37 GMT - Antoine Martin:

Maybe we should set the minimum video batch delay to match the vrefresh rate in this case? Most 4k monitors are 60Hz (some are just 30Hz), which means we should be batching for at least 16ms (rounded down to take processing time into account?) whereas the default "min-delay" is currently set at 5ms.

Fri, 16 Oct 2015 17:02:50 GMT - Antoine Martin: attachment set

shows how long it takes to call swap_buffers

Fri, 16 Oct 2015 17:15:20 GMT - Antoine Martin:

r10879 added an app which can easily generate 100fps: browser/xpra/trunk/src/tests/xpra/test_apps/fps.py. r10880 also modified the existing browser/xpra/trunk/src/tests/xpra/test_apps/test_videoregions.py test app to hit 100fps.

The good news is that the server code quickly finds the best refresh rate (60Hz on my system). The difficulty is to find a good test case, and verify that we are making things better. The patch above allows us to see how long we have to wait for the vblank.

With the "fps" example, the time is usually in the 12 to 15ms range, with only the occasional value below 10ms, very rarely below 5ms. We almost never miss a vblank. That's because it is quick to draw and so we spend most of the time waiting for the vblank. With the "videoregions" example however, it's a lot more varied (it does behave a bit more like a real application...) - but I am not convinced that this is necessarily a much better baseline.

Fri, 23 Oct 2015 11:32:49 GMT - Antoine Martin:

According to this: NVidia OpenGL env variables, __GL_SYNC_TO_VBLANK can be used to enable/disable swapbuffers syncing to the vblank.

See also #386

Fri, 13 Nov 2015 07:11:08 GMT - Antoine Martin: milestone changed

Wed, 16 Mar 2016 05:19:12 GMT - Antoine Martin: milestone changed

Fri, 10 Jun 2016 13:08:50 GMT - Antoine Martin: attachment set

updated patch

Fri, 10 Jun 2016 13:37:05 GMT - Antoine Martin:

Following the work on #1218, here's an updated patch and a better understanding of the problems with it: r12778 shows how many rectangles we paint when we swap the opengl buffers, and whenever we paint video with other screen updates there is a long delay preceding it because it all takes too long to process. Fixing this is not easy. Here are some ideas:

Fri, 10 Jun 2016 15:12:49 GMT - Antoine Martin: attachment set

patch update to r12780

Fri, 10 Jun 2016 15:27:15 GMT - Antoine Martin: attachment set

adds the ability to toggle flush using an env var

Fri, 10 Jun 2016 15:38:51 GMT - Antoine Martin:

r12778 + r12779 make it easier to see the timing of screen updates.

With the latest patch above, I find that screen updates are A LOT smoother without the sync flush code.. which is the opposite of what would be expected.

Note: r12780 sends the non-video updates in the same call to send_delayed_regions if they're close to being due, which helps a bit.

Maybe this needs to be tested with a higher fps video, or a low fps monitor? (or both)

Tue, 12 Jul 2016 16:52:22 GMT - Antoine Martin: milestone changed

Milestone renamed

Fri, 23 Sep 2016 10:33:05 GMT - Antoine Martin: milestone changed

Re-scheduling, too risky at this point.

Wed, 28 Mar 2018 05:16:46 GMT - Antoine Martin: milestone changed

Wed, 20 Mar 2019 05:06:15 GMT - Antoine Martin: milestone changed

Milestone renamed

Wed, 12 Feb 2020 05:11:06 GMT - Antoine Martin: milestone changed

Sat, 23 Jan 2021 05:11:31 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/981