Backport linux dmabuf fixes
Together these cherry-picks fix #2220 (closed) on the 20.0 branch.
Tested by running es2gears_wayland on GNOME Shell (which runs correctly with these patches, and fails without) and that this does not regress running es2gears_wayland on Weston.