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>
Remove automatic loading of drm. And makes xwl_drm_pre_init call always work

Signed-off-by: Axel Davy <axel.davy@ens.fr>
drm: Use O_CLOEXEC flag when opening the graphic device.

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