-
Notifications
You must be signed in to change notification settings - Fork 637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix support for --headless. #1090
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This crashes for me when trying to start any sample in headless mode.
The crash happens in getSurfaceSupportKHR
in the vulkan hpp header and is coming from get_suitable_gpu
in hpp_instance.cpp
.
Callstack:
It works fine without headless.
System is Windows 11 with an NV RTX 4070 and recent Vulkan drivers. The K_EXT_headless_surface
extension is supported.
I also have a switfshader ICD installed to test features not supported by my GPU, but the crash happens when calling getSurfaceSupportKHR
for my discrete RTX 4070.
Change tested on:
I have tested 3 different setups, 1. Display connected+GDM3 started, 2. Display connected+GDM3 shutdown and 3. Display disconnected.
A bit of investigation led me to a failure in the wsi-layer where the usage of vkImportSemaphoreFdKHR when found available fails, leading to the error we see above.
|
My current setup is using Swiftshader https://github.com/google/swiftshader "a high-performance CPU-based implementation of the Vulka 1.3 graphics AP" the headless flag seems to work correctly in all tested examples I can reproduce SaschaWillems crash. Needs more investigation, but seems to be valid use of the API, and only reproducible if you enable ICDs for Nvidia and SwiftShader. As a workaround you can avoid the crash explicitily selecting the valid GPU using the --gpu flag |
f73c125
to
f403630
Compare
Change the name of the flag and add some comments to better explain it. |
7617d5c
to
68fe8fa
Compare
68fe8fa
to
e477c24
Compare
Looks like this triggers a CI failure due to copyright headers not being up-to-date. Can you fix that? |
Now --headless will create a swap_chain and a surface, now the feature will work correctly. Remove headless parameter from Instance::Instance and VulkanSample<>::create_instance. VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME added in HeadlessWindow::get_required_surface_extensions like other window types Added an assert if headless is enabled to hello_triangle and hpp_hello_triangle
Use offscreen when speaking about no swapchain Add warning when using headless on multiple GPUs
e477c24
to
b796f91
Compare
I did not modified those files, so unsure what trigered the copyright failure. I just rebased against main, hopefully that fixes the issue |
I think I said I was going to test this at the last meeting, but it turns out that we don't actually support VK_EXT_headless_surface, so I 'm afraid I can't. |
It seems to work when explicitly selecting swiftshader. I don't see any visual output, which I guess is expected. But I'm still getting a crash when not explicitly selecting swiftshader. I do get the warning first that tells me to explicitly select a gpu, but if wont' do that, I get the same error as above. Is there no way to avoid running with that flag on GPUs that don't have support for it? Or at least catch that error and exit gracefully. For me it's stuck in an endless loop of exceptions. |
And does this really fix #314? |
If we have multiple GPUs, the correct way to check which one supports headless is by calling I tried to catch and handle this crash more gratefully, but the crash is in the driver, so exceptions did not work, and I did not found a correct way to detect it from application side. The alternative is to exit after printing the warning, and forcing user to manually select GPU.
Not sure. It mentions Now that I read the problem more carefully, I am confused. So the crash is fixed, but we still have the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As noted in the last call this PR looks great and fixes the initial problem. As for getting "real" headless support into the framework (samples that don't need any visual output at all) that's something we should do with a separate PR.
Description
The main objective of this PR is to fix the
--headless
flag. Currently it does not work in the framework, due to not requesting a surface and swap chain.This PR reworks
HeadlessWindow
to make it more similar to the other window classes. This will allow us to enableVK_EXT_headless_surface
inHeadlessWindow::get_required_surface_extensions
like the other windows types. Now we can remove theheadless
paramater fromInstance::Instance
andVulkanSample<>::create_instance
simplifying the framework.To keep the samples
hello_world
andhpp_hello_world
as simple as possible, I did not add support for headless. Instead, an assert is run to ensure the are not enabling with headless in those samples.General Checklist:
Please ensure the following points are checked:
Note: The Samples CI runs a number of checks including:
If this PR contains framework changes:
batch
command line argument to make sure all samples still work properlyFixes #830
Fixes #314