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

On Linux, the Browser Source rendering is very laggy (~3FPS) where Chrome and FF run at 60FPS #309

Open
xurei opened this issue Jul 28, 2021 · 17 comments

Comments

@xurei
Copy link

xurei commented Jul 28, 2021

Operating System Info

Other

Other OS

Manjaro Linux

OBS Studio Version

27.0.1

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/FsbiJvZzu3Kl4SSU

OBS Studio Crash Log URL

No response

Expected Behavior

Using this as a Browser Source : https://outer-wilds-anim-6zl8zgucn-xurei.vercel.app/

A comparable FPS using the Browser Source compared to Chrome/FF

Current Behavior

The framerate is really laggy (~5FPS).

Steps to Reproduce

  1. Create a Browser Source with this URL : https://outer-wilds-anim-6zl8zgucn-xurei.vercel.app/
    (dimensions 2560x1440)
  2. Compare with the same page on Google Chrome or Firefox (with 75% zoom on a 1080p screen)

Anything else we should know?

Note that the page is not optimized at all. I'm actually more interested for an explanation of the underlying cause rather than an actual fix of the issue.

I tested it on Windows and the animation is fluid.

@xurei
Copy link
Author

xurei commented Jul 28, 2021

I just made a performance profiling of the page and here is the result :
Screenshot from 2021-07-28 16-18-33

Apparently there is some kind of throttle happening. The browser is almost always idle...

By comparison, the same profile results when opened in Chrome :
Screenshot from 2021-07-28 15-57-07

@WizardCM
Copy link
Member

Our browser source is officially untested with CEF 88.0.4324 on Linux, so I'm not surprised there might be quirks.

Are browser docks/panels having similar performance issues, or is it limited to browser sources?

@xurei
Copy link
Author

xurei commented Jul 28, 2021

For what I know, it only happens on this specific, highly unoptimized page.

The other browser sources I are completely fluid.
I just tested a more complex page with 200+ sprites moving and no lag at all.

Our browser source is officially untested with CEF 88.0.4324 on Linux

I'm not blaming or requesting anything here, I'm just curious about what could be causing this.

@tytan652
Copy link
Contributor

On AUR, there is two "stable" OBS packages, obs-studio-browser which use this CEF and obs-studio-tytan652 which add some tweaks and use the right CEF.

@mihawk90
Copy link

Our browser source is officially untested with CEF 88.0.4324 on Linux

Can reproduce on Fedora though with CEF 4280 (from the OBS CDN).

I suspect missing hardware acceleration (to my knowledge that is still not available on Linux because ... reasons). My CPU fan ramps up immediately and it also gets less and less laggy the further down you set the resolution in the source properties.

@tytan652
Copy link
Contributor

tytan652 commented Jul 28, 2021

CEF Hardware accel is actually made of unmerged PR for Windows and macOS unfortunately

@xurei
Copy link
Author

xurei commented Jul 28, 2021

I just checked and GPU raster is disabled on OBS side, and enabled in Chrome.

Screenshot from 2021-07-28 17-44-46

The root cause seems to be that indeed.

I'm trying obs-studio-tytan652 to see if there is any difference

@kkartaltepe
Copy link
Contributor

kkartaltepe commented Jul 28, 2021

Hardware rendering is not supported on linux because its not compatible with wayland. And in this case since you are on not on ubuntu, your packager's settings may vary*

@xurei
Copy link
Author

xurei commented Jul 28, 2021

@kkartaltepe Isn't there any way to detect a X11 environment then, which remains widely used, and I guess it would probably work ?

@kkartaltepe
Copy link
Contributor

kkartaltepe commented Jul 28, 2021

Probably, the minor testing we did during the last version mostly worked but wayland was our priority.

@kkartaltepe
Copy link
Contributor

If you want to play with it locally you can apply the patch, if you see that doesnt help let us know and we can reopen the bug.

diff --git a/browser-app.cpp b/browser-app.cpp
index 3b867e7..22ba818 100644
--- a/browser-app.cpp
+++ b/browser-app.cpp
@@ -81,7 +81,7 @@ void BrowserApp::OnBeforeCommandLineProcessing(
                CefString type = command_line->GetSwitchValue("type");
 
                if (!enableGPU && type.empty()) {
-                       command_line->AppendSwitch("disable-gpu");
+                       // command_line->AppendSwitch("disable-gpu");
                        command_line->AppendSwitch("disable-gpu-compositing");
                }
        }

@mihawk90
Copy link

mihawk90 commented Jul 28, 2021

That line doesn't exist on current obs-browser master:

void BrowserApp::OnBeforeCommandLineProcessing(

However I still can reproduce the issue as stated above, and I am using the current master because I was testing the Drag&Drop fix

edit:
d564000
#278

@kkartaltepe
Copy link
Contributor

Ah looks like it did land before 27, sorry for misremembering.

@kkartaltepe kkartaltepe reopened this Jul 28, 2021
@xurei
Copy link
Author

xurei commented Jul 28, 2021

@kkartaltepe The line is indeed missing. However, this portion of code gave me the hint :

bool enableGPU = command_line->HasSwitch("enable-gpu");
CefString type = command_line->GetSwitchValue("type");

if (!enableGPU && type.empty()) {
	command_line->AppendSwitch("disable-gpu-compositing");
}

Running obs --enable-gpu gives a much smoother rendering 😃 around 25FPS

Chrome devtools still states that GPU raster is off, though. Around 25% of the frames are dropped when 60FPS are configured in OBS source properties. Almost none with 30FPS.

@kkartaltepe
Copy link
Contributor

kkartaltepe commented Jul 28, 2021

The sample page looks like it renders with CSS animations which I dont think will be as performant in cef for a long time. But maybe someone more knowledgeable can see if there is a better way to tickle cefs buttons.

@WizardCM WizardCM transferred this issue from obsproject/obs-studio Aug 3, 2021
@torgabor
Copy link

I've tested 27.2.0 on Ubuntu 20.04, and it seems the issue still persists, even after the CEF update. I think the root cause is that the CEF shared texture support is not working. Are the shared textures implemented yet for Linux, or are they still WIP?

@RytoEX
Copy link
Member

RytoEX commented Feb 16, 2022

I've tested 27.2.0 on Ubuntu 20.04, and it seems the issue still persists, even after the CEF update. I think the root cause is that the CEF shared texture support is not working. Are the shared textures implemented yet for Linux, or are they still WIP?

Shared textures are only on Windows and macOS right now.

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

No branches or pull requests

7 participants