[PATCH 5/5] modesetting: Implement page flipping support for Present.

Mario Kleiner mario.kleiner.de at gmail.com
Sun May 3 23:15:57 PDT 2015


On 04/28/2015 06:31 AM, Kenneth Graunke wrote:
> On Tuesday, April 21, 2015 05:58:44 PM Kenneth Graunke wrote:
>> Based on code by Keith Packard, Eric Anholt, and Jason Ekstrand.
>>
>> v2:
>> - Fix double free and flip_count underrun (caught by Mario Kleiner).
>> - Don't leak flip_vblank_event on the error_out path (Mario).
>> - Use the updated ms_flush_drm_events API (Mario, Ken).
>>
>> v3: Hack around DPMS shenanigans.  If all monitors are DPMS off, then
>>      there is no active framebuffer; attempting to pageflip will hit the
>>      error_undo paths, causing us to drmModeRmFB with no framebuffer,
>>      which confuses the kernel into doing full modesets and generally
>>      breaks things.  To avoid this, make ms_present_check_flip check that
>>      some CRTCs are enabled and DPMS on.  This is an ugly hack that would
>>      get better with atomic modesetting, or some core Present work.
>>
>> v4:
>> - Don't do pageflipping if CRTCs are rotated (caught by Jason Ekstrand).
>> - Make pageflipping optional (Option "PageFlip" in xorg.conf.d), but
>>    enabled by default.
>>
>> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
>
> Upon further testing, there are still nasty DPMS bugs affecting this
> patch.  We no longer crash the X server, but clients appear to
> occasionally get stuck.
>
> I guess we just need to bite the bullet and unflip on DPMS off.
> Or switch to atomic modesetting...
>

I retested v4 + the attached patch with some small improvements applied. 
The patch adds async page flip cap support, fixes that missing zero init 
which Michel also reported and fixes some small inconsistency in the 
ms_present_unflip routine.

Everything worked nicely, except for the not quite resolved DPMS off 
bug. No more crashes, but page-flipped clients reliably hang after DPMS 
off -> on. KDE with composition on and page flipping on (Setting 
"Tearing prevention" set to "Full scene repaints") hangs after each 
off->on cycle, my own fullscreen app hangs reliably as well if 
page-flipped swaps are used.

Looking at stack traces it seems to me as if somehow after a dpms 
off/on, a present_event_notify() somehow doesn't get delivered to the 
server / gets lost somewhere, so clients like mine which wait for swap 
completion or vblank events hang, and KDE hangs in Mesa when Mesa tries 
to get a new backbuffer for rendering, runs out of buffers and then 
waits infinitely for a present notify event from the server in order to 
reuse one of its busy buffers.

-mario
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-modesetting-Add-async-flip-support-fix-small-bugs.patch
Type: text/x-patch
Size: 1946 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20150504/2dd30aad/attachment.bin>


More information about the xorg-devel mailing list