You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CEF3: Support rendering to a hardware GL/D3D texture/surface provided by the client #1006
Original issue 1006 created by magreenblatt on 2013-06-27T17:50:13.000Z:
CEF3 off-screen rendering does not currently support hardware acceleration. This means that some features like 3D CSS which require hardware acceleration do not currently work when using off-screen rendering.
See issue comment 51.8 for related comments.
Reacted by Maddison Cohodas, Jesper Ek, Suraj and Romain Biessy
Comment 2. originally posted by [email protected] on 2014-02-14T05:30:14.000Z:
Hi , I just wanted to follow up on this issues. I remember we had some good discussions back in issue #518 about a fairly simple approach to support GPU acceleration for off screen rendering on Windows by using shared surfaces.
It seems in Windows Vista and beyond, all windows are actually textures that are rendered to an offscreen buffer and then put in a 3d surface (actually a D3D surface) representing that window.
Taking that into account I guess there must be an easy way to get the whole content (harware accelerated) from CEF and use it as a texture so that we can embed it in our own apps (see awesomium.com)
Probably this will only work in Windows Vista and beyond and not in Windows XP.
I think CEF should support some of the features modern windows have to offer even if that breaks backwards compability with Win XP. I know many people love XP but we can't forget it is a 13 years old OS and many advancements have occurred since its release.
Comment 4. originally posted by MGusarenko on 2014-04-07T08:25:34.000Z:
I am working on patch for HW offscreen render support, description will be avail at CEF forum as soon as premoderated. Everyone who intrested in can join.
Comment 6. originally posted by jarred.nicholls on 2014-04-08T19:38:14.000Z:
Amazing re: the HW accelerated off screen rendering! It really helps my use case with integrating CEF into QtQuick/QML scene graph without compromising.
Comment 7. originally posted by magreenblatt on 2014-06-28T00:10:37.000Z:
There are currently two use cases for hardware acceleration:
Support for accelerated features like 3D CSS and WebGL which require GPU acceleration for rendering and compositing.
Support for delivering the final composited result to a GL/D3D texture/surface provided by the client in order to minimize copies and CPU load.
comment 1. will be addressed by issue comment 12.57 which re-implements off-screen rendering support in trunk using the delegated renderer. comment 2. will be left to this issue.
Comment 13. originally posted by ameggs on 2015-03-02T22:55:56.000Z:
My (possibly incorrect or outdated?) understanding is that Chromium renders to GPU-side 256x256 pixel tiles, rather than a single buffer that's the full size of the visible browser window. When something on the page changes, only tiles that are changed get redrawn. At display time, something called the "ubercompositor" takes the current list of tiles and merges it with browser-side UI things. The only time the entire web page is drawn into a single buffer is when the tiles are combined with that UI for the final render. I'm basing this off these two documents; if I'm wrong I welcome the correction:
But if my understanding is correct, then implementing this as described would mean chromium or CEF would be rendering all its tiles to a buffer we provided, and then we'd render that buffer into our own view. But if the goal here is to reduce latency and copies, maybe the best way to achieve this isn't for CEF to render to a texture/surface that we provide. Instead, just expose the current tile set to us. We can send those tiles into our own 3D renderer as part of our own independently-running update/draw/present loop.
This would be especially appreciated by game developers, because we're frequently GPU-limited, and anything that reduces the number of GPU-side copies would help.
As part of the last chromium update my WIP part of Viz OSR was merged without any shared surface, because the old implementation doesn’t work with Viz.
I will be publishing a new early work PR sometime this week to add shared surface again for Windows and go from there.
We want to make use of the shared texture provided by CEF3 with ANGLE backed by Direct 3D 11.
So the only choice is eglCreatePbufferFromClientBuffer(), however, when we pass the shared handle it fails with EGL_BAD_SURFACE.
After some digging into ANGLE’s source codes, we found that eglCreatePbufferFromClientBuffer() requires the client buffer to be render-able, even if we only read the frame buffer later:
EGLint SwapChain11::resetOffscreenColorBuffer(const gl::Context *context,
int backbufferWidth,
int backbufferHeight)
{
...
// Fail if the offscreen texture is not renderable.if ((offscreenTextureDesc.BindFlags & D3D11_BIND_RENDER_TARGET) == 0)
{
ERR() << "Could not use provided offscreen texture, texture not renderable.";
release();
returnEGL_BAD_SURFACE;
}
...
}
It’s both reasonable that a PBuffer should be render-able and a shared texture from CEF should be read-only, but I think it should be safe to make the staging texture render-able?
Activity
magreenblatt commentedon Aug 8, 2013
Comment 1. originally posted by magreenblatt on 2013-08-08T16:05:01.000Z:
issue #1048 has been merged into this issue.
magreenblatt commentedon Feb 14, 2014
Original comment by Anonymous.
Comment 2. originally posted by [email protected] on 2014-02-14T05:30:14.000Z:
Hi , I just wanted to follow up on this issues. I remember we had some good discussions back in issue #518 about a fairly simple approach to support GPU acceleration for off screen rendering on Windows by using shared surfaces.
Any idea on timeline here ?
magreenblatt commentedon Feb 19, 2014
Original comment by Anonymous.
Comment 3. originally posted by efrencd on 2014-02-19T19:11:57.000Z:
Hello,
here it is a very interesting article about the Desktop Window Manager in Windows Vista, 7 and 8.
http://en.wikipedia.org/wiki/Desktop\_Window\_Manager
It seems in Windows Vista and beyond, all windows are actually textures that are rendered to an offscreen buffer and then put in a 3d surface (actually a D3D surface) representing that window.
Taking that into account I guess there must be an easy way to get the whole content (harware accelerated) from CEF and use it as a texture so that we can embed it in our own apps (see awesomium.com)
Probably this will only work in Windows Vista and beyond and not in Windows XP.
I think CEF should support some of the features modern windows have to offer even if that breaks backwards compability with Win XP. I know many people love XP but we can't forget it is a 13 years old OS and many advancements have occurred since its release.
magreenblatt commentedon Apr 7, 2014
Original comment by Anonymous.
Comment 4. originally posted by MGusarenko on 2014-04-07T08:25:34.000Z:
I am working on patch for HW offscreen render support, description will be avail at CEF forum as soon as premoderated. Everyone who intrested in can join.
magreenblatt commentedon Apr 7, 2014
Original changes by Anonymous.
magreenblatt commentedon Apr 7, 2014
Comment 5. originally posted by magreenblatt on 2014-04-07T14:49:43.000Z:
@ commentcomment 4.: The forum post is http://magpcss.org/ceforum/viewtopic.php?f=8&t=11635.
magreenblatt commentedon Apr 8, 2014
Original comment by Anonymous.
Comment 6. originally posted by jarred.nicholls on 2014-04-08T19:38:14.000Z:
Amazing re: the HW accelerated off screen rendering! It really helps my use case with integrating CEF into QtQuick/QML scene graph without compromising.
magreenblatt commentedon Jun 28, 2014
Comment 7. originally posted by magreenblatt on 2014-06-28T00:10:37.000Z:
There are currently two use cases for hardware acceleration:
Support for accelerated features like 3D CSS and WebGL which require GPU acceleration for rendering and compositing.
Support for delivering the final composited result to a GL/D3D texture/surface provided by the client in order to minimize copies and CPU load.
comment 1. will be addressed by issue comment 12.57 which re-implements off-screen rendering support in trunk using the delegated renderer. comment 2. will be left to this issue.
magreenblatt commentedon Jun 28, 2014
Comment 8. originally posted by magreenblatt on 2014-06-28T00:12:53.000Z:
magreenblatt commentedon Oct 23, 2014
Comment 9. originally posted by magreenblatt on 2014-10-23T17:31:24.000Z:
magreenblatt commentedon Nov 7, 2014
Comment 11. originally posted by magreenblatt on 2014-11-07T22:00:18.000Z:
It's likely best to implement this at the Ozone layer. See http://crbug.com/431397 for details.
magreenblatt commentedon Mar 1, 2015
Original comment by Anonymous.
Comment 12. originally posted by efrencd on 2015-03-01T13:39:33.000Z:
Hello, any plans or aproximate date in which this feature will be added? thanks.
magreenblatt commentedon Mar 2, 2015
Original comment by Anonymous.
Comment 13. originally posted by ameggs on 2015-03-02T22:55:56.000Z:
My (possibly incorrect or outdated?) understanding is that Chromium renders to GPU-side 256x256 pixel tiles, rather than a single buffer that's the full size of the visible browser window. When something on the page changes, only tiles that are changed get redrawn. At display time, something called the "ubercompositor" takes the current list of tiles and merges it with browser-side UI things. The only time the entire web page is drawn into a single buffer is when the tiles are combined with that UI for the final render. I'm basing this off these two documents; if I'm wrong I welcome the correction:
https://docs.google.com/document/d/1tkwOlSlXiR320dFufuA\_M-RF9L5LxFWmZFg5oW35rZk
https://docs.google.com/document/d/1ziMZtS5Hf8azogi2VjSE6XPaMwivZSyXAIIp0GgInNA
But if my understanding is correct, then implementing this as described would mean chromium or CEF would be rendering all its tiles to a buffer we provided, and then we'd render that buffer into our own view. But if the goal here is to reduce latency and copies, maybe the best way to achieve this isn't for CEF to render to a texture/surface that we provide. Instead, just expose the current tile set to us. We can send those tiles into our own 3D renderer as part of our own independently-running update/draw/present loop.
This would be especially appreciated by game developers, because we're frequently GPU-limited, and anything that reduces the number of GPU-side copies would help.
magreenblatt commentedon Aug 20, 2015
Samsung has (very indirectly) proposed a new API for hardware-accelerated off-screen rendering in CEF: http://blogs.s-osg.org/servo-the-countdown-to-your-next-browser-continues/ ("Composite Smarter, Not Harder" section).
Also, using in-process-gpu in combination with a custom OutputSurface seems like a promising implementation approach. Related conversation: https://groups.google.com/a/chromium.org/d/msg/graphics-dev/cnr8n3mdRFc/2n7QrPAaAQAJ
magreenblatt commentedon Aug 27, 2015
Original comment by Cef Gluist (Bitbucket: cefgluist).
Intented updated patches to Chromium41/CEFr2272.
42 remaining items
magreenblatt commentedon Mar 18, 2019
Linux: Add OSR use_external_begin_frame support (see issue #1006)
→ <<cset a48e0720762a (bb)>>
magreenblatt commentedon Mar 18, 2019
Linux: Add OSR use_external_begin_frame support (see issue #1006)
→ <<cset 2ff59af42954 (bb)>>
magreenblatt commentedon Mar 18, 2019
Linux: Add OSR use_external_begin_frame support (see issue #1006)
→ <<cset ce74f0ae4dff (bb)>>
magreenblatt commentedon Jul 23, 2019
Original comment by Romain Caire (Bitbucket: Romain Caire).
Hi,
I’d like to help implementing Accelerated Paint in OSR mode on Linux.
Is there any work being done on this end I could look at ?
magreenblatt commentedon Jul 23, 2019
Original comment by Alexander Guettler (Bitbucket: xforce, GitHub: xforce).
As part of #2575/viz-implementation-for-osr I am investigating the possibility of supporting more platforms.
As part of the last chromium update my WIP part of Viz OSR was merged without any shared surface, because the old implementation doesn’t work with Viz.
I will be publishing a new early work PR sometime this week to add shared surface again for Windows and go from there.
magreenblatt commentedon Aug 27, 2019
Original comment by Romain Caire (Bitbucket: Romain Caire).
Hi @{557058:f07fe0c3-2eef-4563-993e-dcdb7d76e546} ,
Did you had some time to work on this ?
Feel free to DM me on Twitter @RomainCaire if you need any help or If i can be any useful :slight_smile:
magreenblatt commentedon Nov 11, 2021
Issue #3216 was marked as a duplicate of this issue.
magreenblatt commentedon Feb 16, 2022
Issue #3263 is likely the best way to implement this for Linux (and possibly other platforms in the future).
magreenblatt commentedon Jul 14, 2022
Original comment by Joshua Chen (Bitbucket: gpbeta, GitHub: gpbeta).
Hi, again! Just a quick question:
Can we create the staging texture with
D3D11_BIND_RENDER_TARGETbind flag? (libcef/browser/gpu/external_texture_manager.cc)
We want to make use of the shared texture provided by CEF3 with ANGLE backed by Direct 3D 11.
So the only choice is
eglCreatePbufferFromClientBuffer(), however, when we pass the shared handle it fails withEGL_BAD_SURFACE.After some digging into ANGLE’s source codes, we found that
eglCreatePbufferFromClientBuffer()requires the client buffer to be render-able, even if we only read the frame buffer later:It’s both reasonable that a PBuffer should be render-able and a shared texture from CEF should be read-only, but I think it should be safe to make the staging texture render-able?
Linux: Add OSR use_external_begin_frame support (see issue chromiumem…
Linux: Add OSR use_external_begin_frame support (see issue chromiumem…
Linux: Add OSR use_external_begin_frame support (see issue chromiumem…
osr: Implement shared texture support (fixes #1006, fixes #2575)