Skip to content

Move, rename, clean up and reuse cogl-utils format map

Robert Mader requested to merge rmader/mutter:drm-cogl-format-cleanup into main

From the main commit:

1. Move the file out of the `backends/native` so we'll be able to use
   it even if the native backend is disabled. Create the new "platform"
   folder for such use-cases.

2. Rename to cogl-drm-formats to make it more obvious that the format
   map is more than an utility these days.

3. Drop the unused CoglTextureComponents part (see also previous
   commit).

4. Move the map to the header, simplifying some future use-cases.

5. Sync formats with MetaWaylandBuffer and MetaWaylandDmaBufBuffer and
   also use newly introduced opaque formats where appropriate.
   This avoids duplicated code, ensures that new drm-formats added to
   the dmabuf protocol have an adequate representation in Cogl from which
   information like alpha support can be easily derived and finally
   ensures we don't crash if the mappings got out of sync.

6. Remove some likely untested formats. In case some of these are
   actually needed on certain hardware, we can test whether we got
   the correct mapping by also adding support for the corresponding
   wl_shm_format in MetaWaylandBuffer by extending the gradient test in
   https://gitlab.freedesktop.org/jadahl/wayland-test-clients

Also:

  • reuse the format map for zwp_linux_dmabuf_v1.
  • clean up Wayland shm-formats
  • add some more opaque format variants
  • fix a bunch of issues around certain pixel formats and add tests

Needed for !2191 (merged)

Edited by Robert Mader

Merge request reports