Commit graph

89 commits

Author SHA1 Message Date
Brad Werth
e7afee4bf1 Bug 1781122 Part 3: Make macOS video layers prevent capture when TextureHost is DRM. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D155297
2022-09-07 18:51:12 +00:00
Brad Werth
b7bf5c8d2e Bug 1737682 Part 1: Log whether or not we are hitting the detached state. r=mstange
There are 10 enum cases that we track internally, one of which isn't
emitted as telemetry. These cases are 0-indexed to match the enum values.

0 / NotVideo: Not used for telemetry. No video is showing.

1 / LowPower: We are showing exactly one video and we believe we are
hitting the video low power mode. We don't use "Success" because of name
collision in the telemetry generation.

2 / FailMultipleVideo: There is more than one video visible.

3 / FailWindowed: The video is being viewed in windowed mode, not
fullscreen mode, so low power mode is not possible.

4 / FailOverlaid: The video has something on top of it (like captions).

5 / FailBacking: The layer directly underneath the video does not cover
the window or does not have a black background.

6 / FailMacOSVersion: The system is running a too-early version of macOS.

7 / FailPref: The user has disabled the
`gfx.core-animation.specialize-video` pref.

8 / FailSurface: The video is encoded in such a way we can't decode it to
a qualifying pixel format.

9 / FailEnqueue: The video didn't enqueue properly, and we fell back to a
non-video display path.

Differential Revision: https://phabricator.services.mozilla.com/D129453
2022-07-20 20:00:26 +00:00
Cosmin Sabou
ea3afb405e Backed out 2 changesets (bug 1737682) for causing build bustages on TelemetryHistogramEnums.h. CLOSED TREE
Backed out changeset 297b16133aa9 (bug 1737682)
Backed out changeset 362b1e430789 (bug 1737682)
2022-07-20 22:08:50 +03:00
Brad Werth
7b4233aaa1 Bug 1737682 Part 1: Log whether or not we are hitting the detached state. r=mstange
There are 10 enum cases that we track internally, one of which isn't
emitted as telemetry. These cases are 0-indexed to match the enum values.

0 / NotVideo: Not used for telemetry. No video is showing.

1 / Success: We are showing exactly one video and we believe we are
hitting the video low power mode.

2 / FailMultipleVideo: There is more than one video visible.

3 / FailWindowed: The video is being viewed in windowed mode, not
fullscreen mode, so low power mode is not possible.

4 / FailOverlaid: The video has something on top of it (like captions).

5 / FailBacking: The layer directly underneath the video does not cover
the window or does not have a black background.

6 / FailMacOSVersion: The system is running a too-early version of macOS.

7 / FailPref: The user has disabled the
`gfx.core-animation.specialize-video` pref.

8 / FailSurface: The video is encoded in such a way we can't decode it to
a qualifying pixel format.

9 / FailEnqueue: The video didn't enqueue properly, and we fell back to a
non-video display path.

Differential Revision: https://phabricator.services.mozilla.com/D129453
2022-07-20 18:48:28 +00:00
Brad Werth
1652c99df3 Bug 1731821: Remove NativeLayerCA video layer isolation and support scaffolding. r=mstange
The mouse moved tracking was only present to support the video layer isolation, so
this patch also removes that.

Differential Revision: https://phabricator.services.mozilla.com/D147468
2022-06-02 15:37:24 +00:00
Brad Werth
6af8eda593 Bug 1731136 Part 5: Make macOS native compositor and NativeLayerCA handle backdrop r=mstange
layers.


This makes the macOS native compositor claim the ability to handle color
layers and makes NativeLayerCA actually do it. Color layers have a different
structure than other layers. Color layers apply the color to the
wrappingCALayer, and have no contentCALayer at all. That means that the
color layers are always sized to the layer's clip rect.

This also contains a drive-by fix to handle the case where an mOpaquenessTintLayer
exists when mMutatedSpecializeVideo is set to true. Before this change, in such a
case, the opaqueness layer will not be associated with the recreated wrapping layer.

Depends on D128131

Differential Revision: https://phabricator.services.mozilla.com/D128545
2022-06-01 19:40:04 +00:00
Molnar Sandor
307fd4a744 Backed out 5 changesets (bug 1731136) for causing reftest failures in layout/reftests/bugs/299136-1.html CLOSED TREE
Backed out changeset d2a56d51c65b (bug 1731136)
Backed out changeset a24467137e9b (bug 1731136)
Backed out changeset e127e41e12da (bug 1731136)
Backed out changeset 7dfdcb74d1c1 (bug 1731136)
Backed out changeset 6b5626a7b82d (bug 1731136)
2022-06-01 04:12:55 +03:00
Brad Werth
47917e0be8 Bug 1731136 Part 5: Make macOS native compositor and NativeLayerCA handle backdrop r=mstange
layers.


This makes the macOS native compositor claim the ability to handle color
layers and makes NativeLayerCA actually do it. Color layers have a different
structure than other layers. Color layers apply the color to the
wrappingCALayer, and have no contentCALayer at all. That means that the
color layers are always sized to the layer's clip rect.

This also contains a drive-by fix to handle the case where an mOpaquenessTintLayer
exists when mMutatedSpecializeVideo is set to true. Before this change, in such a
case, the opaqueness layer will not be associated with the recreated wrapping layer.

Depends on D128131

Differential Revision: https://phabricator.services.mozilla.com/D128545
2022-05-31 22:21:15 +00:00
criss
59b9e1210a Backed out 4 changesets (bug 1731136) for causing Bug 1771465 . CLOSED TREE
Backed out changeset c333a19d8712 (bug 1731136)
Backed out changeset 6b5b4b5eb1e9 (bug 1731136)
Backed out changeset 7afa3f4b5a85 (bug 1731136)
Backed out changeset b408a3230170 (bug 1731136)
2022-05-27 17:39:43 +03:00
Brad Werth
77aa170cdd Bug 1731136 Part 4: Make macOS native compositor and NativeLayerCA handle backdrop layers. r=mstange
This makes the macOS native compositor claim the ability to handle color
layers and makes NativeLayerCA actually do it. Color layers have a different
structure than other layers. Color layers apply the color to the
wrappingCALayer, and have no contentCALayer at all. That means that the
color layers are always sized to the layer's clip rect.

This also contains a drive-by fix to handle the case where an mOpaquenessTintLayer
exists when mMutatedSpecializeVideo is set to true. Before this change, in such a
case, the opaqueness layer will not be associated with the recreated wrapping layer.

Differential Revision: https://phabricator.services.mozilla.com/D128545
2022-05-26 15:24:13 +00:00
Brad Werth
355dc69516 Bug 1763698: Make NativeLayerCA only iterate the sublayers with an extent. r=mstange
This additionally changes acceptProvidedSublayers to a C++ lambda function,
which keeps the compiler happy with iterating over the new nsTArray.

Differential Revision: https://phabricator.services.mozilla.com/D143220
2022-05-10 21:12:00 +00:00
Marian-Vasile Laza
e68becd63d Backed out changeset b1b0f718e9b1 (bug 1763698) for causing reftest/mochitest/web-platform/devtools failures. CLOSED TREE 2022-05-10 06:10:17 +03:00
Brad Werth
6f95225362 Bug 1763698: Make NativeLayerCA only iterate the sublayers with an extent. r=mstange
This additionally changes acceptProvidedSublayers to a C++ lambda function,
which keeps the compiler happy with iterating over the new nsTArray.

Differential Revision: https://phabricator.services.mozilla.com/D143220
2022-05-10 00:16:16 +00:00
Butkovits Atila
87afda4785 Backed out changeset 15a3396049af (bug 1763698) for causing reftest failures. CLOSED TREE 2022-04-13 07:16:59 +03:00
Brad Werth
a7af9f83fc Bug 1763698: Make NativeLayerCA only iterate the sublayers with an extent. r=mstange
This additionally changes acceptProvidedSublayers to a C++ lambda function,
which keeps the compiler happy with iterating over the new nsTArray.

Differential Revision: https://phabricator.services.mozilla.com/D143220
2022-04-12 22:14:10 +00:00
Randell Jesup
fcaf70841e Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 18:47:08 +00:00
Noemi Erli
2390d257e6 Backed out changeset 12a59e5a50bf (bug 1207753) for causing build bustage CLOSED TREE 2022-03-16 18:32:51 +02:00
Randell Jesup
4b033a5256 Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 16:16:14 +00:00
Butkovits Atila
927ad62c6a Backed out changeset a68ee4b09f92 (bug 1207753) for causing Hazard bustages. CLOSED TREE 2022-03-16 14:38:14 +02:00
Randell Jesup
7d4b5fae04 Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 12:01:14 +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
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
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
Sandor Molnar
c088d49147 Backed out changeset a7c322ebcfea (bug 1737682) for causing high frequency bc failures in browser_panelUINotifications_multiWindow. CLOSED TREE 2021-12-18 01:09:45 +02:00
Brad Werth
da5580fd9b Bug 1737682 Part 2: Log whether or not we are hitting the detached state. r=mstange
There are 13 enum cases that we track internally, 2 of which aren't emitted
as telemetry. These cases are 0-indexed to match the enum values.

0 / None: Not used for telemetry.

1 / FailNotVideo: Not used for telemetry.

2 / Active: This should be "Success" but that creates name-collision
compilation errors for Linux. This is the only enum that indicates that the
feature is working. We want this high, relative to all other states. That
would mean that the feature is providing value for the ways that users tend to
watch video on the web, and what video they choose to watch.

3 / FailPref: We expect to never see this. The pref is on by default so this
indicates that users are turning the feature off (to avoid bugs, perhaps).

4 / Fail10_13: This should go down over time as users upgrade their systems.

5 / FailFullscreen: This will teach us about user habits. If this number is
high in aggregate, it means that users tend to watch video in windows, where
we can't hit detached mode.

6 / FailIsoMouse: We had a qualifying video, but didn't isolate it because the
mouse was moving (which probably means that video controls were showing even
if they are not on top of the video).

7 / FailIsoTopVideo: This indicates that there is a video on screen, but it
is not the topmost layer.

8 / FailIsoSize: The video is topmost, but not large enough, relative to the
screen.

9 / FailIsoCenter: The video is topmost and large enough, but not centered.

10 / FailIsoOneVideo: There is a topmost video, but there's at least one other
video in the layer stack.

11 / FailSurface: This we want to see go down over time. Lowering values
here indicate that more video on the web is using paths in Firefox that support
the low power mode.

12 / FailEnqueue: We expect to never see this. If we do, the only time it
should occur is when we are out of memory. If it occurs at other times, then
we are failing to use the Core Media APIs correctly.

Differential Revision: https://phabricator.services.mozilla.com/D129453
2021-12-17 21:14:24 +00:00
criss
a1f29d497d Backed out changeset ce4dd013648f (bug 1737682) for causing build bustages on TelemetryHistogramEnums.h. CLOSED TREE 2021-12-17 19:24:08 +02:00
Brad Werth
9edeccc7ad Bug 1737682 Part 2: Log whether or not we are hitting the detached state. r=mstange
There are 13 enum cases that we track internally, 2 of which aren't emitted
as telemetry. These cases are 0-indexed to match the enum values.

0 / None: Not used for telemetry.

1 / FailNotVideo: Not used for telemetry.

2 / Success: This is the only enum that indicates that the feature is working.
We want this high, relative to all other states. That would mean that the
feature is providing value for the ways that users tend to watch video on the
web, and what video they choose to watch.

3 / FailPref: We expect to never see this. The pref is on by default so this
indicates that users are turning the feature off (to avoid bugs, perhaps).

4 / Fail10_13: This should go down over time as users upgrade their systems.

5 / FailFullscreen: This will teach us about user habits. If this number is
high in aggregate, it means that users tend to watch video in windows, where
we can't hit detached mode.

6 / FailIsoMouse: We had a qualifying video, but didn't isolate it because the
mouse was moving (which probably means that video controls were showing even
if the are not on top of the video).

7 / FailIsoTopVideo: This indicates that there is a video on screen, but it
is not the topmost layer.

8 / FailIsoSize: The video is topmost, but not large enough, relative to the
screen.

9 / FailIsoCenter: The video is topmost and large enough, but not centered.

10 / FailIsoOneVideo: There is a topmost video, but there's at least one other
video in the layer stack.

11 / FailSurface: This we want to see go down over time. Lowering values
here indicate that more video on the web is using paths in Firefox that support
the low power mode.

12 / FailEnqueue: We expect to never see this. If we do, the only time it
should occur is when we are out of memory. If it occurs at other times, then
we are failing to use the Core Media APIs correctly.

Differential Revision: https://phabricator.services.mozilla.com/D129453
2021-12-17 16:50:01 +00:00
Brad Werth
66e6f8cdeb Bug 1741982: Restructure NativeLayerCA to handle video only updates without a transaction. r=mstange
This reduces our demands on the Core Animation compositor.

Differential Revision: https://phabricator.services.mozilla.com/D131665
2021-11-24 18:07:41 +00:00
Brad Werth
5ad125fce1 Bug 1738926 Part 1: Check if sublayers need to be rebuilt. r=mstange
This fixes a correctness issue. Since NativeLayerCA Representations can
generate new CALayers under certain conditions, the NativeLayerRootCA must
check to see if a rebuild is necessary when committing.

Differential Revision: https://phabricator.services.mozilla.com/D131307
2021-11-18 21:28:44 +00:00
Brad Werth
1b44cb44ee Bug 1737682 Part 1: Cache calls to NativeLayerCA::ShouldSpecializeVideo in a state bit. r=gfx-reviewers,mstange
This guarantees that any time mMutatedSpecializeVideo is set to true, the next
call to ApplyChanges will receive the value that actually triggered the
mutation. This was *probably* already true, but this change makes it explicit
and similar to other state changes.

Differential Revision: https://phabricator.services.mozilla.com/D129452
2021-11-16 20:55:44 +00:00
Brad Werth
63e3c22a38 Bug 1731956: Make NativeLayerRootCA fullscreen and mouse move accessors thread safe. r=mstange
In addition to adding locks around the accessors, this also removes the call
to `CommitToScreen` from the fullscreen accessor, which was probably
redundant and definitely made the main thread call `Commit` which introduces
possible concurrency errors.

Differential Revision: https://phabricator.services.mozilla.com/D129425
2021-10-27 20:46:29 +00:00
Brad Werth
6603a4e814 Bug 1734854: Make NativeLayerRootCA avoid changing sublayers when it has no effect. r=gfx-reviewers,jrmuizel
When isolating video layers, changes to sublayers that we are already ignoring
should not cause us to change our sublayers. This patch checks to see if the
changes to sublayers can all be safely ignored.

Differential Revision: https://phabricator.services.mozilla.com/D129330
2021-10-23 03:39:10 +00:00
Brad Werth
557ceaac29 Bug 1732694: Prevent NativeLayerRootCA from isolating video layers while mouse is moving. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D129065
2021-10-20 22:40:26 +00:00
Brad Werth
4f808bf352 Bug 1736446: Make NativeLayerCA consistently protect member access with a lock. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D128791
2021-10-19 20:48:56 +00:00
Butkovits Atila
8ecb76d03a Backed out changeset 9d531fd67a5f (bug 1736446) for causing failures at Mutex_posix.cpp. CLOSED TREE 2021-10-19 23:09:26 +03:00
Brad Werth
953751f28d Bug 1736446: Make NativeLayerCA consistently protect member access with a lock. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D128791
2021-10-19 18:56:29 +00:00
Brad Werth
8602be6fea Bug 1735420: Make video layers check pixel formats to determine eligibility for layer specialization. r=mstange
This ensures that we only do the extra work of EnqueueSurface when the video
format is eligible for the low power detached mode.

Differential Revision: https://phabricator.services.mozilla.com/D128420
2021-10-15 15:20:09 +00:00
Brad Werth
fb11266988 Bug 1653417 Part 6: Make NativeLayerRootCA attempt to isolate video layers. r=gfx-reviewers,jrmuizel
This is another requirement for the video display layer to be detached and use
less power: the layer must be topmost and have only a black layer behind it.

Differential Revision: https://phabricator.services.mozilla.com/D124150
2021-09-20 19:19:28 +00:00
Brad Werth
2931358d79 Bug 1653417 Part 5: Make NativeLayerCA use AVSampleBufferDisplayLayers for video. r=gfx-reviewers,mstange
This patch reconstitutes a CMSampleBuffer from an IOSurface using spoofed
timing information to display the single sample immediately. Using this method
is neccessary, but not sufficient for the video display layer to be detached
and use less power. The remaining requirements are covered by later parts of
this patch series.

Differential Revision: https://phabricator.services.mozilla.com/D116643
2021-09-20 19:19:27 +00:00
Brad Werth
32624d8ae8 Bug 1653417 Part 4: Add scaffolding for NativeLayerCA to specialize video layers. r=gfx-reviewers,mstange
This is scaffolding for checking the conditions where the specialized video
layers will reduce power consumption. In the next part, we'll actually create
and fill the specialized layers.

Differential Revision: https://phabricator.services.mozilla.com/D107292
2021-09-20 19:19:27 +00:00
Brad Werth
8b0ed5b62c Bug 1653417 Part 3: Convert NativeLayerCA::Representation flags to use a bitfield. r=gfx-reviewers,mstange
The size of the NativeLayerCA::Representation struct seems to be a factor in
the power consumption of native layer updates. Converting this series of bools
into a bitfield is an easy way to reduce the structure size.

Differential Revision: https://phabricator.services.mozilla.com/D124992
2021-09-20 19:19:26 +00:00
Brad Werth
1a1a751ea1 Bug 1653417 Part 2: Make nsCocoaWindow notify its native layer when toggling fullscreen. r=gfx-reviewers,mstange
This allows the native layer code to determine when specialized video layers
might be beneficial for reducing power consumption.

Differential Revision: https://phabricator.services.mozilla.com/D124149
2021-09-20 19:19:26 +00:00
Markus Stange
975565c019 Bug 1726836 - Add a mac-only pref gfx.webrender.debug.dump-native-layer-tree-to-file, which, when set, causes each composite to create an HTML file with the layer tree contents at $HOME/Destop/nativelayerdumps-PID/frame-ID.html. r=bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D123261
2021-08-23 17:09:38 +00:00
Robert Mader
6369b642b9 Bug 1719516 - Add names to some AutoLock arguments in NativeLayerCA. r=mstange
To be more consistent with the rest of the code base and make the
header file easier to read. Also remove an usused function declaration.

Differential Revision: https://phabricator.services.mozilla.com/D119335
2021-07-09 06:49:33 +00:00
Robert Mader
76692c1a43 Bug 1711244 - Integrate NativeLayerWayland with WaylandVsyncSource, r=stransky,gfx-reviewers,jrmuizel
Make the vsync source request frame callbacks from opaque native
layers. This is necessary as opaque layers may occlude the
MozContainer surface, which is normally used for frame callbacks.
Wayland compositors may (and are encouraged to) optimize away
such callbacks, so we need to make sure to request frame callbacks
from actually visible surfaces.

Callbacks are requested for all layers, but only the first callback
will trigger the vsync source.
In order to get this right concerning multiple requested callbacks,
possibly being called from different threads etc., introduce a
callback abstraction, `CallbackMultiplexHelper`, to make this simple
to handle for callers.

Differential Revision: https://phabricator.services.mozilla.com/D116026
2021-06-10 15:12:54 +00:00
Markus Stange
4b48af6bb7 Bug 1690653 - Don't create a CATransaction if nothing changed. r=mattwoodrow
This avoids some overhead from committing the transaction.

Differential Revision: https://phabricator.services.mozilla.com/D104085
2021-02-09 21:17:19 +00:00
Matt Woodrow
5487b02f9e Bug 1666055 - Remove RenderTextureHostOGL. r=lsalzman
This interface is never used directly, and the only consumers of the virtual functions are by the derived classes themselves.

Differential Revision: https://phabricator.services.mozilla.com/D93180
2020-10-14 07:58:18 +00:00
Markus Stange
6d2642e09e Bug 1664047 - Only call UpdateSnapshot when ScreenshotGrabber calls GetWindowContents, which it only does if the profiler is running (and Screenshots are enabled). r=mattwoodrow
This requires passing down the window size down in a different way, because the
NativeLayerRootSnapshotter does not know the window size otherwise.

At the same time, this patch also removes WindowNLRS and makes the NativeLayerRoot
implement the profiler_screenshots::Window interface directly.

Differential Revision: https://phabricator.services.mozilla.com/D89864
2020-09-15 20:47:19 +00:00
Mihai Alexandru Michis
a75aa1f3ed Backed out 2 changesets (bug 1664047, bug 1664135) for causing dt failures in ScreenshotGrabber.cpp
CLOSED TREE

Backed out changeset d8996fcd3568 (bug 1664047)
Backed out changeset 070815d3ff02 (bug 1664135)
2020-09-15 03:09:08 +03:00
Markus Stange
b2cdbc6d3e Bug 1664047 - Only call UpdateSnapshot when ScreenshotGrabber calls GetWindowContents, which it only does if the profiler is running (and Screenshots are enabled). r=mattwoodrow
This requires passing down the window size down in a different way, because the
NativeLayerRootSnapshotter does not know the window size otherwise.

At the same time, this patch also removes WindowNLRS and makes the NativeLayerRoot
implement the profiler_screenshots::Window interface directly.

Depends on D89863

Differential Revision: https://phabricator.services.mozilla.com/D89864
2020-09-13 21:41:24 +00:00