render/allocator/gbm: add log message for gbm_bo_get_fd_for_plane

Makes it easier to find out which branch is taken when debugging
issues like [1].

[1]: https://github.com/swaywm/wlroots/issues/3156
This commit is contained in:
Simon Ser 2021-09-02 10:50:09 +02:00 committed by Kenny Levinsen
parent 5aa5137fae
commit 38cd1b4f4f
1 changed files with 7 additions and 3 deletions

View File

@ -36,8 +36,13 @@ static bool export_gbm_bo(struct gbm_bo *bo,
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 #if HAS_GBM_BO_GET_FD_FOR_PLANE
attribs.fd[i] = gbm_bo_get_fd_for_plane(bo, i);
(void)handle; (void)handle;
attribs.fd[i] = gbm_bo_get_fd_for_plane(bo, i);
if (attribs.fd[i] < 0) {
wlr_log(WLR_ERROR, "gbm_bo_get_fd_for_plane failed");
goto error_fd;
}
#else #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
@ -57,12 +62,11 @@ 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;
} }
#endif
attribs.offset[i] = gbm_bo_get_offset(bo, i); attribs.offset[i] = gbm_bo_get_offset(bo, i);
attribs.stride[i] = gbm_bo_get_stride_for_plane(bo, i); attribs.stride[i] = gbm_bo_get_stride_for_plane(bo, i);