modesetting: fix defined(GBM_BO_*) enum compile checks
Some checks failed
Build X servers / xserver-build-ubuntu (push) Has been cancelled
Build X servers / drivers-build-ubuntu (push) Has been cancelled
Build X servers / xserver-build-mingw32-ubuntu (push) Has been cancelled
Build X servers / xserver-build-macos (push) Has been cancelled
Build X servers / xserver-build-freebsd (push) Has been cancelled
Build X servers / xserver-build-dragonflybsd (push) Has been cancelled
Build X servers / xserver-build-netbsd (push) Has been cancelled
Build X servers / xserver-build-cygwin (push) Has been cancelled
Build X servers / Check Signed-Off-By (push) Has been cancelled
check PRs for merge conflicts / notify (push) Has been cancelled
Build X servers / Release pushed tag (push) Has been cancelled

Apparently the enum values cannot be checked during preprocessor phase.
Fix it with checking gbm version using meson and defining additional
symbols which are visible during compile time.

Signed-off-by: Tautvis <gtautvis@gmail.com>
This commit is contained in:
Tautvis 2026-04-09 13:35:28 +03:00 • committed by Enrico Weigelt
commit 3b81b8a9b9
3 changed files with 8 additions and 4 deletions

View file

@ -312,7 +312,7 @@ check_outputs(int fd, int *count)
*count = res->count_connectors;
ret = res->count_connectors > 0;
#if defined(GLAMOR) && defined(GBM_BO_USE_LINEAR)
#if defined(GLAMOR) && defined(GBM_HAVE_BO_USE_LINEAR)
if (ret == FALSE) {
uint64_t value = 0;
if (drmGetCap(fd, DRM_CAP_PRIME, &value) == 0 &&
@ -1379,7 +1379,7 @@ PreInit(ScrnInfoPtr pScrn, int flags)
if (ms->drmmode.glamor)
pScrn->capabilities |= RR_Capability_SinkOffload;
}
#if defined(GLAMOR) && defined(GBM_BO_USE_LINEAR)
#if defined(GLAMOR) && defined(GBM_HAVE_BO_USE_LINEAR)
if (value & DRM_PRIME_CAP_EXPORT && ms->drmmode.glamor)
pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SourceOffload;
#endif

View file

@ -27,11 +27,11 @@ typedef struct {
Bool used_modifiers;
} bo_priv_t;
#ifndef GBM_BO_USE_LINEAR
#ifndef GBM_HAVE_BO_USE_LINEAR
#define GBM_BO_USE_LINEAR 0
#endif
#ifndef GBM_BO_USE_FRONT_RENDERING
#ifndef GBM_HAVE_BO_USE_FRONT_RENDERING
#define GBM_BO_USE_FRONT_RENDERING 0
#endif

View file

@ -112,6 +112,10 @@ conf_data.set('GBM_BO_FD_FOR_PLANE',
build_glamor and gbm_dep.found() and gbm_dep.version().version_compare('>= 21.1') ? '1' : false)
conf_data.set('GBM_BO_WITH_MODIFIERS2',
build_glamor and gbm_dep.found() and gbm_dep.version().version_compare('>= 21.3') ? '1' : false)
conf_data.set('GBM_HAVE_BO_USE_LINEAR',
build_glamor and gbm_dep.found() and cc.has_header_symbol('gbm.h', 'GBM_BO_USE_LINEAR', dependencies : gbm_dep ) ? '1' : false)
conf_data.set('GBM_HAVE_BO_USE_FRONT_RENDERING',
build_glamor and gbm_dep.found() and cc.has_header_symbol('gbm.h','GBM_BO_USE_FRONT_RENDERING', dependencies: gbm_dep ) ? '1' : false)
conf_data.set_quoted('SERVER_MISC_CONFIG_PATH', serverconfigdir)
conf_data.set_quoted('PROJECTROOT', get_option('prefix'))