modesetting TearFree / VSYNC aware rotation pageflipping
Michel Dänzer
michel at daenzer.net
Mon Oct 1 15:57:20 UTC 2018
On 2018-09-28 2:52 p.m., Carsten Behling wrote:
> Hi all,
>
> I noticed ugly tearing when rotating the screen with modesetting.
>
> I already noticed this thread
>
> https://bugs.freedesktop.org/show_bug.cgi?id=98876
>
> that suggests to implement the TearFree option into modesetting.
>
> So I took a look on the amd and ati implementations
>
> https://cgit.freedesktop.org/xorg/driver/xf86-video-amdgpu/commit/?id=c57da33308a81fa575179238a0415abcb8b34908
>
> https://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?id=43159ef400c3b18b9f4d3e6fa1c4aef2d60d38fe
>
> and compared it to modesetting and I found that pageflipping is already
> implemented since this patch:
>
> https://lists.x.org/archives/xorg-devel/2015-May/046271.html
>
> But:
>
> 1. The above stated Freedesktop bug is older and the modesetting
> pageflipping implementation is not mentioned there in the TearFree context.
> But e.g. AMD GPU is doing a very similar thing for TearFree.
> 2. Modesettings pageflipping is disabled on rotation and I found just that
> comment in the above patch:
>> Don't do pageflipping if CRTCs are rotated (caught by Jason Ekstrand).
>
> So here are my questions:
>
> 1. What is the difference between flipping the scanout buffers in
> amdgpu/ati and the front buffer and back buffer flipping in modesetting?
>
> 2. I suppose in both cases that are real video buffers instead of shadow
> buffers for rotation. Right?
>
> 3. I did not found any background info about the limitation for
> pageflipping caught by Jason. Can anyone give me some more info? Since
> amdgpu does the nearly the same with its two scanout buffers it shouldn't
> be a big problem.
>
> So if TearFree support or something else that makes more sense is still an
> issue I can add that feature. I just need a little help.
Basically you're comparing apples (TearFree, the amdgpu/radeon driver
changes above) and oranges (DRI page flipping, the modesetting change
above).
DRI page flipping is an old mechanism (supported by the amdgpu/radeon
drivers as well, "forever", since long before TearFree) for direct
scanout from buffers whose contents were produced with direct rendering
by the client. Because it scans out directly, output transformations
such as rotation are traditionally not supported with DRI page flipping.
TearFree uses separate dedicated scanout buffers, to which the "main"
buffer contents are copied on demand.
Originally, these three things (DRI page flipping, rotation and
TearFree) were separate and mutually exclusive. However, the
amdgpu/radeon drivers support all of them the same time these days; this
still requires an extra copy in some cases, but that could be eliminated
at least in the non-rotated DRI page flipping case.
https://gitlab.freedesktop.org/xorg/xserver/merge_requests/24 has the
start of TearFree support for the modesetting driver, but it's still
mutually exclusive with rotation (DRI3 page flipping should work with
TearFree, but may still exhibit tearing if the client/user disables
sync-to-vblank).
Hope this helps,
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
More information about the xorg
mailing list