Skip to content

Commit

Permalink
render/allocator/gbm: add log message for gbm_bo_get_fd_for_plane
Browse files Browse the repository at this point in the history
Makes it easier to find out which branch is taken when debugging
issues like [1].

[1]: swaywm#3156
  • Loading branch information
emersion committed Sep 2, 2021
1 parent 267eb02 commit 7c4e0b4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions render/allocator/gbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ static bool export_gbm_bo(struct gbm_bo *bo,
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;

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
// 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
Expand All @@ -57,12 +62,11 @@ 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;
}
#endif

attribs.offset[i] = gbm_bo_get_offset(bo, i);
attribs.stride[i] = gbm_bo_get_stride_for_plane(bo, i);
Expand Down

0 comments on commit 7c4e0b4

Please sign in to comment.