minigbm: i915/amdgpu: Update plane count in bo_import

For format/modifier combination where the plane count does not
match the `DRM_FORMAT_MOD_INVALID` case, importing BOs
(via e.g. `gbm_bo_import`) currently fails as `bo->meta.num_planes`
is not set correctly.

Fix that by making the driver backends that support such
format/modifier combinations update the plane count accordingly.


minigbm: i915: Implement num_planes_from_modifier interface

Some format/modifier combinations have different plane counts
compared to the formats default (i.e. when the modifier is
`DRM_FORMAT_MOD_INVALID`).

Right now the supported cases are hardcoded in
`i915_bo_compute_metadata()`, however this does not cover all
use-cases. So implement the already existing backend interface,
aligning i915 with e.g. amdgpu.

Bug:b:224580219
Change-Id: If017997c70ab7da04ebf9d6cb9db775d9271ed05
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3516490
Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org>
Tested-by: Bas Nieuwenhuizen <basni@chromium.org>
Commit-Queue: Bas Nieuwenhuizen <basni@chromium.org>
2 files changed