Skip to content

Commit

Permalink
minigbm: Add bo_get_plane_fd backend hook
Browse files Browse the repository at this point in the history
Non-DRM drivers shouldn't rely on handles and DRM API.
Add hook to allow drivers create custom implementation.

Signed-off-by: Roman Stratiienko <[email protected]>
Change-Id: I458dae38f80697184070019606b125992a9aa01d
  • Loading branch information
rsglobal committed Sep 12, 2022
1 parent 179dfb9 commit 1c4ff09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,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->handles[plane].u32, DRM_CLOEXEC | DRM_RDWR, &fd);

// Older DRM implementations blocked DRM_RDWR, but gave a read/write mapping anyways
Expand Down
1 change: 1 addition & 0 deletions drv_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ struct backend {
int (*bo_unmap)(struct bo *bo, struct vma *vma);
int (*bo_invalidate)(struct bo *bo, struct mapping *mapping);
int (*bo_flush)(struct bo *bo, struct mapping *mapping);
int (*bo_get_plane_fd)(struct bo *bo, size_t plane);
void (*resolve_format_and_use_flags)(struct driver *drv, uint32_t format,
uint64_t use_flags, uint32_t *out_format,
uint64_t *out_use_flags);
Expand Down

0 comments on commit 1c4ff09

Please sign in to comment.