Commit Graph

582 Commits

Author SHA1 Message Date
Lee Salzman
2b51d84c47 Bug 1894929 - Disable gl::SwapChain's internal pooling when RemoteTextureMap is used. r=jnicol,gfx-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D210864
2024-05-20 18:21:15 +00:00
Kelsey Gilbert
f72ec6e498 Bug 1885447 - Tonemap/color-manage webgl sdr/wcg output into Display profile as pre-compositor post-process. r=gfx-reviewers,webidl,smaug,ahale
Differential Revision: https://phabricator.services.mozilla.com/D207651
2024-05-06 23:36:51 +00:00
Stanca Serban
8996a6a522 Backed out changeset 995596d4362c (bug 1885447) for causing build bustages in AutoMappable.h. CLOSED TREE 2024-04-23 22:19:00 +03:00
Kelsey Gilbert
7393b7c768 Bug 1885447 - Tonemap/color-manage webgl sdr/wcg output into Display profile as pre-compositor post-process. r=gfx-reviewers,webidl,smaug,ahale
Differential Revision: https://phabricator.services.mozilla.com/D207651
2024-04-23 16:54:05 +00:00
Kelsey Gilbert
e4080e620a Bug 1887335 - Poll=4ms for WebGLSync completion, async-notify child. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D206294
2024-04-02 20:36:25 +00:00
Kelsey Gilbert
ecea021dd3 Bug 1883225 - webgl.texSubImage(video): re-enable gpu-blit for RGBA, and RGB iff RGB8+SRGB8 renderable. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D203698
2024-03-09 05:35:20 +00:00
Jeff Muizelaar
bff9a39458 Bug 1877726. Revert "Bug 1664063 - Ensure we consistently handle all errors from IDXGIKeyedMutex::AcquireSync.".
This reverts commit e25a5f344af32bdd689500bae7b4f24f205ba9f0.

We believe bug 1664063 was causing to hit some broken device reset
handling code.

Differential Revision: https://phabricator.services.mozilla.com/D201658
2024-02-13 04:25:35 +00:00
Kelsey Gilbert
f9468430e1 Bug 1794893 - WebGLMemoryTracker ensured-registered in WebGLContext::ctor. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D200851
2024-02-06 19:34:26 +00:00
Lee Salzman
25a04a247d Bug 1877010 - Track forwarder transaction ids for RemoteTextureMap with WebGL and WebGPU. r=sotaro
Differential Revision: https://phabricator.services.mozilla.com/D199876
2024-01-30 15:44:04 +00:00
Lee Salzman
3c808bc246 Bug 1876506 - Check for CopyToSwapChain failure. r=aosmond
CopyToSwapChain was silently failing, causing no texture to get pushed
to RemoteTextureMap, so that when a wait on it was occurring, it would
timeout.

The failure occurred in DrawTargetWebgl::FlushFromSkia, because the
DT's size actually exceeded the value of the texture limit pref when
it was attempting to allocate a temporary texture to blend back a
Skia layer to the WebGL framebuffer. This is fixed by allowing layering
to bypass this limit, as it is always expected that layer blending
succeed.

To guard against future instances of this bug, CopyToSwapChain now returns
a boolean result so that it is fallible and can signal to CanvasTranslator
that it needs to take appropriate fallback measures on failure.

Differential Revision: https://phabricator.services.mozilla.com/D199794
2024-01-27 15:56:04 +00:00
sotaro
f52ae4f4f6 Bug 1875980 - Always notify context lost RemoteTextureOwner in WebGLContext::Present() r=gfx-reviewers,lsalzman
During testing Bug 1863257, there were cases that test failed with timeout in RemoteTextureMap::WaitRemoteTextureReady(). In this case, RemoteTextureOwner was not registered since first Surface allocation was failed at GeckoProcessManager.getSurfaceAllocator().

Even with the case, RemoteTextureOwner should be registered as context lost.

Differential Revision: https://phabricator.services.mozilla.com/D199312
2024-01-23 06:55:02 +00:00
Lee Salzman
899e73a619 Bug 1875193 - Don't recycle SharedSurfaces from different SurfaceFactory. r=sotaro
It looks like we're accidentally putting SharedSurfaces that came from a different
SurfaceFactory back into a different one recycling. This happens because on context
loss in CanvasTranslator, the old GL context may go away, though the RemoteTextureOwnerClient
has a shared recycling bin that might accidentally keep the old surfaces.

This also tries to clear the old recycled surfaces as soon as possible on a context
loss now.

Differential Revision: https://phabricator.services.mozilla.com/D198918
2024-01-18 06:46:51 +00:00
Lee Salzman
2364029b02 Bug 1874534 - Fix DrawTargetWebgl and RemoteTextureMap context loss handling. r=aosmond
When a context loss occurs on DrawTargetWebgl, this may result in a fallback TextureData
being created. Each of these are currently managed by two different RemoteTextureOwnerClients.
This is not really safe at all.

To fix this, CopyToSwapChain is modified so that it can be supplied a RemoteTextureOwnerClient.
Then CanvasTranslator can inject its own RemoteTextureOwnerClient into CopyToSwapChain, rather
than letting CopyToSwapChain use its own separate internal RemoteTextureOwnerClient.

This also tries to address a few other data consistency bugs with the fallback TextureData.

Differential Revision: https://phabricator.services.mozilla.com/D198487
2024-01-13 18:19:24 +00:00
sotaro
c66558645d Bug 1868927 - Remove RemoteTextureHostWrapper's async mode r=gfx-reviewers,lsalzman
By removing the async mode, remote texture implementation becomes simpler.

Differential Revision: https://phabricator.services.mozilla.com/D197323
2024-01-07 22:47:05 +00:00
Kelsey Gilbert
0ce272935b Bug 1655101 - Allow webgl.texImage gpu-blit for RGB8 if supported. r=gfx-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D194943
2024-01-04 18:38:52 +00:00
Lee Salzman
c25839df68 Bug 1872087 - Share recycling across WebGL framebuffers on a single context. r=aosmond,gfx-reviewers
This was a change for bug 1872087 that somehow got lost when I was rebasing. The idea
here is that DrawTargetWebgls use a single shared WebGL context, so it makes sense for
them to share recycle texture data, much like CanvasTranslator shares recycling of
texture data for D2D. This should increase the efficiency of use-cases that create and
destroy a lot of canvases every frame and would not normally benefit from recycling.

Depends on D197375

Differential Revision: https://phabricator.services.mozilla.com/D197376
2023-12-28 20:29:58 +00:00
Norisz Fay
85c1b98629 Backed out 3 changesets (bug 1872087, bug 1767344, bug 1872159) for causing gpu related leak failures CLOSED TREE
Backed out changeset 2c0ef884644c (bug 1872087)
Backed out changeset 0cf50076e7ee (bug 1872159)
Backed out changeset a4148511920c (bug 1767344)
2023-12-28 21:24:33 +02:00
Lee Salzman
065613ca66 Bug 1872087 - Share recycling across WebGL framebuffers on a single context. r=aosmond,gfx-reviewers
This was a change for bug 1872087 that somehow got lost when I was rebasing. The idea
here is that DrawTargetWebgls use a single shared WebGL context, so it makes sense for
them to share recycle texture data, much like CanvasTranslator shares recycling of
texture data for D2D. This should increase the efficiency of use-cases that create and
destroy a lot of canvases every frame and would not normally benefit from recycling.

Depends on D197375

Differential Revision: https://phabricator.services.mozilla.com/D197376
2023-12-28 16:31:07 +00:00
Lee Salzman
ab390835ca Bug 1872087 - Share recycled texture data across remote texture owners on a single client. r=sotaro,gfx-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D197324
2023-12-27 14:56:24 +00:00
Lee Salzman
69cc2255fd Bug 1829026 - Allow WebGLContext::PushRemoteTexture to specify an explicit pid. r=aosmond
Since we're not using WebGL remoting, we no longer have direct knowledge of the pid across
the IPDL gap inside WebGLContext. This must be explicitly passed in.

Differential Revision: https://phabricator.services.mozilla.com/D194348
2023-12-18 18:10:45 +00:00
Lee Salzman
f8c05c0396 Bug 1829026 - Allow WebGLContext to work without a host or client wrapper. r=jgilbert,aosmond
DrawTargetWebgl will use WebGLContext in a direct, non-networked capacity. Currently
there are only a few places WebGLContext actually checks for a host context, and those
are easily stubbed our or made conditional.

Differential Revision: https://phabricator.services.mozilla.com/D194347
2023-12-18 18:10:45 +00:00
Andrew Osmond
90a104b8c5 Bug 1664063 - Ensure we consistently handle all errors from IDXGIKeyedMutex::AcquireSync. r=gfx-reviewers,lsalzman
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
2023-12-18 16:41:54 +00:00
Sebastian Hengst
cdce9d5ae9 Backed out 10 changesets (bug 1829026) for causing bug 1869760 and bug 1869738. a=backout
Backed out changeset 4c619422efe5 (bug 1829026)
Backed out changeset 77da89c7dab7 (bug 1829026)
Backed out changeset 19d28d8f75a4 (bug 1829026)
Backed out changeset 674b60ba54b1 (bug 1829026)
Backed out changeset 31935f164ef0 (bug 1829026)
Backed out changeset 13c9bf69085f (bug 1829026)
Backed out changeset 330a6732fc0b (bug 1829026)
Backed out changeset 974c08a3791b (bug 1829026)
Backed out changeset 3ba040642ddc (bug 1829026)
Backed out changeset 9d9b3a68858c (bug 1829026)
2023-12-13 19:20:00 +01:00
Lee Salzman
38a4d8fc90 Bug 1829026 - Allow WebGLContext::PushRemoteTexture to specify an explicit pid. r=aosmond
Since we're not using WebGL remoting, we no longer have direct knowledge of the pid across
the IPDL gap inside WebGLContext. This must be explicitly passed in.

Differential Revision: https://phabricator.services.mozilla.com/D194348
2023-12-12 07:35:01 +00:00
Lee Salzman
794d964e19 Bug 1829026 - Allow WebGLContext to work without a host or client wrapper. r=jgilbert,aosmond
DrawTargetWebgl will use WebGLContext in a direct, non-networked capacity. Currently
there are only a few places WebGLContext actually checks for a host context, and those
are easily stubbed our or made conditional.

Differential Revision: https://phabricator.services.mozilla.com/D194347
2023-12-12 07:35:01 +00:00
Andrew Osmond
ed08ff90d5 Bug 1868397 - Make WebGL use VideoBridge to avoid copies with GPUVideoImage. r=jgilbert
This patch makes it so that WebGL that runs in the compositor process
can take advantage of the fact that GPUVideoImage should have an already
created TextureHost between the compositor process and the producing
utility process. For software decoders, this will allow us to avoid a
copy into a shmem from the utility process, and another copy into a
shmem to the compositor process.

Differential Revision: https://phabricator.services.mozilla.com/D195559
2023-12-06 19:31:32 +00:00
Cosmin Sabou
088aba68e8 Backed out 8 changesets (bug 1829026) for causing several mochitest failures. CLOSED TREE
Backed out changeset 790ba6aa65e4 (bug 1829026)
Backed out changeset 2ff1f5f41380 (bug 1829026)
Backed out changeset de6ddf5eb2a7 (bug 1829026)
Backed out changeset 773e7b31ac6e (bug 1829026)
Backed out changeset e09602ab096d (bug 1829026)
Backed out changeset fe16d4ac1049 (bug 1829026)
Backed out changeset c0fe0aea86c2 (bug 1829026)
Backed out changeset 53d6f69055f1 (bug 1829026)
2023-12-05 16:08:36 +02:00
Lee Salzman
d3f66f907e Bug 1829026 - Allow WebGLContext::PushRemoteTexture to specify an explicit pid. r=aosmond
Since we're not using WebGL remoting, we no longer have direct knowledge of the pid across
the IPDL gap inside WebGLContext. This must be explicitly passed in.

Differential Revision: https://phabricator.services.mozilla.com/D194348
2023-12-05 09:37:02 +00:00
Lee Salzman
a9d18eacda Bug 1829026 - Allow WebGLContext to work without a host or client wrapper. r=jgilbert,aosmond
DrawTargetWebgl will use WebGLContext in a direct, non-networked capacity. Currently
there are only a few places WebGLContext actually checks for a host context, and those
are easily stubbed our or made conditional.

Differential Revision: https://phabricator.services.mozilla.com/D194347
2023-12-05 09:37:02 +00:00
Cosmin Sabou
0db4b6a2ba Backed out changeset 7aa58b8ef68a (bug 1655101) for causing bustages on dom/WebGLIpdl.h. CLOSED TREE 2023-11-30 21:06:53 +02:00
Kelsey Gilbert
b8e33d2390 Bug 1655101 - Allow webgl.texImage gpu-blit for RGB8 if supported. r=gfx-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D194943
2023-11-30 17:40:42 +00:00
Cosmin Sabou
0cdca790f8 Backed out changeset 1e7d530afef0 (bug 1862039) for causing GLContext related crashes. 2023-11-09 19:27:41 +02:00
Nicolas Silva
523ffeabdb Bug 1862039 - Don't set GL_CONTEXT_FLAG_NO_ERROR_BIT with mesa. r=gfx-reviewers,jgilbert,jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D193053
2023-11-09 16:40:46 +00:00
Kelsey Gilbert
86319b38ea Bug 1841050 - Add pref webgl.gl_khr_no_error:true. r=gfx-reviewers,bradwerth
This allows for disabling WebGL's use of GL_KHR_no_error, rather than the default of enabled.

Use snake_case so that searching for KHR_no_error finds this more
easily.

Differential Revision: https://phabricator.services.mozilla.com/D188781
2023-10-25 00:20:59 +00:00
sotaro
162407e36c Bug 1854541 - Add webgpu::ExternalTexture handling to RemoteTextureMap r=gfx-reviewers,lsalzman
It is a preparation for Bug 1843891.
RemoteTextureMap needs to handle webgpu::ExternalTexture.

Differential Revision: https://phabricator.services.mozilla.com/D188928
2023-09-26 07:17:54 +00:00
sotaro
be652aeaf7 Bug 1851432 - Add error handling to WebGLContext::PushRemoteTexture() r=gfx-reviewers,lsalzman
SharedSurface_DMABUF::ToSurfaceDescriptor() could return Nothing() with error. It needs to be handled as failure.

SharedSurface::ToSurfaceDescriptor() is expected to return Nothing() only with SharedSurface_Basic.

Differential Revision: https://phabricator.services.mozilla.com/D188078
2023-09-14 00:24:42 +00:00
Kelsey Gilbert
a9ce34156e Bug 1849433 - Code cleanups in dom/canvas/WebGL. r=gfx-reviewers,gw
Differential Revision: https://phabricator.services.mozilla.com/D186589
2023-08-31 21:45:35 +00:00
David Turner
e164f40a46 Bug 1848171 - Recycle SharedSurface_DMABUF on WebGL with RemoteTexture r=gfx-reviewers,sotaro
Currently WebGL on the GTK backend constantly creates new DMAbuf
surfaces for every frame, causing high CPU usage (Bug 1848171).  At
60fps on a high-end Intel CPU this uses 50% of a core. On a Raspberry Pi
4 this uses around 100% of a core and limits FPS to about 50.

This patch allows DMABufSurfaces to be recycled and so greatly reduces
CPU usage on WebGL content (on a Raspberry Pi 4 this halves the CPU
usage on https://www.testufo.com/stutter#demo=smooth&foreground=ffffff&background=000000&pps=720

This patch was originally authored by Sotaro Ikeda but did not solve
their problem, I am co-opting it to fix Bug 1848171.

Differential Revision: https://phabricator.services.mozilla.com/D186223
2023-08-17 16:47:52 +00:00
Chris Peterson
6640998d0c Bug 1846113 - Remove some always-true macOS version checks now that Firefox only supports macOS >= 10.15. r=gfx-reviewers,jgilbert
Also remove mNeedsFakeNoStencil_UserFBs code in WebGLContext.h/cpp that was only needed on Intel macOS <= 10.11.

Differential Revision: https://phabricator.services.mozilla.com/D184880
2023-08-01 05:05:48 +00:00
stransky
aa1af63997 Bug 1833855 [Linux] Replace kIsX11 and kIsWayland with kIsLinux r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D178647
2023-06-22 13:42:39 +00:00
Cristian Tuns
48e7cfef13 Backed out 14 changesets (bug 1833855) for causing build bustages in DMABufSurface.cpp CLOSED TREE
Backed out changeset b8daeb03b670 (bug 1833855)
Backed out changeset cc17af8bae3d (bug 1833855)
Backed out changeset 2d4f6b8ad5d3 (bug 1833855)
Backed out changeset 3b75e59357bb (bug 1833855)
Backed out changeset 86948033f163 (bug 1833855)
Backed out changeset 3e6387b95e39 (bug 1833855)
Backed out changeset 7f22e082786c (bug 1833855)
Backed out changeset 9d5ae056d3c8 (bug 1833855)
Backed out changeset b0a7ca2dfbd6 (bug 1833855)
Backed out changeset ac0947e6e601 (bug 1833855)
Backed out changeset a058367a436a (bug 1833855)
Backed out changeset 7b4da292159c (bug 1833855)
Backed out changeset d50ae530998d (bug 1833855)
Backed out changeset 895b93846598 (bug 1833855)
2023-06-22 08:05:40 -04:00
stransky
cea5320d14 Bug 1833855 [Linux] Replace kIsX11 and kIsWayland with kIsLinux r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D178647
2023-06-22 11:17:24 +00:00
Cristian Tuns
270acd05ee Backed out 14 changesets (bug 1833855) for causing build bustages in SharedSurface.cpp CLOSED TREE
Backed out changeset c3f7d1963902 (bug 1833855)
Backed out changeset 347c47f5542a (bug 1833855)
Backed out changeset 2c0807d0b39a (bug 1833855)
Backed out changeset 013d1d16194d (bug 1833855)
Backed out changeset 2e49d43a627c (bug 1833855)
Backed out changeset ea21e90a71dd (bug 1833855)
Backed out changeset 8d5d0690668c (bug 1833855)
Backed out changeset 4eb11068275d (bug 1833855)
Backed out changeset 15120d9c5b24 (bug 1833855)
Backed out changeset b75750bb7596 (bug 1833855)
Backed out changeset 6f94e3f002ed (bug 1833855)
Backed out changeset 3235825211f9 (bug 1833855)
Backed out changeset 47a6e9ed8828 (bug 1833855)
Backed out changeset b8013c43aa20 (bug 1833855)
2023-06-22 05:29:12 -04:00
stransky
df34eee8b6 Bug 1833855 [Linux] Replace kIsX11 and kIsWayland with kIsLinux r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D178647
2023-06-22 08:35:58 +00:00
sotaro
3e27db98be Bug 1834302 - Add WebGL context lost handling to RemoteTextureMap r=lsalzman,gfx-reviewers
When WebGL context is lost, we could not expect that pending remote texture becomes ready. We do not need to wait the remote texture ready.

Differential Revision: https://phabricator.services.mozilla.com/D180303
2023-06-09 06:48:55 +00:00
Jeff Muizelaar
97c3f119f0 Bug 1833030. Don't use native_srgb on Windows. r=jgilbert
There was confusion about the purpose of this pref. Just hard code
it for now.

Differential Revision: https://phabricator.services.mozilla.com/D178355
2023-05-26 01:35:33 +00:00
Kelsey Gilbert
3cc7f14e8c Bug 1804368 - Add webgl.forbid-software/forbid-hardware on Mac. r=gfx-reviewers,lsalzman
I would prefer to leave "this doesn't work on linux/windows/android as open bugs to be handled later.

Differential Revision: https://phabricator.services.mozilla.com/D164016
2023-04-03 21:25:41 +00:00
stransky
e5e7571c51 Bug 1809026 [Linux] Implement fast DMABuf WebGL textures upload r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D167240
2023-02-27 11:20:09 +00:00
sotaro
8e6f5e5b31 Bug 1810097 - Support AHardwareBuffer of out-of-process WebGL on Android r=lsalzman,gfx-reviewers
Modify AHardwareBuffer implementation as to support gl::SharedSurface of out-of-process WebGL. And remove unused AHardwareBuffer implementation.

By limiting AHardwareBuffer only in GPU process, AHardwareBuffer implementation becomes simpler. We do not need to handle cross process AHardwareBuffer delivery and cross process android Fence delivery.

Differential Revision: https://phabricator.services.mozilla.com/D167911
2023-01-27 21:35:26 +00:00
Jeff Muizelaar
57a1004505 Bug 1803375. Use different coordinates when running on AMD. r=lsalzman,jgilbert
This updates the version wpf-gpu-raster which adds support for
GPUs/drivers that use truncation instead of rounding when converting
vertices to fixed point.

It also adds the GL vendor to InitContextResult so that we can detect
AMD on macOS and tell wpf-gpu-raster that truncation is going to happen.

Differential Revision: https://phabricator.services.mozilla.com/D167503
2023-01-27 01:45:17 +00:00