-
Notifications
You must be signed in to change notification settings - Fork 142
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
[Feature Request] Vulkan support in Bumblebee/Primus #769
Comments
Yes, that’s expected. We don’t support Vulkan at all currently, and it’s probably not going to happen any time soon. I’m wondering what’s the status of PRIME on this thought. Is there any native Linux Vulkan demo thing that reports the used card for me to test that? |
This is a shame, because for what I have seen PRIME is a technology than its meant mainly for ubuntu-based distros, and I guess than I could modify the Xorg.conf to only use the nvidia card, but on a laptop I also want to use the intel card. |
I think you’re confused about PRIME. What you cite is Nvidia reverse PRIME. But PRIME is way more than that (take a look at default PRIME function: https://wiki.archlinux.org/index.php/PRIME#PRIME_GPU_offloading). However, after sleeping a bit, I found the answer by myself: Vulkan won’t work with PRIME currently, at least because they are no Vulkan driver in Mesa at all (and the only one that is coming for sure is Intel, which AFAIU we don’t need here). Nevertheless, it might work in reverse PRIME indeed. But that’s not ideal, granted. For our purpose, it would take someone adding Vulkan support in Primus just like OpenGL is supported right now. I’m not sure anyone having this capacity is willing to spend time on this, especially given that in the individuals around this project I count at most 2 that could: @karolherbst, but he is busy developing nouveau — which is a far greater priority — and has already stated that he won’t maintain Primus ; a discussion that happened because the other one people I think of, @amonakov, actual Primus dev and maintainer, is almost MIA. So, I’m sorry about this (not just for you, I would love to see that too), but unless you manage to find someone who can and want to implement this, nothing is going to happen here. |
@ArchangeGabriel there is an intal vulkan driver already, but I thought that offloading on other GPUs is already builtin into vulkan? Well, if not, then they always forget the important bits |
I know about the Intel driver (first parenthesis in my previous message), but I thought that like in OpenGL case, we don’t care about the Intel part, only Nvidia side. However, you might well be right about offloading, I remember having read something about this and the ability to use very heterogeneous setups in terms of graphic cards. Which probably requires Vulkan on both sides. So, in the end, if that’s right, maybe we could do something in Bumblebee for Vulkan support (it probably comes down to the --no-xorg option in fact, ensuring driver loading and paths setting, or a modification of it to take Vulkan into account). |
Something else to keep an eye on is libglvnd: https://github.com/NVIDIA/libglvnd |
Some quick experiments when running
So it seems that Nvidia's vulkan driver only works if |
@Amanieu that is most likely the case because nvidia isn't loaded and the GPU is off. What is the output of optirun -b none vulkaninfo? |
@Amanieu @karolherbst Maybe something like this perhaps? Intel HD 4000 , Nvidia GT 730M, Driver ver. 364.19, Antergos optirun -b none vulkaninfo DISPLAY=:8 optirun -b none vulkaninfo |
While running vulkaninfo, I’ve got:
And I’ve attached the output of:
|
odd that the nvidia GPU isn't found in the case without DISPLAY. |
Would that be a bug in the Nvidia driver that Vulkan doesn't work with Optimus laptops? I've tried to contact Nvidia about it, but they didn't reply. |
I think so. |
mesa 12.0 now has glvnd support, hope it solves some problems |
This seems to be a step forward fixing this |
I just tried it with
vulkaninfo crashes on my system with DISPLAY=:8 set. |
Bumblebee development is totally dead? Any way to run Vulkan with it? |
no way to run vulkan with bumblebee as now, @edoantonioco comment is interesting |
I feel like there is some misunderstanding here. If you have nvidia's recent stable driver 378.13, you can run Vulkan without X running perfectly fine with bumblebee. Assuming our main display environment is
In fact, it doesn't matter if you change the environment Either we do screen scaping, which has many drawbacks, or we continue with extension forking. VirtualGL chose to do GLX forking for OpenGL. Primus is essentially the same thing without the overhead requirements for multiple users. However, even primus now doesn't support all OpenGL functions, like the issued glXAllocateMemoryNV and glXFreeMemoryNV. We basically need a VirtualVulkan to do VulkanX forking and/or a low-client overhead equivalent. Writing all of Vulkan's extensions, with the API still changing and growing, would be very tedious and annoying. |
Wasn't GLVND supposed to be an important step toward fixing this sort of thing? And doesn't Vulkan have that kind of functionality just built right in? Where does GLVND fit in, in the scope of what bumblebee and optirun are meant to do? What does it not do that needs to be done? |
As far as I understand it, libglvnd only arbitrates between multiple drivers/vendors in a way that allows each driver to ship its own OpenGL library without overwriting the main system libGL file. With the removal of libglx symlinks in xorg-server and libglvnd support in mesa, you can install mesa along with nvidia whereas before you would have to remove mesa-libgl for nvidia-libgl and vice-versa. It would allow mesa to call from This doesn't change the state of render offloading. Vulkan does not have this functionality built-in as it does not arbitrate its own API calls to X. As of now, it looks like libglvnd currently only supports OpenGL API calls and not Vulkan. As to where libglvnd fits in bumblebee... it doesn't? I don't see any updates on bumblebee-devel regarding it so GLX forking seems unchanged. Maybe VirtualGL added updates for it, but I doubt it. Absolutely no updates for primus. |
@monotykamary Some (Arch Linux at least) is patching Bumblebee with #845 for libglvnd support |
@Lekensteyn As I mentioned on IRC, that sounds good to me. Do you want to do it, or shall I? |
@Thulinma Go for it! |
@Thulinma Sorry for the stupid question, but will this work on wayland as well? |
@Thulinma I have tried your solution out of curiosity on Rise of the Tomb Raider. The launcher detects the vulkank drivers but the game isn't actually able to start correctly. One more step towards victory :) |
I had some interest in xpra in the past as I was interested in potentially adding scaling filters to 2D games that don't have any but would benefit from them, like Freedom Planet and Momodora. It was brought up on /r/linux as a way to scale applications on HiDPI. But someone mentioned there that input lag is present--or rather, discrepancy between an input is received and when its result is displayed--and that immediately disqualified it for me as a possibility for anything. Any amount of input lag will cause issues for many gamers and for some will make it entirely unacceptable. Before forging ahead on this, can someone check the input lag situation somehow? I don't know of a precise way to test it and I'm presuming you're all fairly casual gamers. Just play a game--any game--and see if you can feel anything weird. I am competitive in fighting games; if you guys think it feels fine, I'll check it too and see if I think it feels fine. |
Just throwing my 2 cents here. I recently discovered a project on github called run_scaled, which as the name suggests allows easily running an application with a scaling factor, this being through xpra. Although I haven't done extensive testing, I was using it to run a very old game, which originally maxes out at something like 360p. Despite the negligible system requirements for the game, running it at a 2x scale factor appeared to introduce noticeable input latency. This was however through integrated Intel graphics; I hadn't bothered trying to run this through my Nvidia card. |
Any input latency at all, IMO, disqualifies xpra from being usable for this purpose. But if it's easily noticeable that's all the worse. |
@Thulinma tried your fix with xpra with simple example written in vulkano and it works fine (showed 2 different PhysicalDevice-s). Also I've attempted to run vkquake with no luck. It failed at this line, as you may guess because it cannot find discrete card (only integrated one). I hope that information could help you |
I asked on DXVK discord server a few weeks ago it would be possible to just use the dGPU in Vulkan directly, and since Vulkan supports multigpu, it should be possible to render on the dGPU and then output on iGPU. Now, don't ask me the details of how and why, since I know nothing about Vulkan. But I think this direction could be better then copying images after the fact. Here is the convo:
So yeah, it would be better if nvidia finally get offload capability, but for Vulkan it might already be possible to do something similar. |
Oh, and good news: I also asked on nvidia linux dev forum, and Aaron Plattner responded that they are working on it, I have asked for a rough estimate on when it would be available (Doubt he can answer, but hopefully something vague): |
After updating my system xpra solution does not work anymore. |
Hey, Proton was just released by Valve and it can run windows games in steam through DXVK which relies on Vulkan, since it is not a good solution to game on an integrated gpu, I hope more devs are going to make it a real thing. |
I have implemented a draft version of something like Primus for Vulkan: https://github.com/felixdoerre/primus_vk |
Hi felixdoerre! I'm trying to test your code in ArchLinux. I did these changes in these files:
Well, next I'm tryed to test with dolphin emulator launching with this:
Now I can change in graphic configuration OpenGL to Vulkan and shows in configuration my GeForce 840M, wow! But when I'm going to test a game dolphin crash with core dump. In dmesg I see this errors:
Any advice or is too soon to try launch a game with your Vulkan layer? Thanks!!! |
Good news! @felixdoerre code really works!! Now we can use Vulkan in our laptops with Bumblebee/Primus. 🥇 |
It doesn't work with The Talos Principle. When I switch to the Vulkan API, I have (but yes, it does work with Dolphin-emu!) Edit: Well, the Nvidia driver has been updated (410.57) and now it works with The Talos Principle! 🎉 |
I tried the xpra solution with a recent game (Frostpunk). It works but the performances are very poor. I can not even see my mouse cursor. |
@Nautigsam have you tried primus_vk? It is a Primus like implementation but for Vulkan. It actually works well using in combination with proton |
@PierfrancescoArdino Nope, the game won't launch. I get the same kind of error: |
@felixdoerre Your primus_vk solution looks more promising than the xpra solution, nicely done! It might be worth shipping this with Bumblebee and trying to streamline the setup somewhat to be more user friendly. @Lekensteyn Do you have any thoughts on (or time for) this? I'd be happy to work on it, but as my sporadic replies to this issue have indicated, my time is quite limited these days 🙁. So somebody else might get it done faster than me. But if nobody else picks this up, I will take a look at it as soon as I have a free moment. |
@felixdoerre Thanks for your work! This seems to be working OOTB, which is nice. I hope to get some available free time soon, and maybe then we could release Bumblebee 4.0 and advertise this nice addition. Is there any downside in setting the env var all the time, including for OpenGL apps? If not then maybe pvkrun could become the default loader (Bumblebee 4.0 was to replace virtualgl by primus as the default bridge, but maybe we can go further). Though |
@ArchangeGabriel Thank you very much for pushing this forward. aI don't see any downside in always setting the env-var to enable the primus-vk layer. For pure OpenGL apps this shouldn't change anything, as the variable is evaluated by the vulkan loader which such a purge OpenGL application should not load. |
Great, so we could default to “pvkrun” instead. Still need to see how/if replacing the underlying logic of optirun with primusrun/pvkrun is doable. |
Hello, I have tried with windows vulkan demos (on wine staging), the talos principle (which on the logs says than it use the intel card even if I use primusrun, only when trying to run it with the vulkan renderer), and the vulkan caps viewer (which can only sees the intel gpu even if I use primusrun), and it does not work, because when I try "primusrun randomVulkanApp' (for example), it never use the nvidia card, it uses the intel card.
My hardware is intel haswell, nvidia 960m, driver 364.19, Manjaro
The text was updated successfully, but these errors were encountered: