Request for feedback for my GSoC project to improve Present support in Xwayland

Michel Dänzer michel at
Tue Jul 25 08:46:33 UTC 2017

On 24/07/17 11:07 AM, Roman Gilg wrote:>
> I'm writing this mail in order to get some feedback from the X.Org
> community regarding my current approach and the progress I've made so
> far. You can find my main working branch at
> I've tried to limit the changes to the Present code to a minimum. At the
> moment it should be able to flip Glamor/GBM Pixmaps of Present
> supporting clients to a Wayland surface for one full screen window
> without copies. The restriction of only one window, which is full
> screen, is in line with what is possible with the currently available
> functionality by the Present code in the Xserver.

This restriction doesn't make much sense in the rootless case though.

> I have also worked on a second solution as a long term strategy. But
> it's probably not in the scope of my GSoC project: The idea would be to
> remodel the Present code in order to support Pixmap flips per CRTC,
> which would enable the Xwayland DDX to flip every Wayland window
> individually. This would be important if a compositor wants to support
> the scanout of client buffers to overlay planes different to the primary
> planes of the CRTCs. In my opinion it would also greatly increase the
> functionality in other DDX, since being able to flip in a multi monitor
> setting a full screen window on one CRTC alone is to my knowledge
> currently not possible when using only one Screen struct in combination
> with RandR. But Daniel already warned me that this rewrite would be very
> difficult to get right or maybe not doable at all. The main reason for
> that is presumably that the Present code uses in central parts the
> Screen Pixmap for its flipping.

It doesn't really use the screen pixmap for flipping, but maybe you mean
that it generally assumes rootful operation. Apart from that, per-CRTC
flipping would require wrapping the screen and GC rendering hooks to
deal with different parts of the root window being stored in different

> Also it would mean, that current Present supporting DDX drivers need to
> be rewritten in some parts.

I'd expect that the driver interface could be extended in a backwards
compatible way, so only drivers which want to support per-CRTC flips
would need any changes.

However, per-CRTC flips might still not be a very good match for the
rootless case.

Maybe it would be better to start by duplicating the whole Present code
in the Xwayland DDX, and modifying it in any way necessary to allow
per-window flipping in the rootless case. Then you could see what if
anything can be usefully shared between the rootless and rootful cases.

> This also leads to an explicit question in the end: Present changes the
> Screen

Present doesn't change the screen pixmap, it just sets the flip pixmap
instead of the screen pixmap as the window pixmap of the root and
flipping windows while flipping.

> and Window Pixmaps via a TraverseTree operation. Why is this necessary

Because every window has its own window pixmap pointer, so the above
also has to be done for any children of the flipping window.

> and why did using the same construction not work in my Xwayland code? 

What happened when you tried? I guess it might be related to rootless.

> I change the Window Pixmaps currently directly in the Xwayland DDX
> without traversing the tree:

This might not work correctly when the flipping window has children.

Earthling Michel Dänzer               |     
Libre software enthusiast             |             Mesa and X developer

More information about the xorg-devel mailing list