egl/wayland: Fix zwp_linux_dmabuf usage

There's no guarantee that the formats advertised by wl_drm and the formats
advertised by zwp_linux_dmabuf_v1 are the same.

get_back_bo() handles this by falling back from createImageWithModifiers() to
createImage() when there's a wl_drm format but no corresponding linux_dmabuf
format, but create_wl_buffer() unconditionally tries to create a linux_dmabuf
buffer unless DRIimage has DRM_FORMAT_MOD_INVALID.

Fix this by always checking if the DRIimage modifier has been advertised
by zwp_linux_dmabuf_v1, and falling back to wl_drm if not.

If DRM_FORMAT_MOD_INVALID has been advertised then we trust the client
has allocated something appropriate and treat any modifier as matching.

Closes: mesa/mesa#2220
Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <mesa/mesa!4294>
53 jobs for !4294 with fix-2220 in 27 minutes and 30 seconds (queued for 3 seconds)
detached
Status Job ID Name Coverage
  Container
passed #2494733
aarch64
arm_build

00:00:55

passed #2494734
aarch64
arm_test

00:00:31

passed #2494735
windows shell 1809 mesa
windows_build_vs2019

00:01:40

passed #2494729
x86_build

00:02:31

passed #2494732
x86_build_old

00:01:16

passed #2494730
x86_test-gl

00:00:55

passed #2494731
x86_test-vk

00:00:50

 
  Meson X86 64
passed #2494739
meson-clang

00:08:17

passed #2494738
meson-classic

00:05:09

passed #2494740
meson-clover

00:06:00

passed #2494741
meson-clover-old-llvm

00:06:43

passed #2494737
meson-gallium

00:08:56

passed #2494736
meson-testing

00:07:55

passed #2494742
meson-vulkan

00:06:40

 
  Scons
passed #2494743
scons-win64

00:08:59

 
  Meson Misc
passed #2494745
aarch64
meson-arm64

00:06:04

passed #2494746
aarch64
meson-arm64-build-test

00:06:06

passed #2494744
aarch64
meson-armhf

00:07:35

passed #2494748
meson-i386

00:06:13

passed #2494751
meson-mingw32-x86_64

00:06:29

passed #2494750
kvm
meson-ppc64el

00:06:59

passed #2494749
kvm
meson-s390x

00:05:48

passed #2494747
windows docker 1809 mesa
meson-windows-vs2019

00:11:05

 
  Llvmpipe
passed #2494755
llvmpipe-gles2

00:04:25

passed #2494756
llvmpipe-traces

00:00:27

passed #2494753
piglit-glslparser

00:04:44

passed #2494752
piglit-quick_gl

00:07:41

passed #2494754
piglit-quick_shader

00:05:20

 
  Softpipe
passed #2494757
softpipe-gles2

00:01:19

passed #2494760
softpipe-gles31 1/4

00:03:20

passed #2494758
softpipe-gles3 1/2

00:05:11

passed #2494761
softpipe-gles31 2/4

00:03:52

passed #2494762
softpipe-gles31 3/4

00:05:36

passed #2494763
softpipe-gles31 4/4

00:03:15

passed #2494759
softpipe-gles3 2/2

00:04:08

 
  Freedreno
passed #2494768
google-freedreno-db410c
arm64_a306_gles2

00:11:00

passed #2494769
google-freedreno-db410c
arm64_a306_gles3

00:08:34

passed #2494770
google-freedreno-db820c
arm64_a530_gles2

00:12:04

passed #2494771
google-freedreno-db820c
arm64_a530_gles3

00:20:20

passed #2494772
google-freedreno-db820c
arm64_a530_gles31

00:14:07

passed #2494764
mesa-cheza
arm64_a630_gles2

00:01:37

passed #2494766
mesa-cheza
arm64_a630_gles3

00:06:11

passed #2494765
mesa-cheza
arm64_a630_gles31

00:04:31

passed #2494767
mesa-cheza
arm64_a630_gles31_options

00:02:49

 
  Panfrost
passed #2494773
mesa-ci-aarch64-lava-collabora
panfrost-t720-gles2:arm64

00:16:15

passed #2494774
mesa-ci-aarch64-lava-collabora
panfrost-t760-gles2:armhf

00:11:05

passed #2494775
mesa-ci-aarch64-lava-collabora
panfrost-t860-gles2:arm64

00:08:55

passed #2494776
mesa-ci-aarch64-lava-collabora
panfrost-t860-gles3:arm64

00:06:03

 
  Radv
passed #2494777
radv-fossils

00:00:35

 
  Virgl
passed #2494778
virgl-gles2

00:02:38

passed #2494779
virgl-gles3

00:04:03

passed #2494780
virgl-gles31

00:02:34

passed #2494781
virgl-traces

00:00:34