glamor: Don't glFlush/ctx switch unless any work has been performed

Merged Joshua Ashton requested to merge JoshuaAshton/xserver:glamor-context-dirty into master

glamor_make_current is always called before any calls to GL.

Apply some dirty-tracking to whenever we call glamor_make_current so that we can avoid a decent amount of redundant GL work on each Dispatch cycle.

Gamescope previously was waking up an empty Xwayland server with an XQueryPointer and I noticed a significant amount of churn doing redundant GL work.

This has been addressed on the Gamescope side as well, but avoiding any useless GL context switches and flushes when glamor is doing nothing is still beneficial for CPU and power usage on portable devices.

Merge request reports