From 91e09f886586bf2aa3f9c71fb8d0d24e3dec766c Mon Sep 17 00:00:00 2001 From: stefan11111 Date: Sat, 4 Apr 2026 04:08:52 +0300 Subject: [PATCH] glamor: xfree86/glamor_egl: Fix builds without libdrm Signed-off-by: stefan11111 --- glamor/glamor_egl.c | 22 +++++++++++++++------- glamor/meson.build | 2 +- hw/xfree86/glamor_egl/meson.build | 2 +- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 0ae9ab015..e9a170fb3 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -33,15 +33,18 @@ #include #include #include + +#ifdef WITH_LIBDRM #include +#include +#endif + #define EGL_DISPLAY_NO_X_MESA #ifdef GLAMOR_HAS_GBM #include #endif -#include - #include "dix/screen_hooks_priv.h" #include "glamor/glamor_priv.h" #include "os/bug_priv.h" @@ -84,7 +87,7 @@ glamor_egl_make_current(struct glamor_context *glamor_ctx) } } -#ifdef GLAMOR_HAS_GBM +#if defined(GLAMOR_HAS_GBM) && defined (WITH_LIBDRM) static int glamor_get_flink_name(int fd, int handle, int *name) { @@ -166,6 +169,7 @@ glamor_egl_set_pixmap_image(PixmapPtr pixmap, EGLImageKHR image, Bool glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride) { +#ifdef WITH_LIBDRM ScreenPtr screen = pixmap->drawable.pScreen; glamor_egl_priv_t *glamor_egl = glamor_egl_get_screen_private(screen); @@ -195,6 +199,9 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride) close(fd); return TRUE; +#else + return FALSE; +#endif } Bool @@ -329,7 +336,7 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, #endif } -#ifdef GLAMOR_HAS_GBM +#if defined(GLAMOR_HAS_GBM) && defined (WITH_LIBDRM) static void glamor_get_name_from_bo(int gbm_fd, struct gbm_bo *bo, int *name) { @@ -531,7 +538,7 @@ glamor_egl_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds, uint32_t *strides, uint32_t *offsets, uint64_t *modifier) { -#ifdef GLAMOR_HAS_GBM +#if defined(GLAMOR_HAS_GBM) && defined (WITH_LIBDRM) struct gbm_bo *bo; int num_fds; #ifdef GBM_BO_WITH_MODIFIERS @@ -626,7 +633,7 @@ glamor_egl_fd_name_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, CARD16 *stride, CARD32 *size) { -#ifdef GLAMOR_HAS_GBM +#if defined(GLAMOR_HAS_GBM) && defined(WITH_LIBDRM) glamor_egl_priv_t *glamor_egl; struct gbm_bo *bo; int fd = -1; @@ -728,7 +735,7 @@ glamor_pixmap_from_fds(ScreenPtr screen, CARD8 depth, CARD8 bpp, uint64_t modifier) { -#ifdef GLAMOR_HAS_GBM +#if defined(GLAMOR_HAS_GBM) && defined(WITH_LIBDRM) PixmapPtr pixmap; glamor_egl_priv_t *glamor_egl; Bool ret = FALSE; @@ -866,6 +873,7 @@ glamor_filter_modifiers(uint32_t *num_modifiers, uint64_t **modifiers, if (external_only[i]) { continue; } + (*modifiers)[write_pos++] = (*modifiers)[i]; } diff --git a/glamor/meson.build b/glamor/meson.build index dc81583f1..c51581d27 100644 --- a/glamor/meson.build +++ b/glamor/meson.build @@ -48,7 +48,7 @@ glamor = static_library('glamor', include_directories: [inc, glx_inc], dependencies: [ common_dep, - dependency('libdrm', version: '>= 2.4.46'), + libdrm_dep, epoxy_dep, gbm_dep, ], diff --git a/hw/xfree86/glamor_egl/meson.build b/hw/xfree86/glamor_egl/meson.build index 2ca4a8a86..da0a34896 100644 --- a/hw/xfree86/glamor_egl/meson.build +++ b/hw/xfree86/glamor_egl/meson.build @@ -12,7 +12,7 @@ shared_module( c_args: xorg_c_args, dependencies: [ common_dep, - dependency('libdrm', version: '>= 2.4.46'), + libdrm_dep, gbm_dep, ], link_with: [glamor, libxserver_glx],