obsproject / obs-browser

CEF-based OBS Studio browser plugin
GNU General Public License v2.0
776 stars 221 forks source link

Custom browser dock window under Wayland is transparent #279

Open rmnvgr opened 3 years ago

rmnvgr commented 3 years ago

Operating System Info

Other

Other OS

Fedora 33

OBS Studio Version

Other

OBS Studio Version (Other)

OBS 4074e68-modified (Flatpak bundle of obsproject/obs-studio#4431)

OBS Studio Log URL

https://obsproject.com/logs/FJfJkTBIEjv7KI55

OBS Studio Crash Log URL

No response

Expected Behavior

The content of the window should be visible.

Current Behavior

The content of the window is transparent, only the border and titlebar is visible.

Steps to Reproduce

  1. Open OBS in a Wayland session
  2. Create a new custom browser dock (View → Docks → Custom browser docks)

Anything else we should know?

No response

Screenshot: Capture d’écran de 2021-04-02 20-36-00

CC @GeorgesStavracas

kkartaltepe commented 3 years ago

This should probably be disabled on wayland, the browser docks were not updated to work on wayland yet.

RytoEX commented 3 years ago

This should probably be disabled on wayland, the browser docks were not updated to work on wayland yet.

That sounds safest, if doable to avoid this subpar UX.

RytoEX commented 3 years ago

@GeorgesStavracas Just to clarify, what is needed to actually fix this? Changes on our side? Qt patches?

GeorgesStavracas commented 3 years ago

I'm not really sure. I suspect this problem exists because CEF is using Xwayland to render, and then passing the contents to a Wayland application. This just can't go well. But it can be something else entirely...

Gol-D-Ace commented 3 years ago

Hmm Browser Docks should be deactivated from what I remember when you run obs in wayland because of known issues.

RytoEX commented 3 years ago

Hmm Browser Docks should be deactivated from what I remember when you run obs in wayland because of known issues.

Yes, this was opened before we disabled them on Wayland. I was just asking for clarity on what would need to be done to actually fix the issue rather than temporarily disabling them, which we've already done.

kkartaltepe commented 3 years ago

I actually dont know how the browser sources work at all, but what I think is happening here is.

  1. CEF only runs with an X11 windowing backend (basically no one runs a wayland compositor that doesnt also provide X11 through Xwayland, but we can assume if they did disable Xwayland CEF just wouldnt load at all on that system).
  2. OBS sources without texture sharing will download the frames out of cef and load them into our graphics context so they work regardless of wayland/x11.
  3. OBS Panels try to share window handles, but since OBS has wayland handles and CEF expects X11 it fails and the wayland surface is transparent.
rloutrel commented 2 years ago

Hi every one,

may I suggest to improve the user experience of concerned user and adapt the current workaround (hiding under "Docks menu" the option "add Custom browser Docks")?

Well... I did not wait for the response of if I may suggest, or not. Therefore, if the response is no, please ignore the below lines.

My suggestion would be to leave the option in the menu. It opens a popup, explaining, it is not supported yet on Wayland, and the user should go back to x11/x.org from the loging screen, to be able to use this. At least, one quickly knows from the application itself, that its problem is known and there is a quickfix. I lost a lot of time trying snap, flatpak, then deb, then older versions, (parallel to searches on duckduckgo), ... until someone pointed out the problem on discord.

Of course, if the solution is already on the pipe, please ignore this silly suggestion.

Of course also: You are all doing an amazing work and I thank you all for this!

GloriousEggroll commented 1 year ago

Just spent an entire day trying to figure out why my build wasn't showing the custom docks option. logged in to X11 after seeing this bug and magically everything worked of course. sigh. Hope this gets fixed soon

GloriousEggroll commented 1 year ago

One of my community members for Nobara accidentally stumbled upon a workaround for this while troubleshooting another issue. Launching OBS with QT_QPA_PLATFORM=xcb obs allows the docks and integrations to all work within wayland :o Screenshot from 2023-03-31 23-05-28

mihawk90 commented 1 year ago

That's on XWayland and can result in some other weird behaviour. If it works for them that's great but it is not supported. (and yes that's been known for a while ;) )

GloriousEggroll commented 1 year ago

That's on XWayland and can result in some other weird behaviour. If it works for them that's great but it is not supported. (and yes that's been known for a while ;) )

yeah i noticed it breaks obs-vkcapture on nvidia (works fine on amd)

neolectron commented 1 year ago

OK, I got it to work, and found other behavior that you might be interested in.

Operating System Info

Ubuntu 22.10

OBS Studio Version

Git

OBS Studio Log URL

https://obsproject.com/logs/4WXvjRYBshjkFrRA

Expected Behavior

Expected behavior would be to NOT work without the temporary commit that disable custom browser docks on wayland. https://github.com/obsproject/obs-studio/commit/c7aaceaee6fb8df4e0d5c315f038b9321de31cd8 image

Current Behavior

It DOES work, therefore the disabling of custom browser docks is useless.

If you build OBS with the commit reverted, and you start OBS without the flags, it works but browser-docks are disabled, so there's no difference with what we have now. (commit has no impact, no crash or else)

If you start with the flags, it also add the browser-docks to the already working OBS setup on xwayland (with pipewire screen-capture and any wayland specific other features)

Steps to Reproduce

  1. Clone OBS-studio.
  2. Revert commit 7402271392a6a74fb49f16d84fb3c04c1b603d9a in obs-browser.
  3. Build from source.
  4. Start OBS with qt (for X): GDK_BACKEND=x11 QT_QPA_PLATFORM=xcb obs.
  5. Custom browser docks works while on wayland host.

image

Anything else we should know?

(I tested it on Arch and the last Ubuntu, they both worked)

mihawk90 commented 1 year ago

This was mentioned by GE above and does not need the patch reverted.

And as stated above, if it works for you, good on you, that's your business. That doesn't make it a universal/acceptable solution though as you were told in obsproject/obs-studio#9369.

neolectron commented 1 year ago

@mihawk90 that's odd because it didn't work before the revert. I tested this solution in 2 of my setups and it unlocked the situation in both of them. And even if it didn't worked, the reverted commit didn't make any difference unless obs was started with the flag aswell. That's why I'm full of incomprehension here. In one hand, it seems like the issue is not really a thing anymore (I don't think it works "just for me", but for every wayland users), and in the other hand, reverting the commit doesn't change a thing for 99.99% of the users and just provide fallbacks for the ones that are interested in the feature (I do understand however that it doesn't mean that you're going to support xwayland or anything, it's just a matter of not blocking options in the code if it has no other effects than preventing it to work in some cases).

mihawk90 commented 1 year ago

Apologies for my previous (now deleted) comment in case you read it, it came off more rough then intended. The title of the video is however slightly misleading as it is not Wayland that breaks this feature. It is a missing implementation on CEFs side, which yes only manifests on Wayland, however that is not Waylands fault.

Either way, for future reference: We're waiting on chromiumembedded/cef#2804

Specifically, see the comments from on Jan 31, 2022:

What’s currently missing (and covered by this issue) is the ability to embed CEF windows in third-party Wayland applications. That requires providing a Wayland alternative to the X11 code that is currently #ifdef-d out of the CEF Ozone build.

As I understand this comment there is currently no way for the OBS team to embed CEF "natively" into OBS on Wayland. XWayland via QT_QPA_PLATFORM (as mentioned above) works in some usecases, but it breaks others so it cannot be default behaviour.

edit: Matt also addressed this in a comment on the video.

davidedmundson commented 11 months ago

Is there a reason we use CEF directly over QtWebengine? (other than the porting work)

The latter would be trivially embeddable, either as the widget or textures can be retrieved and used in any way.

Fenrirthviti commented 11 months ago

Short answer is that QtWebengine doesn't offer us anything over the existing implementation, and is missing core functionality that we have patched in to CEF (OSR, hardware accel, shared textures, audio routing). It would be a lot of extra work to port it for reduced functionality. QtWebengine also tends to lag behind CEF proper.

TheRealFame commented 1 month ago

Short answer is that QtWebengine doesn't offer us anything over the existing implementation, and is missing core functionality that we have patched in to CEF (OSR, hardware accel, shared textures, audio routing). It would be a lot of extra work to port it for reduced functionality. QtWebengine also tends to lag behind CEF proper.

What about now in 2024?

Is there any alternatives that fix this simple solution of no custom browser docks for Wayland? (Without using an external app.)