[meta] Use EGL instead of GLX on X11
Categories
(Core :: Graphics: WebRender, enhancement)
Tracking
()
People
(Reporter: marco, Unassigned)
References
(Depends on 5 open bugs, Blocks 2 open bugs)
Details
(Keywords: meta, Whiteboard: [leave open])
Attachments
(9 obsolete files)
Comment 1•13 years ago
|
||
Comment 2•13 years ago
|
||
| Reporter | ||
Comment 3•13 years ago
|
||
Comment 4•13 years ago
|
||
Comment 5•13 years ago
|
||
Comment 6•13 years ago
|
||
Comment 7•13 years ago
|
||
Comment 8•13 years ago
|
||
Comment 9•13 years ago
|
||
Comment 10•12 years ago
|
||
Comment 11•12 years ago
|
||
Comment 12•12 years ago
|
||
Comment 13•12 years ago
|
||
Comment 14•12 years ago
|
||
Comment 15•12 years ago
|
||
Comment 16•12 years ago
|
||
Comment 17•12 years ago
|
||
Comment 18•12 years ago
|
||
Comment 19•12 years ago
|
||
Comment 20•12 years ago
|
||
Comment 21•12 years ago
|
||
Comment 22•12 years ago
|
||
Comment 23•12 years ago
|
||
Comment 24•12 years ago
|
||
Updated•12 years ago
|
Comment 25•12 years ago
|
||
Comment 26•12 years ago
|
||
Comment 27•12 years ago
|
||
Comment 28•12 years ago
|
||
Updated•12 years ago
|
Comment 29•12 years ago
|
||
Comment 30•12 years ago
|
||
Comment 31•12 years ago
|
||
Comment 32•12 years ago
|
||
Comment 33•12 years ago
|
||
Comment 34•12 years ago
|
||
Comment 35•12 years ago
|
||
| Reporter | ||
Updated•12 years ago
|
| Reporter | ||
Updated•12 years ago
|
Comment 36•12 years ago
|
||
Comment 37•11 years ago
|
||
Comment 38•11 years ago
|
||
Comment 39•10 years ago
|
||
Comment 40•10 years ago
|
||
Comment 41•9 years ago
|
||
Comment 42•9 years ago
|
||
Comment 43•9 years ago
|
||
| Comment hidden (admin-reviewed) |
Comment 45•8 years ago
|
||
| Reporter | ||
Comment 46•8 years ago
|
||
Comment 47•7 years ago
|
||
Comment 48•7 years ago
|
||
Comment 49•7 years ago
|
||
Comment 50•7 years ago
|
||
Comment 51•7 years ago
|
||
| Comment hidden (advocacy) |
| Comment hidden (advocacy) |
Comment 54•7 years ago
|
||
Comment 55•7 years ago
|
||
Comment 56•7 years ago
|
||
Comment 57•7 years ago
|
||
Updated•6 years ago
|
Comment 60•5 years ago
|
||
Short question concerning the flash-plugin: does it work with the EGL backend? AFAIK the plan is to support it until the end of 2020 (which also blocks us from removing the leftovers of GTK2).
Comment 61•5 years ago
|
||
(Flash is force-disabled on Wayland backend (bug 1548475). Enabling Wayland backend by default (bug 1543600) depends on Flash removal (bug 1455897) with Nightly ~84 in October.
IMHO, X11 Flash users should be forced to keep using Basic compositor (Skia) if it doesn't work with EGL, or GLX be kept alive until then (EGL by pref or env var). Skia removal depends on WebRender's software GL backend (bug 1601053).)
Comment 62•5 years ago
|
||
Skia has more dependencies than Basic Layers, so WR-SW obsoletes only Basic Layers.
Comment 63•5 years ago
|
||
As flash plugin is Gtk2 and IMHO has it's own connection to X11 display it may work with any GL backend on Firefox side. AFAIK flash plugin is tied to firefox by X11 socket (or whatever the name is - https://developer.gnome.org/gtk2/stable/GtkPlug.html) and does not interact by Firefox directly (and it's also sandboxed).
Comment 64•5 years ago
|
||
With bug 1474281 done I'm tinkering with this now, mainly so we can have clean unified Webrender partial damage using EGL_KHR_swap_buffers_with_damage and potentially EGL_EXT_buffer_age (bug 1620076).
Jeff, how would you prefer this to work? Choosing via build time option, env variable or about:config option (or even remove GLX altogether)? I guess env variable would be the most pleasant option for the moment?
Comment 65•5 years ago
•
|
||
IMHO the huge advantage of an env var is that it can apply to all profiles at once which makes testing easier. Wayland testing already works good this way. Something like PR_GetEnv("MOZ_USE_EGL") could be used for testing. Then, when it's getting enabled by default it should be inverted to MOZ_USE_GLX. (Or something like MOZ_GL=EGL, I don't know.)
Comment 66•5 years ago
|
||
What's missing here? It'd be nice to start testing firefox with EGL on X11 aswell. Environment variable sounds good to me, for the time being.
Comment 67•5 years ago
|
||
(In reply to pasik from comment #66)
What's missing here? It'd be nice to start testing firefox with EGL on X11 aswell. Environment variable sounds good to me, for the time being.
I've been playing with it and it's easy to get working for webgl, but I haven't got it working for WR or gl layers yet. There seem to be a bunch of implicit assumptions and checks all over the place and I don't have that much time to spent on FF. So feel free to jump in @ anyone. I hope to get something working soon, but there will likely be quite a bit of cleanup necessary if I see things right :/
Updated•5 years ago
|
Comment 68•5 years ago
|
||
(In reply to Robert Mader [:rmader] from comment #67)
(In reply to pasik from comment #66)
What's missing here? It'd be nice to start testing firefox with EGL on X11 aswell. Environment variable sounds good to me, for the time being.
I've been playing with it and it's easy to get working for webgl, but I haven't got it working for WR or gl layers yet. There seem to be a bunch of implicit assumptions and checks all over the place and I don't have that much time to spent on FF. So feel free to jump in @ anyone. I hope to get something working soon, but there will likely be quite a bit of cleanup necessary if I see things right :/
Ok. Are your initial/wip patches available somewhere, as a starting point for others? Thanks!
Comment 69•5 years ago
|
||
Comment 70•5 years ago
|
||
(In reply to pasik from comment #68)
Ok. Are your initial/wip patches available somewhere, as a starting point for others? Thanks!
The above patch includes the clean part and can hopefully help people get going. I've got plenty more try/error/debug stuff but that's probably not very helpful atm.
Comment 71•5 years ago
|
||
Ehrm.. Maybe I'm missing something, but shouldn't that UseGLX also check for EGL availability to begin with?
I can think to nvidia 304 cards as not supporting it (and maybe also 340 ones, but I'm not sure), despite working pretty nicely with firefox.
Comment 72•5 years ago
•
|
||
Mesa/Nouveau works fine. EGL with proprietary Nvidia is available since 331.13 BETA from 4 October 2013.
There is a proprietary legacy EGL package (https://packages.debian.org/en/stable/libegl1-nvidia-legacy-340xx), it supports 11 year old Nvidia cards (https://packages.debian.org/en/stable/nvidia-legacy-340xx-driver).
There shouldn't be any fallback to GLX. GLX support should be removed at some point. Currently, everyone uses software rendering by default. It wouldn't be a regression if, in addition, old or broken drivers had to be blocked. Don't forget that WebRender anyway needs OpenGL 3.2, otherwise Firefox has to use software rendering with Skia (and later bug 1601053).
Comment 73•5 years ago
|
||
Mesa/Nouveau may even work fine, but it's not a mystery that DRM/nouveau is a complete disaster.
And the thing with 340 is that even if 334.16 was the first 64-bit EGL.. That was still GLES-only, and other improvements were in-between (which could or could not be needed, this is what I was wondering).
Comment 74•5 years ago
•
|
||
(In reply to mirh from comment #73)
Mesa/Nouveau may even work fine, but it's not a mystery that DRM/nouveau is a complete disaster.
X11 would just share the Wayland codepath. So far I haven't tested DMABUF WebGL and DMABUF VAAPI with Nouveau (disaster?) and proprietary Nvidia (likely not working at all?). If DMABUF is enabled, but not supported, the regular WebGL code path is used. One can only hope that Nvidia improves their open-source driver.
improvements were in-between (which could or could not be needed, this is what I was wondering).
Thanks! It sounds the current 257.21 baseline should be increased to at least 343.13 (only relevant for WebGL).
There is another more recent legacy driver: libegl1-nvidia-legacy-390xx.
Comment 75•5 years ago
|
||
Site note while working on it: theres still no equivalent to GLX_MESA_query_renderer` to get vendor and device IDs. I opened an issue for it here: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2976
Atm we use GLX even on Wayland if available, in order to e.g. whitelist devices for Webrender rollout. On Gnome Shell the Xwayland on demand feature is getting closer to get enabled by default - so we'd need to start up Xwayland together with FF just to query those two IDs :(
| Comment hidden (offtopic) |
| Comment hidden (offtopic) |
| Comment hidden (offtopic) |
Comment 79•5 years ago
|
||
- prefere GL on EGL and use GLES only as fallback
- preparations to avoid using GLX
- some random cleanups
| Comment hidden (offtopic) |
Comment 81•5 years ago
|
||
(In reply to Robert Mader [:rmader] from comment #80)
Apart from that: thanks for stepping up trying to implement DMABUF sharing on X11, Rinat!
Sorry, I'm not working on DMABUF sharing. That cannot be even started until your work on EGL is finished.
The working prototype I have, is using X11 Pixmaps to share images between processes, since most of the required functionality is already in the code.
Can we please keep this bug about the effort to use EGL on X11? DMABUF related discussions can go to bug 1619523.
I was saying that despite EGL is hopefully available with NVIDIA's proprietary drivers, hard-switching to EGL will degrade WebGL performance significantly there because images will be shared through reading textures back to the CPU memory.
Please consider keeping GLX as a fallback.
Sorry for the noise, I'll stop.
Comment 82•5 years ago
|
||
(In reply to Rinat from comment #81)
I was saying that despite EGL is hopefully available with NVIDIA's proprietary drivers, hard-switching to EGL will degrade WebGL performance significantly there because images will be shared through reading textures back to the CPU memory.
Please consider keeping GLX as a fallback.Sorry for the noise, I'll stop.
This is perfectly on topic. Some notes on this:
- I'm not quite following why switching to EGL would degrade performance - using pixmaps for sharing would still work, right? Further more, we currently don't even use it by default because of bug 1193015 - a NVidia driver specific bug - and if I read it right it might even work better with EGL. Could you elaborate on this?
- the main reason why I would like to use EGL is to make it easy to enable partial damage with Webrender, which in many scenarios can be a major performance improvement. So the GLX implementation will much less efficient in many common scenarios (see 1 for context) or require it's own partial damage implementation - the later potentially being a lot of work. Assuming that the later does not happen and EGL can't provide something that GLX does, we'd end up with an optional feature which at best is a trade-off.
- removing GLX support as far out of scope if this bug - getting EGL support to work is certainly the first step, with everything else requiring further evaluation and investigation - thanks for raising concerns in that regard.
Comment 83•5 years ago
|
||
using pixmaps for sharing would still work
You are right. I confused EGL with DMABUF for some reason. This bug was mentioned in the context of DMABUF discussion, so maybe that's why.
X11 Pixmap sharing should work as long as processes can interact with such pixmaps. EGL transition was also mentioned in the context of reducing number of X11 connections, since it should be possible to get EGL context from DRM connection, for example. And if there are no X11 connections in a process, no X11 Pixmap operations are available.
As far as I know, GLX Pixmaps and X11 Pixmap are not the same thing. I don't remember if I ever tried GLX Pixmap sharing. So, I'm not sure about this either.
Comment 84•5 years ago
|
||
So can we conclude the plan forward is to add an option (env var) which allows choosing X11 with EGL (instead of the default GLX), so that it's possible to start testing the EGL bits with X11, and more code paths and features can be common/shared between X11 and Wayland more easily, such as the mentioned partial damage support, ffmpeg/vaapi/dmabuf, etc.
Comment 85•5 years ago
•
|
||
If try builds are green and local testing looks good, it might be fine to merge EGL enabled by default and allow switching back to GLX by MOZ_USE_GLX env var. X11 has a GPU process, an edge case problem like surfman had wouldn't break Nightly.
Comment 86•5 years ago
|
||
(In reply to Jan Andre Ikenmeyer [:darkspirit] from comment #85)
If try builds are green and local testing looks good, it might be fine to merge EGL enabled by default and allow switching back to GLX by MOZ_USE_GLX env var. X11 has a GPU process, an edge case problem like surfman had wouldn't break Firefox.
I am not sure if that can be good for stable users. I think we can and should wait until more testing is done until we can change that behaviour( i am not developper anywais and I am not working to mozilla but IMHO)
Comment 87•5 years ago
|
||
Status update: just got Webrender to start with EGL for the first time. Only the first frame though and only with gpu process disabled (so like on Wayland). So some progress :)
Comment 88•5 years ago
|
||
(In reply to Robert Mader [:rmader] from comment #87)
Status update: just got Webrender to start with EGL for the first time. Only the first frame though and only with gpu process disabled (so like on Wayland). So some progress :)
Now got it running properly for both WR and OGL (with gpu process disabled and minus bugs). Will clean up what I have and post in a couple of days - then I'll probably need some input people more familiar with the materia.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Comment 89•5 years ago
|
||
(In reply to Robert Mader [:rmader] from comment #64)
With bug 1474281 done I'm tinkering with this now, mainly so we can have clean unified Webrender partial damage using
EGL_KHR_swap_buffers_with_damageand potentiallyEGL_EXT_buffer_age(bug 1620076).Jeff, how would you prefer this to work? Choosing via build time option, env variable or about:config option (or even remove GLX altogether)? I guess env variable would be the most pleasant option for the moment?
Not a build var.
Prefs are best, because we automatically see them in crashreports. Prefs are also preserved across restarts.
We primarily use envvars for settings that we don't want to persist across restarts.
swap_buffers_with_damage/buffer_age must be pref-disableable until we no longer support running without them. (this prevents chemspills, since we can ship pref updates)
Comment 90•5 years ago
|
||
With bug 1640048 landed I would like to invite everyone following this thread to help testing. All what's needed is to start the upcoming nightly with the MOZ_X11_EGL env variable (e.g. MOZ_X11_EGL=1 ./firefox). The more feedback we get, the earlier we can be confident to enable it by default, which in turn helps greatly with Webrender and DMABUF/VAAPI enablement on X11. Thanks! :)
Comment 91•5 years ago
|
||
The GLX backend can still be used by setting the MOZ_X11_GLX
env var.
Comment 92•5 years ago
|
||
Apart MOZ_X11_EGL=1, I also had to set media.ffmpeg.vaapi.enabled;true
But then it worked fine with no problems so far and noticeable less CPU-load!
Radeon RX 580 Series, mesa/radeonsi 20.1.3.0
With amd GPUs, while the video is running, also watch the second last line (UVD: ...) with:
sudo watch -n '0.1' cat '/sys/kernel/debug/dri/0/amdgpu_pm_info'
Thanks to all who made this possible :)
Updated•5 years ago
|
Updated•5 years ago
|
Comment 93•5 years ago
|
||
(In reply to Robert Mader [:rmader] from comment #90)
With bug 1640048 landed I would like to invite everyone following this thread to help testing. All what's needed is to start the upcoming nightly with the
MOZ_X11_EGLenv variable (e.g.MOZ_X11_EGL=1 ./firefox). The more feedback we get, the earlier we can be confident to enable it by default, which in turn helps greatly with Webrender and DMABUF/VAAPI enablement on X11. Thanks! :)
I'd like to report that EGL works fine on Firefox 84 on a Ryzen Renoir APU (libegl-mesa0 20.0.8-0ubuntu1~20.04.1) running Xfce (no Wayland). I did 2 hours of YT 4K videos in PiP mode while browsing the web.
Aside from MOZ_X11_EGL=1 on the command line, only media.ffmpeg.vaapi.enabled, gfx.webrender.all, layers.acceleration.force-enabled had to be set to true in about:config.
It should be safe to enable this for production use, maybe by migrating MOZ_X11_EGL to a boolean value in about:config as first step.
Comment 94•5 years ago
|
||
(In reply to klk745 from comment #93)
I'd like to report that EGL works fine on Firefox 84 on a Ryzen Renoir APU (libegl-mesa0 20.0.8-0ubuntu1~20.04.1) running Xfce (no Wayland). I did 2 hours of YT 4K videos in PiP mode while browsing the web.
Aside fromMOZ_X11_EGL=1on the command line, onlymedia.ffmpeg.vaapi.enabled,gfx.webrender.all,layers.acceleration.force-enabledhad to be set to true in about:config.
Thank you for testing. Why do you need layers.acceleration.force-enabled? What does not work without it?
Comment 95•5 years ago
|
||
(In reply to Paul Menzel from comment #94)
Thank you for testing. Why do you need
layers.acceleration.force-enabled? What does not work without it?
It's not necessary but at least in my configuration it further reduces the CPU load in top when playing a 4K video on YT:
~200-300% (stock FF84)
~30-50% (MOZ_X11_EGL=1, media.ffmpeg.vaapi.enabled = true, gfx.webrender.all = true)
~20-30% (the above plus layers.acceleration.force-enabled = true)
Comment 96•5 years ago
|
||
(In reply to klk745 from comment #95)
(In reply to Paul Menzel from comment #94)
Thank you for testing. Why do you need
layers.acceleration.force-enabled? What does not work without it?It's not necessary but at least in my configuration it further reduces the CPU load in
topwhen playing a 4K video on YT:
~200-300% (stock FF84)
~30-50% (MOZ_X11_EGL=1, media.ffmpeg.vaapi.enabled = true, gfx.webrender.all = true)
~20-30% (the above plus layers.acceleration.force-enabled = true)
Interesting. Do you see any differences in about:support or RadeonTop, for example? If nobody else answers in the next day, could you please create a separate issue for that, so that layers.acceleration is automatically set for your configuration?
Comment 97•5 years ago
|
||
It's indeed surprising that layers.acceleration.force-enabled has any effect when WR is enabled - given that it enables the OpenGL compositor, which is replaced by WR. It's also in the process of getting removed from FF - for the same reason. So any indication of it having any effect is rather a bug to be investigated.
Concerning enabling EGL by default: this is tracked in bug 1677203 - the biggest blocker ATM is updating the testing infrastructure. Apart from that there are a few corner cases here and there to be taken care of (e.g. multi-gpu and dmabuf).
Comment 98•5 years ago
|
||
(In reply to Robert Mader from comment #97)
So any indication of it having any effect is rather a bug to be investigated.
I'm on Ubuntu's 5.8 HWE kernel in Focal, which is required for my Renoir APU to run smoothly - not sure if that kernel might make a difference, just in case someone wants to test in the same environment.
(In reply to Paul Menzel from comment #96)
Interesting. Do you see any differences in
about:supportorRadeonTop, for example?
radeontop 1.2 in Ubuntu doesn't seem to support Renoir APUs (4350G/4650g/4750G) yet.
In about:support only the values for HW_COMPOSITING and OPENGL_COMPOSITING change with layers.acceleration.force-enabled:
130d129
< "layers.acceleration.force-enabled": true,
588c587
< "status": "force_enabled",
"status": "available",
593,597d591
< },
< {
< "type": "user",
< "status": "force_enabled",
< "message": "Force-enabled by pref"
604c598
< "status": "force_enabled",
"status": "available",
609,613d602
< },
< {
< "type": "user",
< "status": "force_enabled",
< "message": "Force-enabled by pref"
Comment 99•5 years ago
|
||
Apologies, I think I need to correct myself:
I don't see anymore noticeable difference between the two settings after doing several 5 minute long test viewings while watching top.
I guess I simply ran into some higher peak readings earlier - observing top is really not the right tool to profile such cases exactly.
In any case thanks for the hard work you all put into this EGL/VAAPI/WR/VP9 HW decoding chain over the years.
It will enable 4K video without framedrops, save a lot of power for all X11 users and drastically increase battery life for laptop users when watching even only in 1440p on YT.
Comment 100•5 years ago
|
||
Nvidia news: https://www.phoronix.com/scan.php?page=news_item&px=NVIDIA-DMA-BUF-Wayland-KDE
https://bugs.kde.org/show_bug.cgi?id=428089#c2
Incidentally, we're currently working on driver-side support for passing buffers as dma-bufs, and once that's ready we could transition egl-wayland away from using EGLStreams. Then it should be possible to remove all of the EglStreamTexture stuff from kwin.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
| Comment hidden (offtopic) |
| Comment hidden (offtopic) |
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•3 years ago
|
Description
•