tu+meson: Re-work KMD selection
Now that turnip can support multiple kernel-mode drivers in a single build, re-work the meson option to have a single list of KMDs, rather than special options to enable kgsl for turnip or virtio for gallium. It is temporarily a bit awkward as gallium does not yet support kgsl and turnip does not yet support virtio. But both of those are planned or in-progress, so long term a single list is the most sensible option. TODO freedreno/drm support to build with only virtio support. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21394>
This commit is contained in:
@@ -48,7 +48,7 @@ one cross-compiling the turnip driver for a stock Pixel phone)
|
|||||||
-Dandroid-stub=true \
|
-Dandroid-stub=true \
|
||||||
-Dgallium-drivers= \
|
-Dgallium-drivers= \
|
||||||
-Dvulkan-drivers=freedreno \
|
-Dvulkan-drivers=freedreno \
|
||||||
-Dfreedreno-kgsl=true
|
-Dfreedreno-kmds=kgsl
|
||||||
ninja -C build-android-aarch64
|
ninja -C build-android-aarch64
|
||||||
|
|
||||||
Replacing Android drivers on stock Android
|
Replacing Android drivers on stock Android
|
||||||
|
13
meson.build
13
meson.build
@@ -131,11 +131,6 @@ with_shared_glapi = with_shared_glapi and with_any_opengl
|
|||||||
|
|
||||||
system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos', 'android'].contains(host_machine.system())
|
system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos', 'android'].contains(host_machine.system())
|
||||||
|
|
||||||
with_freedreno_kgsl = get_option('freedreno-kgsl')
|
|
||||||
if with_freedreno_kgsl
|
|
||||||
system_has_kms_drm = false
|
|
||||||
endif
|
|
||||||
|
|
||||||
gallium_drivers = get_option('gallium-drivers')
|
gallium_drivers = get_option('gallium-drivers')
|
||||||
if gallium_drivers.contains('auto')
|
if gallium_drivers.contains('auto')
|
||||||
if system_has_kms_drm
|
if system_has_kms_drm
|
||||||
@@ -193,6 +188,13 @@ foreach gallium_driver : gallium_drivers
|
|||||||
pre_args += '-DHAVE_@0@'.format(gallium_driver.to_upper())
|
pre_args += '-DHAVE_@0@'.format(gallium_driver.to_upper())
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
freedreno_kmds = get_option('freedreno-kmds')
|
||||||
|
# If building only vulkan with only kgsl kmd support, there is no libdrm
|
||||||
|
# dependency:
|
||||||
|
if freedreno_kmds.length() == 1 and freedreno_kmds.contains('kgsl') and not with_gallium_freedreno
|
||||||
|
system_has_kms_drm = false
|
||||||
|
endif
|
||||||
|
|
||||||
with_gallium = gallium_drivers.length() != 0
|
with_gallium = gallium_drivers.length() != 0
|
||||||
with_gallium_kmsro = system_has_kms_drm and [
|
with_gallium_kmsro = system_has_kms_drm and [
|
||||||
with_gallium_asahi,
|
with_gallium_asahi,
|
||||||
@@ -244,7 +246,6 @@ with_freedreno_vk = _vulkan_drivers.contains('freedreno')
|
|||||||
with_panfrost_vk = _vulkan_drivers.contains('panfrost')
|
with_panfrost_vk = _vulkan_drivers.contains('panfrost')
|
||||||
with_swrast_vk = _vulkan_drivers.contains('swrast')
|
with_swrast_vk = _vulkan_drivers.contains('swrast')
|
||||||
with_virtio_vk = _vulkan_drivers.contains('virtio-experimental')
|
with_virtio_vk = _vulkan_drivers.contains('virtio-experimental')
|
||||||
with_freedreno_virtio = get_option('freedreno-virtio')
|
|
||||||
with_broadcom_vk = _vulkan_drivers.contains('broadcom')
|
with_broadcom_vk = _vulkan_drivers.contains('broadcom')
|
||||||
with_imagination_vk = _vulkan_drivers.contains('imagination-experimental')
|
with_imagination_vk = _vulkan_drivers.contains('imagination-experimental')
|
||||||
with_imagination_srv = get_option('imagination-srv')
|
with_imagination_srv = get_option('imagination-srv')
|
||||||
|
@@ -198,19 +198,16 @@ option(
|
|||||||
'will be built'
|
'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.
|
||||||
option(
|
option(
|
||||||
'freedreno-kgsl',
|
'freedreno-kmds',
|
||||||
type : 'boolean',
|
type : 'array',
|
||||||
value : false,
|
value : ['msm'],
|
||||||
description : 'use kgsl backend for freedreno vulkan driver',
|
choices : ['msm', 'kgsl', 'virtio'],
|
||||||
)
|
description : 'List of kernel-mode drivers to enable for freedreno ' +
|
||||||
|
'gallium and vulkan driver',
|
||||||
option(
|
|
||||||
'freedreno-virtio',
|
|
||||||
type : 'boolean',
|
|
||||||
value : false,
|
|
||||||
description : 'use experimental virtio backend for freedreno (currently ' +
|
|
||||||
'only gallium driver)',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
option(
|
option(
|
||||||
|
@@ -62,7 +62,7 @@ libfreedreno_drm_virtio_files = files(
|
|||||||
'virtio/virtio_ringbuffer.c',
|
'virtio/virtio_ringbuffer.c',
|
||||||
'virtio/virtio_ringbuffer.h',
|
'virtio/virtio_ringbuffer.h',
|
||||||
)
|
)
|
||||||
if with_freedreno_virtio
|
if freedreno_kmds.contains('virtio')
|
||||||
libfreedreno_drm_files += libfreedreno_drm_virtio_files
|
libfreedreno_drm_files += libfreedreno_drm_virtio_files
|
||||||
libfreedreno_drm_flags += '-DHAVE_FREEDRENO_VIRTIO'
|
libfreedreno_drm_flags += '-DHAVE_FREEDRENO_VIRTIO'
|
||||||
libfreedreno_drm_includes += inc_virtio_gpu
|
libfreedreno_drm_includes += inc_virtio_gpu
|
||||||
|
@@ -67,12 +67,18 @@ if with_xlib_lease
|
|||||||
tu_deps += [dep_xlib_xrandr]
|
tu_deps += [dep_xlib_xrandr]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if with_freedreno_kgsl
|
if not system_has_kms_drm
|
||||||
tu_flags += '-DTU_USE_KGSL'
|
# Even if libdrm is available we shouldn't use it in KGSL-only build
|
||||||
# Even if libdrm is available we shouldn't use it in KGSL build
|
|
||||||
tu_flags += '-UHAVE_LIBDRM'
|
tu_flags += '-UHAVE_LIBDRM'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if freedreno_kmds.contains('kgsl')
|
||||||
|
tu_flags += '-DTU_HAS_KGSL'
|
||||||
libtu_files += files('tu_knl_kgsl.c')
|
libtu_files += files('tu_knl_kgsl.c')
|
||||||
else
|
endif
|
||||||
|
|
||||||
|
if freedreno_kmds.contains('msm')
|
||||||
|
tu_flags += '-DTU_HAS_MSM'
|
||||||
libtu_files += files('tu_knl_drm_msm.c')
|
libtu_files += files('tu_knl_drm_msm.c')
|
||||||
tu_deps += dep_libdrm
|
tu_deps += dep_libdrm
|
||||||
endif
|
endif
|
||||||
|
@@ -119,7 +119,7 @@ tu_queue_submit(struct vk_queue *vk_queue, struct vk_queue_submit *submit)
|
|||||||
VkResult
|
VkResult
|
||||||
tu_enumerate_devices(struct vk_instance *vk_instance)
|
tu_enumerate_devices(struct vk_instance *vk_instance)
|
||||||
{
|
{
|
||||||
#ifdef TU_USE_KGSL
|
#ifdef TU_HAS_KGSL
|
||||||
struct tu_instance *instance =
|
struct tu_instance *instance =
|
||||||
container_of(vk_instance, struct tu_instance, vk);
|
container_of(vk_instance, struct tu_instance, vk);
|
||||||
|
|
||||||
@@ -168,7 +168,6 @@ tu_physical_device_try_create(struct vk_instance *vk_instance,
|
|||||||
|
|
||||||
const char *primary_path = drm_device->nodes[DRM_NODE_PRIMARY];
|
const char *primary_path = drm_device->nodes[DRM_NODE_PRIMARY];
|
||||||
const char *path = drm_device->nodes[DRM_NODE_RENDER];
|
const char *path = drm_device->nodes[DRM_NODE_RENDER];
|
||||||
VkResult result = VK_SUCCESS;
|
|
||||||
drmVersionPtr version;
|
drmVersionPtr version;
|
||||||
int fd;
|
int fd;
|
||||||
int master_fd = -1;
|
int master_fd = -1;
|
||||||
@@ -189,8 +188,11 @@ tu_physical_device_try_create(struct vk_instance *vk_instance,
|
|||||||
|
|
||||||
struct tu_physical_device *device = NULL;
|
struct tu_physical_device *device = NULL;
|
||||||
|
|
||||||
|
VkResult result = VK_ERROR_INCOMPATIBLE_DRIVER;
|
||||||
if (strcmp(version->name, "msm") == 0) {
|
if (strcmp(version->name, "msm") == 0) {
|
||||||
|
#ifdef TU_HAS_MSM
|
||||||
result = tu_knl_drm_msm_load(instance, fd, version, &device);
|
result = tu_knl_drm_msm_load(instance, fd, version, &device);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
result = vk_startup_errorf(instance, VK_ERROR_INCOMPATIBLE_DRIVER,
|
result = vk_startup_errorf(instance, VK_ERROR_INCOMPATIBLE_DRIVER,
|
||||||
"device %s (%s) is not compatible with turnip",
|
"device %s (%s) is not compatible with turnip",
|
||||||
|
@@ -46,9 +46,7 @@ struct tu_bo {
|
|||||||
const char *name; /* pointer to device->bo_sizes's entry's name */
|
const char *name; /* pointer to device->bo_sizes's entry's name */
|
||||||
int32_t refcnt;
|
int32_t refcnt;
|
||||||
|
|
||||||
#ifndef TU_USE_KGSL
|
|
||||||
uint32_t bo_list_idx;
|
uint32_t bo_list_idx;
|
||||||
#endif
|
|
||||||
|
|
||||||
bool implicit_sync : 1;
|
bool implicit_sync : 1;
|
||||||
};
|
};
|
||||||
@@ -122,9 +120,7 @@ tu_bo_get_ref(struct tu_bo *bo)
|
|||||||
return bo;
|
return bo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TU_USE_KGSL
|
|
||||||
VkResult tu_knl_kgsl_load(struct tu_instance *instance, int fd);
|
VkResult tu_knl_kgsl_load(struct tu_instance *instance, int fd);
|
||||||
#endif
|
|
||||||
|
|
||||||
struct _drmVersion;
|
struct _drmVersion;
|
||||||
VkResult tu_knl_drm_msm_load(struct tu_instance *instance,
|
VkResult tu_knl_drm_msm_load(struct tu_instance *instance,
|
||||||
|
@@ -110,7 +110,7 @@ foreach d : [[with_gallium_kmsro, [
|
|||||||
[with_gallium_r600, 'r600_dri.so'],
|
[with_gallium_r600, 'r600_dri.so'],
|
||||||
[with_gallium_svga, 'vmwgfx_dri.so'],
|
[with_gallium_svga, 'vmwgfx_dri.so'],
|
||||||
[with_gallium_virgl or
|
[with_gallium_virgl or
|
||||||
(with_gallium_freedreno and with_freedreno_virtio),
|
(with_gallium_freedreno and freedreno_kmds.contains('virtio')),
|
||||||
'virtio_gpu_dri.so'],
|
'virtio_gpu_dri.so'],
|
||||||
[with_gallium_lima, 'lima_dri.so'],
|
[with_gallium_lima, 'lima_dri.so'],
|
||||||
[with_gallium_zink, 'zink_dri.so'],
|
[with_gallium_zink, 'zink_dri.so'],
|
||||||
|
Reference in New Issue
Block a user