Skip to content
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

video/out/gpu/context: prefer vulkan over opengl when reasonable #15095

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Dudemanguy
Copy link
Member

For most actual desktop users, vulkan should be the a superior experience over opengl as this point and our autoprobe should pick that. For linux users, vulkan on wayland is rapidly seeing improvements and is far ahead of egl. There is no sign of that changing anytime soon and working fifo is on the horizon, so really wayland users should just all be using vulkan from now on. For x11, there is not a big difference between using egl vs vulkan as far as I know and both work well. macOS already prefers the vulkan backend over the libmpv one anyways, and finally windows still defaults to d3d11. Probably virtually no one uses opengl on windows, but vulkan is reasonably common among windows users and it doesn't make any sense to prefer opengl over it.

The two outliers here are Android and VK_KHR_display. On Android, vulkan drivers are probably just a total disaster and let's not put ourselves in that mess if there's no reason to. For VK_KHR_display, it actually works fine except for one really big problem: VT switching doesn't work. If you try it, enjoy losing all input and being forced to do a hard reboot. It might be fixable if you use logind or something, but the method of using signals like the drm context does won't work because VK_KHR_display uses render nodes not primary nodes. Also, the opengl drm context could support hdr in theory (some attempts were made but none succesful) so it is probably "better". Maybe. Anyways, for these two platforms, we still prefer opengl.

Something similar was done in #13620. But I don't believe this needs to wait until a consensus is formed around preferring vo_gpu_next.

For most actual desktop users, vulkan should be the a superior
experience over opengl as this point and our autoprobe should pick that.
For linux users, vulkan on wayland is rapidly seeing improvements and is
far ahead of egl. There is no sign of that changing anytime soon and
working fifo is on the horizon, so really wayland users should just all
be using vulkan from now on. For x11, there is not a big difference
between using egl vs vulkan as far as I know and both work well. macOS
already prefers the vulkan backend over the libmpv one anyways, and
finally windows still defaults to d3d11. Probably virtually no one uses
opengl on windows, but vulkan is reasonably common among windows users
and it doesn't make any sense to prefer opengl over it.

The two outliers here are Android and VK_KHR_display. On Android, vulkan
drivers are probably just a total disaster and let's not put ourselves
in that mess if there's no reason to. For VK_KHR_display, it actually
works fine except for one really big problem: VT switching doesn't work.
If you try it, enjoy losing all input and being forced to do a hard
reboot. It might be fixable if you use logind or something, but the
method of using signals like the drm context does won't work because
VK_KHR_display uses render nodes not primary nodes. Also, the opengl drm
context could support hdr in theory (some attempts were made but none
succesful) so it is probably "better". Maybe. Anyways, for these two
platforms, we still prefer opengl.
Copy link

Download the artifacts for this pull request:

Windows
macOS

@guidocella
Copy link
Contributor

Isn't --vo=gpu --gpu-api=vulkan basically libplacebo? Won't #11499 (comment) occur?

@llyyr
Copy link
Contributor

llyyr commented Oct 15, 2024

Isn't --vo=gpu --gpu-api=vulkan basically libplacebo? Won't #11499 (comment) occur?

I haven't heard any of the issues be reproduced with vo_gpu, since the libplacebo issues appear to mostly be related to compute shaders and not the graphics API.

@llyyr
Copy link
Contributor

llyyr commented Oct 15, 2024

Something similar was done in #13620. But I don't believe this needs to wait until a consensus is formed around preferring vo_gpu_next.

Keep in mind that vo_gpu + vulkan is the worst combination of vo/API as far as power efficiency goes. I documented some here #9551 (comment) but basically for the same settings vo_gpu + vulkan may use up 30-40W more than vo_gpu + opengl or vo_gpu_next + vulkan might.

@Dudemanguy
Copy link
Member Author

That is fair and a point for vo_gpu_next, but luckily for us we don't really aim for the lowest possible power efficiency out of the box. You'd have to enable hwdec anyways, so possibly changing the default vo to vo_gpu_next or vo_dmabuf_wayland is fine. People probably do that today anyways. We keep getting hit by opengl bugs on nvidia like apparently #15099 and I'd rather people need to flip some settings to save power as opposed to OOM'ing out of the box.

Copy link
Contributor

@kasper93 kasper93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think reasoning makes sense. It may increase initialization time on systems without Vulkan, but we cannot do better here really. If user care about init time, they should always set gpu-context/gpu-api/hwdec manually, to avoid probing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants