Support binding IOSurfaces to textures on ANGLE/EGL for webrender
Categories
(Core :: Graphics, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox154 | --- | fixed |
People
(Reporter: jnicol, Assigned: jnicol)
References
(Blocks 1 open bug)
Details
(Whiteboard: [fxpe])
Attachments
(4 files)
Similar to bug 2048254, we must support binding IOSurfaces to textures using EGL/ANGLE for use with webrender. Specifically, in SurfacePoolCA, and RenderMacIOSurfaceTextureHost. The latter of these almost works already because it uses the MacIOSurface::BindTexImage() helper - we just need to stop hardcoding the target as GL_TEXTURE_RECTANGLE.
One wrinkle, however, is that the ImageBufferKind for a webrender external image is set by the TextureHost, not the RenderTextureHost, e.g. here. This must match the texture target used by the render texture host. Currently we just assume that MacIOSurfaceTextureHosts will always use TextureRect, but that will no longer be the case with Metal ANGLE. [MacIOSurface::GetTextureTarget()] can be used to query the target which should be used, but this needs a GL context, which we do not have access to in the texture host.
Updated•2 months ago
|
| Assignee | ||
Comment 1•2 months ago
|
||
Moves the helper function for querying which GL texture target Mac
IOSurfaces should be bound to from a static helper in MacIOSurface to a
virtual method on GLContext.
This should have no functional change, but better mirrors the existing
GetPreferredEGLImageTextureTarget() helper.
It also avoids having to include MacIOSurface.h in order to query this
value, which avoids unified build errors in subsequent patches.
Updated•2 months ago
|
| Assignee | ||
Comment 2•2 months ago
|
||
Implement GLContext::GetPreferredMacIOSurfaceTextureTarget() for
GLContextEAGL, and use to query the target rather than using
constants.
In the macOS path in
SurfacePoolCA::LockedPool::GetFramebufferForSurface(), construct a
temporary MacIOSurface and call the BindTexImage() helper, which is
implemented for both CGL and EGL/ANGLE contexts, rather than directly
calling CGLTexImageIOSurface2D().
Note we purposefully do not implement MacIOSurface::BindTexImage() for
EAGL (iOS), and instead retain the separate iOS path in
GetFramebufferForSurface(). This is to avoid changing behaviour on iOS
for other callers of BindTexImage(), such as SharedSurface_IOSurface
and RenderMacIOSurfaceTextureHost, where we would currently
MOZ_CRASH("unimplemented"). Perhaps this should be done as a
follow-up, but whether they would work or not has not yet been tested.
| Assignee | ||
Comment 3•2 months ago
|
||
Combines several of WebRenderAPI's various members and getters into a
single struct, and plumb through TransactionBuilder so they can all be
accessed by TextureHost::PushResourceUpdates().
This makes no functional change, but will allow the following patch to
neatly add a new capability that is required by PushResourceUpdates().
| Assignee | ||
Comment 4•2 months ago
|
||
RenderMacIOSurfaceTextureHost already uses the
MacIOSurface::BindTexImage() helper, which is implemented for
EGL/ANGLE, so simply needs to query which texture target to use rather
than assuming GL_TEXTURE_RECTANGLE.
MacIOSurfaceTextureHostOGL::PushResourceUpdates() must set the correct
ImageBufferKind, which depends on which GL texture target should be
used, but has no access to a GL context from which to query that. We
therefore add a new mIOSurfaceImageKind field to
WebRenderCapabilities, which is initialized by querying the GL context
when the WebRenderAPI is created.
https://hg.mozilla.org/mozilla-central/rev/5bf29304f9f9
https://hg.mozilla.org/mozilla-central/rev/ab80d7fe298d
https://hg.mozilla.org/mozilla-central/rev/5fd6257cd691
https://hg.mozilla.org/mozilla-central/rev/a1972c31ea5d
Updated•1 month ago
|
Description
•