diff --git a/.gitlab-ci/build/gitlab-ci.yml b/.gitlab-ci/build/gitlab-ci.yml index 7dc4649c30b..9b0ae2378e3 100644 --- a/.gitlab-ci/build/gitlab-ci.yml +++ b/.gitlab-ci/build/gitlab-ci.yml @@ -547,10 +547,11 @@ debian-no-libdrm: BUILDTYPE: release EXTRA_OPTION: > -D freedreno-kmds=kgsl - -D glx=disabled + -D glx=dri -D gbm=disabled - -D egl=disabled + -D egl=enabled -D perfetto=true + -D platforms=x11,wayland debian-clang: extends: diff --git a/meson.build b/meson.build index 43b1afd7ba9..eb35cc77937 100644 --- a/meson.build +++ b/meson.build @@ -250,7 +250,7 @@ if with_gallium_swrast endif with_gallium = gallium_drivers.length() != 0 -with_gallium_kmsro = system_has_kms_drm and [ +with_gallium_drm = system_has_kms_drm and [ with_gallium_asahi, with_gallium_etnaviv, with_gallium_freedreno, @@ -258,7 +258,6 @@ with_gallium_kmsro = system_has_kms_drm and [ with_gallium_panfrost, with_gallium_v3d, with_gallium_vc4, - with_gallium_zink, ].contains(true) _vulkan_drivers = get_option('vulkan-drivers') @@ -322,7 +321,7 @@ freedreno_kmds = get_option('freedreno-kmds') if freedreno_kmds.length() != 0 and freedreno_kmds != [ 'msm' ] and with_freedreno_vk if freedreno_kmds.contains('msm') warning('Turnip with the DRM KMD will require libdrm to always be present at runtime which may not always be the case on platforms such as Android.') - elif with_gallium_kmsro + elif with_gallium_drm warning('As a side-effect, Turnip is forced to link with libdrm when built alongside Gallium DRM drivers which platforms such as Android may not have available at runtime.') elif _vulkan_drivers != [ 'freedreno' ] warning('Turnip is forced to link with libdrm when built alongside other Vulkan drivers which platforms such as Android may not have available at runtime.') @@ -333,6 +332,9 @@ if freedreno_kmds.length() != 0 and freedreno_kmds != [ 'msm' ] and with_freedre endif endif +# This has to be below the freedreno_kmds check since that can change system_has_kms_drm +with_gallium_kmsro = with_gallium_drm or (system_has_kms_drm and with_gallium_zink) + pre_args += ['-DMESA_SYSTEM_HAS_KMS_DRM=@0@'.format(system_has_kms_drm.to_int())] if host_machine.cpu_family() == 'x86' and with_glx_read_only_text pre_args += ['-DGLX_X86_READONLY_TEXT'] @@ -352,7 +354,7 @@ with_vdrm = [ ].contains(true) with_dri = false -if with_gallium and system_has_kms_drm +if with_gallium and (system_has_kms_drm or (freedreno_kmds.contains('kgsl') and with_gallium_zink)) _glx = get_option('glx') _egl = get_option('egl') if _glx == 'dri' or _egl.enabled() or (_glx == 'disabled' and _egl.allowed()) @@ -413,8 +415,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' +elif host_machine.system() == 'gnu' or (freedreno_kmds.contains('kgsl') and with_gallium_zink) + with_dri_platform = 'software' 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. @@ -538,7 +540,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' or with_dri_platform == 'hurd'), 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 == 'software'), error_message : 'xlib-lease requires X11 and KMS/DRM support') \ .allowed() with_egl = get_option('egl') \ @@ -657,7 +659,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' or with_dri_platform == 'hurd') +with_dri2 = (with_dri or with_any_vk) and (with_dri_platform == 'drm' or with_dri_platform == 'apple' or with_dri_platform == 'software') if with_dri if with_glx == 'disabled' and not with_egl and not with_gbm @@ -2203,7 +2205,7 @@ if with_platform_x11 error('libdrm required for gallium video statetrackers when using x11') endif endif - if with_dri_platform == 'drm' or with_dri_platform == 'hurd' + if with_dri_platform == 'drm' or with_dri_platform == 'software' 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 @@ -2219,7 +2221,7 @@ if with_platform_x11 dep_glproto = dependency('glproto', version : dep_glproto_version) endif if with_glx == 'dri' - if with_dri_platform == 'drm' or with_dri_platform == 'hurd' + if with_dri_platform == 'drm' or with_dri_platform == 'software' if with_glx_direct dep_xxf86vm = dependency('xxf86vm') endif @@ -2329,7 +2331,7 @@ elif with_glx == 'dri' gl_priv_reqs += [ 'x11', 'xext', 'xfixes', 'x11-xcb', 'xcb', 'xcb-glx >= 1.8.1'] - if with_dri_platform == 'drm' or with_dri_platform == 'hurd' + if with_dri_platform == 'drm' or with_dri_platform == 'software' gl_priv_reqs += 'xcb-dri2 >= 1.8' if with_glx_direct gl_priv_reqs += 'xxf86vm' @@ -2463,7 +2465,7 @@ if with_egl if with_dri egl_drivers += 'builtin:egl_dri2' endif - if with_dri_platform == 'drm' or with_dri_platform == 'hurd' + if with_dri_platform == 'drm' or with_dri_platform == 'software' egl_drivers += 'builtin:egl_dri3' endif if with_platform_windows diff --git a/meson.options b/meson.options index 7311f21fc85..220d46eaba3 100644 --- a/meson.options +++ b/meson.options @@ -216,9 +216,9 @@ option( 'will be built' ) -# Note that currently turnip supports msm and kgsl, while the gallium driver -# support msm and virtio. This is a temporary situation with virtio support -# for turnip and kgsl support for gallium planned/in-progress. +# Note that the freedreno gallium driver doesn't support KGSL. +# On those systems, zink with Turnip should be used instead. +# WSL is only supported for the replay tool. option( 'freedreno-kmds', type : 'array', diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 7db9f6bccb6..73f0ae5b547 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include "util/libdrm.h" #include #include #include diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c index 8fbb9a60ed4..ff7bb4a5600 100644 --- a/src/egl/drivers/dri2/platform_surfaceless.c +++ b/src/egl/drivers/dri2/platform_surfaceless.c @@ -385,12 +385,12 @@ dri2_initialize_surfaceless(_EGLDisplay *disp) struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); /* When ForceSoftware is false, we try the HW driver. When ForceSoftware - * is true, we try kms_swrast and swrast in order. + * or Zink is true, we try kms_swrast and swrast/zink in order. */ driver_loaded = surfaceless_probe_device(disp, disp->Options.ForceSoftware, disp->Options.Zink); - if (!driver_loaded && disp->Options.ForceSoftware) { - _eglLog(_EGL_DEBUG, "Falling back to surfaceless swrast without DRM."); + if (!driver_loaded && (disp->Options.ForceSoftware || disp->Options.Zink)) { + _eglLog(_EGL_DEBUG, "Falling back to surfaceless without DRM."); driver_loaded = surfaceless_probe_device_sw(disp); } diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 89c046d8d48..e59d4fe4875 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include "util/libdrm.h" #include "drm-uapi/drm_fourcc.h" #include #include diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 62ae615c6f3..96c38aacd93 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -42,7 +42,7 @@ #include /* clang-format on */ #ifdef HAVE_LIBDRM -#include +#include "util/libdrm.h" #include "platform_x11_dri3.h" #endif #include "util/bitscan.h" diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c index ab44c5333bc..2c4353ae1f5 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -31,7 +31,7 @@ #include #if defined(HAVE_WAYLAND_PLATFORM) -#include +#include "util/libdrm.h" #endif #include "drm-uapi/drm_fourcc.h" #include "util/macros.h" diff --git a/src/egl/meson.build b/src/egl/meson.build index acd277fa5e9..9a27fae3429 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' or with_dri_platform == 'hurd' + if with_dri_platform == 'drm' or with_dri_platform == 'software' 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 c3a22c2dd1e..d1d2cfd27ae 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' or with_dri_platform == 'hurd' + if with_dri_platform == 'drm' or with_dri_platform == 'software' 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 38d8db52e30..8b939f861e0 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' or with_dri_platform == 'hurd' + if with_dri_platform == 'drm' or with_dri_platform == 'software' 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/meson.build b/src/glx/meson.build index 42c58eed40a..8ee877ea080 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' or with_dri_platform == 'hurd' +if with_dri_platform == 'drm' or with_dri_platform == 'software' files_libglx += files('dri3_glx.c', 'dri3_priv.h') endif diff --git a/src/util/libdrm.h b/src/util/libdrm.h index d8ef0b55182..8876ebef675 100644 --- a/src/util/libdrm.h +++ b/src/util/libdrm.h @@ -131,6 +131,18 @@ drmFreeDevices(drmDevicePtr devices[], int count) {} static inline char* drmGetDeviceNameFromFd2(int fd) { return NULL;} +static inline int +drmGetNodeTypeFromFd(int fd) +{ + return -1; +} + +static inline char * +drmGetRenderDeviceNameFromFd(int fd) +{ + return NULL; +} + typedef struct _drmVersion { int version_major; /**< Major version */ int version_minor; /**< Minor version */ diff --git a/src/x11/meson.build b/src/x11/meson.build index 44a5578e772..292a167089e 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' or with_dri_platform == 'hurd' +if with_dri_platform == 'drm' or with_dri_platform == 'software' loader_x11_files += files('x11_dri3.c') endif