drv: prep for sub-driver support

Similar to a backend can update drv->backend during init to point to a
sub-backend, we want to allow a backend to update bo->drv during
allocate/import to point to a sub-driver.

All existing backends are DRM backends. When asked to allocate a bo,
they allocate from the DRM drivers, which may impose additional
restrictions to guarantee BO_USE_SCANOUT support. The restrictions are
unnecessary and unwated when BO_USE_SCANOUT is not set.

Without sub-drivers, a possible maneuver would be to allocate a dma-buf
from elsewhere and to import the dma-buf into the DRM driver. But it
would not work because the restrictions imposed by the DRM driver could
apply to imports as well.

By having sub-drivers, a backend can forward allocate or import to
sub-drivers. The bo is in no way associated with the backend. All bo
operations skip the backend and are dispatched to the sub-driver
directly.

Another option would be for frontends to create two (or more) drivers,
but frontends have even less clue when to use which drivers.

BUG=b:446040761
TEST=boot navi

Change-Id: Ibfac9648e2e450121f655a87b53da0214524ee00
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/6967758
Auto-Submit: Chia-I Wu <[email protected]>
Commit-Queue: Chia-I Wu <[email protected]>
Reviewed-by: Ryan Neph <[email protected]>
Reviewed-by: Yiwei Zhang <[email protected]>
Tested-by: Chia-I Wu <[email protected]>
4 files changed