Bug 1898238 - Keep SharedSurface_EGLImages alive but do not recycle them. r=sotaro,jgilbert

We must ensure that a SharedSurface_EGLImage outlives its
corresponding RenderEGLImageTextureHost, so that
RenderEGLImageTextureHost does not attempt to wait on an EGLSync that
has been destroyed. This can be achieved by passing the surface to
RemoteTextureOwnerClient::PushTexture(), ensuring the RemoteTextureMap
keeps it alive.

However, we must be careful not to recycle the SharedSurface_EGLImage,
as that is currently not supported. To achieve this, we make
RemoteTextureMap::RecycleTexture() only recycle SharedSurfaces whose
mDesc.canRecycle value is true.

Differential Revision: https://phabricator.services.mozilla.com/D211292
This commit is contained in:
Jamie Nicol 2024-07-22 20:23:38 +00:00
parent 34ec60f7ff
commit dda2aa9413
2 changed files with 7 additions and 0 deletions

View File

@ -1377,6 +1377,7 @@ bool WebGLContext::PushRemoteTexture(
case layers::SurfaceDescriptor::TSurfaceDescriptorMacIOSurface:
case layers::SurfaceDescriptor::TSurfaceTextureDescriptor:
case layers::SurfaceDescriptor::TSurfaceDescriptorAndroidHardwareBuffer:
case layers::SurfaceDescriptor::TEGLImageDescriptor:
case layers::SurfaceDescriptor::TSurfaceDescriptorDMABuf:
keepAlive = surf;
break;

View File

@ -324,6 +324,12 @@ bool RemoteTextureMap::RecycleTexture(
RemoteTextureRecycleBin::RecycledTextureHolder recycled{info.size,
info.format};
if (aHolder.mResourceWrapper) {
// Don't attempt to recycle non-recyclable shared surfaces
if (aHolder.mResourceWrapper->mSharedSurface &&
!aHolder.mResourceWrapper->mSharedSurface->mDesc.canRecycle) {
return false;
}
// Recycle shared texture
SurfaceDescriptor desc;
if (!aHolder.mTextureData->Serialize(desc)) {