diff --git a/include/drm-uapi/drm.h b/include/drm-uapi/drm.h index 4e4f7c2c39e..ceb0f9ec8a5 100644 --- a/include/drm-uapi/drm.h +++ b/include/drm-uapi/drm.h @@ -41,11 +41,15 @@ #include typedef unsigned int drm_handle_t; -#else /* One of the BSDs */ +#else /* One of the BSDs or GNU */ #include -#include #include +#if defined(__GNU__) +#include +#else +#include +#endif typedef int8_t __s8; typedef uint8_t __u8; typedef int16_t __s16; diff --git a/meson.build b/meson.build index 98f5423a278..c5176f0dcf4 100644 --- a/meson.build +++ b/meson.build @@ -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 diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c index 894ae6d6892..ab44c5333bc 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -30,7 +30,9 @@ #include #include +#if defined(HAVE_WAYLAND_PLATFORM) #include +#endif #include "drm-uapi/drm_fourcc.h" #include "util/macros.h" diff --git a/src/egl/drivers/dri2/platform_x11_dri3.h b/src/egl/drivers/dri2/platform_x11_dri3.h index c487188212e..1d269ea4a08 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.h +++ b/src/egl/drivers/dri2/platform_x11_dri3.h @@ -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 { diff --git a/src/egl/meson.build b/src/egl/meson.build index f9b0e348ad4..acd277fa5e9 100644 --- a/src/egl/meson.build +++ b/src/egl/meson.build @@ -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] diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index 1d010ba2ac0..c3a22c2dd1e 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -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, diff --git a/src/gallium/frontends/dri/meson.build b/src/gallium/frontends/dri/meson.build index 6d54daebae0..38d8db52e30 100644 --- a/src/gallium/frontends/dri/meson.build +++ b/src/gallium/frontends/dri/meson.build @@ -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') diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index 678c98f380d..9440d2ba019 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -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); diff --git a/src/glx/meson.build b/src/glx/meson.build index 28313f83a78..42c58eed40a 100644 --- a/src/glx/meson.build +++ b/src/glx/meson.build @@ -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 diff --git a/src/util/libsync.h b/src/util/libsync.h index 0acf778446d..b22b75a11bd 100644 --- a/src/util/libsync.h +++ b/src/util/libsync.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -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) diff --git a/src/x11/meson.build b/src/x11/meson.build index 3829ea7b88e..44a5578e772 100644 --- a/src/x11/meson.build +++ b/src/x11/meson.build @@ -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