|
|
@ -35,12 +35,14 @@ static bool export_gbm_bo(struct gbm_bo *bo,
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
int32_t handle = -1;
|
|
|
|
int32_t handle = -1;
|
|
|
|
for (i = 0; i < attribs.n_planes; ++i) {
|
|
|
|
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,
|
|
|
|
// 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
|
|
|
|
// check all planes have the same handle. We can't use
|
|
|
|
// drmPrimeHandleToFD because that messes up handle ref'counting in
|
|
|
|
// drmPrimeHandleToFD because that messes up handle ref'counting in
|
|
|
|
// the user-space driver.
|
|
|
|
// 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);
|
|
|
|
union gbm_bo_handle plane_handle = gbm_bo_get_handle_for_plane(bo, i);
|
|
|
|
if (plane_handle.s32 < 0) {
|
|
|
|
if (plane_handle.s32 < 0) {
|
|
|
|
wlr_log(WLR_ERROR, "gbm_bo_get_handle_for_plane failed");
|
|
|
|
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);
|
|
|
|
attribs.fd[i] = gbm_bo_get_fd(bo);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (attribs.fd[i] < 0) {
|
|
|
|
if (attribs.fd[i] < 0) {
|
|
|
|
wlr_log(WLR_ERROR, "gbm_bo_get_fd failed");
|
|
|
|
wlr_log(WLR_ERROR, "gbm_bo_get_fd failed");
|
|
|
|
goto error_fd;
|
|
|
|
goto error_fd;
|
|
|
|