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

42701 Коммитов

Автор SHA1 Сообщение Дата
Mark Banner fe937b78bd Bug 1758474 - Implement an ESLint rule to disallow passing {} as the target parameter for ChromeUtils.import. r=Gijs,mossop,perftest-reviewers,preferences-reviewers,sparky
Differential Revision: https://phabricator.services.mozilla.com/D140517
2022-03-10 09:25:28 +00:00
Lee Salzman 6f0be8c19f Bug 1757067 - Explicitly specify chroma subsampling scheme for YCbCr data. r=jgilbert,jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D139656
2022-03-10 09:24:15 +00:00
smolnar 97f77f8381 Backed out changeset 36c6350bc7d1 (bug 1757067) for causing build bustages in gfx/gl/GLBlitHelperD3D.cpp CLOSED TREE 2022-03-10 10:10:10 +02:00
Lee Salzman a664a6d305 Bug 1757067 - Explicitly specify chroma subsampling scheme for YCbCr data. r=jgilbert,jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D139656
2022-03-10 07:48:53 +00:00
smolnar 5ca48a83e1 Backed out changeset d8f3596e358e (bug 1757876) for causing wr3 failures in css-transforms/perspective-split-by-zero-w CLOSED TREE 2022-03-10 08:09:46 +02:00
Iulian Moraru 6df286bfe3 Backed out changeset 58f10ceb16ba (bug 1756529) for causing mochitest failures on test_group_keyboard.html. CLOSED TREE 2022-03-10 06:25:37 +02:00
Matteo Ruello 44f4c447d2 Bug 1756529 - Honor general.smoothScroll.[line|page|other] for keyboard scrolls with MSD physics r=botond,hiro
Differential Revision: https://phabricator.services.mozilla.com/D140090
2022-03-10 03:13:02 +00:00
Jonathan Kew cc35e93ae5 Bug 1758286 - Revert to separate Lookup and InsertOrUpdate calls when working with mFcSubstituteCache. r=lsalzman
This shouldn't change behavior at all, afaict, but by reverting to the original
code structure I'm hoping it may avoid the release-assert that has showed up
in a few crash reports.

Differential Revision: https://phabricator.services.mozilla.com/D140562
2022-03-10 01:06:56 +00:00
Glenn Watson 9223d06411 Bug 1757876 - Introduce command buffers between prepare <-> batch pass r=gfx-reviewers,nical
Previously, WR would recursively walk the entire picture
tree during each of the visibility, prepare and batching
passes. With this change, the prepare pass builds a tightly
packed command buffer of draw commands for each child surface
and/or picture cache tile. The batching pass now reads the
packed command buffers, meaning that no traversal of the
picture tree is required during batching.

This serves two purposes:

(1) It makes it possible to direct primitives within a
    single picture to different render tasks. This isn't
    yet used, but is a straightforward addition to how
    command buffers work. This functionality will be used
    to split primitives across render tasks where there
    are readback boundaries (e.g. backdrop-filter and also
    mix-blend-mode). The existing picture graph code ensures
    that we then optimally allocate, batch and draw pictures
    that contain these barrier style primitives.

(2) In the common case, where only a small portion of the
    scene has changed during a frame, it's a significant
    optimization to avoid another picture tree traversal.
    Instead, the batching code will only end up iterating
    small lists of the primitives that overlap the dirty
    region for the given tile / child surface.

Differential Revision: https://phabricator.services.mozilla.com/D140159
2022-03-09 19:39:28 +00:00
Norisz Fay decb86e048 Backed out changeset fd02141cc64d (bug 1758156) for causing build bustages on CanvasManagerParent.obj CLOSED TREE 2022-03-09 16:16:12 +02:00
Nicolas Silva b429877313 Bug 1758156 - Check that the webgpu pref is enabled when creating PWebGPUParent. r=aosmond
A better solution would check against the same value as reported by gfxConfig, which takes the pref as well as whether webgpu was blocked (for example due to buggy drivers) into account, but this still is good sanity check and easy to uplift.

Differential Revision: https://phabricator.services.mozilla.com/D140535
2022-03-09 13:05:34 +00:00
sotaro cb830217d5 Bug 1758618 - Add error log to mVideoSwapChain->Present() r=jrmuizel
Error log helps to understand the problem.

Differential Revision: https://phabricator.services.mozilla.com/D140602
2022-03-09 06:25:39 +00:00
sotaro 7991ca6079 Bug 1757879 - Make SimulateDeviceReset() similar to actual device reset handling r=ipc-reviewers,gfx-reviewers,lsalzman,mccr8
SimulateDeviceReset() works differently from actual device reset handling. It seems better to make SimulateDeviceReset() more similar to actual device reset handling.

Differential Revision: https://phabricator.services.mozilla.com/D140161
2022-03-08 23:14:28 +00:00
sotaro a7eb2e3d49 Bug 1757710 - Add fallback handling of video overlay from YUV SwapChain to RGB SwapChain r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D140507
2022-03-08 23:13:05 +00:00
Jonathan Kew 3b1e5a39be Bug 1758315 - Call SetupVariationRanges when initializing font attributes in the FT2 font-list, to handle installed fonts with variation axes. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D140538
2022-03-08 16:02:41 +00:00
Emilio Cobos Álvarez 94d7e11a79 Bug 1758169 - Clean up WebGPU lifetime handling a bit. r=nical
No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D140384
2022-03-08 15:00:39 +00:00
Gerald Squelart 5802980a6e Bug 1757596 - #include "mozilla/ProfilerThreadSleep.h" instead of GeckoProfiler.h where possible - r=florian
And in one case, #include "mozilla/ProfilerThreadState.h" where only `AUTO_PROFILER_THREAD_WAKE` is used.

Depends on D140172

Differential Revision: https://phabricator.services.mozilla.com/D140173
2022-03-08 10:32:44 +00:00
Lee Salzman d22d724cc2 Bug 1511493 - Ensure PushGlyphs uses the current transaction's IpcResourceUpdateQueue. r=emilio
WebRenderBridgeChild::GetFontKeyForScaledFont can currently cause a IpcResourceUpdateQueue race.
If we're in the middle of a transaction building a blob image, GetFontKeyForScaledFont is called
in the blob image building code using the transaction's IpcResourceUpdateQueue as expected, such
that resource updates are sent out when the transaction is finalized.

However, TextDrawTarget calls into PushGlyphs without passing along its IpcResourceUpdateQueue,
calling GetFontKeyForScaledFont without it, and causing it to immediately send out the resource
update.

So if a blob image uses a font key and submits a resource update, but a display list is built
after that also using the font key within the transaction, the display list will fail to send
the resource update because it thinks the blob image already did, even though the blob image
transaction has not yet been finalized.

The simple fix is to just pass IpcResourceUpdateQueue from TextDrawTarget into PushGlyphs, thus
ensuring the resource updates are properly ordered.

Differential Revision: https://phabricator.services.mozilla.com/D140438
2022-03-05 23:35:16 +00:00
Brad Werth 11bd443591 Bug 1745492 Part 5: Make NativeLayerCA::LogSurface print buffer attachments. r=mstange
This expands the information we can request from future bug reporters. This
logging is only done when the `gfx.core-animation.specialize-video.log` pref
is set.

Depends on D135634

Differential Revision: https://phabricator.services.mozilla.com/D137084
2022-03-05 17:31:20 +00:00
Brad Werth cd93840cc1 Bug 1745492 Part 4: Make NativeLayerCA create specialized video layers for HDR video. r=mstange
This adds additional logic to detect when video requires a specialized video
layer. The logic from NativeLayerCA::Representation::CanSpecializeSurface has
been rolled into the mainline decision of whether or not to specialize the
video layer at all.

Depends on D137082

Differential Revision: https://phabricator.services.mozilla.com/D135634
2022-03-05 17:31:20 +00:00
Brad Werth 26751bb55f Bug 1745492 Part 3: Expand WR YUV formats to include P010 as a MSB packing. r=lsalzman
P010 is trivially the same as NV12, but the 10-bit colors are packed into
the most significant bits instead of the least significant bits. This changes
the yuv shader to use the correct packing for P010. It treats P010 as its
own yuv format, which requires a lot of scaffolding.

Differential Revision: https://phabricator.services.mozilla.com/D140422
2022-03-05 17:31:19 +00:00
Brad Werth 418ae64bbb Bug 1745492 Part 2: Update MacIOSurface handling to deal with 10-bit formats. r=media-playback-reviewers,gfx-reviewers,lsalzman,alwu
This fixes an issue caused by landing Bug 1679927. Now that it's possible to
get 10-bit formats in macOS, the texture pipeline has to be updated to pass
those surfaces to WebRender.

This also contains a drive-by comment on D3D11 handing of 10-bit WebRender
display items. It was not clear why specifing 16-bit color depth for P010
format was correct there, but should be specified as 10-bit color elsewhere.

This also contains another drive-by fix to comments in webrender describing
the RG16 enum.

Depends on D136046

Differential Revision: https://phabricator.services.mozilla.com/D136823
2022-03-05 17:31:18 +00:00
Jonathan Kew f117aaab66 Bug 1756400 - Improve font-selection behavior with fontconfig setups that prepend family names to all patterns. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D140391
2022-03-05 14:37:57 +00:00
Jonathan Kew 2cb57c044a Bug 1756400 - Pass the content language (if any) to fontconfig when calling FcConfigSubstitute, to get appropriate substitutions for the page rather than system-locale defaults. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D140378
2022-03-05 14:37:56 +00:00
Randell Jesup ffaf118a11 Bug 1758188: Remove unneeded mutex from FilterNodeSoftware r=gfx-reviewers,mstange
Differential Revision: https://phabricator.services.mozilla.com/D140404
2022-03-04 21:44:29 +00:00
Jamie Nicol 504c6180cd Bug 1754339 - Route HandleTap message from GPU process through android's priority queue. r=botond
In response to a touch down and up event on Android,
NPZCSupport::FinishHandlingMotionEvent sends the events over the Input
Bridge to APZ, then dispatches the event to the main thread for the
widget to process them (which will in turn send them to the tab). It
uses android's priority event queue to do so, via
nsAppShell::PostEvent.

Meanwhile, the AsyncPanZoomController will detect these events as a
tap gesture, and call RemoteContentController::HandleTap. When the GPU
process is disabled, and APZ therefore lives in the parent process,
this calls BrowserParent::SendHandleTap to forward the tap event to
the tab. On Android, however, we ensure that we first dispatch through
the same priority queue used when dispatching the touch events to the
widget, otherwise the tap event could be sent to the tab before the
events from which it was synthesized.

With the GPU process enabled, however, APZ lives in the GPU process
and RemoteContentController::HandleTap must call
APZCTreeManagerParent::SendHandleTap to send the event back to the
parent process, which in turn calls BrowserParent::SendHandleTap to
send it to the tab. However, because IPDL uses a different event queue
than we used to schedule the widget's processing of the events, there
is no guarantee that APZCTreeManagerChild::RecvHandleTap will be
scheduled after the pending tasks on the android priority queue.

This means we sometimes end up calling BrowserParent::SendHandleTap
before BrowserParent::SendRealTouchEvent, and content can receive the
events in the incorrect order.

To fix this, we simply ensure that APZCTreeManagerChild::RecvHandleTap
runs through the android priority queue before calling
BrowserParent::SendHandleTap, ensuring the events are sent in order.

Differential Revision: https://phabricator.services.mozilla.com/D140326
2022-03-04 21:18:43 +00:00
Nika Layzell 05dc5e0d76 Bug 1754037 - Part 3c: Automatically update all ParamTraits implementations, r=ipc-reviewers,media-playback-reviewers,bryce,mccr8
Automatically generated rewrites of all ParamTraits and IPDLParamTraits
implementations in-tree to use IPC::Message{Reader,Writer}.

Differential Revision: https://phabricator.services.mozilla.com/D140004
2022-03-04 15:39:41 +00:00
Glenn Watson 15704e4696 Bug 1757845 - Fix nested local scale within surface hierarchy r=gfx-reviewers,nical
Also include the raster scale in the PictureKey, so that WR will
invalidate when everything is the same apart from the raster
scale (was causing the included wrench reftest to not re-render).

Differential Revision: https://phabricator.services.mozilla.com/D140282
2022-03-04 09:18:31 +00:00
Mike Hommey f7b39f73c2 Bug 1758021 - Get is_{arm,aarch64}_feature_detected from std::arch on rustc >= 1.60. r=gfx-reviewers,jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D140278
2022-03-04 00:39:40 +00:00
Jonathan Kew 3d6362c37e Bug 1757897 - Add null-check for charmap in FT_Face, before trying to check for symbol encoding. r=lsalzman
We need a null-check here in case FT_Select_Charmap failed to find any usable charmap in the font
(e.g. maybe an old font with only a MacRoman charmap, but no Unicode or Symbol table).

Differential Revision: https://phabricator.services.mozilla.com/D140179
2022-03-03 20:14:25 +00:00
Lee Salzman 1cab27db44 Bug 1757624 - Move FontInstanceMap out of webrender_api. r=nical,gfx-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D139971
2022-03-03 19:42:52 +00:00
Jonathan Kew 091447cf5b Bug 1756750 - Reftest for SVG-in-OT font with embedded bitmaps. r=emilio
The testcase includes a 1-second pause after the onload event fires, because the test font
includes PNG bitmaps which are asynchronously decoded. This is in theory unreliable,
but for these small images it should be plenty of time (even without any delay, the test
fails only very intermittently) -- if we're failing to decode the images even with the
1-second delay, something is probably truly broken.

(The file svg-bitmap.ttx file is not actually required to run the test, but is the source
for the svg-bitmap.ttf font file, constructed by inserting base64-encoded PNG images
into a minimal font framework.)

Differential Revision: https://phabricator.services.mozilla.com/D140057
2022-03-03 13:27:44 +00:00
Hiroyuki Ikezoe b0023fb190 Bug 1749352 - Add gtests. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D139561
2022-03-03 04:11:15 +00:00
Markus Stange 25b05c514f Bug 1749352 - Remove unused mFollowedByMomentum. r=botond
Depends on D135922

Differential Revision: https://phabricator.services.mozilla.com/D135923
2022-03-03 04:11:15 +00:00
Markus Stange 0ce5d3bb24 Bug 1749352 - Always call ScrollSnapToDestination from OnPanEnd, and ignore mFollowedByMomentum. r=botond
This patch makes us use the same code path for scroll snapping of
zero-velocity OnPanEnd and followed-by-momentum OnPanEnd.
This is preferable because mFollowedByMomentum is unreliable.

Depends on D135921

Differential Revision: https://phabricator.services.mozilla.com/D135922
2022-03-03 04:11:15 +00:00
Markus Stange 3da51fcc14 Bug 1749352 - Use ScrollUnit::DEVICE_PIXELS in ScrollSnapToDestination. r=botond
ScrollSnapUtils::GetSnapPointForDestination has different behavior based on
the scroll unit. More specifically, the difference is in CalcSnapPoints::AddEdge:
Unless the unit is DEVICE_PIXELS, this function will only look for snap
points in the scroll direction. For example, if we are currently at position 40,
our destination is 50, and we have snap points at 30 and 100, then we'll only
consider snap point 100, even though snap point 30 would be closer to the destination.
Furthermore, if the destination is at the same position as the current position,
then we will not snap at all.
This behavior makes some sense for discrete-tick wheel scrolling, but I don't think
it is appropriate for touchpad scrolling. ScrollSnapToDestination is called from
OnPanMomentumStart and from AttemptFling; in both these contexts I think it makes
more sense to take all snap points into account.

With this change, it becomes possible to call ScrollSnapToDestination even when
our current velocity is zero. Without this change, we wouldn't scroll snap at
all in that case.

Depends on D135920

Differential Revision: https://phabricator.services.mozilla.com/D135921
2022-03-03 04:11:14 +00:00
Markus Stange 2f8bd6f824 Bug 1749352 - Don't interrupt scroll snapping animations when we receive a momentum pan event. r=botond
Scroll snapping uses an MSD smooth scroll to animate to the target position.
During the scroll snap animation, any synthesized momentum events
from the OS should be ignored; the scroll snap animation has taken over.

It is possible that this patch has unfortunate consequences when mixing
keyboard and touchpad scrolling. For example, pressing space to scroll down
by a page and then doing a fling with the touchpad might now have different
results.

Differential Revision: https://phabricator.services.mozilla.com/D135920
2022-03-03 04:11:14 +00:00
sotaro 33ec38c192 Bug 1757698 - Add D3D11TextureIMFSampleImage and array index handling to D3D11TextureData r=jgilbert,gfx-reviewers,jrmuizel
This is a preparation of Bug 1723207.

D3D11TextureIMFSampleImage is used for storing ID3D11Texture2D of IMFSample. Array index handling is added, since there are cases that hardware decoder uses array texture. D3D11TextureIMFSampleImage is expected to be used in GPU process.

Differential Revision: https://phabricator.services.mozilla.com/D140017
2022-03-03 02:30:28 +00:00
Jamie Nicol ffb15c5a6b Bug 1757766 - Avoid using NS_DISPATCH_SYNC in UiCompositorController::Destroy. r=gfx-reviewers,aosmond
On Android, we must dispatch UiCompositorController::Destroy to run on
the UI thread synchronously. We were using NS_DISPATCH_SYNC to do so,
but that works by starting a nested event loop that continues to
execute tasks on the thread we have dispatched from. This means that
we can start to execute a task which calls
nsBaseWidget::CreateCompositor whilst we are midway through
nsBaseWidget::DestroyCompositor. As well as generally seeming like a
terrible idea, this also causes an assertion failure in some tests.

To avoid this use SynchronousTask rather than NS_DISPATCH_SYNC, as it
actually blocks synchronously. Additionally, do the same thing for
APZInputBridgeChild::Destroy, as it is called from the same location
and poses the same risk.

Ideally we wouldn't have to call UiCompositorControllerChild::Destroy
synchronously at all, but it was added in bug 1392705 to fix severe
crashes. It might be a good idea to re-evaluate whether it is still
required at some point in the future.

Differential Revision: https://phabricator.services.mozilla.com/D140084
2022-03-02 18:52:08 +00:00
Lee Salzman 05d60c01fa Bug 1752457 - Don't normalize zero halfway-vector in SpecularLightingSoftware. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D139967
2022-03-02 18:24:28 +00:00
smolnar 0ae36bf20f Backed out changeset 8a8ff9d086f4 (bug 1757766) for causing build bustages in gfx/layers/ipc/UiCompositorControllerChild.cpp CLOSED TREE 2022-03-02 19:59:29 +02:00
Jamie Nicol a30d089e14 Bug 1757766 - Avoid using NS_DISPATCH_SYNC in UiCompositorController::Destroy. r=gfx-reviewers,aosmond
On Android, we must dispatch UiCompositorController::Destroy to run on
the UI thread synchronously. We were using NS_DISPATCH_SYNC to do so,
but that works by starting a nested event loop that continues to
execute tasks on the thread we have dispatched from. This means that
we can start to execute a task which calls
nsBaseWidget::CreateCompositor whilst we are midway through
nsBaseWidget::DestroyCompositor. As well as generally seeming like a
terrible idea, this also causes an assertion failure in some tests.

To avoid this use SynchronousTask rather than NS_DISPATCH_SYNC, as it
actually blocks synchronously. Additionally, do the same thing for
APZInputBridgeChild::Destroy, as it is called from the same location
and poses the same risk.

Ideally we wouldn't have to call UiCompositorControllerChild::Destroy
synchronously at all, but it was added in bug 1392705 to fix severe
crashes. It might be a good idea to re-evaluate whether it is still
required at some point in the future.

Differential Revision: https://phabricator.services.mozilla.com/D140084
2022-03-02 17:43:33 +00:00
Jamie Nicol 6918615b37 Bug 1756700 - Delay compositor creation on Android to allow time for GPU process to launch. r=gfx-reviewers,geckoview-reviewers,aosmond,calu
We noticed a cold_view_nav_start regression on Fenix from enabling the
GPU process, and profiles showed time spent synchronously waiting for
the GPU process to launch. This occured because the compositor was
being created in nsWindow::Create, and as it requires the GPU process
to be running it had to block until launch completed. The process is
launched when the gfxPlatform is first initialized, but that was only
occuring immediately prior to creating the compositor, which did not
give it enough time to complete asynchronously.

This patch makes it so that we initialize the gfxPlatform slightly
earlier, and importantly delay creating the compositor until it is
actually required. This gives the process enough time to launch
asynchronously meaning we do not have to block.

We started deliberately creating the compositor early on Android
because of bug 1453501, to avoid a race condition where the compositor
didn't exist when RemoteLayerTreeOwner::Initialize was called, causing
us to use a basic layer manager. However, since bug 1741156 landed we
now create the compositor on-demand, meaning this is no longer a
possibility.

Delaying compositor creation can, however, uncover another race
condition. If the UICompositorControllerChild is opened on the UI
thread before the main thread is able to set its pointer to the
widget, then the java GeckoSession will never be notified that the
compositor has been opened, and composition will never be
resumed. This patch fixes this issue by setting the
UiCompositorControllerChild's widget pointer in its constructor rather
than immediately afterwards.

Differential Revision: https://phabricator.services.mozilla.com/D139842
2022-03-02 16:56:28 +00:00
Jeff Muizelaar 96997a4322 Bug 1757574 - Reduce the maximum number of high priority WrWorker threads. r=nical
This cuts the time spent doing get_ct_font on macOS in half because of
various contention issues. It should also reduce overall memory usage
for large fonts because we have half as many threads loading the
fonts.

Differential Revision: https://phabricator.services.mozilla.com/D139946
2022-03-02 15:27:31 +00:00
Lee Salzman 619a501c21 Bug 1757449 - Make WR NativeFontHandle use String instead of CGFont on macOS. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D139882
2022-03-02 10:11:05 +00:00
criss b13da6025c Backed out changeset e0f1d94942ce (bug 1757449) for causing build bustages on macOs. CLOSED TREE 2022-03-02 12:02:50 +02:00
Lee Salzman a3df467ef4 Bug 1757449 - Make WR NativeFontHandle use String instead of CGFont on macOS. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D139882
2022-03-02 09:34:31 +00:00
Florian Quèze 7e7760e643 Bug 1757587 - Remove non-webrender CompositorAnimationStorage code that seems unused, r=mstange.
Differential Revision: https://phabricator.services.mozilla.com/D139957
2022-03-01 23:08:15 +00:00
Markus Stange 3ce08a4e07 Bug 1676760 - Rename Add/RemoveChildRefreshTimer. r=smaug
It is used by far more than just content process refresh driver timers.

Differential Revision: https://phabricator.services.mozilla.com/D139769
2022-03-01 22:48:19 +00:00
Markus Stange d85ed119fd Bug 1676760 - Remove unused RefreshTimerVsyncDispatcher::SetParentRefreshTimer. r=smaug
Even in the parent process, VsyncRefreshDriverTimer uses AddChildRefreshTimer.

Differential Revision: https://phabricator.services.mozilla.com/D139768
2022-03-01 22:48:19 +00:00
Cristian Tuns 956c714ac3 Backed out changeset 0946d4ce352f (bug 1756700) for causing geckoview crashes. CLOSED TREE 2022-03-01 18:11:55 -05:00
Jamie Nicol b3781363fb Bug 1756700 - Delay compositor creation on Android to allow time for GPU process to launch. r=gfx-reviewers,geckoview-reviewers,aosmond,calu
We noticed a cold_view_nav_start regression on Fenix from enabling the
GPU process, and profiles showed time spent synchronously waiting for
the GPU process to launch. This occured because the compositor was
being created in nsWindow::Create, and as it requires the GPU process
to be running it had to block until launch completed. The process is
launched when the gfxPlatform is first initialized, but that was only
occuring immediately prior to creating the compositor, which did not
give it enough time to complete asynchronously.

This patch makes it so that we initialize the gfxPlatform slightly
earlier, and importantly delay creating the compositor until it is
actually required. This gives the process enough time to launch
asynchronously meaning we do not have to block.

We started deliberately creating the compositor early on Android
because of bug 1453501, to avoid a race condition where the compositor
didn't exist when RemoteLayerTreeOwner::Initialize was called, causing
us to use a basic layer manager. However, since bug 1741156 landed we
now create the compositor on-demand, meaning this is no longer a
possibility.

Delaying compositor creation can, however, uncover another race
condition. If the UICompositorControllerChild is opened on the UI
thread before the main thread is able to set its pointer to the
widget, then the java GeckoSession will never be notified that the
compositor has been opened, and composition will never be
resumed. This patch fixes this issue by setting the
UiCompositorControllerChild's widget pointer in its constructor rather
than immediately afterwards.

Differential Revision: https://phabricator.services.mozilla.com/D139842
2022-03-01 22:09:44 +00:00
Glenn Watson f36af647ca Bug 1757201 - Fix mix-blend mode on parent surfaces with snapping enabled r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D139904
2022-03-01 21:01:40 +00:00
Noemi Erli e4c2b99c8e Backed out changeset 7aaefe97188d (bug 1757201) for causing bustage in mix-blend-layers.yaml CLOSED TREE 2022-03-01 22:42:09 +02:00
Glenn Watson ea8cb44b81 Bug 1757201 - Fix mix-blend mode on parent surfaces with snapping enabled r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D139904
2022-03-01 20:05:54 +00:00
Ryan VanderMeulen ba43141112 Bug 1756664 - Update HarfBuzz to 3.4.0. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D139411
2022-03-01 17:37:04 +00:00
Jeff Muizelaar 76ca55d0b9 Bug 1757454 - Remove code for working with CGFonts. r=lsalzman
Bug 1744851 removed the need for creating variations using a CGFont.
This removes some of the support code that was left behind and completes
the reverting of the initial fix for bug 1675185: c8875713fd6d193e6b017da0a88c264b7bdd9a78

Differential Revision: https://phabricator.services.mozilla.com/D139886
2022-03-01 16:06:01 +00:00
Jonathan Kew 331c406f5c Bug 1756720 - When using legacy MS Symbol fonts, map character codes from the U+00xx range to the PUA range U+F0xx found in the cmap subtables. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D139724
2022-03-01 15:22:56 +00:00
Butkovits Atila 0dedf487f0 Backed out changeset 207c7cefa9db (bug 1757454) for causing WR bustages. CLOSED TREE 2022-03-01 17:27:27 +02:00
Jeff Muizelaar e2fb461ea3 Bug 1757454 - Remove code for working with CGFonts. r=lsalzman
Bug 1744851 removed the need for creating variations using a CGFont.
This removes some of the support code that was left behind and completes
the reverting of the initial fix for bug 1675185: c8875713fd6d193e6b017da0a88c264b7bdd9a78

Differential Revision: https://phabricator.services.mozilla.com/D139886
2022-03-01 14:57:17 +00:00
Butkovits Atila 84fea240ab Backed out changeset db75af2b4f4e (bug 1748788) for causing webrender crashes (bug 1707052). CLOSED TREE 2022-03-01 16:10:26 +02:00
Timothy Nikkel 22b5bfa1de Bug 1756762. When the root scroll frame is destroyed, reset the visual viewport offset on it's presshell. r=botond
The regular scroll position restoration code will restore it.

Specifically, in ScrollFrameHelper::SaveState

https://searchfox.org/mozilla-central/rev/44ae61c5eeb150cb77b6b8511ceee7ddd6892cb7/layout/generic/nsGfxScrollFrame.cpp#7376

we store the visual viewport offset. ScrollFrameHelper::ScrollToRestoredPosition will try to restore both the layout scroll offset and the visual viewport offset by calling ScrollToWithOrigin (which leads to ScrollToImpl) and PresShell::ScrollToVisual respectively.

I observed the following sequence of events when running gfx/layers/apz/test/mochitest/browser_test_background_tab_load_scroll.js in one of the cases that it fails for me locally.

-ScrollFrameHelper::NotifyApzTransaction is called after sending a transaction to webrender, this sets mAllowScrollOriginDowngrade = true.
-the scroll frame is destroyed and re-created (I'm not sure why this destroy and re-create happened, I didn't investigate), we call SaveState and RestoreState. So now mLastScrollOrigin == Other, and mAllowScrollOriginDowngrade == true.
-the test calls ScrollBy, so we get a call to ScrollToImpl with aOrigin == Relative
-aOrigin gets changed to Other here https://searchfox.org/mozilla-central/rev/9b0bdcc37419e6765223358a31a4a54d62e1cd97/layout/generic/nsGfxScrollFrame.cpp#2979
-the code just below that determines that it is not a downgrade, so we update mLastScrollOrigin to Other (not a change) and set mAllowScrollOriginDowngrade = false
-ScrollFrameHelper::NotifyApzTransaction is _not_ called (probably because we are in a background tab), so mAllowScrollOriginDowngrade remains false
-the scroll frame is now at position 20000 and the visual viewport offset (stored on the presshell) is also 20000.
-the scroll frame is destroyed and re-created (this one I investigated, it's because the font subsystem has finished loading and asks for a global reconstruct https://searchfox.org/mozilla-central/rev/9b0bdcc37419e6765223358a31a4a54d62e1cd97/layout/base/PresShell.cpp#9830), we call SaveState and RestoreState. So mLastScrollOrigin == Other, and mAllowScrollOriginDowngrade == true (the same values.
-we get a call to ScrollToRestoredPosition for the newly re-created scroll frame, we are trying to scroll from the current layout scroll position of 0 to the one we had before destruction and re-creation (20000). The visual viewport offset that is stored on the presshell has not been affected, it is still 20000.
-this gets to ScrollToImpl and with aOrigin == Restore
-we arrive at https://searchfox.org/mozilla-central/rev/9b0bdcc37419e6765223358a31a4a54d62e1cd97/layout/generic/nsGfxScrollFrame.cpp#3000 and Restore is a downgrade from Other, and mAllowScrollOriginDowngrade is false so we do not change mLastScrollOrigin (still Other) and mAllowScrollOriginDowngrade remains false
-we arrive at the code in ScrollToImpl that updates the visual viewport offset on the presshell https://searchfox.org/mozilla-central/rev/9b0bdcc37419e6765223358a31a4a54d62e1cd97/layout/generic/nsGfxScrollFrame.cpp#3232
-mLastScrollOrigin is Other, which can clobber apz, so we enter the if and add the difference between the before/after layout scroll position from this ScrollToImpl call (20000-0 = 20000) to the visual viewport offset (20000), getting 40000, which gets clamped to the max ~38000.
-and now the layout scroll position and the visual viewport offset have been detached when they shouldn't be.

If we reset the visual viewport offset when the scroll frame is destroyed we avoid the problem here.

Differential Revision: https://phabricator.services.mozilla.com/D139792
2022-03-01 01:51:27 +00:00
Marian-Vasile Laza a0a962b604 Backed out changeset cd5ac5f6ff6e (bug 1756720) for causing reftest failures on 399636-standards-css.html. CLOSED TREE 2022-02-28 16:53:40 -08:00
Glenn Watson 4144c8d651 Bug 1757002 - Fix incorrect scaling of large surfaces r=gfx-reviewers,aosmond
Fixes a typo introduced when rebasing the original patch

Differential Revision: https://phabricator.services.mozilla.com/D139883
2022-02-28 23:22:11 +00:00
Nika Layzell a2fec877d8 Bug 1751948 - Part 4: Correctly initialize OtherPid() for in-process actors, r=ipc-reviewers,mccr8
Before this change, OtherPid() would only be initialized for one side of an
actor pair when opening an in-process actor using `IToplevelProtocol::Open` or
`IToplevelProtocol::OpenOnSameThread`. This changes the function to directly
accept the other protocol, and initializes the value correctly in all cases.

Differential Revision: https://phabricator.services.mozilla.com/D137168
2022-02-28 21:01:48 +00:00
Nika Layzell 9e65eb911e Bug 1751948 - Part 1: Fix IPDL unified build issues, r=ipc-reviewers,mccr8
The changes in this patch stack will change how IPDL generated files are built,
such that these issues are now surfaced, especially during non-unified builds.

Differential Revision: https://phabricator.services.mozilla.com/D137165
2022-02-28 21:01:47 +00:00
Jonathan Kew 6901bd37b7 Bug 1756720 - When using legacy MS Symbol fonts, map character codes from the U+00xx range to the PUA range U+F0xx found in the cmap subtables. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D139724
2022-02-28 20:38:38 +00:00
Bob Owen 73d19e1f32 Bug 1755470: Assume zero GPU usage in GetGpuTimeSinceProcessStartInMs when win32k locked down. r=florian
Differential Revision: https://phabricator.services.mozilla.com/D139834
2022-02-28 15:59:01 +00:00
criss 482513fd24 Backed out 5 changesets (bug 1749352) for causing GTest failures. CLOSED TREE
Backed out changeset 977e030270db (bug 1749352)
Backed out changeset 8f8afd043413 (bug 1749352)
Backed out changeset 550c693e5dea (bug 1749352)
Backed out changeset c50f4c8331d3 (bug 1749352)
Backed out changeset ba1013d34a9e (bug 1749352)
2022-02-28 08:47:39 +02:00
Glenn Watson 439765c954 Bug 1757259 - Fix snapping on surfaces with 180 + 180 deg rotations r=gfx-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D139801
2022-02-28 05:54:42 +00:00
Hiroyuki Ikezoe c05a6a04a8 Bug 1749352 - Add gtests. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D139561
2022-02-27 23:19:50 +00:00
Markus Stange a5b1d43de7 Bug 1749352 - Remove unused mFollowedByMomentum. r=botond
Depends on D135922

Differential Revision: https://phabricator.services.mozilla.com/D135923
2022-02-27 23:19:49 +00:00
Markus Stange 0b89caa1e2 Bug 1749352 - Always call ScrollSnapToDestination from OnPanEnd, and ignore mFollowedByMomentum. r=botond
This patch makes us use the same code path for scroll snapping of
zero-velocity OnPanEnd and followed-by-momentum OnPanEnd.
This is preferable because mFollowedByMomentum is unreliable.

Depends on D135921

Differential Revision: https://phabricator.services.mozilla.com/D135922
2022-02-27 23:19:49 +00:00
Markus Stange 45f1667d94 Bug 1749352 - Use ScrollUnit::DEVICE_PIXELS in ScrollSnapToDestination. r=botond
ScrollSnapUtils::GetSnapPointForDestination has different behavior based on
the scroll unit. More specifically, the difference is in CalcSnapPoints::AddEdge:
Unless the unit is DEVICE_PIXELS, this function will only look for snap
points in the scroll direction. For example, if we are currently at position 40,
our destination is 50, and we have snap points at 30 and 100, then we'll only
consider snap point 100, even though snap point 30 would be closer to the destination.
Furthermore, if the destination is at the same position as the current position,
then we will not snap at all.
This behavior makes some sense for discrete-tick wheel scrolling, but I don't think
it is appropriate for touchpad scrolling. ScrollSnapToDestination is called from
OnPanMomentumStart and from AttemptFling; in both these contexts I think it makes
more sense to take all snap points into account.

With this change, it becomes possible to call ScrollSnapToDestination even when
our current velocity is zero. Without this change, we wouldn't scroll snap at
all in that case.

Depends on D135920

Differential Revision: https://phabricator.services.mozilla.com/D135921
2022-02-27 23:19:48 +00:00
Markus Stange 51877e08a5 Bug 1749352 - Don't interrupt scroll snapping animations when we receive a momentum pan event. r=botond
Scroll snapping uses an MSD smooth scroll to animate to the target position.
During the scroll snap animation, any synthesized momentum events
from the OS should be ignored; the scroll snap animation has taken over.

It is possible that this patch has unfortunate consequences when mixing
keyboard and touchpad scrolling. For example, pressing space to scroll down
by a page and then doing a fling with the touchpad might now have different
results.

Differential Revision: https://phabricator.services.mozilla.com/D135920
2022-02-27 23:19:48 +00:00
Olli Pettay 1edf4c885e Bug 1754562, make parent process' idle detection be aware of active RefreshDrivers in the other processes, r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138504
2022-02-26 22:37:03 +00:00
Lee Salzman 0e447bde60 Bug 1757111 - Report cropped YCbCr sizes in RenderExternalTextureHost. r=jrmuizel
I had assumed in bug 1750858 that we would only need to modify RenderBufferTextureHost.
It turns out macOS will also still use the ffmpeg decoder and so RenderExternalTextureHost
must report cropped YCbCr sizes as well.

Differential Revision: https://phabricator.services.mozilla.com/D139679
2022-02-26 21:12:35 +00:00
Jeff Muizelaar 544b42554c Bug 1757011 - Unify some Moz2D documentation. r=gfx-reviewers,mstange
Differential Revision: https://phabricator.services.mozilla.com/D139601
2022-02-26 18:54:49 +00:00
Randell Jesup 359cf4ab53 Bug 1757189: Remove unneeded lock in FilterNodeLightingSoftware since we don't use OMTP r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D139726
2022-02-25 19:58:24 +00:00
sotaro 4388cf2116 Bug 1748788 - Send parent commands with ClearCachedResources r=gfx-reviewers,nical
RecvClearCachedResources() does not handle parent commands. They are handled by a different transaction. It caused the problem. To avoid the problem, modifying RecvClearCachedResources() as to handle parent commands.

Differential Revision: https://phabricator.services.mozilla.com/D139568
2022-02-25 15:43:19 +00:00
criss d17f55ed9f Backed out changeset 39bd7bdd12be (bug 1754562) for causing multiple failures. CLOSED TREE 2022-02-25 13:40:50 +02:00
Olli Pettay 89b093258f Bug 1754562, make parent process' idle detection be aware of active RefreshDrivers in the other processes, r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138504
2022-02-25 10:13:16 +00:00
sotaro 1145ad3b4c Bug 1757123 - Remove BufferTextureData::RestoreOriginalDescriptor() r=gfx-reviewers,jrmuizel
RestoreOriginalDescriptor() is not used since Bug 1750858 fix.

Differential Revision: https://phabricator.services.mozilla.com/D139678
2022-02-25 08:26:43 +00:00
Botond Ballo 69a291009d Bug 1750667 - Make the Rendering Overview page show up in the table of contents. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D136838
2022-02-25 06:16:06 +00:00
Glenn Watson 276701f973 Bug 1757032 - Fix rounding out of snapped off-screen surfaces r=gfx-reviewers,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D139667
2022-02-25 02:45:46 +00:00
stransky 9358067df4 Bug 1756775 Don't disable HW decoding directly on RDD level as we handle RDD crashes by MediaFormatReader r=alwu
Revert changes from Bug 1752493 as we handle RDD crashes on MediaFormatReader level.

Differential Revision: https://phabricator.services.mozilla.com/D139470
2022-02-24 08:54:04 +00:00
Marian-Vasile Laza acfb3e797d Merge autoland to mozilla-central. a=merge 2022-02-23 19:49:43 -08:00
Glenn Watson 6e579c034e Bug 1749380 - Part 2 - Performance and quality fixes for part 1. r=gfx-reviewers,nical
* Add support for local scale factors to a surface, allowing it to
  be rasterized in root coordinate space. This allows snapping to
  work across surfaces where the surface transform is a fractional
  offset.

* Calculate scaling factors per rasterized surface and propagate
  them. Ensures correct scale factor calculations when dealing with
  nested preserve-3d contexts with 90-degree axis rotations.

* Support determining exact surface device rect for 2d surfaces
  with fractional surface transforms.

* Fix line decoration cache key size calculations based on world
  scaling factor.

* Remove `get_clipped_device_rect` usage for calculating clip-mask
  surface allocations, use `surface.get_surface_rect` instead. The
  prior method doesn't correctly account for expanded local regions
  from the current dirty rect, resulting in invalidation issues in
  some animated edge cases. Also unifies the way clip-mask surface
  allocations work with the way general render target surface
  allocations work.

Differential Revision: https://phabricator.services.mozilla.com/D138982
2022-02-23 20:49:27 +00:00
Glenn Watson 9a83835d67 Bug 1749380 - Part 1 - Improve how WR handles bounding rects for off-screen surfaces r=gfx-reviewers
This patch introduces a number of subtle but important changes
to how we deal with off-screen surfaces. The overall goals are:

 - Improve rendering correctness in a number of edge cases.
 - Begin reducing complexity related to surfaces, scaling
   factors, surface size adjustments and clipping.
 - Improve CPU performance by removing some per-primitive work.
 - Simplify implementation of future SVG and CSS filters by
   having explicit support for picture rects + inflation regions.
 - Lay the groundwork for caching child picture surfaces,
   reduction of per-primitive work during visibility pass,
   simplifying picture code.

Unfortunately, the nature of the changes make it impossible to
split up in to small isolated patches. Details below:

* Introduce `LocalRectKind` concept. This allows us to separate
  out the bounding rect of the surface (a group of primitives
  backed by a texture) from the bounding rect of the picture
  compositing that surface (e.g. a drop-shadow which draws the
  surface once at the local origin and once at a specific offset
  + blur-radius). This fixes a number of correctness bugs we have
  related to culling, clipping, invalidation regions of complex
  primitives such as drop-shadows and blur filters. Importantly,
  it makes it simpler to implement (or fix) SVG filter chains,
  backdrop-filter implementations.

* Establish raster roots for all off-screen surfaces. Every off-screen
  surface uses the spatial node of the enclosing stacking context as
  a coordinate system root, ensuring that each off-screen surface is
  drawn in a 2D coordinate system, with appropriate scaling factors
  applied to ensure high quality rendering. The primary goal is to make
  it possible to correctly inflate and clip off-screen surfaces, removing
  some correctness issues we currently have with complex filters interacting
  with transforms. The initial work here doesn't reduce complexity a huge
  amount, but will allow us to simplify large parts of the picture/surface
  handling code in future, as well as simplify a number of shaders that
  currently must handle arbitrarily complex transform matrices. This will
  also allow us to simplify the implementation of features such as
  mix-blend-mode and backdrop-filter, which rely on readback and UV mapping
  from the parent surface.

* Remove concepts of `estimated` and `precise` local rects for pictures. This
  is both a performance optimization and a code simplification. Instead, we
  only determine the estimated local rect during bounding rect propagation,
  and rely on the clipping regions from the tile dirty regions to reduce which
  parts of the picture we allocate if drawing to an off-screen surface. This
  removes some per-primitive work during the visibility pass, and also means
  we can rely on the final picture bounding rect from the start of the visibility
  pass. This also removes much of the complexity in `take_context` where we
  previously determined surface scale factors and device pixel ratio - instead
  these can be determined earlier during `propagate_bounding_rects`.

* Remove some complexity in `update_prim_visibility`. This is still recursive,
  but follow up patches will aim to remove this recursion and integrate this
  pass with the picture graph (similar to how `propagate_bounding_rects` works).

* Remove `PictureOptions` struct. Instead, store `inflate_if_required` with
  the Blur filter enum, which is the only place that uses it.

* Remove `root_scaling_factor` from text runs - this is handled implicitly
  by the surface device-pixel scale.

* Skip calling `update_clip_task` for pass-through pictures (since they have
  no defined local rect).

* Improve scaling factors used for determining the render task cache size for
  complex line decorations.

Differential Revision: https://phabricator.services.mozilla.com/D137569
2022-02-23 20:49:26 +00:00
Narcis Beleuzu 79e1db1339 Backed out 5 changesets (bug 1745492) for reftest failures on image-10bits-rendering-720-video.html CLOSED TREE
Backed out changeset 4cbbe77eaede (bug 1745492)
Backed out changeset 8eead27d1cc7 (bug 1745492)
Backed out changeset 6fc6bbab5b53 (bug 1745492)
Backed out changeset 823e45ca5fd3 (bug 1745492)
Backed out changeset f378944b0366 (bug 1745492)
2022-02-23 21:15:58 +02:00
Narcis Beleuzu 6799f1b983 Backed out 10 changesets (bug 1752332) for bc failures on browser_preferences_usage.js
Backed out changeset 5c475692133f (bug 1752332)
Backed out changeset 7fb5f0cc44f6 (bug 1752332)
Backed out changeset e8b2a80aa796 (bug 1752332)
Backed out changeset 593e5e138927 (bug 1752332)
Backed out changeset a8832dc94d1b (bug 1752332)
Backed out changeset b10197a1ed67 (bug 1752332)
Backed out changeset 8de253223dbc (bug 1752332)
Backed out changeset be908bb7a985 (bug 1752332)
Backed out changeset 26796b527442 (bug 1752332)
Backed out changeset 1a875dc06058 (bug 1752332)
2022-02-23 20:43:01 +02:00
Tom Ritter dc362926e6 Bug 1752332: Remove the blocklisting check in ::OnPreferenceChange r=KrisWright
Now that we send everything (except sometimes the user value
is sanitized) we should no longer perform this check.

This is also good because it eliminates security code you
have to have (and thus accidently omitting it is a
vulnerability) and changes it to security code that happens
automatically, and is enforced by the compiler (via mandatory
ctor argument.)

Differential Revision: https://phabricator.services.mozilla.com/D138684
2022-02-23 15:31:10 +00:00
Tom Ritter 1c8c5ab5d0 Bug 1752332: Rename ShouldSyncPreference to ShouldSanitizePreference r=necko-reviewers,KrisWright,dragana
This simplifies the number of negations needed,
and makes things easy to understand.  I think
anyway; I know that without renaming it I made
several annoying-to-diagnose negation errors...

Differential Revision: https://phabricator.services.mozilla.com/D138682
2022-02-23 15:31:09 +00:00
Tom Ritter 69c064a961 Bug 1752332: Move ShouldSyncPreferences to Preferences module r=KrisWright
While we do so, also add a boolean argument to indicate
if we are in a _Content_ process or some other type of
subprocess, which I expect we will need later.

Differential Revision: https://phabricator.services.mozilla.com/D138681
2022-02-23 15:31:08 +00:00
Tom Ritter 46c1c370d7 Bug 1752332: Rename references to parent-only pref structures r=KrisWright
We're going to be using them in more contexts, so generalize
the name.

Differential Revision: https://phabricator.services.mozilla.com/D138680
2022-02-23 15:31:08 +00:00
Tom Ritter 62ea762c4d Bug 1752332: Add in a sanitize property for prefs, and only serialize the user value if we're not sanitized r=KrisWright
We want to eventually crash if a blocklisted preference
is accessed.  In order to do this, we do need to
populate the preference in the pref hashmap of the
subprocess; otherwise when we look up a blocklisted
pref we will just not find anything. We could try to
put the blocklist check at that point; but this won't
work for StaticPrefs; we'd also need to put the blocklist
check there.

Performing a list iteration and string comparison on
every Static Pref call is not acceptable when we can
just populate a bit and check it.

Differential Revision: https://phabricator.services.mozilla.com/D138679
2022-02-23 15:31:07 +00:00
sotaro 3a75af29e0 Bug 1756604 - Remove PrivateExternalImage handling r=gfx-reviewers,aosmond
PrivateExternalImage is not used by WebRender.

Differential Revision: https://phabricator.services.mozilla.com/D139382
2022-02-23 14:21:39 +00:00
Nicolas Silva c42f4165d3 Bug 1686654 - Ensure SwitchItem is called at the start of each blob group. r=jrmuizel
It was previously only called where we create a stacking context helper: before entering the grouping code and before pushing an active item into the wr display list, and not between the active items and the next blob group. This caused the leaf clip rect of the active item to leak into the next blob group.

Differential Revision: https://phabricator.services.mozilla.com/D136906
2022-02-23 13:43:38 +00:00
Nicolas Silva 50ca258be2 Bug 1755747 - Add support for antialiased non-snapped rectangles. r=gfx-reviewers,aosmond
We need them for SVG primitives.

This patch adds a bit of plumbing to disable snapping some of the primitives and forcing the antialiasing shader feature where needed, and uses it for SVG solid rectangles and images.

Differential Revision: https://phabricator.services.mozilla.com/D139024
2022-02-23 13:37:39 +00:00
stransky f677662932 Bug 1751987 [Linux] Add VA-API feature r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D139301
2022-02-23 11:47:07 +00:00
Miko Mynttinen ddec6eef59 Bug 1714584 - Part 1: Decouple nsDisplayList internal list from nsDisplayItems r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138152
2022-02-22 23:42:18 +00:00
Brad Werth ccfb0403c2 Bug 1745492 Part 5: Make NativeLayerCA::LogSurface print buffer attachments. r=mstange
This expands the information we can request from future bug reporters. This
logging is only done when the `gfx.core-animation.specialize-video.log` pref
is set.

Differential Revision: https://phabricator.services.mozilla.com/D137084
2022-02-22 19:17:21 +00:00
Brad Werth 748350ebb5 Bug 1745492 Part 4: Make NativeLayerCA create specialized video layers for HDR video. r=mstange
This adds additional logic to detect when video requires a specialized video
layer. The logic from NativeLayerCA::Representation::CanSpecializeSurface has
been rolled into the mainline decision of whether or not to specialize the
video layer at all.

Differential Revision: https://phabricator.services.mozilla.com/D135634
2022-02-22 19:17:20 +00:00
Brad Werth 4b772da5ef Bug 1745492 Part 2: Update MacIOSurface handling to deal with 10-bit formats. r=media-playback-reviewers,gfx-reviewers,lsalzman,alwu
This fixes an issue caused by landing Bug 1679927. Now that it's possible to
get 10-bit formats in macOS, the texture pipeline has to be updated to pass
those surfaces to WebRender.

This also contains a drive-by comment on D3D11 handing of 10-bit WebRender
display items. It was not clear why specifing 16-bit color depth for P010
format was correct there, but should be specified as 10-bit color elsewhere.

This also contains another drive-by fix to comments in webrender describing
the RG16 enum.

Differential Revision: https://phabricator.services.mozilla.com/D136823
2022-02-22 19:17:20 +00:00
Lee Salzman 9ff6a3947e Bug 1750858 - Respect mPicSize in WebRender. r=sotaro
This makes WR properly handle mPicSize when RenderBufferTextureHost is used.
The main change is that we need to take care to pass in display().Size() from
the descriptor, and then further use that to carefully limit the size of the
CbCr texture, as it doesn't necessarily maintain an appropriate half-sized
scale with respect to the Y texture if it is padded.

Given that mPicSize should now actually work, we should no longer need any
of the previous mCroppedSize mechanisms that were added to work around this,
and so they are removed in this patch.

Differential Revision: https://phabricator.services.mozilla.com/D139267
2022-02-22 17:56:30 +00:00
Jamie Nicol 72a1b5cd91 Bug 1755381 - Avoid relaunching GPU process immediately on Android if app is in background. r=agi,aosmond
If the android system kills the GPU process to free memory while the
app is in the background, then we want to avoid immediately restarting
the GPU process.

To achieve this, we make GPUProcessManager keep track of whether it is
in the foreground or background. If HandleProcessLost() gets called
while in the background then we destroy the existing compositor
sessions as before, but return early instead of immediately
relaunching the process. If the process has not been launched when the
app later gets foregrounded then we do so then.

The final part of HandleProcessLost(), which reinitializes the content
bridges and emits the "compositor-reinitialized" signal, has been
moved to a new function ReinitializeRendering(). If the GPU process
has been disabled, this gets called as-before at the end of
HandleProcessLost(). When the GPU process is enabled, however, we now
call it from OnProcessLaunchComplete(), so that it gets called
regardless of whether the process is launched immediately or after a
delay.

While we're here, rename the functions RebuildRemoteSessions() and
RebuildInProcessSessions() to DestroyRemoteCompositorSessions() and
DestroyInProcessCompositorSessions(), to better reflect what they
actually do: the "rebuilding" part occurs later on. Also update the
mega-comment documenting the restart sequence, as it was somewhat
outdated.

In case a caller of EnsureGPUReady() gets called before the foreground
signal arrives (eg in nsBaseWidget::CreateCompositorSession() due to a
refresh tick paint), make EnsureGPUReady() launch the GPU process
itself if the GPU process is enabled but not yet launched. As a
consequence, to avoid launching the GPU process unnecessarily, change
a couple callers of EnsureGPUReady() to simply check whether the
process is enabled instead.

Additionally, guard against a null pointer deref if the compositor has
been destroyed when the widget receives a memory pressure event. This
is now more likely to occur as there may be a gap between the
compositor being destroyed and recreated.

Differential Revision: https://phabricator.services.mozilla.com/D139042
2022-02-22 15:59:13 +00:00
Norisz Fay 2121660ce9 Backed out 2 changesets (bug 1714584) per devs request for causing crashes a=backout
Backed out changeset 3baead3e079b (bug 1714584)
Backed out changeset a2da895a58ce (bug 1714584)
2022-02-22 16:41:57 +02:00
Miko Mynttinen 28474c7ad2 Bug 1714584 - Part 1: Decouple nsDisplayList internal list from nsDisplayItems r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138152
2022-02-22 00:44:25 +00:00
Nicolas Silva fe4765d2b0 Bug 1753404 - Track hit tested bounds separately from painted bounds. r=jrmuizel
This patch separates the tracking and submission of paint/hit-test rects, ensuring that we can remove invisible parts form the blobs without breaking hit testing.

Differential Revision: https://phabricator.services.mozilla.com/D139134
2022-02-21 21:57:03 +00:00
Nicolas Silva 4824b5ed95 Bug 1753404 - Avoid extra blob tiles from invisible items. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D137862
2022-02-21 21:57:03 +00:00
Lee Salzman ce2bd5b47f Bug 1755780 - Optimize DrawTargetWebgl for BGRA WebGL framebuffer. r=aosmond
Currently within DrawTargetWebGL, the Skia framebuffer and external software
surfaces are in BGRA, while the WebGL framebuffer is in RGBA. This requires
swizzling all software surfaces to RGBA on upload and swizzling surfaces
back to BGRA on readback. This can either require intermediate surfaces or
extra costly processing.

Now that CopyToSwapChain is available with support for a BGRA blit, we can
remove these complications by just treating the WebGL framebuffer as if it
was BGRA directly, so that any uploads or readbacks do not require a swizzle.

Differential Revision: https://phabricator.services.mozilla.com/D139066
2022-02-21 17:33:09 +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
Norisz Fay e580b1098c Merge autoland to mozilla-central. a=merge 2022-02-21 11:39:24 +02:00
Norisz Fay 44a6c895e2 Backed out 3 changesets (bug 1749380) for causing webrender crashes a=backout DONTBUILD
Backed out changeset 1762adb371d4 (bug 1749380)
Backed out changeset 2b42abbdb0df (bug 1749380)
Backed out changeset 9fa6f71111d0 (bug 1749380)
2022-02-21 11:35:49 +02:00
Hiroyuki Ikezoe f9fa9e01f5 Bug 1720240 - Clamp overscroll animation positions to zero to not get across over zero. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D138091
2022-02-20 23:27:33 +00:00
Glenn Watson aa7dd422cf Bug 1749380 - Part 2 - Performance and quality fixes for part 1. r=gfx-reviewers,nical
* Add support for local scale factors to a surface, allowing it to
  be rasterized in root coordinate space. This allows snapping to
  work across surfaces where the surface transform is a fractional
  offset.

* Calculate scaling factors per rasterized surface and propagate
  them. Ensures correct scale factor calculations when dealing with
  nested preserve-3d contexts with 90-degree axis rotations.

* Support determining exact surface device rect for 2d surfaces
  with fractional surface transforms.

* Fix line decoration cache key size calculations based on world
  scaling factor.

* Remove `get_clipped_device_rect` usage for calculating clip-mask
  surface allocations, use `surface.get_surface_rect` instead. The
  prior method doesn't correctly account for expanded local regions
  from the current dirty rect, resulting in invalidation issues in
  some animated edge cases. Also unifies the way clip-mask surface
  allocations work with the way general render target surface
  allocations work.

Differential Revision: https://phabricator.services.mozilla.com/D138982
2022-02-20 18:56:55 +00:00
Glenn Watson 4ef4327873 Bug 1749380 - Part 1 - Improve how WR handles bounding rects for off-screen surfaces r=gfx-reviewers
This patch introduces a number of subtle but important changes
to how we deal with off-screen surfaces. The overall goals are:

 - Improve rendering correctness in a number of edge cases.
 - Begin reducing complexity related to surfaces, scaling
   factors, surface size adjustments and clipping.
 - Improve CPU performance by removing some per-primitive work.
 - Simplify implementation of future SVG and CSS filters by
   having explicit support for picture rects + inflation regions.
 - Lay the groundwork for caching child picture surfaces,
   reduction of per-primitive work during visibility pass,
   simplifying picture code.

Unfortunately, the nature of the changes make it impossible to
split up in to small isolated patches. Details below:

* Introduce `LocalRectKind` concept. This allows us to separate
  out the bounding rect of the surface (a group of primitives
  backed by a texture) from the bounding rect of the picture
  compositing that surface (e.g. a drop-shadow which draws the
  surface once at the local origin and once at a specific offset
  + blur-radius). This fixes a number of correctness bugs we have
  related to culling, clipping, invalidation regions of complex
  primitives such as drop-shadows and blur filters. Importantly,
  it makes it simpler to implement (or fix) SVG filter chains,
  backdrop-filter implementations.

* Establish raster roots for all off-screen surfaces. Every off-screen
  surface uses the spatial node of the enclosing stacking context as
  a coordinate system root, ensuring that each off-screen surface is
  drawn in a 2D coordinate system, with appropriate scaling factors
  applied to ensure high quality rendering. The primary goal is to make
  it possible to correctly inflate and clip off-screen surfaces, removing
  some correctness issues we currently have with complex filters interacting
  with transforms. The initial work here doesn't reduce complexity a huge
  amount, but will allow us to simplify large parts of the picture/surface
  handling code in future, as well as simplify a number of shaders that
  currently must handle arbitrarily complex transform matrices. This will
  also allow us to simplify the implementation of features such as
  mix-blend-mode and backdrop-filter, which rely on readback and UV mapping
  from the parent surface.

* Remove concepts of `estimated` and `precise` local rects for pictures. This
  is both a performance optimization and a code simplification. Instead, we
  only determine the estimated local rect during bounding rect propagation,
  and rely on the clipping regions from the tile dirty regions to reduce which
  parts of the picture we allocate if drawing to an off-screen surface. This
  removes some per-primitive work during the visibility pass, and also means
  we can rely on the final picture bounding rect from the start of the visibility
  pass. This also removes much of the complexity in `take_context` where we
  previously determined surface scale factors and device pixel ratio - instead
  these can be determined earlier during `propagate_bounding_rects`.

* Remove some complexity in `update_prim_visibility`. This is still recursive,
  but follow up patches will aim to remove this recursion and integrate this
  pass with the picture graph (similar to how `propagate_bounding_rects` works).

* Remove `PictureOptions` struct. Instead, store `inflate_if_required` with
  the Blur filter enum, which is the only place that uses it.

* Remove `root_scaling_factor` from text runs - this is handled implicitly
  by the surface device-pixel scale.

* Skip calling `update_clip_task` for pass-through pictures (since they have
  no defined local rect).

* Improve scaling factors used for determining the render task cache size for
  complex line decorations.

Differential Revision: https://phabricator.services.mozilla.com/D137569
2022-02-20 18:56:54 +00:00
Jens Stutte 8dc1e5affa Bug 1750635: Substitute AppShutdown:IsShuttingDown with equivalent AppShutdown::IsInOrBeyond. r=florian,xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D139143
2022-02-18 19:35:13 +00:00
Andrew Osmond c18a944c15 Bug 1754978 - Part 2. Switch WebGPU to use async image pipelines for display. r=kvark
This patch removes more main thread dependencies from the content side
of WebGPU. Instead of issuing a resource update for an external image,
we now use an async image pipeline in conjunction with
CompositableInProcessManager from part 1. This allows us to update the
HTMLCanvasElement bound to the WebGPU device without having to go
through the main thread, or even the content process after the swap
chain update / readback has been requested.

Differential Revision: https://phabricator.services.mozilla.com/D138887
2022-02-18 15:59:13 +00:00
Andrew Osmond 45ae50555d Bug 1754978 - Part 1. Refactor CompositableHandle infrastructure to allow in-process driven handles. r=sotaro
For WebGPU, we produce the textures in the compositor process and the
content process doesn't need to be that involved except for hooking up
the texture to the display list. Currently this is done via an external
image ID.

Given that WebGPU needs to work with OffscreenCanvas, it would be best
if its display pipeline was consistent whether it was gotten from an
HTMLCanvasElement, OffscreenCanvas on the main thread, or on a worker
thread. As such, using an AsyncImagePipeline would be best.

However there is no real need to bounce the handles across process
boundaries. Hence this patch which adds CompositableInProcessManager.
This static class is responsible for collecting WebRenderImageHost
objects backed by TextureHost objects which do not leave the compositor
process. This will allow WebGPUParent to schedule compositions directly
in future patches.

Differential Revision: https://phabricator.services.mozilla.com/D138588
2022-02-18 15:59:12 +00:00
Cosmin Sabou e0e7542556 Backed out 2 changesets (bug 1755381) for causing gtest failures on TestMediaDataDecoder.cpp. CLOSED TREE
Backed out changeset 255cda33f56e (bug 1755381)
Backed out changeset 2c55863fbccc (bug 1755381)
2022-02-18 16:40:08 +02:00
Jamie Nicol e0e12f120a Bug 1755381 - Avoid relaunching GPU process immediately on Android if app is in background. r=agi,aosmond
If the android system kills the GPU process to free memory while the
app is in the background, then we want to avoid immediately restarting
the GPU process.

To achieve this, we make GPUProcessManager keep track of whether it is
in the foreground or background. If HandleProcessLost() gets called
while in the background then we destroy the existing compositor
sessions as before, but instead of immediately relaunching the process
then reinitializing content bridges, just set a flag saying we need to
do so. If the flag is set when the app later gets foregrounded then we
continue where we left off.

While we're here, rename the functions RebuildRemoteSessions() and
RebuildInProcessSessions() to DestroyRemoteCompositorSessions() and
DestroyInProcessCompositorSessions(), to better reflect what they
actually do: the "rebuilding" part occurs later on. Also update the
mega-comment documenting the restart sequence, as it was somewhat
outdated.

In case a caller of EnsureGPUReady() gets called before the foreground
signal arrives (eg in nsBaseWidget::CreateCompositorSession() due to a
refresh tick paint), make EnsureGPUReady() launch the GPU process
itself if the GPU process is enabled but not yet launched.

Additionally, guard against a null pointer deref if the compositor has
been destroyed when the widget receives a memory pressure event. This
is now more likely to occur as there may be a gap between the
compositor being destroyed and recreated.

Differential Revision: https://phabricator.services.mozilla.com/D139042
2022-02-18 13:38:27 +00:00
Emilio Cobos Álvarez ede3f249a7 Bug 1754752 - Avoid a ton of warning spam when building swgl with gcc. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D139088
2022-02-18 09:38:21 +00:00
Emilio Cobos Álvarez f4f180967d Bug 1754752 - Use initializer lists in some swgl constructors. r=lsalzman,gfx-reviewers
We call it from another constexpr function. Clang seems to not be so
strict about this.

Differential Revision: https://phabricator.services.mozilla.com/D139078
2022-02-18 09:37:55 +00:00
Jamie Nicol aa73eaed41 Bug 1754332 - Add callback argument to APZInputBridge::ReceiveInputEvent. r=botond,geckoview-reviewers,agi
Rather than using a separate function
APZCTreeManager::AddInputBlockCallback(), allow an optional callback
argument to be passed to APZInputBridge::ReceiveInputEvent().

This avoids a race condition where the input block is processed before
the callback has a chance to be added to the input queue, meaning the
callback will never be fired. With the GPU process enabled the added
latency of adding the callback cross-process meant this occured
frequently, causing intermittent junit test failures.

This works similarily to before, with the in-process APZCTreeManager
implementation simply calling InputQueue::AddInputBlockCallback() and
the InputQueue will fire the callback when the input block has been
processed. For the cross-process implementation, APZInputBridgeChild
maintains a local map of the callbacks, and APZInputBridgeParent adds
an intermediate callback to its local InputQueue. This intermediate
callback will call APZInputBridgeParent::SendCallInputBlockCallback(),
which tells the APZInputBridgeChild to fire the real callback.

Care must be taken in both APZInputBridgeChild and Parent to only add
their respective callbacks if we determine that it is required, eg not
already handled by the root APZ.

Differential Revision: https://phabricator.services.mozilla.com/D138801
2022-02-18 07:29:10 +00:00
Jeff Muizelaar 1b11e0ebdb Bug 1755718 - Assert that color formats can be handled by Skia. r=aosmond
Just defaulting to BGRA is going to cause trouble down the line.

Differential Revision: https://phabricator.services.mozilla.com/D138897
2022-02-17 20:14:01 +00:00
Iulian Moraru 3dbfe82835 Backed out 2 changesets (bug 1754978) for causing valgrind bustages.
Backed out changeset 491a985fc34a (bug 1754978)
Backed out changeset 98983bf9eaed (bug 1754978)
2022-02-18 00:36:31 +02:00
Jeff Muizelaar 493bc03a67 Bug 1755959 - Remove unused path creation methods. r=gfx-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D139036
2022-02-17 19:11:38 +00:00
Andrew Osmond 7b655cecb8 Bug 1751721 - Add Zoom to the OffscreenCanvas domain allowlist and turn it on for users. r=gfx-reviewers,lsalzman,jgilbert
This will allow users to use gallery view with the web client for Zoom
in Firefox.

Differential Revision: https://phabricator.services.mozilla.com/D136836
2022-02-17 01:43:24 +00:00
Coelacanthus 7076b8ea9d Bug 1744765 - Add font features config from user's fontconfig r=jfkthame,layout-reviewers
As Pango do, we get font feature settings for specfied from user's
fontconfig. This will not affect users that don't use this feature,
because they will not add fontfeatures setting in their fontconfig.

There is an example config I use to test:
  <match target="pattern">
    <test name="family" compare="eq" ignore-blanks="true">
      <string>Iosevka</string>
    </test>
    <edit name="fontfeatures" mode="append">
      <string>ss10 on</string> <!-- using SS10 variant shape -->
      <string>cv49 1</string> <!-- straight y -->
      <string>cv83 2</string> <!-- underline, not too high, not too low -->
    </edit>
  </match>

Signed-off-by: Coelacanthus <coelacanthus@outlook.com>

Differential Revision: https://phabricator.services.mozilla.com/D138757
2022-02-16 23:00:52 +00:00
Andrew Osmond a18bf8a50c Bug 1754978 - Part 2. Switch WebGPU to use async image pipelines for display. r=kvark
This patch removes more main thread dependencies from the content side
of WebGPU. Instead of issuing a resource update for an external image,
we now use an async image pipeline in conjunction with
CompositableInProcessManager from part 1. This allows us to update the
HTMLCanvasElement bound to the WebGPU device without having to go
through the main thread, or even the content process after the swap
chain update / readback has been requested.

Differential Revision: https://phabricator.services.mozilla.com/D138887
2022-02-16 22:23:20 +00:00
Andrew Osmond 23a67affe1 Bug 1754978 - Part 1. Refactor CompositableHandle infrastructure to allow in-process driven handles. r=sotaro
For WebGPU, we produce the textures in the compositor process and the
content process doesn't need to be that involved except for hooking up
the texture to the display list. Currently this is done via an external
image ID.

Given that WebGPU needs to work with OffscreenCanvas, it would be best
if its display pipeline was consistent whether it was gotten from an
HTMLCanvasElement, OffscreenCanvas on the main thread, or on a worker
thread. As such, using an AsyncImagePipeline would be best.

However there is no real need to bounce the handles across process
boundaries. Hence this patch which adds CompositableInProcessManager.
This static class is responsible for collecting WebRenderImageHost
objects backed by TextureHost objects which do not leave the compositor
process. This will allow WebGPUParent to schedule compositions directly
in future patches.

Differential Revision: https://phabricator.services.mozilla.com/D138588
2022-02-16 22:23:19 +00:00
Emilio Cobos Álvarez 74d0665b85 Bug 1755737 - Make layout.css.dpi a static pref. r=jfkthame,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D138921
2022-02-16 21:13:58 +00:00
Nicolas Silva 7c8e9a875e Bug 1755503 - Support recording wgpu traces for multiple instances. r=kvark"
Record the trace of each instance into "$WGPU_TRACE/$IDX/" where $IDX is a monotonically increasing integer per instance.

Differential Revision: https://phabricator.services.mozilla.com/D138814
2022-02-16 19:04:20 +00:00
Butkovits Atila 20e27a3364 Backed out 2 changesets (bug 1755737) for causing failures at browser_test_feature_preferencereads.js. CLOSED TREE
Backed out changeset c2609661965d (bug 1755737)
Backed out changeset 34596510350a (bug 1755737)
2022-02-16 21:53:03 +02:00
Emilio Cobos Álvarez 47d1f077af Bug 1755737 - Make layout.css.dpi a static pref. r=jfkthame,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D138921
2022-02-16 17:39:57 +00:00
Butkovits Atila dff61f12f4 Backed out changeset 4c5ad6cc4df3 (bug 1755718) for causing reftest failures. CLOSED TREE 2022-02-16 20:06:14 +02:00
Jeff Muizelaar f610da391a Bug 1755718 - Assert that color formats can be handled by Skia. r=aosmond
Just defaulting to BGRA is going to cause trouble down the line.

Differential Revision: https://phabricator.services.mozilla.com/D138897
2022-02-16 16:12:50 +00:00
Marian-Vasile Laza 0bf097fcd0 Backed out changeset 27c56f453b34 (bug 1755503) for causing build bustages. CLOSED TREE 2022-02-16 15:18:54 +02:00
Nicolas Silva ffc6811e7d Bug 1755503 - Support recording wgpu traces for multiple instances. r=kvark"
Record the trace of each instance into "$WGPU_TRACE/$IDX/" where $IDX is a monotonically increasing integer per instance.

Differential Revision: https://phabricator.services.mozilla.com/D138814
2022-02-16 10:02:07 +00:00
Lee Salzman 9dee6a394e Bug 1755459 - Handle negative skew in skew_bitmap. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D138845
2022-02-15 21:34:08 +00:00
Jonathan Kew 0d504da0d2 Bug 1755179 - Add a missing null-check in gfxFontGroup::GetDefaultFont(), for better crash reports in the case where the default font is unusable. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D138798
2022-02-15 19:29:51 +00:00
Cristian Tuns 10c82ef861 Backed out 6 changesets (bug 1754336, bug 1754131, bug 1754809, bug 1749380, bug 1754350, bug 1754160) as requested by gwatson CLOSED TREE
Backed out changeset 6ad4a655b768 (bug 1754809)
Backed out changeset c60f4861cfa5 (bug 1754350)
Backed out changeset e3acddf74704 (bug 1754336)
Backed out changeset 49db3f1cc79a (bug 1754160)
Backed out changeset 346a4ffcb536 (bug 1754131)
Backed out changeset b7f88e5c537b (bug 1749380)
2022-02-14 23:25:33 -05:00
Glenn Watson 8ec675ff42 Bug 1754809 - Handle fractional snapping with off-screen surfaces where possible r=gfx-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D138628
2022-02-15 00:40:16 +00:00
Emilio Cobos Álvarez 51f5539b57 Bug 1754813 - Make Hal::ScreenOrientation an enum class. r=gsvelto,m_kato,geckoview-reviewers
This adds proper IPC validation too.

Differential Revision: https://phabricator.services.mozilla.com/D138461
2022-02-14 07:51:06 +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
Lee Salzman 58cc63bda7 Bug 1754130 - Implement SourceSurfaceWebgl for faster snapshots of DrawTargetWebgl. r=aosmond
Now that each DrawTargetWebgl shares the same WebGL context, we can efficiently draw snapshots
of one DrawTargetWebgl to another without requiring any readback or error-prone driver-provided
shared context/resource mechanism. We just need to simply pass the WebGL texture from one target
to the other, and use it like any other texture.

This provides SourceSurfaceWebgl to store and pass along that WebGL texture. It is largely
modeled off of SourceSurfaceSkia in terms of its copy-on-write behavior. There are three
noteworthy state changes that it must track from DrawTargetWebgl - when the framebuffer
contents is changing, when the framebuffer is being destroyed, and when any cached texture
handle separate from a framebuffer is also being destroyed. It will copy, orphan, or read
back data as appropriate to handle each case.

If it needs to be mapped, it just forces a read back of the data into a CPU surface that
can be mapped as requested.

Differential Revision: https://phabricator.services.mozilla.com/D138118
2022-02-11 19:49:55 +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
Lee Salzman 4fb52bf9bc 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 15:36:30 +00:00
Lee Salzman 8a34e8c65e Bug 1754130 - Implement SourceSurfaceWebgl for faster snapshots of DrawTargetWebgl. r=aosmond
Now that each DrawTargetWebgl shares the same WebGL context, we can efficiently draw snapshots
of one DrawTargetWebgl to another without requiring any readback or error-prone driver-provided
shared context/resource mechanism. We just need to simply pass the WebGL texture from one target
to the other, and use it like any other texture.

This provides SourceSurfaceWebgl to store and pass along that WebGL texture. It is largely
modeled off of SourceSurfaceSkia in terms of its copy-on-write behavior. There are three
noteworthy state changes that it must track from DrawTargetWebgl - when the framebuffer
contents is changing, when the framebuffer is being destroyed, and when any cached texture
handle separate from a framebuffer is also being destroyed. It will copy, orphan, or read
back data as appropriate to handle each case.

If it needs to be mapped, it just forces a read back of the data into a CPU surface that
can be mapped as requested.

Differential Revision: https://phabricator.services.mozilla.com/D138118
2022-02-11 15:36:30 +00:00