mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
render/allocator/gbm: require GBM 21.1
Mesa 21.1 was released back in 2021. Let's require it so that we can simplify our build and remove the workaround.
This commit is contained in:
parent
221b37355f
commit
bb50c7a5a4
2 changed files with 1 additions and 33 deletions
|
|
@ -9,7 +9,6 @@
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include <xf86drm.h>
|
#include <xf86drm.h>
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "render/allocator/gbm.h"
|
#include "render/allocator/gbm.h"
|
||||||
#include "render/drm_format_set.h"
|
#include "render/drm_format_set.h"
|
||||||
|
|
||||||
|
|
@ -39,40 +38,12 @@ static bool export_gbm_bo(struct gbm_bo *bo,
|
||||||
attribs.modifier = gbm_bo_get_modifier(bo);
|
attribs.modifier = gbm_bo_get_modifier(bo);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int32_t handle = -1;
|
|
||||||
for (i = 0; i < attribs.n_planes; ++i) {
|
for (i = 0; i < attribs.n_planes; ++i) {
|
||||||
#if HAVE_GBM_BO_GET_FD_FOR_PLANE
|
|
||||||
(void)handle;
|
|
||||||
|
|
||||||
attribs.fd[i] = gbm_bo_get_fd_for_plane(bo, i);
|
attribs.fd[i] = gbm_bo_get_fd_for_plane(bo, i);
|
||||||
if (attribs.fd[i] < 0) {
|
if (attribs.fd[i] < 0) {
|
||||||
wlr_log(WLR_ERROR, "gbm_bo_get_fd_for_plane failed");
|
wlr_log(WLR_ERROR, "gbm_bo_get_fd_for_plane failed");
|
||||||
goto error_fd;
|
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
|
|
||||||
// drmPrimeHandleToFD because that messes up handle ref'counting in
|
|
||||||
// the user-space driver.
|
|
||||||
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");
|
|
||||||
goto error_fd;
|
|
||||||
}
|
|
||||||
if (i == 0) {
|
|
||||||
handle = plane_handle.s32;
|
|
||||||
} else if (plane_handle.s32 != handle) {
|
|
||||||
wlr_log(WLR_ERROR, "Failed to export GBM BO: "
|
|
||||||
"all planes don't have the same GEM handle");
|
|
||||||
goto error_fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
attribs.fd[i] = gbm_bo_get_fd(bo);
|
|
||||||
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.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);
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,12 @@ wlr_files += files(
|
||||||
|
|
||||||
gbm = disabler()
|
gbm = disabler()
|
||||||
if 'gbm' in allocators or 'auto' in allocators
|
if 'gbm' in allocators or 'auto' in allocators
|
||||||
gbm = dependency('gbm', version: '>=17.1.0', required: 'gbm' in allocators)
|
gbm = dependency('gbm', version: '>=21.1', required: 'gbm' in allocators)
|
||||||
endif
|
endif
|
||||||
if gbm.found()
|
if gbm.found()
|
||||||
wlr_files += files('gbm.c')
|
wlr_files += files('gbm.c')
|
||||||
wlr_deps += gbm
|
wlr_deps += gbm
|
||||||
features += { 'gbm-allocator': true }
|
features += { 'gbm-allocator': true }
|
||||||
|
|
||||||
has = cc.has_function('gbm_bo_get_fd_for_plane', dependencies: [gbm])
|
|
||||||
internal_config.set10('HAVE_GBM_BO_GET_FD_FOR_PLANE', has)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
udmabuf = false
|
udmabuf = false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue