Move the wl_buffer from xwl_window to xwl_pixmap

This is cleaner, and a wl_buffer won't be destroyed until
the associated pixmap is destroyed. That way if we
use SetWindowPixmap with a pixmap with a wl_buffer already
attached, we don't have to create a new one.

This patch also allows a future api change to be able
to pend some work to do when a wl_buffer is released.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Add support to render-nodes.

And allows to create wl_buffers from fds instead of gem names.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Add function to get new fd of the graphic device

neccessary for dri3

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Add XWayland API with Present support in mind.

The API enables to use the frame event and the buffer release event.
We can pend todo items that are functions which will be called when
the event is raised.

When a window is unrealized, all the todo items associated to the
window are called with special parameters, so the todo item can handle
this case differently.
Same when a Pixmap is destroyed.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Implements xwl_get_visible_parent_window.
This function is needed to get the parent window
that the wayland compositors sees.

If no parent window is seen by the wayland compositor
(unmapped, or root window is not in the parents, etc),
then the function returns NULL.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Present Wayland support

This uses the frame event to synchronise with the screen refresh.

Each window has its own msc count, like for the standard Present
implementation, but the msc count will always start at 0,
and no correlation is expected between the msc count of different
windows.

The msc count, and waiting a specific msc, rely on adding todo items
to the frame event. If never this fails, for example because
the window is not mapped yet, no synchronization will be done, and
the rendering will be as fast as possible.

If some conditions are matched, the Presented pixmap will be
exchanged ('flipped') with the window pixmap, thus avoiding a copy
and possible tearings.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Change configure and Makefile to build XWayland Present support

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Wait the wayland compositor release the pixmaps before destroying them.

In the case the X server closes, it would still destroy all
pixmaps without waiting the release.

Signed-off-by: Axel Davy <axel.davy@ens.fr>