gecko uses IDXGIResource::GetSharedHandle(). But it is recommend not to use anymore to retrieve the handle to a shared resource.
IDXGIResource1::CreateSharedHandle() with D3D11_RESOURCE_MISC_SHARED_NTHANDLE flag should be used instead of the GetSharedHandle().
The CreateSharedHandle() could be called only once for a shared resource. Later calls fail.
HANDLEs of ID3D11Texture2D are replaced by gfx::FileHandleWrappers.
Differential Revision: https://phabricator.services.mozilla.com/D192173
On a given thread, if there are outside users of OpenGL (such as WebRender) that don't go
through the GLContext interface to set the current context, the TLS current context value
may be incorrect. To solve this, we need to assume that on establishing some TLS scopes,
that the current context value is unreliable and invalidate it so that it gets properly
reset.
Differential Revision: https://phabricator.services.mozilla.com/D194350
When we call IDXGIKeyedMutex::AcquireSync, we need to check for a
general failure, WAIT_ABANDONED and WAIT_TIMEOUT. The last two are
special because Microsoft's SUCCEEDED and FAILED macros consider them
successful.
Differential Revision: https://phabricator.services.mozilla.com/D196668
In CompositorOGL (used by software webrender on Android) as an
optimization we use glInvalidateFramebuffer rather than glClear for
the color attachment if there is no non-opaque invalid region. This
causes rendering glitches on the Samsung Xclipse 920 GPU. This patch
marks GLfeature::invalidate_framebuffer as unsupported on this GPU,
causing us to fall back to the glClear pach which avoids the glitches.
Differential Revision: https://phabricator.services.mozilla.com/D196416
Pixel 6, 7, and 8 devices running Android 14 are affected by a bug
where video frames with SMPTE 432 color primaries are rendered
incorrectly when sampled from an external texture in GLES. To work
around this, we force these frames to be converted to RGB using BT709
colorspace instead. While this won't look exactly right, it is much
better than the current situation.
When we detect that a frame is decoded with that color space on an
affected device, we set a "ForceBT709" flag which gets passed through
to webrender as a new ImageBufferKind. Rendering this ImageBufferKind
is handled via a new shader feature TEXTURE_EXTERNAL_BT709, which
works much like the existing TEXTURE_EXTERNAL feature, but
additionally uses the EXT_YUV_TARGET extension to override the
colorspace transformation.
This approach could be extended in the future to handle additional
colorspace transformations, but for now only handles the one required
to workaround this particular driver bug.
Differential Revision: https://phabricator.services.mozilla.com/D195800
We are seeing crashes on the european Samsung S22 family of devices in
eglTerminate after updating to Android 14. To work around this we
deliberately leak the EGLDisplay on affected devices. In practice we
only ever use the default EGLDisplay on Android, and calling
eglInitialize multiple times is allowed, so this is fine.
Note this only occurs when running webgl in the content process, which
will occur naturally following enough GPU process crashes that we
disable the GPU process. When webgl is running in the GPU process
webrender keeps the EGLDisplay alive, meaning we never terminate it.
Differential Revision: https://phabricator.services.mozilla.com/D196146
We are seeing crashes on the european Samsung S22 family of devices in
eglTerminate after updating to Android 14. To work around this we
deliberately leak the EGLDisplay on affected devices. In practice we
only ever use the default EGLDisplay on Android, and calling
eglInitialize multiple times is allowed, so this is fine.
Note this only occurs when running webgl in the content process, which
will occur naturally following enough GPU process crashes that we
disable the GPU process. When webgl is running in the GPU process
webrender keeps the EGLDisplay alive, meaning we never terminate it.
Differential Revision: https://phabricator.services.mozilla.com/D196146
Pixel 6, 7, and 8 devices running Android 14 are affected by a bug
where video frames with SMPTE 432 color primaries are rendered
incorrectly when sampled from an external texture in GLES. To work
around this, we force these frames to be converted to RGB using BT709
colorspace instead. While this won't look exactly right, it is much
better than the current situation.
When we detect that a frame is decoded with that color space on an
affected device, we set a "ForceBT709" flag which gets passed through
to webrender as a new ImageBufferKind. Rendering this ImageBufferKind
is handled via a new shader feature TEXTURE_EXTERNAL_BT709, which
works much like the existing TEXTURE_EXTERNAL feature, but
additionally uses the EXT_YUV_TARGET extension to override the
colorspace transformation.
This approach could be extended in the future to handle additional
colorspace transformations, but for now only handles the one required
to workaround this particular driver bug.
Differential Revision: https://phabricator.services.mozilla.com/D195800
On a given thread, if there are outside users of OpenGL (such as WebRender) that don't go
through the GLContext interface to set the current context, the TLS current context value
may be incorrect. To solve this, we need to assume that on establishing some TLS scopes,
that the current context value is unreliable and invalidate it so that it gets properly
reset.
Differential Revision: https://phabricator.services.mozilla.com/D194350
The change is a preparation for Bug 1865984, Bug 1863474 and Bug 1861605.
FenceD3D11 is going to be used by Bug 1865984 and Bug 1863474. And FileHandleWrapper is going to be added for wrapping shared handle of ID3D11Fence and ID3D11Texture2D(Bug 1861605).
For now, FenceInfo is expected to be delivered just during creating TextureHost. It works for WebGL and WebGPU.
Differential Revision: https://phabricator.services.mozilla.com/D194612
The change is a preparation for Bug 1865984, Bug 1863474 and Bug 1861605.
FenceD3D11 is going to be used by Bug 1865984 and Bug 1863474. And FileHandleWrapper is going to be added for wrapping shared handle of ID3D11Fence and ID3D11Texture2D(Bug 1861605).
For now, FenceInfo is expected to be delivered just during creating TextureHost. It works for WebGL and WebGPU.
Differential Revision: https://phabricator.services.mozilla.com/D194612
On a given thread, if there are outside users of OpenGL (such as WebRender) that don't go
through the GLContext interface to set the current context, the TLS current context value
may be incorrect. To solve this, we need to assume that on establishing some TLS scopes,
that the current context value is unreliable and invalidate it so that it gets properly
reset.
Differential Revision: https://phabricator.services.mozilla.com/D194350
In current gecko, SharedSurface_ANGLEShareHandle requests ANGLE to allocate ID3D11Texture2D. But Bug 1865984 and Bug 1861605 requests to change D3D11_TEXTURE2D_DESC::MiscFlags. To do it, the ID3D11Texture2D needs to be allocated by SharedSurface_ANGLEShareHandle.
Differential Revision: https://phabricator.services.mozilla.com/D194332
Use sigle point of release for EGL surfaces (GLContextEGL::DestroySurface()) and also release Wayland related structures here.
Differential Revision: https://phabricator.services.mozilla.com/D190152
On devices where GL_RGB is a color-renderable format, allow blitting
to GL_RGB textures to implement texture upload. This allows us to stay
on the fast-path when the source data is video and the target texture
format is GL_RGB. In fact, on Android this makes it work at all, as
the slow-path is not actually implemented.
Differential Revision: https://phabricator.services.mozilla.com/D167159
SyncObjectD3D11Host::Synchronize() could spend time when GPU is busy.
The Synchronize() call is not necessary when all RenderDXGITextureHosts have GpuProcessTextureId or KeyedMutex.
Differential Revision: https://phabricator.services.mozilla.com/D185619