xf86-video-modesetting X.Org Driver Sees Patch For "TearFree" Page Flipping
Hardware-specific DDX drivers like xf86-video-amdgpu and the long unmaintained xf86-video-intel drivers have long offered a "TearFree" option in an attempt to provide tear-free screen rendering by engaging hardware-specific page-flipping mechanisms. But these days the xf86-video-modesetting DDX is increasingly being used for those still relying upon an X.Org Server and particularly if not using a composited window manager the screen tearing can still be an issue on the Linux desktop as we approach 2023.
Independent developer Sultan Alsawaf has managed to write a generic TearFree implementation for the xf86-vide-modesetting driver that can be optionally enabled. Sultan summarized the work as:
This adds support for TearFree page flips to eliminate tearing without the use of a compositor. It allocates two shadow buffers for each CRTC, a back buffer and a front buffer, and uses damage tracking to minimize excessive copying between buffers and skip unnecessary flips when the screen's contents remain unchanged. It works on transformed screens too, such as rotated and scaled CRTCs.
TearFree doesn't allow DRI clients to perform page flips since TearFree already performs page flips itself, and TearFree flips are preferable since they utilize damage tracking, whereas DRI flips do not.
TearFree is disabled by default.
The TearFree support for this DDX driver is around 300 lines of new code and is currently pending review via this X.Org Server merge request.