minigbm: Add bo_get_plane_fd backend hook

Non-DRM drivers shouldn't rely on handles and DRM API.
Add hook to allow drivers create custom implementation.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Change-Id: I458dae38f80697184070019606b125992a9aa01d
This commit is contained in:
Roman Stratiienko 2021-06-23 17:11:10 +03:00 committed by Brendan Szymanski
parent 37858e5143
commit 529b476a9e
2 changed files with 6 additions and 0 deletions

5
drv.c
View file

@ -692,6 +692,11 @@ int drv_bo_get_plane_fd(struct bo *bo, size_t plane)
if (bo->is_test_buffer)
return -EINVAL;
if (bo->drv->backend->bo_get_plane_fd) {
fd = bo->drv->backend->bo_get_plane_fd(bo, plane);
return fd;
}
ret = drmPrimeHandleToFD(bo->drv->fd, bo->handle.u32, DRM_CLOEXEC | DRM_RDWR, &fd);
// Older DRM implementations blocked DRM_RDWR, but gave a read/write mapping anyways