wayfire icon indicating copy to clipboard operation
wayfire copied to clipboard

Re-request: Vulkan support

Open orowith2os opened this issue 2 years ago • 16 comments

Wayfire currently uses wlroots as the compositor library, which has a Vulkan renderer built in. This could give some benefits, such as more efficiency since Vulkan allows more fine-tuned control over rendering. Gamescope, for example, uses it by default and falls back to the default renderer when Vulkan isn't available.

There was a related issue over at https://github.com/WayfireWM/wayfire/issues/109, though it's a bit messy and hard to understand for me, so I want to make this issue to track everything Wayfire would need to support Vulkan.

There are of course the core wlroots issues, which IIRC is not being able to screenshare yet (so screenshots are broken. I'll try and find some sources for this sometime in the future).

orowith2os avatar Jan 01 '23 19:01 orowith2os

What would be a real life benefit of using Vulkan though?

Would it actually solve some of the current issues wayfire experiences? (E.g. desktop stuttering on heavy cpu load?)

Nuc1eoN avatar Jan 05 '23 11:01 Nuc1eoN

Ideally it would, but that depends on how it's implemented. Vulkan allows for decent multithreading, so I imagine it would help for CPU load issues.

It can also help free up system resources since you have finer control over the memory.

orowith2os avatar Jan 05 '23 11:01 orowith2os

I was not aware wayfire is currently bottlenecked by opengl. In that case obviously I support the notion of adapting Vulkan.

Nuc1eoN avatar Jan 05 '23 11:01 Nuc1eoN

I was not aware wayfire is currently bottlenecked by opengl. In that case obviously I support the notion of adapting Vulkan.

I have not yet seen data to suggest this.

ammen99 avatar Jan 05 '23 11:01 ammen99

@Nuc1eoN Again, that depends on how it's implemented. If wayfire adds Vulkan support it could help, but it could also not. For example, with Unreal Engine, its Vulkan renderer performs worse than DirectX simply because of how its implemented.

orowith2os avatar Jan 05 '23 11:01 orowith2os

Vulkan is generally said to lower CPU overhead, yes, but lowering CPU overhead is important when the program is CPU-bound to begin with. I highly doubt that the bottleneck here is issuing commands to the GPU. We usually draw simple textured quads, and I'd expect at most 20-30 draw commands per frame. How much will vulkan help here?

If you guys are interested in Vulkan, I'd suggest first running some meaningful benchmarks with Sway. Sway supports both GLES and Vulkan, so you can see whether the rendering API makes that much of a difference there. I'd expect not, but I'd stand corrected if I'm wrong.

ammen99 avatar Jan 05 '23 11:01 ammen99

(E.g. desktop stuttering on heavy cpu load?)

If the system is under high CPU load, the compositor may lag, no matter which renderer is in use. Have you tried increasing Wayfire's priority?

ammen99 avatar Jan 05 '23 12:01 ammen99

Testing with Sway might not be the best, since it doesn't do as many effects as Wayfire does. That being said, I'm not sure of how else to test. When Sway has their Vulkan screensharing issue fixed I'll look into doing tests.

I have high hopes for a Vulkan renderer in Wayfire, especially for lower power devices that can utilize Vulkan. When I get some other stuff sorted out I might be able to look into this.

orowith2os avatar Jan 05 '23 12:01 orowith2os

It was my understanding, that Vulkan was made for games and was never supposed to actually replace OpenGL in all scenarios. Thus personally I would highly sceptical of any real-life benefits for wayfire.

But if such benefits can be proven for real workloads, then obviously such move can be justified. I just think that wayfire has a limited dev time and it should be put where users will actually feel a difference. There's a lot on the to-do list.

@orowith2os which low-power devices specifically do you have in mind?

If the system is under high CPU load, the compositor may lag, no matter which renderer is in use. Have you tried increasing Wayfire's priority?

Yes, and to no avail.. The system lags beyond being practically usable while conpiling heavy stuff. I should probably open a separate bug report.

Nuc1eoN avatar Jan 05 '23 12:01 Nuc1eoN

@Nuc1eoN ones such as the Raspberry Pi, phones, low power laptops. They can all benefit from finer control over how the GPU reacts, especially since they're so low power. Being able to say how the GPU should act can take a lot of work off of the CPU/GPU.

Whether or not those devices actually support Vulkan is a different topic, but I know most low power laptops do, and the RPi4 has v3dv.

orowith2os avatar Jan 05 '23 12:01 orowith2os

it could better support the upcoming powervr (pvr) devices which only have vk drivers upstream and rely on zink for ogl. Im not sure of any consumer devices with it currently but some should be coming fairly soon IIRC.

Quackdoc avatar Jan 06 '23 08:01 Quackdoc