aboutsummaryrefslogtreecommitdiff
path: root/render/gbm_allocator.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-04-06 11:36:15 +0200
committerSimon Ser <contact@emersion.fr>2021-05-19 10:17:28 +0200
commit66e100ffbffbb70b64b973a4606d7c7b857c19ce (patch)
tree4f5e063877fcdf09472876941ecb885fa667244a /render/gbm_allocator.c
parent9ca743f9fd742e64784feedb718550c9fa8c109d (diff)
render/gbm_allocator: add support for gbm_bo_get_fd_for_plane
See [1]. This allows us to remove the workaround for GBM API limitations. [1]: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5442
Diffstat (limited to 'render/gbm_allocator.c')
-rw-r--r--render/gbm_allocator.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/render/gbm_allocator.c b/render/gbm_allocator.c
index 4006b66d..cbdd2640 100644
--- a/render/gbm_allocator.c
+++ b/render/gbm_allocator.c
@@ -35,12 +35,14 @@ static bool export_gbm_bo(struct gbm_bo *bo,
int i;
int32_t handle = -1;
for (i = 0; i < attribs.n_planes; ++i) {
+#if HAS_GBM_BO_GET_FD_FOR_PLANE
+ attribs.fd[i] = gbm_bo_get_fd_for_plane(bo, i);
+ (void)handle;
+#else
// GBM is lacking a function to get a FD for a given plane. Instead,
// check all planes have the same handle. We can't use
// drmPrimeHandleToFD because that messes up handle ref'counting in
// the user-space driver.
- // TODO: use gbm_bo_get_plane_fd when it lands, see
- // https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5442
union gbm_bo_handle plane_handle = gbm_bo_get_handle_for_plane(bo, i);
if (plane_handle.s32 < 0) {
wlr_log(WLR_ERROR, "gbm_bo_get_handle_for_plane failed");
@@ -55,6 +57,8 @@ static bool export_gbm_bo(struct gbm_bo *bo,
}
attribs.fd[i] = gbm_bo_get_fd(bo);
+#endif
+
if (attribs.fd[i] < 0) {
wlr_log(WLR_ERROR, "gbm_bo_get_fd failed");
goto error_fd;