From b6b0090b501799fb98f8ca3cae1d87bd991635ed Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 9 Feb 2021 23:21:26 +0000 Subject: [PATCH] Revert "Vulkan: Fallback to XCB for Xlib surfaces" This reverts commit fb0bf70459c44b31419400598b592eaaae85f932. Reason for revert: Failing build during roll: https://chromium-review.googlesource.com/c/chromium/src/+/2686267/2 Original change's description: > Vulkan: Fallback to XCB for Xlib surfaces > > Chromium builds the Vulkan loader without support Xlib (because it > prefers XCB) which caused Xlib wgpu::SwapChain creation to fail on the > Vulkan backend. > > This CL adds a fallback to use VK_KHR_xcb_surface if VK_KHR_xlib_surface > isn't present. > > Bug: dawn:662 > Change-Id: I0e0128ee6b5c75da03998dbae231d17e48bacc81 > Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41180 > Reviewed-by: Austin Eng > Commit-Queue: Austin Eng > Auto-Submit: Corentin Wallez TBR=cwallez@chromium.org,jiawei.shao@intel.com,hao.x.li@intel.com,enga@chromium.org Change-Id: Ia8d2ffb715260b1de490ca04cc76f41bb60b1f61 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: dawn:662 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41343 Reviewed-by: Kai Ninomiya Commit-Queue: Kai Ninomiya --- src/common/vulkan_platform.h | 1 - src/common/xlib_with_undefs.h | 1 - src/dawn_native/BUILD.gn | 5 +---- src/dawn_native/CMakeLists.txt | 11 +---------- src/dawn_native/vulkan/SwapChainVk.cpp | 20 -------------------- src/dawn_native/vulkan/VulkanFunctions.cpp | 4 ---- src/dawn_native/vulkan/VulkanFunctions.h | 5 ----- 7 files changed, 2 insertions(+), 45 deletions(-) diff --git a/src/common/vulkan_platform.h b/src/common/vulkan_platform.h index 3c78243009..236c68236c 100644 --- a/src/common/vulkan_platform.h +++ b/src/common/vulkan_platform.h @@ -162,7 +162,6 @@ namespace dawn_native { namespace vulkan { #if defined(DAWN_USE_X11) # define VK_USE_PLATFORM_XLIB_KHR -# define VK_USE_PLATFORM_XCB_KHR # include "common/xlib_with_undefs.h" #endif // defined(DAWN_USE_X11) diff --git a/src/common/xlib_with_undefs.h b/src/common/xlib_with_undefs.h index 660a87a5a2..f82a19aa2d 100644 --- a/src/common/xlib_with_undefs.h +++ b/src/common/xlib_with_undefs.h @@ -24,7 +24,6 @@ // This header includes but removes all the extra defines that conflict with // identifiers in internal code. It should never be included in something that is part of the public // interface. -#include #include #undef Success diff --git a/src/dawn_native/BUILD.gn b/src/dawn_native/BUILD.gn index 398105f308..b98708c69d 100644 --- a/src/dawn_native/BUILD.gn +++ b/src/dawn_native/BUILD.gn @@ -295,10 +295,7 @@ source_set("dawn_native_sources") { ] if (dawn_use_x11) { - libs += [ - "X11", - "X11-xcb", - ] + libs += [ "X11" ] } if (is_win) { diff --git a/src/dawn_native/CMakeLists.txt b/src/dawn_native/CMakeLists.txt index 37bf90867e..8767a70b6c 100644 --- a/src/dawn_native/CMakeLists.txt +++ b/src/dawn_native/CMakeLists.txt @@ -179,17 +179,8 @@ target_link_libraries(dawn_native ) if (DAWN_USE_X11) - find_package(X11 REQUIRED OPTIONAL_COMPONENTS X11_xcb) + find_package(X11 REQUIRED) target_link_libraries(dawn_native PRIVATE ${X11_LIBRARIES}) - target_include_directories(dawn_native PRIVATE ${X11_INCLUDE_DIR}) - - if (DAWN_ENABLE_VULKAN) - if (NOT X11_X11_xcb_FOUND) - message(FATAL_ERROR "X11::X11_xcb cannot be found, maybe because cmake < 3.18. Consider filing an issue for Dawn to bundle its own FindX11_XCB script") - endif() - target_link_libraries(dawn_native PRIVATE ${X11_X11_xcb_LIB}) - target_include_directories(dawn_native PRIVATE ${X11_X11_xcb_INCLUDE_PATH}) - endif() endif() if (WIN32) diff --git a/src/dawn_native/vulkan/SwapChainVk.cpp b/src/dawn_native/vulkan/SwapChainVk.cpp index 65e7f77e2b..0398f1e758 100644 --- a/src/dawn_native/vulkan/SwapChainVk.cpp +++ b/src/dawn_native/vulkan/SwapChainVk.cpp @@ -145,26 +145,6 @@ namespace dawn_native { namespace vulkan { "CreateXlibSurface")); return vkSurface; } - - // Fall back to using XCB surfaces if the Xlib extension isn't available. - // See https://xcb.freedesktop.org/MixingCalls/ for more information about - // interoperability between Xlib and XCB - if (info.HasExt(InstanceExt::XcbSurface)) { - VkXcbSurfaceCreateInfoKHR createInfo; - createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; - createInfo.pNext = nullptr; - createInfo.flags = 0; - // The XCB connection lives as long as the X11 display. - createInfo.connection = - XGetXCBConnection(static_cast(surface->GetXDisplay())); - createInfo.window = surface->GetXWindow(); - - VkSurfaceKHR vkSurface = VK_NULL_HANDLE; - DAWN_TRY(CheckVkSuccess( - fn.CreateXcbSurfaceKHR(instance, &createInfo, nullptr, &*vkSurface), - "CreateXcbSurfaceKHR")); - return vkSurface; - } break; #endif // defined(DAWN_USE_X11) diff --git a/src/dawn_native/vulkan/VulkanFunctions.cpp b/src/dawn_native/vulkan/VulkanFunctions.cpp index 261aabe7a8..9584475a4b 100644 --- a/src/dawn_native/vulkan/VulkanFunctions.cpp +++ b/src/dawn_native/vulkan/VulkanFunctions.cpp @@ -152,10 +152,6 @@ namespace dawn_native { namespace vulkan { GET_INSTANCE_PROC(CreateXlibSurfaceKHR); GET_INSTANCE_PROC(GetPhysicalDeviceXlibPresentationSupportKHR); } - if (globalInfo.HasExt(InstanceExt::XcbSurface)) { - GET_INSTANCE_PROC(CreateXcbSurfaceKHR); - GET_INSTANCE_PROC(GetPhysicalDeviceXcbPresentationSupportKHR); - } #endif // defined(DAWN_USE_X11) return {}; } diff --git a/src/dawn_native/vulkan/VulkanFunctions.h b/src/dawn_native/vulkan/VulkanFunctions.h index 2e6218ee27..bb98b6d222 100644 --- a/src/dawn_native/vulkan/VulkanFunctions.h +++ b/src/dawn_native/vulkan/VulkanFunctions.h @@ -137,11 +137,6 @@ namespace dawn_native { namespace vulkan { PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR = nullptr; PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR GetPhysicalDeviceXlibPresentationSupportKHR = nullptr; - - // KHR_xcb_surface - PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR = nullptr; - PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR - GetPhysicalDeviceXcbPresentationSupportKHR = nullptr; #endif // defined(DAWN_USE_X11) // ---------- Device procs