-
Notifications
You must be signed in to change notification settings - Fork 272
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
feat: Update CEF to 117 #1499
feat: Update CEF to 117 #1499
Conversation
Thank you for the research, I am very interested in trying the build once its merged. By your post and what I could understand googling a bit: the missing "shared texture" will only affect performance in certain cases, is that correct? Or is there any HTML features/ workflows that will be directly affected or non-functional by its absence? I am trying to understand what this change entails to remain in the old one with shared-texture support or just update with no fear of the old templates breaking. Thanks! |
When When using the Without shared textures, CEF is downloading the frame to CPU memory and passing us that CPU located pixels. We then perform a copy and send that back to the GPU. So the difference becomes: Copying via the CPU is problematic because firstly it requires more copies to be done, which costs CPU time. And going between the GPU and CPU will consume PCIE bandwidth. A caveat here, is that if using an onboard gpu (one built into the cpu), because it shares system memory, doing the copy via cpu most likely has very little cost. I expect this environment would not be very representive of production deployments. As such I have not done any testing here I should probably repeat the same test in 4K50, to make sure that it remains similarly usable. As far as Im aware, nothing should break with this, other than a degradation in performance due to the change in copying. Whether that change is noticable is what my measurements in the PR description were trying to figure out. |
Thank you for the detailed explanation. It makes sense... I now understand how the lack of shared textures can easily become a headache. |
9c83b8e
to
cd4b62b
Compare
248d0b3
to
9e00b33
Compare
af68197
to
95f5430
Compare
I've been testing some templates in 2.4-beta1 vs 2.4-dev and it seems that
I captured a video to show the results: |
@rrebuffo are you running on windows or linux? CEF should still be gpu enabled, but I did tell it to use a different backend which could have an impact on this. It seemed fine in my testing though |
Sorry for the lack of context. My developement rig is: I'm running a custom resolution: 3584x768 I could prepare the template for you to test. It's heavy on SVGs and masks so it's a good candidate to stress chrome. |
@rrebuffo yes a copy of the template would be helpful |
@rrebuffo I've taken a look at this, and it seems to be a consequence of some of the performance tweaks made. Try using this with the next beta build, and it should run better:
|
I tried to test this with the 2023-12-22 15:16 build but I couldn't make it show aything on screen. The HTML shows up in the DIAG, but there is no output. I tried GPU true and false, and backend blank, gl, d9 and d11. I didn't have an SDI output at the moment, just the screen consumer. |
@Sidonai-1 should be better now. I appear to have been clumsy when doing #1390 and broke most producers (all except ffmpeg). |
This work was sponsored by NRK.
Related #1235
Closes #1498
Fixes #1265
Fixes #1454
Fixes #1387
Fixes #1441
And others?
It has been a few years since I last evaluated whether the shared-texture flow in CEF was necessary. I started off looking into this as I was curious how linux performed, which has never had shared-texture support.
Initial tests were run on a machine with a 7950x (dual channel ddr5) and GTX1060, using https://www.testufo.com/ as the page to produce constant fluid motion. I did try some webgl demos at a couple of points, but results were not impacted noticably. Using a single channel of 1080i5000. From memory, the cost is the same no matter how many channels the producers are spread across, but this needs verifying.
Using the CEF95 in master:
Also worth noting, CEF95 gpu-enabled without shared-textures flooded the console with errors from CEF.
At one point I was having issues with CEF117 crashing on linux, that appears to have stopped happening now.
From this, it looks like there is no big change in gpu-disabled behaviour (a change of 1 could be due to my testing method), but gpu-enabled (no shared) is performing much better, and looks to negate the need for shared-textures.
To verify this, I tried this on another machine (i9-10920X & Quadro P4000. quad channel DDR4)
And another (i7-7800X & RTX 3080Ti. dual channel DDR4)
And another (xeon W-2133 & Quadro P4000. dual channel DDR4)
While not a perfect match, depending on the machine used performance can be better than before.
Investigating this, I discovered that the slowness with
gpu enabled (no shared)
was due to the memcpy we are performing, to copy the CEF pixel buffer into our gpu backed buffer. It was notably slower in this vsgpu disabled
, but wrapping the copy with atbb:parallel_for
improves performance such that it rivals thegpu disabled
flow. Making the same change whengpu disabled
or on linux has no noticable impact, so it is not done in either of those cases.This performance optimisations was made for only the CEF117 builds, as this PR is aiming to ensure it doesnt degrade performance compared to the current builds/releases of casparcg.
For this test I have been focusing on how the number of producers, and not focusing at all on the actual resource usage of this. I expect that there will be more cost on system memory especially for this change, but at this point this is a question of do we want to accept the increased resource requirement, or stick with a 2021 version of CEF for the forseeable future. There are known issues with the current CEF integration (#1454), causing some users to be sticking with the previous version we had, CEF71 from 2018.
The unfortunate situation is that the shared-texture support in CEF is broken, and has been for over 2 years. Various people have been fixing it for each new release of CEF, most recently OBS. But as of CEF 104 from mid 2022, the patch needs to be rewritten from scratch, which is likely to take quite a while to happen. As it looks like we do not need (but we would like it, once possible again) the shared-texture support, I think it best to drop it for now so that we can update CEF.
I have tried again at making CEF 103 work for us, starting from the work done by OBS, but getting the D3D to GL interop to not lose frames is proving too challenging. And as that version is already over a year old, how long would we stick to it for?
Windows build: https://builds.julusian.dev/casparcg/casparcg-server-cef117-upstream-2842bc616bb9817547b775eae466d330050d0025-windows.zip