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

Does CefSharp support accelerated compositing? #316

Closed
oxbough opened this issue Apr 8, 2014 · 11 comments
Closed

Does CefSharp support accelerated compositing? #316

oxbough opened this issue Apr 8, 2014 · 11 comments
Labels
enhancement question upstream These issues require fixing in the Chromium Embedded Framework(CEF) or Chromium. wpf WPF Implementation
Milestone

Comments

@oxbough
Copy link

oxbough commented Apr 8, 2014

Please tell me that CefSharp does indeed support accelerated compositing. In #309 @jornh said that CefSharp.Wpf.Example uses off-screen rendering mode. And https://code.google.com/p/chromiumembedded/wiki/GeneralUsage very clearly states that off-screen rendering mode does not support accelerated compositing. Is it just the Wpf.Example that uses off screen rendering? Or is it CefSharp.Wpf ? Or not at all? This is an important factor for me in using CefSharp.Wpf.

@oxbough
Copy link
Author

oxbough commented Apr 9, 2014

Looked thru the CefSharp code and found a call to set off screen rendering mode in the CefSharp.Wpf WebView constructor ... managedCefBrowserAdapter.CreateOffscreenBrowser(...). So it would seem that the WPF version is unconditionally coded to use off screen rendering, so does not support accelerated compositing.

@jornh jornh added this to the 3000 milestone Apr 9, 2014
@jornh
Copy link
Contributor

jornh commented Apr 9, 2014

Yes right. Seems someone has started working on accelerated OSR upstream though... http://www.magpcss.org/ceforum/viewtopic.php?f=8&t=11635

Here's hoping that it will land before milestone 3000 😉

@oxbough
Copy link
Author

oxbough commented Apr 9, 2014

Is it necessary for CefSharp.Wpf to unconditionally use CEF in OSR mode? What are the reasons, pros and cons?

@jornh
Copy link
Contributor

jornh commented Apr 10, 2014

I guess an alternative could be implemented either at the HWND or WinFormsHost level. I think it would be nice if CefSharp had both options if a solid solution can be built. That just hasn't been done - yet.

https://www.simple-talk.com/dotnet/.net-framework/mixing-wpf-and-winforms/ seems like a good introduction to the WinFormsHost approach including a pointer to some "gotchas". BTW #241 mentions the opposite direction of embedding.

This is an important factor for me in using CefSharp.Wpf.

For what reasons, if I may ask?

@oxbough
Copy link
Author

oxbough commented Apr 10, 2014

I do see WinFormsHost as my first option.
To answer the why question ... my team is developing an app that has several video windows displayed concurrently, probably 5, maybe as many as 9. We would like to render a name tag semi-transparently over a strip across the bottom each video window, and maybe even a collection of semi-transparent command icons. We may also need to display a menu over the videos dropped from the top, without using an iframe. Because the video will refresh/redraw 15 to 30 times per second, anything rendered over top of the video will have to be redrawn for each refresh. And the refresh of each is likely to be out sync with each other, meaning the redraws done for the name tags or other overlaid content all get multiplied by the number of video windows which are out of sync. Redraws potentially scale from 30x /s to 150x /s for 5 video windows. With software compositing, CPU usage rises too high to build a feasible product.

@perlun
Copy link
Member

perlun commented Apr 10, 2014

Hi @oxbough.

The reason the WPF control uses OSR is that it must do so to properly support the features that are native to WPF, like transparency (being able to overlay a WebView on top of other WPF content, or below, for example), transformations (i.e. tilting the WebView by 45 degrees or whatever).

These features are more crucial for some people (like me) than being able to support use cases like the one you describe.

Generally, as a user, I would be quite annoyed by an application that tries to display 9 videos concurrently... 😜 But perhaps I'm missing your point a bit.

@perlun perlun added the wpf label Apr 10, 2014
@perlun
Copy link
Member

perlun commented Apr 10, 2014

(As far as WinForms is concerned, it should be fairly easy to support though. Feel free to experiment with it and get back to us if you cannot make it work for whatever reason. So either write your app as a WinForms app, or - like @jornh is suggesting - try the approach of embedding the WinForms control in a WPF app.)

Bear in mind though that the CefSharp3 (i.e. the current master) is not yet that mature for WinForms. This is simply because people haven't been scratching their own itches enough. Care to give a helping hand? Any contributions to that end would be highly appreciated. See #241 for some discussion on the matter.

@oxbough
Copy link
Author

oxbough commented Apr 10, 2014

Hi @perlun We have existing development using WPF. But there are reasons for not using the VS WPF default rendering engine (trident), so we are looking to replace with Chromium. This is an embedded browser control that is part of a larger app. The embedded browser control will not be a general use browser with navigation buttons, but will load specific, proprietary HTML/CSS/JavaScript code. Our users want multiple video windows in this product.

@perlun
Copy link
Member

perlun commented Apr 16, 2014

Right. Well, I think it is hard to combine this requirement with requirements from other people (like me). But feel free to hack around; if you manage to patch CefSharp so that it works for you, I guess we can include the changes in the master branch also, since it might be useful for others also.

@perlun perlun closed this as completed Apr 16, 2014
@oxbough
Copy link
Author

oxbough commented Jul 22, 2014

FYI, was able to get WinForms control version of CefSharp embedded in a WPF frame. I'm relatively new to C# and WPF, but now even newer to WinForms. Some gotchas I hit, like had to explicitly set visibility to true before it was visible or else CEF didn't start the renderer process. However, in the end, this may not be what we go with. Looking at embedding C++ WInForms CEF3 in WPF frame instead. Not sure it is possible in all our use cases.

@amaitland
Copy link
Member

Looking at embedding C++ WInForms CEF3 in WPF frame instead.

Out of curiosity, what exacrtly is C++ WinForms CEF3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement question upstream These issues require fixing in the Chromium Embedded Framework(CEF) or Chromium. wpf WPF Implementation
Projects
None yet
Development

No branches or pull requests

4 participants