[wpe-webkit] Backend objects for multiple WebViews

Adrian Perez de Castro aperez at igalia.com
Wed Jun 5 06:22:47 PDT 2019


Hello again,

On Wed, 05 Jun 2019 10:39:20 +1000, Ryan Walklin <ryan at testtoast.com> wrote:

> Also, are there any tips/tricks for managing frame lifecycles when you don't
> necessarily want to render frames from multiple views? e.g you have a number
> of tabs but only one is visible at a time. 
> 
> Ideally I'd suspend rendering from the non-visible tabs entirely by not
> calling wpe_view_backend_exportable_fdo_dispatch_frame_complete(), but I
> don't know whether this would suspend JS execution etc.

What I have done myself is issue the calls to “_dispatch_frame_complete()”
at intervals (for example, once every three seconds) to make sure all keep
running normally for Web views which are not being displayed. While it is
not strictly needed to keep JavaScript running in most cases, it comes to
my mind that for example “requestAnimationFrame()” is tied to frame
synchronization; therefore it is probably a good idea to report frame
completion every now and then.

Note that you can use change the WPE backend's “activity state” [1] to add
or remove the “wpe_view_activity_state_visible” flag to provide hints to WPE
WebKit. IIUC at the moment this does *not* stop dispatching of new frames
through the WPE backend right now, but there are plans to implement that—at
which point throttling calls to “_dispatch_frame_completed()” will not be
needed anymore.
 
> Finally, is there any way to use an off-screen EGL context to render the
> images, rather than tieing the context to an EGLDisplay? Obviously if you're
> running a full-screen kiosk app it's not an issue, but I'm planning to
> render to wl_subsurfaces and then use the compositor to build my UI.

Rendering to subsurfaces is known to work. Probably the most straightforward
achieving that is to use the “.export_buffer_resource” callback, which makes
the FDO backend give you a “wl_resource” with a buffer, and in the callback
use “eglCreateImageKHR()” + “eglCreateWaylandBufferFromImageWL()” to turn it
into a “wl_buffer” which finally you can use with “wl_surface_attach()” on
the subsurface. You will also want to add a callback on the “wl_buffer” to
know when the compositor has committed it, which is a good location to call
“wpe_view_backend_exportable_fdo_dispatch_release_buffer()”.

(Let me know if you run into trouble or have doubts, I wrote the above
quickly and the explanation might be a bit too terse.)

Best regards,
—Adrián
 
---
[1] https://github.com/WebPlatformForEmbedded/libwpe/blob/master/include/wpe/view-backend.h#L119-L129
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-wpe/attachments/20190605/09e4ded5/attachment.bin>


More information about the webkit-wpe mailing list