turnip: Don't link the WSI code if we don't have a WSI extension.

I don't like the TU_HAS_SURFACE duplication, but this is a step to having
a non-libdrm-dependent turnip on Android with KGSL (which doesn't have
drm for rendering).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6821>
This commit is contained in:
Eric Anholt
2020-09-18 14:36:36 -07:00
committed by Marge Bot
parent 8f3313fb47
commit f63ce9bbe0
2 changed files with 22 additions and 2 deletions
+12 -2
View File
@@ -59,12 +59,14 @@ libtu_files = files(
'tu_shader.c',
'tu_util.c',
'tu_util.h',
'tu_wsi.c',
'vk_format.h',
)
tu_deps = []
tu_flags = []
tu_link_with = []
tu_wsi = false
if with_platform_x11
tu_deps += dep_xcb_dri3
@@ -73,17 +75,25 @@ if with_platform_x11
'-DVK_USE_PLATFORM_XLIB_KHR',
]
libtu_files += files('tu_wsi_x11.c')
tu_wsi = true
endif
if with_platform_wayland
tu_deps += dep_wayland_client
tu_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
libtu_files += files('tu_wsi_wayland.c')
tu_wsi = true
endif
if system_has_kms_drm and not with_platform_android
tu_flags += '-DVK_USE_PLATFORM_DISPLAY_KHR'
libtu_files += files('tu_wsi_display.c')
tu_wsi = true
endif
if tu_wsi
libtu_files += 'tu_wsi.c'
tu_link_with += libvulkan_wsi
endif
if with_platform_android
@@ -118,7 +128,7 @@ libvulkan_freedreno = shared_library(
inc_freedreno,
],
link_with : [
libvulkan_wsi,
tu_link_with,
libfreedreno_ir3,
libfreedreno_layout,
],
+10
View File
@@ -44,6 +44,12 @@
/* for fd_get_driver/device_uuid() */
#include "freedreno/common/freedreno_uuid.h"
#define TU_HAS_SURFACE \
(VK_USE_PLATFORM_WAYLAND_KHR || \
VK_USE_PLATFORM_XCB_KHR || \
VK_USE_PLATFORM_XLIB_KHR || \
VK_USE_PLATFORM_DISPLAY_KHR)
static int
tu_device_get_cache_uuid(uint16_t family, void *uuid)
{
@@ -124,11 +130,13 @@ tu_physical_device_init(struct tu_physical_device *device,
tu_physical_device_get_supported_extensions(device, &device->supported_extensions);
#if TU_HAS_SURFACE
result = tu_wsi_init(device);
if (result != VK_SUCCESS) {
vk_startup_errorf(instance, result, "WSI init failure");
goto fail;
}
#endif
return VK_SUCCESS;
@@ -142,7 +150,9 @@ fail:
static void
tu_physical_device_finish(struct tu_physical_device *device)
{
#if TU_HAS_SURFACE
tu_wsi_finish(device);
#endif
disk_cache_destroy(device->disk_cache);
close(device->local_fd);