os: Add support for GNU/HURD compilation and use of dri swrast/llvmpipe.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39277>
This commit is contained in:
Krzysztof Sobiecki 2026-01-12 22:59:21 +01:00 committed by Marge Bot
parent 0662febcaf
commit 615e2d15d1
11 changed files with 32 additions and 16 deletions

View file

@ -41,11 +41,15 @@
#include <asm/ioctl.h>
typedef unsigned int drm_handle_t;
#else /* One of the BSDs */
#else /* One of the BSDs or GNU */
#include <stdint.h>
#include <sys/ioccom.h>
#include <sys/types.h>
#if defined(__GNU__)
#include <sys/ioctl.h>
#else
#include <sys/ioccom.h>
#endif
typedef int8_t __s8;
typedef uint8_t __u8;
typedef int16_t __s16;

View file

@ -413,6 +413,8 @@ elif ['windows', 'cygwin'].contains(host_machine.system())
with_dri_platform = 'windows'
elif system_has_kms_drm
with_dri_platform = 'drm'
elif host_machine.system() == 'gnu'
with_dri_platform = 'hurd'
else
# FIXME: haiku doesn't use dri, and xlib doesn't use dri, probably should
# assert here that one of those cases has been met.
@ -536,7 +538,7 @@ with_gbm = get_option('gbm') \
.allowed()
with_xlib_lease = get_option('xlib-lease') \
.require(with_platform_x11 and (system_has_kms_drm or with_dri_platform == 'apple'), error_message : 'xlib-lease requires X11 and KMS/DRM support') \
.require(with_platform_x11 and (system_has_kms_drm or with_dri_platform == 'apple' or with_dri_platform == 'hurd'), error_message : 'xlib-lease requires X11 and KMS/DRM support') \
.allowed()
with_egl = get_option('egl') \
@ -655,7 +657,7 @@ if with_vulkan_icd_dir == ''
with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d')
endif
with_dri2 = (with_dri or with_any_vk) and (with_dri_platform == 'drm' or with_dri_platform == 'apple')
with_dri2 = (with_dri or with_any_vk) and (with_dri_platform == 'drm' or with_dri_platform == 'apple' or with_dri_platform == 'hurd')
if with_dri
if with_glx == 'disabled' and not with_egl and not with_gbm
@ -2191,7 +2193,7 @@ if with_platform_x11
error('libdrm required for gallium video statetrackers when using x11')
endif
endif
if with_dri_platform == 'drm'
if with_dri_platform == 'drm' or with_dri_platform == 'hurd'
dep_xcb_dri3 = dependency('xcb-dri3', version : dep_xcb_dri3_version)
dep_xcb_present = dependency('xcb-present', version : dep_xcb_present_version)
if (dep_xcb_dri3.version().version_compare('>= 1.17') and
@ -2207,7 +2209,7 @@ if with_platform_x11
dep_glproto = dependency('glproto', version : dep_glproto_version)
endif
if with_glx == 'dri'
if with_dri_platform == 'drm'
if with_dri_platform == 'drm' or with_dri_platform == 'hurd'
if with_glx_direct
dep_xxf86vm = dependency('xxf86vm')
endif
@ -2317,7 +2319,7 @@ elif with_glx == 'dri'
gl_priv_reqs += [
'x11', 'xext', 'xfixes', 'x11-xcb', 'xcb',
'xcb-glx >= 1.8.1']
if with_dri_platform == 'drm'
if with_dri_platform == 'drm' or with_dri_platform == 'hurd'
gl_priv_reqs += 'xcb-dri2 >= 1.8'
if with_glx_direct
gl_priv_reqs += 'xxf86vm'
@ -2451,7 +2453,7 @@ if with_egl
if with_dri
egl_drivers += 'builtin:egl_dri2'
endif
if with_dri_platform == 'drm'
if with_dri_platform == 'drm' or with_dri_platform == 'hurd'
egl_drivers += 'builtin:egl_dri3'
endif
if with_platform_windows

View file

@ -30,7 +30,9 @@
#include <xcb/present.h>
#include <xcb/xcb.h>
#if defined(HAVE_WAYLAND_PLATFORM)
#include <xf86drm.h>
#endif
#include "drm-uapi/drm_fourcc.h"
#include "util/macros.h"

View file

@ -24,7 +24,9 @@
#define EGL_X11_DRI3_INCLUDED
#include "platform_x11.h"
#if !defined(HAVE_LIBDRM)
#include "loader_dri3_helper.h"
#endif
_EGL_DRIVER_TYPECAST(dri3_egl_surface, _EGLSurface, obj)
struct dri3_egl_surface {

View file

@ -108,7 +108,7 @@ if with_dri
files_egl += files('drivers/dri2/platform_x11.c')
incs_for_egl += inc_loader_x11
link_for_egl += libloader_x11
if with_dri_platform == 'drm'
if with_dri_platform == 'drm' or with_dri_platform == 'hurd'
files_egl += files('drivers/dri2/platform_x11_dri3.c')
endif
deps_for_egl += [dep_x11_xcb, dep_xcb_xrandr, dep_xcb_xfixes, dep_xcb_shm]

View file

@ -420,7 +420,7 @@ endif
if with_platform_x11
files_libgalliumvlwinsys += files('vl/vl_winsys_dri.c')
links_libgalliumvlwinsys += libloader_x11
if with_dri_platform == 'drm'
if with_dri_platform == 'drm' or with_dri_platform == 'hurd'
vlwinsys_deps += [
dep_xcb_sync, dep_xcb_present, dep_xshmfence, dep_xcb_xfixes,
dep_xcb_dri3,

View file

@ -21,7 +21,7 @@ files_libdri = files(
if with_platform_x11
deps_for_libdri += dep_xcb
if with_dri_platform == 'drm'
if with_dri_platform == 'drm' or with_dri_platform == 'hurd'
deps_for_libdri += [dep_xcb_dri3, dep_xcb_present, dep_xcb_sync,
dep_xshmfence, dep_xcb_xfixes]
files_libdri += files('loader_dri3_helper.c')

View file

@ -141,10 +141,9 @@ extern __GLXDRIdisplay *driwindowsCreateDisplay(Display * dpy);
#if defined(GLX_DIRECT_RENDERING) && (!defined(GLX_USE_APPLEGL) || defined(GLX_USE_APPLE))
#ifdef HAVE_LIBDRM
struct glx_screen *dri3_create_screen(int screen, struct glx_display * priv, bool driver_name_is_inferred, bool *return_zink);
void dri3_destroy_display(__GLXDRIdisplay * dpy);
#endif
bool dri2CheckSupport(Display *dpy);
struct glx_screen *dri2CreateScreen(int screen, struct glx_display * priv, bool driver_name_is_inferred);

View file

@ -58,7 +58,7 @@ extra_libs_libglx = []
extra_deps_libgl = []
extra_ld_args_libgl = []
if with_dri_platform == 'drm'
if with_dri_platform == 'drm' or with_dri_platform == 'hurd'
files_libglx += files('dri3_glx.c', 'dri3_priv.h')
endif

View file

@ -34,6 +34,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <stdlib.h>
@ -86,6 +87,9 @@ struct sync_merge_data {
uint32_t flags;
uint32_t pad;
};
#if defined(__GNU__)
#define _IOT_sync_merge_data _IOT(_IOTS(struct sync_merge_data), 1, 0, 0, 0, 0)
#endif
struct sync_fence_info {
char obj_name[32];
@ -104,6 +108,9 @@ struct sync_file_info {
uint64_t sync_fence_info;
};
#if defined(__GNU__)
#define _IOT_sync_file_info _IOT(_IOTS(struct sync_file_info), 1, 0, 0, 0, 0)
#endif
#define SYNC_IOC_MAGIC '>'
#define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)

View file

@ -7,7 +7,7 @@ loader_x11_files = files(
'x11_display.c',
)
if with_dri_platform == 'drm'
if with_dri_platform == 'drm' or with_dri_platform == 'hurd'
loader_x11_files += files('x11_dri3.c')
endif