Module: Mesa Branch: master Commit: f63ce9bbe0c7c0157dd4ef22acfe9f412a8ec0b2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f63ce9bbe0c7c0157dd4ef22acfe9f412a8ec0b2
Author: Eric Anholt <[email protected]> Date: Fri Sep 18 14:36:36 2020 -0700 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> --- src/freedreno/vulkan/meson.build | 14 ++++++++++++-- src/freedreno/vulkan/tu_device.c | 10 ++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/freedreno/vulkan/meson.build b/src/freedreno/vulkan/meson.build index 2dbcfd85c06..6d97698f41a 100644 --- a/src/freedreno/vulkan/meson.build +++ b/src/freedreno/vulkan/meson.build @@ -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, ], diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c index 4bb4d52e702..a94e3910d55 100644 --- a/src/freedreno/vulkan/tu_device.c +++ b/src/freedreno/vulkan/tu_device.c @@ -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); _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
