Remove useless comments.

Leds, etc are handled by the Wayland compositor

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Fix device creation

Instead of registering a new device everytime the compositor
tells us it has keyboard or mouse capability, register
mouse and keyboard once for all.

Handle better when the server says it doesn't have anymore the mouse
or keyboard capability.

This fixes VT switch handling: after some VT switch,
the Xserver would crash because it would have created
too much devices.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
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>
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>