Skip to content

Commit

Permalink
[ozone/common] Fix gbm_bo_get_plane_count type mismatch
Browse files Browse the repository at this point in the history
Though minigbm gbm_bo_get_plane_count returns a size_t, libgbm is
returning an int. And a return value of -1 is possible (it
reports the operation failed).

So modify DCHECK that would assume both are size_t for the
case build is using system GBM.
  • Loading branch information
Jose Dapena Paz authored and jkim-julie committed Nov 5, 2018
1 parent edbf0d0 commit 80e9664
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ui/ozone/common/linux/gbm_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ void InitializeImportData(uint32_t format,
}

int GetPlaneFdForBo(gbm_bo* bo, size_t plane) {
#if defined(USING_MINIGBM)
DCHECK(plane < gbm_bo_get_plane_count(bo));
#else
const int plane_count = gbm_bo_get_plane_count(bo);
DCHECK(plane_count > 0 && plane < static_cast<size_t>(plane_count));
#endif

// System linux gbm (or Mesa gbm) does not provide fds per plane basis. Thus,
// get plane handle and use drm ioctl to get a prime fd out of it avoid having
Expand Down

0 comments on commit 80e9664

Please sign in to comment.