Add an automated script to update wl_shm.format

Graphics / Wayland / Wayland - Simon Ser [] - 6 September 2019 12:09 UTC

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).

8854f64 Add an automated script to update wl_shm.format
protocol/ | 153 +++++++++++++++++++++++++++++++++++++++
1 file changed, 153 insertions(+)


  • Share