Commit graph

255 commits

Author SHA1 Message Date
sotaro
4bb5a78f8e Bug 1688020 - Release image of SurfaceDescriptorD3D10 after WebGLContext::TexImage() also with in-process WebGL r=gfx-reviewers,lsalzman
Like Bug 1798624, image of SurfaceDescriptorD3D10  needs to be kept alive until WebGLContext::TexImage() call with in-process WebGL.

Differential Revision: https://phabricator.services.mozilla.com/D165109
2022-12-20 04:25:15 +00:00
Andrew McCreight
dec541b90a Bug 1805931, part 1 - Declare Root and Unroot inline to save on boilerplate. r=smaug
Bug 181137 made ContentIteratorBase no longer refcounted, but
it did not remove this bit of CC boilerplate. With the inline
root, using this macro in a non-refcounted class is an error.

ObjectModel.h and ClientWebGLContext.cpp used macros to define
root and unroot, but that is no longer needed.

Differential Revision: https://phabricator.services.mozilla.com/D164828
2022-12-15 19:45:00 +00:00
sotaro
02d18ed8c1 Bug 1776885 - Add capability of async remote texture on WebGL if CanvasRenderThread is used r=gfx-reviewers,lsalzman
The remote texture is processed asynchronously, but the WebGL rendering results are rendered synchronously with WebRender transaction by WebRender.

Async remote texture support is enabled only when CanvasRenderThread is used. This is to simplify implementation.

In async mode, remote texture of current RemoteTextureId might not be created yet when WebRenderImageHost::UseRemoteTexture() is called. In this case, RemoteTextureHostWrapper uses its own external image ID, otherwise the RemoteTextureHostWrapper uses compatible old remote texture for creating wr display list. RenderTextureHostWrapper calls RemoteTextureMap::GetExternalImageIdOfRemoteTextureSync() before is ussage. The GetExternalImageIdOfRemoteTextureSync() synchronously waits until remote texture becomes ready. The wait works since WebGL IPC handling is always done in CanvasRenderThread in async mode.

PWebGLChild::SendGetFrontBuffer() triggers sync IPC. It is called to ensure the compatible remote texture in RemoteTextureMap during RemoteTextureMap::GetRemoteTextureForDisplayList() call.

Differential Revision: https://phabricator.services.mozilla.com/D162971
2022-12-07 02:24:57 +00:00
Kelsey Gilbert
e335b58f95 Bug 1801095 - Don't expose webgl_-prefixed uniforms to webgl. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D164007
2022-12-07 02:14:03 +00:00
Stanca Serban
d0ad6a0b22 Backed out changeset d78a41db7a82 (bug 1776885) for causing reftests failures in ReleaseCompositableRef. CLOSED TREE 2022-12-06 17:34:12 +02:00
sotaro
e23cea6ac1 Bug 1776885 - Add capability of async remote texture on WebGL if CanvasRenderThread is used r=gfx-reviewers,lsalzman
The remote texture is processed asynchronously, but the WebGL rendering results are rendered synchronously with WebRender transaction by WebRender.

Async remote texture support is enabled only when CanvasRenderThread is used. This is to simplify implementation.

In async mode, remote texture of current RemoteTextureId might not be created yet when WebRenderImageHost::UseRemoteTexture() is called. In this case, RemoteTextureHostWrapper uses its own external image ID, otherwise the RemoteTextureHostWrapper uses compatible old remote texture for creating wr display list. RenderTextureHostWrapper calls RemoteTextureMap::GetExternalImageIdOfRemoteTextureSync() before is ussage. The GetExternalImageIdOfRemoteTextureSync() synchronously waits until remote texture becomes ready. The wait works since WebGL IPC handling is always done in CanvasRenderThread in async mode.

PWebGLChild::SendGetFrontBuffer() triggers sync IPC. It is called to ensure the compatible remote texture in RemoteTextureMap during RemoteTextureMap::GetRemoteTextureForDisplayList() call.

Differential Revision: https://phabricator.services.mozilla.com/D162971
2022-12-06 13:56:19 +00:00
Kelsey Gilbert
103503c9a5 Bug 1645092 - Don't fail GetUniform if the program is not current. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D163401
2022-11-30 08:18:10 +00:00
Csoregi Natalia
dc69b21404 Backed out changeset 71ab84eb3e33 (bug 1645092) for causing build bustages. CLOSED TREE 2022-11-30 06:54:06 +02:00
Kelsey Gilbert
8594b62bb9 Bug 1645092 - Don't fail GetUniform if the program is not current. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D163401
2022-11-30 04:23:40 +00:00
Botond Ballo
68c71a503c Bug 1802225 - Remove Layers.{h,cpp}. r=tnikkel,geckoview-reviewers,jgilbert,media-playback-reviewers,padenot,m_kato
Where appropriate, `#include "Layers.h"` is replaced with
more specific inclusions.

Differential Revision: https://phabricator.services.mozilla.com/D162934
2022-11-29 01:52:03 +00:00
Lee Salzman
cb9096e766 Bug 1799402 - Use WGR to rasterize paths in DrawTargetWebgl. r=jrmuizel
This adds a path vertex buffer where triangle list output from WGR is stored.
Each PathCacheEntry can potentially reference a range of vertexes in this buffer
corresponding to triangles for that entry. When this buffer is full, it gets
orphaned and clears corresponding cache entries, so that it can start anew.

Differential Revision: https://phabricator.services.mozilla.com/D161479
2022-11-12 08:06:44 +00:00
Iulian Moraru
f838c68136 Backed out 3 changesets (bug 1799402) for causing windows build bustages. CLOSED TREE
Backed out changeset e51cd76008ef (bug 1799402)
Backed out changeset 3ff660b475ff (bug 1799402)
Backed out changeset 9cfa7581565e (bug 1799402)
2022-11-12 08:33:24 +02:00
Lee Salzman
bea9f37e42 Bug 1799402 - Use WGR to rasterize paths in DrawTargetWebgl. r=jrmuizel
This adds a path vertex buffer where triangle list output from WGR is stored.
Each PathCacheEntry can potentially reference a range of vertexes in this buffer
corresponding to triangles for that entry. When this buffer is full, it gets
orphaned and clears corresponding cache entries, so that it can start anew.

Differential Revision: https://phabricator.services.mozilla.com/D161479
2022-11-12 05:42:30 +00:00
Emilio Cobos Álvarez
44ef3b8685 Bug 1799435 - Make RFP checks faster. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D161447
2022-11-08 02:36:25 +00:00
sotaro
93ee669086 Bug 1798624 - Release image of SurfaceDescriptorD3D10 on Send-side after Ping response r=jgilbert,gfx-reviewers
GPUVideoTextureClient of SurfaceDescriptorD3D10 needs to be kept alive until WebGLParent::RecvTexImage() is handled by parent side.

Confirmed that test_conformance__textures__misc__texture-npot-video.html test failure was addressed.

Differential Revision: https://phabricator.services.mozilla.com/D161015
2022-11-08 00:32:17 +00:00
Sandor Molnar
7a39c6eef3 Backed out changeset c7f5349824c4 (bug 1799435) for causing crashes in mozilla::dom::HTMLImageElement::LoadSelectedImage CLOSED TREE 2022-11-08 02:39:14 +02:00
Emilio Cobos Álvarez
68c342910f Bug 1799435 - Make RFP checks faster. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D161447
2022-11-07 22:23:50 +00:00
Iulian Moraru
2f0dd0e293 Backed out changeset 44cb21194dc0 (bug 1799435) for causing multiple resist fingerprint related failures. CLOSED TREE 2022-11-07 18:42:11 +02:00
Emilio Cobos Álvarez
bac0597c49 Bug 1799435 - Make RFP checks faster. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D161447
2022-11-07 14:40:57 +00:00
Kelsey Gilbert
2e7f5f28e7 Bug 1798703 - Enforce alignment for UniformData via union rather than overalignment. r=lsalzman
Reverts the overalignment from bug 1794237.

Differential Revision: https://phabricator.services.mozilla.com/D161360
2022-11-07 07:24:43 +00:00
sotaro
6b45a3fe5d Bug 1795050 - Set mResetLayer = true in ClientWebGLContext::Event_webglcontextrestored() r=gfx-reviewers,lsalzman
There was still a timing that hit the assert. When ClientWebGLContext::Event_webglcontextrestored() was called just before ClientWebGLContext::UpdateWebRenderCanvasData() the assert was failed.

Differential Revision: https://phabricator.services.mozilla.com/D161243
2022-11-05 04:14:31 +00:00
Kelsey Gilbert
cde25793b6 Bug 1798539 - Release temp shmem on Send-side after Ping response. r=gfx-reviewers,lsalzman
Originally, we special-cased shmems to try to send them directly
without a copy.
Unfortunately, ipc::Shmem doesn't support that, so we
allocated a new shmem on PWebGL and sent that.
However, we didn't include shmem-cleanup steps in RecvTexImage, so we
leaked the shmem.

We would be tempted to check inside the Desc in RecvTexImage and cleanup that
shmem, *however* RawTexImage from dtwebgl also uses this path, and its shmems
are UnsafeShmems, which are *not* supposed to be cleaned up.

Rather than adding e.g. a bool to differentiate them, let's just explicitly do
the cleanup in the caller that knows it needs to clean up.

One pattern I want to use more often for cross-process lifetimes is:
```
  foo = new RefcountedResource();
  SendUseAsync(foo);
  SendPing()->Then([foo]() {});
```

By the time we the promise from SendPing is resolved, we know the remote side is
done with `foo`, and so our trivial capturing lambda will take care of releasing
it on the Send side. It's straightforward and safe, and the lifetimes have one
extra return-trip of latency, but that's almost always fine.

Differential Revision: https://phabricator.services.mozilla.com/D160996
2022-11-02 05:22:09 +00:00
sotaro
2ca9b289bc Bug 1795050 - Add context lost check to ClientWebGLContext::UpdateWebRenderCanvasData() r=gfx-reviewers,lsalzman
There was a case that context was lost with mResetLayer=false.

Differential Revision: https://phabricator.services.mozilla.com/D160874
2022-11-01 08:13:54 +00:00
Kelsey Gilbert
8c20431fa2 Bug 1696693 - Don't blit-tex-upload for srgb textures. r=gfx-reviewers,bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D159649
2022-10-19 01:22:43 +00:00
Kelsey Gilbert
4e7b4b5647 Bug 1794956 - TransferToImageBitmap should reset bitmap but not state. r=gfx-reviewers,lsalzman
s/Reset/ResetBitmap/ and implement for WebGL and WebGPU.

Differential Revision: https://phabricator.services.mozilla.com/D159346
2022-10-16 22:52:40 +00:00
Iulian Moraru
b3fd738eb1 Backed out 2 changesets (bug 1794956) for causing wpt failures on offscreencanvas.transfer.to.imagebitmap.html. CLOSED TREE
Backed out changeset 7b3067b086e6 (bug 1794956)
Backed out changeset 3abcf6ccf88a (bug 1794956)
2022-10-15 19:09:01 +03:00
Kelsey Gilbert
4253cbe5b3 Bug 1794956 - TransferToImageBitmap should reset bitmap but not state. r=gfx-reviewers,lsalzman
s/Reset/ResetBitmap/ and implement for WebGL and WebGPU.

Differential Revision: https://phabricator.services.mozilla.com/D159346
2022-10-15 09:01:46 +00:00
Kelsey Gilbert
bb67af2abb Bug 1795372 - Remove redundant keepalives. r=gfx-reviewers,lsalzman
Now that FuncScope keepalives mNotLost, individual functions don't need
to.

Differential Revision: https://phabricator.services.mozilla.com/D159431
2022-10-14 23:10:19 +00:00
Kelsey Gilbert
2853c1d91c Bug 1795372 - Keepalive mNotLost within FuncScope. r=gfx-reviewers,lsalzman
Also remove unused FuncScopeId.

Differential Revision: https://phabricator.services.mozilla.com/D159428
2022-10-14 23:10:19 +00:00
Butkovits Atila
14c4666a5f Backed out changeset 0a2985a48339 (bug 1769747) for causing gl failures. 2022-10-05 01:38:13 +03:00
Kelsey Gilbert
5e0abe1b97 Bug 1769747 - Support non-RGBA video-to-texture fastpath. r=gfx-reviewers,nical
Also scale back some asserts from debug-fatal to just warnings, because
I kept hitting them during testing because of our poor surface lifetime
handling.

Differential Revision: https://phabricator.services.mozilla.com/D157993
2022-10-04 20:31:42 +00:00
sotaro
99f2276518 Bug 1792008 - Check size when mNotLost->mCanvasRenderer is re-used r=lsalzman,gfx-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D158096
2022-09-26 05:14:45 +00:00
Kelsey Gilbert
a32dfd5297 Bug 1785925 - Add LUT and Colorspace support to GLBlitHelper. r=lsalzman,media-playback-reviewers,alwu
This code was originally developed in bug 1771374, but here we omit the
DCLayerTree changes for later.

Differential Revision: https://phabricator.services.mozilla.com/D155027
2022-09-13 17:40:43 +00:00
Kelsey Gilbert
506a9b25d6 Bug 1755973 - Try implied arr+[0] in GetUniformIndices. r=gfx-reviewers,bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D156622
2022-09-12 21:51:55 +00:00
Marian-Vasile Laza
7ec7dec6f1 Backed out changeset f1e6746037f7 (bug 1785925) for causing reftest failures on DCLayerTree.cpp. CLOSED TREE 2022-09-06 23:35:51 +03:00
Kelsey Gilbert
24a9bc97bb Bug 1785925 - Add LUT and Colorspace support to GLBlitHelper. r=lsalzman,media-playback-reviewers,alwu
This code was originally developed in bug 1771374, but here we omit the
DCLayerTree changes for later.

Differential Revision: https://phabricator.services.mozilla.com/D155027
2022-09-06 18:36:34 +00:00
Cristian Tuns
3d56a1da28 Backed out changeset b14b975aa6d7 (bug 1785925) for causing build bustages on GLBlitHelper.cpp CLOSED TREE 2022-09-02 20:12:33 -04:00
Kelsey Gilbert
75cccdd5cb Bug 1785925 - Add LUT and Colorspace support to GLBlitHelper. r=lsalzman,media-playback-reviewers,alwu
This code was originally developed in bug 1771374, but here we omit the
DCLayerTree changes for later.

Differential Revision: https://phabricator.services.mozilla.com/D155027
2022-09-02 22:15:58 +00:00
Andrew Osmond
8d1323b0e8 Bug 1782722 - Make WebGL override unmasked renderer/vendor pref accesses thread safe. r=gfx-reviewers,lsalzman,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D153469
2022-08-16 01:00:22 +00:00
Kelsey Gilbert
f608e1f1e0 Bug 1778808 - Use stricter TiedFields instead of IsTriviallySerializable in WebGL's QueueParamTraits. r=lsalzman,nika
```
// We guarantee our robustness via these requirements:
// * Object.MutTiedFields() gives us a tuple,
// * where the combined sizeofs all field types sums to sizeof(Object),
//   * (thus we know we are exhaustively listing all fields)
// * where feeding each field back into ParamTraits succeeds,
// * and ParamTraits is only automated for BytesAlwaysValidT<T> types.
// (BytesAlwaysValidT rejects bool and enum types, and only accepts int/float
// types, or array or std::arrays of such types)
// (Yes, bit-field fields are rejected by MutTiedFields too)
```

BytesAlwaysValidT<T> is the same as the IsTriviallySerializable<T> that
it replaces, however the emphasis is different, and should discourage
tagging structs as IsTriviallySerializable, since they more clearly
aren't BytesAlwaysValid.

Differential Revision: https://phabricator.services.mozilla.com/D151676
2022-08-09 21:01:55 +00:00
Kelsey Gilbert
a8b77633d6 Bug 1778549 - Don't crash on validation failure in ReadPixelsPbo. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D153423
2022-08-03 06:10:31 +00:00
Iulian Moraru
27d760c7c2 Backed out 9 changesets (bug 1771374) for causing mochitest-webgl failures. CLOSED TREE
Backed out changeset ded977dd1896 (bug 1771374)
Backed out changeset adeb8b7d48f9 (bug 1771374)
Backed out changeset 7767340872c5 (bug 1771374)
Backed out changeset 33282b4ffaae (bug 1771374)
Backed out changeset 75db498cd0e7 (bug 1771374)
Backed out changeset 70035903ea37 (bug 1771374)
Backed out changeset 7c7de0fb66e1 (bug 1771374)
Backed out changeset 615df05e016f (bug 1771374)
Backed out changeset ac3411d21928 (bug 1771374)
2022-08-02 03:38:09 +03:00
Kelsey Gilbert
5702c0640c Bug 1771374 - Use {bool, T} instead of Maybe<T> for now. r=gfx-reviewers,lsalzman
`Maybe` isn't is_trivially_copyable, and std::optional isn't either on
the old libstdc++ we use from gcc7 still.

I'm working on more robust approach to serialization but that's beyond
the scope of this bug.

Differential Revision: https://phabricator.services.mozilla.com/D151421
2022-08-01 19:49:28 +00:00
Kelsey Gilbert
fa6e66aedd Bug 1771374 - Support display-p3 output via DirectComposition on Windows. r=sotaro,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D150275
2022-08-01 19:49:26 +00:00
Andrew Osmond
c5bc96cab6 Bug 1782242 - Remove assert for CanvasManagerChild::Get that we handle gracefully anyways. r=gfx-reviewers,bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D153290
2022-07-30 00:12:36 +00:00
sotaro
ba4ad83992 Bug 1779942 - Check IsContextLost() after DrawingBufferSize() call r=gfx-reviewers,jgilbert,lsalzman
ClientWebGLContext::DrawingBufferSize() could cause context lost. Then IsContextLost() check is added after the DrawingBufferSize() call.

Differential Revision: https://phabricator.services.mozilla.com/D152138
2022-07-19 07:00:20 +00:00
Narcis Beleuzu
a9e7761934 Backed out 4 changesets (bug 1771374) for causing Google docs and maps rendering regressions. a=backout
Backed out changeset 9c65411d1843 (bug 1771374)
Backed out changeset 9f5cf953fcc8 (bug 1771374)
Backed out changeset 8b39f60971e4 (bug 1771374)
Backed out changeset ef52a6c462b6 (bug 1771374)
2022-07-14 00:43:56 +03:00
Kelsey Gilbert
05864ec823 Bug 1771374 - Use {bool, T} instead of Maybe<T> for now. r=gfx-reviewers,lsalzman
`Maybe` isn't is_trivially_copyable, and std::optional isn't either on
the old libstdc++ we use from gcc7 still.

I'm working on more robust approach to serialization but that's beyond
the scope of this bug.

Differential Revision: https://phabricator.services.mozilla.com/D151421
2022-07-12 23:55:51 +00:00
Kelsey Gilbert
8eb05ff04b Bug 1771374 - Support display-p3 output via DirectComposition on Windows. r=sotaro,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D150275
2022-07-12 23:55:50 +00:00
Lee Salzman
4a88a37cf6 Bug 1777872 - Use Shmem for backing DrawTargetWebgl's Skia target. r=jgilbert
When rendering large and/or fullscreen Canvas2Ds, excessive time can be spent
in calls to TexImage/ReadPixels copying into and out of Shmems to the separate
buffer for DrawTargetSkia. To alleviate this, we can make the DrawTargetSkia
directly wrap the Shmem, so that calls to TexImage/ReadPixels then directly
read or write to this without any separate copy. We modify RawTexImage to use
the IPDL SendTexImage path so that Shmems can be sent via SurfaceDescriptor.
Since SendTexImage is nominally async (which is beneficial), we rely on a
call to GetError later to verify that the Shmem processing is completely before
we further modify the DrawTargetSkia. We further add a ReadPixelsIntoShmem IPDL
call to allow sending the Shmem in the other direction directly.

Differential Revision: https://phabricator.services.mozilla.com/D151286
2022-07-12 09:25:35 +00:00