This provides an extended version of ‘create_pool’, called
‘create_pool2’, which allows the client to specify a 64-bit offset in
the file to map at. As Wayland does not support 64-bit integers, the
offset is passed as two 32-bit numbers.
The intended use-case for this extension is when one needs to map a
surface from a character special device, but it can also be used with
regular files if one needs to map with a nonzero offset. Qubes OS needs
the Wayland compositor to map the ‘/dev/xen/gntdev’ character device,
which represents memory shared by a different Xen virtual machine.
Currently, this can be accomplished by opening a separate instance of
‘/dev/xen/gntdev’ every time, but that is slightly wasteful. Until
recently, it also on undocumented behavior in the kernel driver.
This also requires libwayland-server to be built with 64-bit off_t,
which should be supported on any reasonably modern system. A
‘_Static_assert’ will trip if off_t is not large enough.
This also forbids resizing a pool of version 3 or later that is
currently in use. On non-Linux systems, supporting pool resize requires
holding the file descriptor open, which can lead to file descriptor
exhaustion in the compositor. This change allows libwayland-server to
close the file descriptor once the pool is first mapped.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This prevents mismatches and missing formats between wl_shm.formats and
drm_fourcc.h.
The script collects DRM_FORMAT_* constants from drm_fourcc.h, compares the list
with the current wayland.xml entries (checking for any mismatch) and then
appends missing entries to wayland.xml.
Enum values are obtained by executing a generated C file which prints the
constants. There is no other reliable way to get these values as they are
defined via various macros.
There is no widespread Python library able to parse an XML file and format it
with all whitespace preserved. For this reason, we don't use an XML library to
create the new XML elements. Instead, we keep track of the line number of the
last wl_shm.format enum entry and add new entries right after. To be able to
read the line number of an element, we use lxml (the standard library doesn't
retain line number information).
Signed-off-by: Simon Ser <contact@emersion.fr>