Граф коммитов

536 Коммитов

Автор SHA1 Сообщение Дата
Kelsey Gilbert 58bc15010f 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 626d67ee7b 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 d55f5ec846 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 3a46da3d80 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
sotaro 44518c888e Bug 1808818 - Add RemoteTextureOwnerClient::PushDummyTexture() for handling remote texture allocation failure r=gfx-reviewers,lsalzman
Push dummy texture when remote texture allocation is failed.

Differential Revision: https://phabricator.services.mozilla.com/D166516
2023-01-11 22:23:01 +00:00
sotaro 954c16acec Bug 1805209 - Use RemoteTexture for WebGPU r=gfx-reviewers,lsalzman
WebGPU uses CompositableInProcessManager to push TextureHost directly from WebGPUParent to WebRender. But CompositableInProcessManager plumbing has a problem and caused Bug 1805209.

gecko already has a similar mechanism, called RemoteTextureMap. It is used in oop WebGL. If WebGPU uses RemoteTextureMap instead of CompositableInProcessManager, both WebGPU and oop WebGL use same mechanism.

WebGPUParent pushes a new texture to RemoteTextureMap. The RemoteTextureMap notifies the pushed texture to WebRenderImageHost.

Before the change, only one TextureHost is used for one swap chain. With the change, multiple TextureHosts are used for one swap chain with recycling.

The changes are followings.

- Use RemoteTextureMap instead of CompositableInProcessManager.
- Use RemoteTextureOwnerId instead of CompositableHandle.
- Use WebRenderCanvasData instead of WebRenderInProcessImageData.
- Add remote texture pushed callback functionality to RemoteTextureMap. With it, RemoteTextureMap notifies a new pushed remote texture to WebRenderImageHost.
- Remove CompositableInProcessManager.

Differential Revision: https://phabricator.services.mozilla.com/D164890
2022-12-23 20:41:02 +00:00
sotaro ad6c294e3c Bug 1794380 - Fix RemoteTexture with WebGL sync present on Android r=gfx-reviewers,lsalzman
The change addressed followings problems.

- Recycling of gl::SharedSurface by RemoteTextureMap is not handled by gl::SwapChain.
- PrepareForUse()/NotifyNotUsed() of remote texture's TextureHost(SurfaceTextureHost) is not handled
- Wrapping of RenderAndroidSurfaceTextureHost by RenderTextureHostWrapper is not handled

PrepareForUse()/NotifyNotUsed() is called based on compositor ref count of TextureHost. Normally TextureHost is wrapped by WebRenderTextureHost, then the WebRenderTextureHost handles PrepareForUse()/NotifyNotUsed(). But in remote texture case, WebRenderTextureHost wraps RemoteTextureHostWrapper. And compositable ref of remote texture's TextureHost is updated within RemoteTextureMap::mMutex. Then PrepareForUse()/NotifyNotUsed() happen outside of WebRenderTextureHost in non compositor thread.

With pref gfx.canvas.accelerated=true, canvas renderings were broken on android emulator. The boroken rendering seemed to happen by GL of android emulator. The boroken rendering did not happen with tests on android hardware.

Differential Revision: https://phabricator.services.mozilla.com/D159261
2022-12-07 12:40:02 +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
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
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
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
Lee Salzman ef71173113 Bug 1787959 - Reset packing state before reading pixels. r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D156259
2022-09-02 18:12:14 +00:00
Andrew Osmond 0b66feace8 Bug 1783957 - Part 2. Ensure we can manage LRU WebGL contexts on different threads. r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D154171
2022-08-20 17:03:51 +00:00
Andrew Osmond 6b34b549bd Bug 1783957 - Part 1. Fix up thread annotations for WebGLContext's LRU position. r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D154170
2022-08-20 17:03:50 +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
Lee Salzman 2273a39e73 Bug 1781064 - Get buffer size directly from BufferTextureData. r=aosmond,gfx-reviewers
Since the BufferTextureData is getting created based on ImageDataSerialize::ComputeRGBBufferSize,
the stride may be padded for alignment which doesn't agree with the simple calculation duplicated
here. In general, it is less error-prone to just ask the BufferTextureData itself for its buffer
size, so just do that here instead rather than trying to make duplicate calculations with invalid
assumptions.

Differential Revision: https://phabricator.services.mozilla.com/D153868
2022-08-05 18:48:48 +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
Narcis Beleuzu dce2ae28ba Merge Mozilla-Central to autoland on a CLOSED TREE 2022-07-14 00:55:03 +03: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
Lee Salzman 911d479aa2 Bug 1779410 - Ensure SwapChainPresenter destructor is called before we access the front buffer. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D151732
2022-07-13 17:27:03 +00: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 1d9820a99d Bug 1777426 - Support fast readbacks in CopyToSwapChain with async present. r=sotaro,jgilbert
Currently CopyToSwapChain creates spurious copies of the back buffer when SharedSurfaces aren't exportable (= ToSurfaceDescriptor returns Nothing from SharedSurface_Basic). These then later get read back into a CPU memory buffer when PresentFrontBufferToCompositor is used to send the buffer to RemoteTextureMap. This has associated performance and memory costs.

Conceptually, we want Present/CopyToSwapChain to just do the right thing and automatically push buffers to RemoteTextureMap, rather than secondarily needing a hidden call to PresentFrontBufferToCompositor. Then we can get rid of the need to create front buffers whose only purpose is to shuttle data to PresentFrontBufferToCompositor which then shuttles it RemoteTextureMap.

This patch achieves this by refactoring the guts of PresentFrontBufferToCompositor into Present/CopyToSwapChain. The remote texture ids are sent along inside SwapChainOptions if async present is enabled. Those remote texture ids are cached in ClientWebGLContext so that GetFrontBuffer can return them without any subsequent need for an IPDL call.

On the parent side, CopyToSwapChain will now notice if async present is to be used and if a SurfaceFactory does not generate SharedSurfaces that can be exported. In that case it cuts out the middle man and reads from the WebGLFramebuffer's back buffer directly into a CPU buffer to send to RemoteTextureMap.

This also adds a forceAsyncPresent option to SwapChainOptions so that in the future we can have a separate pref for Accelerated Canvas2D that will allow enabling async present independent of the global WebGL pref.

Differential Revision: https://phabricator.services.mozilla.com/D150720
2022-07-12 06:56:19 +00:00
smolnar 3fa084ce2f Backed out 3 changesets (bug 1771374) for causing build bustage in gfx/gl/gtest/TestColorspaces.cpp CLOSED TREE
Backed out changeset 4d01f260c43a (bug 1771374)
Backed out changeset fc62679f0a6c (bug 1771374)
Backed out changeset f4f12470f8b7 (bug 1771374)
2022-06-30 21:19:17 +03:00
Kelsey Gilbert bb48a57a8a Bug 1771374 - Support display-p3 output via DirectComposition on Windows. r=sotaro,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D150275
2022-06-30 17:56:26 +00:00
criss d5ece910a9 Backed out 3 changesets (bug 1771374) for causing bustages on Colorspaces.h. CLOSED TREE
Backed out changeset 498c27656dc3 (bug 1771374)
Backed out changeset 6f97bc39643f (bug 1771374)
Backed out changeset b4fdb70808b6 (bug 1771374)
2022-06-30 05:28:11 +03:00
Kelsey Gilbert c4f86e2e33 Bug 1771374 - Support display-p3 output via DirectComposition on Windows. r=sotaro,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D150275
2022-06-29 23:38:22 +00:00
criss efb5f18b59 Backed out 3 changesets (bug 1771374) for causing build bustages on GLBlitHelper.cpp. CLOSED TREE
Backed out changeset 71d40a0a3c9c (bug 1771374)
Backed out changeset 6a42df6834fe (bug 1771374)
Backed out changeset be888d0fd0bf (bug 1771374)
2022-06-30 01:12:46 +03:00
Kelsey Gilbert bad5d9146c Bug 1771374 - Support display-p3 output via DirectComposition on Windows. r=sotaro,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D150275
2022-06-29 21:48:52 +00:00
sotaro a807c798e9 Bug 1712486 - Add async front buffer posting for out-of-process WebGL r=jgilbert,lsalzman,gfx-reviewers
The async front buffer posting is going to be enabled by another bug.

Async IPC was added for async front buffer posting for out-of-process WebGL.
Client does not use TextureClient for storing SurfaceDescriptor.
It works basically same way as to in-process WebGL around nsDisplayCanvas, WebRenderCanvasData, WebRenderCommandBuilder and WebRenderBridgeParent.
SharedSurfaces of SurfaceDescriptorD3D10 are kept alive during their usage. It is for keeping a shread handle valid.
Copied data buffers of SharedShurface_Basics are kept alive during their usage. It is for keeping RenderBufferTextureHost valid.

Differential Revision: https://phabricator.services.mozilla.com/D150197
2022-06-29 09:32:29 +00:00
Norisz Fay f70f5a4b0f Backed out changeset af98fb4ff148 (bug 1712486) for causing build bustages on LayersSurfaces CLOSED TREE 2022-06-29 09:06:45 +03:00
sotaro 8a8d04cce2 Bug 1712486 - Add async front buffer posting for out-of-process WebGL r=jgilbert,lsalzman,gfx-reviewers
The async front buffer posting is going to be enabled by another bug.

Async IPC was added for async front buffer posting for out-of-process WebGL.
Client does not use TextureClient for storing SurfaceDescriptor.
It works basically same way as to in-process WebGL around nsDisplayCanvas, WebRenderCanvasData, WebRenderCommandBuilder and WebRenderBridgeParent.
SharedSurfaces of SurfaceDescriptorD3D10 are kept alive during their usage. It is for keeping a shread handle valid.
Copied data buffers of SharedShurface_Basics are kept alive during their usage. It is for keeping RenderBufferTextureHost valid.

Differential Revision: https://phabricator.services.mozilla.com/D150197
2022-06-29 05:05:47 +00:00
Andrew Osmond 3676efda31 Bug 1769739. r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D146842
2022-06-22 22:43:15 +00:00
Kelsey Gilbert edaf0ffd31 Bug 1703654 - Deal with Maybe<> not trivially_copyable on build-linux64-base-toolchains. r=gfx-reviewers,lsalzman
Start moving away from manual (risky!) IsTriviallySerializable<>.

Differential Revision: https://phabricator.services.mozilla.com/D145252
2022-05-02 23:54:10 +00:00
Kelsey Gilbert e722cdd3ed Bug 1703654 - Prototype display-p3 for WebGL canvas. r=lsalzman,emilio,webidl,smaug
Enable (direct) external surface compositing for MacIOSurfaces.
Works on Mac.

Differential Revision: https://phabricator.services.mozilla.com/D144073
2022-05-02 23:54:09 +00:00
Csoregi Natalia 9a8af5a95a Backed out changeset 718ead395698 (bug 1703654) for causing bustage on IPCMessageUtils.h. CLOSED TREE 2022-04-29 00:38:28 +03:00
Kelsey Gilbert c3a7e39783 Bug 1703654 - Prototype display-p3 for WebGL canvas. r=lsalzman,emilio
Enable (direct) external surface compositing for MacIOSurfaces.
Works on Mac.

Differential Revision: https://phabricator.services.mozilla.com/D144073
2022-04-28 19:12:08 +00:00
Molnar Sandor 68045e3d85 Backed out changeset 071aa43a0419 (bug 1703654) for causing build bustages in SharedSurfaceDMABUF. CLOSED TREE 2022-04-26 20:14:48 +03:00
Kelsey Gilbert 9f7815a9e2 Bug 1703654 - Prototype display-p3 for WebGL canvas. r=lsalzman,emilio
Enable (direct) external surface compositing for MacIOSurfaces.
Works on Mac.

Differential Revision: https://phabricator.services.mozilla.com/D144073
2022-04-26 16:54:17 +00:00
Iulian Moraru 92b62b9e23 Bug 1449575 - fix file-whitespace lint failures on WebGLContext.cpp. r=fix CLOSED TREE 2022-03-24 22:35:57 +02:00
Kelsey Gilbert 5362a1dd62 Bug 1449575 - Don't attempt ColorMask elision in WebGL. r=gfx-reviewers,aosmond
* Always use DoColorMask(u32?, u8) in webgl code.
* Handle OES_draw_buffers_indexed ColorMaski in GLBlitHelper.

Differential Revision: https://phabricator.services.mozilla.com/D141543
2022-03-24 19:39:06 +00:00
Lee Salzman 46a74c07ea Bug 1755780 - Support CopyToSwapChain on WebGLContext. r=jgilbert
For use within accelerated Canvas2D, it is expedient to have a variant of Present
that explicitly acknowledges that there is a copy from a supplied WebGL framebuffer
into the swap chain back buffer, as is usually the case when remoting, so that it
can be relied upon for format conversions or other concerns. This allows Present
to remain simple and assume rendering happened directly to the back buffer, without
need of a copy.

This backs out some of the earlier changes to Present in 1754130 in favor of
separating the new copy behavior into an explicit CopyToSwapChain interface,
which supports a format swizzle that is useful for converting between Canvas2D
and WebGL swap chain formats. The behavior of CopyToSwapChain, as noted,
assumes that there is a supplied WebGL framebuffer that must be copied to the
swap chain back buffer before any compositing should occur.

Differential Revision: https://phabricator.services.mozilla.com/D138954
2022-02-21 17:33:09 +00:00
Kelsey Gilbert aeeb1e199d Bug 1750310 - Centralize and reuse pixelstorei pack/unpack handling. r=lsalzman
* Accept that finding an explicit unpack for a given stride might fail.
* Directly use the logic from the GLES spec for unpacking stride calculations.
* Use structuredSrcSize member.
* Calc explicit unpack based on dstStride, not srcStride.

Differential Revision: https://phabricator.services.mozilla.com/D136052
2022-02-12 02:20:42 +00:00
Lee Salzman 5c61fe02e5 Bug 1754130 - Support presenting a WebGLFramebuffer to its own swap chain without opaque FB. r=aosmond,jgilbert
Most of the support for presenting a WebGLFramebuffer to a swap chain existed as part of the
mechanism for opaque WebXR framebuffer support. However, such "opaque" framebuffer are meant
to be opaque in the sense that their attachments can't be inspected or changed, which does
not provide the requisite level of control for efficiently implementing Canvas2D snapshots.

To this end, the existing Present mechanism is slightly extended to allow presenting to the
swap chain already present in WebGLFramebuffer without the existence of a corresponding
MozFramebuffer.

This also fixes a bug in that AsWebgl() was no longer being utilized in CanvasRenderer, such
that a new mechanism that routed GetFrontBuffer() was needed to fix the code rot.

There are also some efforts to remove a couple redundant copies I noticed in profiles along
the way.

Differential Revision: https://phabricator.services.mozilla.com/D138119
2022-02-11 19:49:56 +00:00
Marian-Vasile Laza 610558649b Backed out 3 changesets (bug 1754130) for causing mochitest failures. CLOSED TREE
Backed out changeset 7fea32057b92 (bug 1754130)
Backed out changeset 1ac8f10e0025 (bug 1754130)
Backed out changeset 3d56b847ddf9 (bug 1754130)
2022-02-11 18:30:11 +02:00