minigbm: amdgpu: Update plane count in bo_import

This is required for importing multi-plane modifiers where the
format plane count is lower (usually `1`). It will be used
by Exo for v3/4 of the `zwp_linux_dmabuf_v1` Wayland potocol,
allowing Wayland clients (and thus all clients that build on
the Wayland support) to use explicit modifiers which again
can increase performance on many GPUs.

Also add another fallback path to `dri_num_planes_from_modifier()`
for cases when `queryDmaBufFormatModifierAttribs()` fails and do
some refactoring there. Without this, some test apparently fail.

This includes the amdgpu part of
commit 1a733377e91b9e714541ea1f51e1f5808b32897c, partially reverting
commit 853b8542fbf5711cca4b00d0e30cd3e559c925fd.

Bug:b:224580219
Change-Id: I93b64123420b39f3b83ff1bbbb9c59ddf4bc6105
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3568489
Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org>
Tested-by: Robert Mader <robert.mader@collabora.com>
Commit-Queue: Robert Mader <robert.mader@collabora.com>
2 files changed