Commit Graph

3118 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
7e6a74492c Bug 1926862 - Add transparency support to RenderCompositorANGLE. r=gfx-reviewers,nical
Bring back some of the code from
https://hg.mozilla.org/mozilla-central/rev/5942e11048ea to achieve this.

Partial present seems to work fine, so we can just keep it working.

Differential Revision: https://phabricator.services.mozilla.com/D226886
2024-11-08 22:17:11 +00:00
Butkovits Atila
7bb6eba7e2 Backed out changeset cf4ff8c9cb90 (bug 1926862) for causing failures at UniquePtr.h. CLOSED TREE 2024-11-08 21:22:04 +02:00
Emilio Cobos Álvarez
ecb1eeb9ed Bug 1926862 - Add transparency support to RenderCompositorANGLE. r=gfx-reviewers,nical
Bring back some of the code from
https://hg.mozilla.org/mozilla-central/rev/5942e11048ea to achieve this.

Partial present seems to work fine, so we can just keep it working.

Differential Revision: https://phabricator.services.mozilla.com/D226886
2024-11-08 16:09:40 +00:00
Nicolas Silva
cc93351050 Bug 1918133 - Stub stacking context snapshot API. r=gfx-reviewers,gw
Differential Revision: https://phabricator.services.mozilla.com/D225226
2024-11-07 22:13:42 +00:00
Stanca Serban
db768c13e8 Backed out 5 changesets (bug 1921980) for causing Linux wrench bustages. CLOSED TREE
Backed out changeset 70ae923fd74b (bug 1921980)
Backed out changeset ae3fdc5495a6 (bug 1921980)
Backed out changeset 53119e779c89 (bug 1921980)
Backed out changeset f4ad9697fb5d (bug 1921980)
Backed out changeset e4f2f5ea2563 (bug 1921980)
2024-11-07 16:14:38 +02:00
Nicolas Silva
facced4834 Bug 1921980 - Stub stacking context API. r=gfx-reviewers,gw
Differential Revision: https://phabricator.services.mozilla.com/D225226
2024-11-07 13:18:10 +00:00
Stanca Serban
9d6594adfa Backed out 6 changesets (bug 1921980) for causing snapshot area related wrench bustages. CLOSED TREE
Backed out changeset 9430536b14b2 (bug 1921980)
Backed out changeset ddf9bea4b718 (bug 1921980)
Backed out changeset f1fcd71a112b (bug 1921980)
Backed out changeset 51f4dc44dd7b (bug 1921980)
Backed out changeset cac0414bfcb8 (bug 1921980)
Backed out changeset cc9b213f6a2f (bug 1921980)
2024-11-07 11:30:01 +02:00
Nicolas Silva
2072ff9bcb Bug 1921980 - Stub stacking context API. r=gfx-reviewers,gw
Differential Revision: https://phabricator.services.mozilla.com/D225226
2024-11-07 09:01:55 +00:00
Butkovits Atila
d337c98ae6 Backed out 6 changesets (bug 1921980) for causing wrench bustages. CLOSED TREE
Backed out changeset d519011c078b (bug 1921980)
Backed out changeset 46b1ed75bb19 (bug 1921980)
Backed out changeset b14169d1c137 (bug 1921980)
Backed out changeset 877f329b665d (bug 1921980)
Backed out changeset bb7a2635293a (bug 1921980)
Backed out changeset 1fcd83380d56 (bug 1921980)
2024-11-06 12:40:21 +02:00
serge-sans-paille
c826dd5df9 Bug 1929222 - Use std::clamp instead of min/max chain in gfx/ r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D227942
2024-11-06 10:10:54 +00:00
Nicolas Silva
a46bf73e7f Bug 1921980 - Stub stacking context API. r=gfx-reviewers,gw
Differential Revision: https://phabricator.services.mozilla.com/D225226
2024-11-06 10:00:17 +00:00
Alexandru Marc
f6ad344a32 Backed out changeset 17f9248f7a54 (bug 1929222) for causing build bustages @ ScaledFontMac.cpp. CLOSED TREE 2024-11-05 17:51:25 +02:00
serge-sans-paille
2003ac5eb4 Bug 1929222 - Use std::clamp instead of min/max chain in gfx/ r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D227942
2024-11-05 14:09:36 +00:00
sotaro
8328357295 Bug 1929180 - Add external semaphore handling to DMABufSurface r=stransky
This is a preparation for Bug 1920763.

Add capability of importing Vulkan external semaphore to DMABufSurface(OpenGL).

Differential Revision: https://phabricator.services.mozilla.com/D227916
2024-11-05 08:15:15 +00:00
Jamie Nicol
98e9cfa31f Bug 1914774 - Fix non-unified GCC build. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D227857
2024-11-04 21:15:50 +00:00
serge-sans-paille
8a0a0f7524 Bug 1920718 - Annotate all global variable with runtime initialization attributes r=glandium,application-update-reviewers,media-playback-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,gfx-reviewers,aosmond,lina,nalexander,aabh,geckoview-reviewers,win-reviewers,gstoll,m_kato
MOZ_RUNINIT => initialized at runtime
MOZ_CONSTINIT => initialized at compile time
MOZ_GLOBINIT => initialized either at runtime or compile time, depending on template parameter, macro parameter etc
This annotation is only understood by our clang-tidy plugin. It has no
effect on regular compilation.

Differential Revision: https://phabricator.services.mozilla.com/D223341
2024-10-30 11:05:24 +00:00
sotaro
57f157bf89 Bug 1923263 - Add log around RenderThread::PostEvent() and RendererEvent r=gfx-reviewers,lsalzman
The log helps to understand how time was spent around RenderThread::PostEvent() and RendererEvent.

Differential Revision: https://phabricator.services.mozilla.com/D224897
2024-10-10 04:13:21 +00:00
Cosmin Sabou
45a7b2d5b4 Backed out changeset 9cd00158c7e5 (bug 1923263) for causing bc failures on browser_Troubleshoot.js. CLOSED TREE 2024-10-09 11:17:49 +03:00
sotaro
dd81d633c6 Bug 1923263 - Add log around RenderThread::PostEvent() and RendererEvent r=gfx-reviewers,lsalzman
The log helps to understand how time was spent around RenderThread::PostEvent() and RendererEvent.

Differential Revision: https://phabricator.services.mozilla.com/D224897
2024-10-09 06:25:14 +00:00
Tamas Szentpeteri
8be45dd280 Backed out changeset 4b1409597101 (bug 1920718) for causing bp bustages on rapl.cpp. 2024-10-08 23:27:18 +03:00
serge-sans-paille
069a97307f Bug 1920718 - Annotate all global variable with runtime initialization as MOZ_RUNINIT r=application-update-reviewers,media-playback-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,gfx-reviewers,aosmond,lina,nalexander,aabh
This annotation is only understood by our clang-tidy plugin. It has no
effect on regular compilation.

Differential Revision: https://phabricator.services.mozilla.com/D223341
2024-10-08 16:49:51 +00:00
sotaro
07a7c08603 Bug 1922214 - Post Pause/Resume by using RenderThread::PostEvent() r=gfx-reviewers,lsalzman
Calling RenderThread::Pause() without using low_priority_scene_sender could  reduce the waiting time for Pause/Resume handling. RenderThread::PostEvent() already exists for positing task directly to RenderThread. And RenderCompositor::IsPaused() exists for handling RenderCompositor paused state.

Differential Revision: https://phabricator.services.mozilla.com/D224306
2024-10-03 06:36:28 +00:00
Nicolas Silva
ec7a7d1f83 Bug 1920678 - Purge WebRender's chunk pool when idle. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D223925
2024-09-30 14:56:28 +00:00
Nicolas Silva
191a255d19 Bug 1920678 - Add a pool for the memory chunks used by per-frame allocators. r=gfx-reviewers,lsalzman
Instead of dropping the frame's memory chunk when a frame is replaced, place the chunks into a global pool. This mostly helps when running stress tests like motionmark's html suite that cause intense allocation spikes (around 90 chunks per frame).

We should revisit whether this is needed if the cost of deallocating large regions of memory in mozjemalloc improves in the future.

Differential Revision: https://phabricator.services.mozilla.com/D223924
2024-09-30 14:56:28 +00:00
Emilio Cobos Álvarez
bb03b082e6 Bug 1911763 - Clean-up plumbing for transparent window compositing on windows. r=gfx-reviewers,sotaro
The RemoteBackBuffer change is the only tricky thing. It comes from
bug 1616000, but since bug 1870512 we don't create child windows for
non-native notifications, so we can remove it.

The SizeMode plumbing is totally unused so remove it while at it.

Differential Revision: https://phabricator.services.mozilla.com/D209505
2024-09-30 12:16:08 +00:00
Andrew Osmond
4685d5aacf Bug 1918778 - Correct ownership/recycling issues with MacIOSurface. r=bradwerth
This patch corrects a few different issues related to recycling
MacIOSurface objects.

1) When recycling a surface, we must check that the cached surfaces
   match all of the requested parameters, not just the size. If we do
   not, we should just flush the whole cache immediately since they
   should all be created with the same parameters.

2) Allocations can fail, and we should check for failing to get a
   surface from the allocator and fall back if so.

3) Locking can fail, and we should check that return value at all of the
   call sites.

This may help resolve a number of otherwise difficult to understand
crash signatures. It may also solve display corruption issues in rare
cases where the parameters that changed were roughly equivalent such
that everything appears to work, but they differ enough to change the
presentation.

Differential Revision: https://phabricator.services.mozilla.com/D222205
2024-09-14 16:23:54 +00:00
Nicolas Guichard
0d9b59bd37 Bug 1917746 - Fix Rust 1.82's new elided_named_lifetimes warning. r=emilio
This warning was introduced by https://github.com/rust-lang/rust/pull/129207.

Differential Revision: https://phabricator.services.mozilla.com/D221462
2024-09-10 04:51:23 +00:00
Jamie Nicol
0c43a18e35 Bug 1913568 - Handle SurfaceTexture transforms in webrender, for reals this time. r=gfx-reviewers,media-playback-reviewers,padenot,nical
On Android, SurfaceTextures provide a transform that should be applied
to texture coordinates when sampling from the texture. Usually this is
simply a y-flip, but sometimes it includes a scale and slight
translation, eg when the video frame is contained within a larger
texture. Previously we ignored this transform but performed a y-flip,
meaning we rendered correctly most of the time, but not all of the
time.

Our first attempt to fix this was in bug 1731980. When rendering as a
compositor surface with RenderCompositorOGLSWGL, we supplied the
transform to CompositorOGL's shaders, which correctly fixed the bug
for this rendering path.

However, the attempted fix for hardware webrender in fact made things
worse. As UV coordinates are supplied to webrender unnormalized, then
the shaders normalize them by dividing by the actual texture size,
this effectively handled the scale component of the transform. (Though
not quite scaling by the correct amount, and ignoring the translation
component, sometimes resulting in a pixel-wide green seam being
visible at the video's edges.) When we additionally applied the
transformation to the coordinates, it resulted in the scale being
applied twice, and the video being rendered too far zoomed
in.

To make matters worse, when we received subsequent bug reports of
incorrect rendering on various devices we mistakenly assumed that the
devices must be buggy, rather than our code being incorrect. We
therefore reverted to ignoring the transform on these devices, thereby
breaking the software webrender path again.

Additionally, on devices without GL_OES_EGL_image_external_essl3
support, we must sample from the SurfaceTexture using an ESSL1
shader. This means we do not have access to the correct texture size,
meaning we cannot correctly normalize the UV coordinates. This results
in the video being rendered too far zoomed out. And in the
non-compositor-surface software webrender path, we were accidentally
downscaling the texture when reading back into a CPU buffer, resulting
in the video being rendered at the correct zoom, but being very
blurry.

This patch aims to handle the transform correctly, in all rendering
paths, hopefully once and for all.

For hardware webrender, we now supply the texture coordinates to
webrender already normalized, using the functionality added in the
previous patch. This avoids the shaders scaling the coordinates again,
or using an incorrect texture size to do so.

For RenderCompositorOGLSWGL, we continue to apply the transform using
CompositorOGL's shaders.

In the non-compositor-surface software webrender path, we make
GLReadPixelsHelper apply the transform when reading from the
SurfaceTexture in to the CPU buffer. Again using functionality added
earlier in this patch series. This avoids downscaling the image. We
can then provide the default untransformed and unnormalized UVs to
webrender. As a result we can now remove the virtual function
RenderTextureHost::GetUvCoords(), added in bug 1731980, as it no
longer serves any purpose: we no longer want to share the
implementation between RenderAndroidSurfaceTextureHost::Lock and
RenderTextureHostSWGL::LockSWGL.

Finally, we remove all transform overrides on the devices we
mistakenly assumed were buggy.

Differential Revision: https://phabricator.services.mozilla.com/D220582
2024-09-09 14:06:26 +00:00
Jamie Nicol
f54558e79d Bug 1913568 - Add support for normalized UV coordinates to webrender. r=gfx-reviewers,nical
Some external images must be sampled from by providing normalized UV
coordinates to webrender, but currently webrender only supports
unnormalized UVs.

This patch adds a flag to webrender's external image API that
specifies whether the UV coordinates supplied when the texture is
locked are normalized or unnormalized. This flag is plumbed through
webrender to the required locations. We then add support for taking
normalized UVs as inputs to the brush_image and cs_scale shaders. The
only other shader that can be used with external textures is the
composite shader, which already supports normalized UVs.

This does not change any behaviour, that will happen in the next patch
in this series.

Differential Revision: https://phabricator.services.mozilla.com/D220581
2024-09-09 14:06:26 +00:00
Jamie Nicol
c979eb3890 Bug 1913568 - Add texture transform support to GLReadTexImageHelper. r=gfx-reviewers,nical
Add the capability to transform the texture coordinates when reading
from a texture, similar to existing support in GLBlitHelper and
CompositorOGL.

This patch doesn't change any behaviour, but this capability will be
made use of by a later patch in this series.

Differential Revision: https://phabricator.services.mozilla.com/D220580
2024-09-09 14:06:26 +00:00
Iulian Moraru
e53fc69e92 Backed out 3 changesets (bug 1913568) for causing multiple wrench build bustages related to normalized_uvs. CLOSED TREE
Backed out changeset 08890d5674ad (bug 1913568)
Backed out changeset 4aaa0e9d0a6f (bug 1913568)
Backed out changeset b6f9d83c6da0 (bug 1913568)
2024-09-09 13:14:14 +03:00
Jamie Nicol
566512fb28 Bug 1913568 - Handle SurfaceTexture transforms in webrender, for reals this time. r=gfx-reviewers,media-playback-reviewers,padenot,nical
On Android, SurfaceTextures provide a transform that should be applied
to texture coordinates when sampling from the texture. Usually this is
simply a y-flip, but sometimes it includes a scale and slight
translation, eg when the video frame is contained within a larger
texture. Previously we ignored this transform but performed a y-flip,
meaning we rendered correctly most of the time, but not all of the
time.

Our first attempt to fix this was in bug 1731980. When rendering as a
compositor surface with RenderCompositorOGLSWGL, we supplied the
transform to CompositorOGL's shaders, which correctly fixed the bug
for this rendering path.

However, the attempted fix for hardware webrender in fact made things
worse. As UV coordinates are supplied to webrender unnormalized, then
the shaders normalize them by dividing by the actual texture size,
this effectively handled the scale component of the transform. (Though
not quite scaling by the correct amount, and ignoring the translation
component, sometimes resulting in a pixel-wide green seam being
visible at the video's edges.) When we additionally applied the
transformation to the coordinates, it resulted in the scale being
applied twice, and the video being rendered too far zoomed
in.

To make matters worse, when we received subsequent bug reports of
incorrect rendering on various devices we mistakenly assumed that the
devices must be buggy, rather than our code being incorrect. We
therefore reverted to ignoring the transform on these devices, thereby
breaking the software webrender path again.

Additionally, on devices without GL_OES_EGL_image_external_essl3
support, we must sample from the SurfaceTexture using an ESSL1
shader. This means we do not have access to the correct texture size,
meaning we cannot correctly normalize the UV coordinates. This results
in the video being rendered too far zoomed out. And in the
non-compositor-surface software webrender path, we were accidentally
downscaling the texture when reading back into a CPU buffer, resulting
in the video being rendered at the correct zoom, but being very
blurry.

This patch aims to handle the transform correctly, in all rendering
paths, hopefully once and for all.

For hardware webrender, we now supply the texture coordinates to
webrender already normalized, using the functionality added in the
previous patch. This avoids the shaders scaling the coordinates again,
or using an incorrect texture size to do so.

For RenderCompositorOGLSWGL, we continue to apply the transform using
CompositorOGL's shaders.

In the non-compositor-surface software webrender path, we make
GLReadPixelsHelper apply the transform when reading from the
SurfaceTexture in to the CPU buffer. Again using functionality added
earlier in this patch series. This avoids downscaling the image. We
can then provide the default untransformed and unnormalized UVs to
webrender. As a result we can now remove the virtual function
RenderTextureHost::GetUvCoords(), added in bug 1731980, as it no
longer serves any purpose: we no longer want to share the
implementation between RenderAndroidSurfaceTextureHost::Lock and
RenderTextureHostSWGL::LockSWGL.

Finally, we remove all transform overrides on the devices we
mistakenly assumed were buggy.

Differential Revision: https://phabricator.services.mozilla.com/D220582
2024-09-09 09:10:24 +00:00
Jamie Nicol
e0ec49b382 Bug 1913568 - Add support for normalized UV coordinates to webrender. r=gfx-reviewers,nical
Some external images must be sampled from by providing normalized UV
coordinates to webrender, but currently webrender only supports
unnormalized UVs.

This patch adds a flag to webrender's external image API that
specifies whether the UV coordinates supplied when the texture is
locked are normalized or unnormalized. This flag is plumbed through
webrender to the required locations. We then add support for taking
normalized UVs as inputs to the brush_image and cs_scale shaders. The
only other shader that can be used with external textures is the
composite shader, which already supports normalized UVs.

This does not change any behaviour, that will happen in the next patch
in this series.

Differential Revision: https://phabricator.services.mozilla.com/D220581
2024-09-09 09:10:23 +00:00
Jamie Nicol
7d2db6b03a Bug 1913568 - Add texture transform support to GLReadTexImageHelper. r=gfx-reviewers,nical
Add the capability to transform the texture coordinates when reading
from a texture, similar to existing support in GLBlitHelper and
CompositorOGL.

This patch doesn't change any behaviour, but this capability will be
made use of by a later patch in this series.

Differential Revision: https://phabricator.services.mozilla.com/D220580
2024-09-09 09:10:23 +00:00
Zach Hoffman
11860bb190 Bug 1914777 - Use cbindgen for StyleBorderImageRepeatKeyword. r=firefox-style-system-reviewers,layout-reviewers,emilio
Generated enum StyleBorderImageRepeatKeyword replaces enum StyleBorderImageRepeat.

Differential Revision: https://phabricator.services.mozilla.com/D220073
2024-08-25 15:57:04 +00:00
sotaro
7bd93b341e Bug 1914306 - Disable Super Resolution explicitly when it is enabled but not used r=gfx-reviewers,lsalzman
With current gecko, Super Resolution became inactive automatically when video overlay is removed. However, when the video overlay used Super Resolution and power change becomes false, it needs to call SetVpSuperResolution with aEnable=false for disabling Super Resolution.

Differential Revision: https://phabricator.services.mozilla.com/D219831
2024-08-22 06:41:34 +00:00
Alexandre Lissy
f0290f55a8 Bug 1913469 - Fix --disable-gecko-profiler r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D219346
2024-08-20 11:55:10 +00:00
Iulian Moraru
4aa4e29fb6 Backed out changeset d2dcc2830204 (bug 1913469) for causing build bustages related to gecko-profiler. CLOSED TREE 2024-08-20 12:47:12 +03:00
Alexandre Lissy
a81bd85b3f Bug 1913469 - Fix --disable-gecko-profiler r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D219346
2024-08-20 09:07:45 +00:00
Kelsey Gilbert
03da82760b Bug 1913073 - Disable and add pref gfx.webrender.dcomp.color-manage-with-filters. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D219134
2024-08-15 03:19:44 +00:00
sotaro
b9a796eeb7 Bug 1912368 - Use GpuProcessTextureId in D3D11TextureData if compositor device is used r=gfx-reviewers,lsalzman
With NVIDIA GPU, original ID3D11Texture2D created by compositor device and ID3D11Texture2D opened from shared handle compositor device seemed to work differently. The original ID3D11Texture2D seemed to work well with STR of Bug 1911237 with NVIDIA GPU.

Then if  ID3D11Texture2D is created by compositor device, it seems better to use GpuProcessTextureId instead of shared handle.

Differential Revision: https://phabricator.services.mozilla.com/D218903
2024-08-14 11:02:38 +00:00
Nicolas Silva
0370444885 Bug 1903977 - Add a blob tile pool. r=gfx-reviewers,gw
The tile pool keeps a strong reference to all of its allocations and reuses them when their reference count gets down to one.
Jemalloc only uses thread-local arenas for small allocations (<496 bytes) so it does not matter what thread the blob tiles which are typically much larger, are deallocated in.

Differential Revision: https://phabricator.services.mozilla.com/D218547
2024-08-07 18:16:58 +00:00
Norisz Fay
d6b96877dd Backed out changeset cac5254f4a00 (bug 1903977) for causing WR bustages CLOSED TREE 2024-08-07 15:56:12 +03:00
Nicolas Silva
1cd5938125 Bug 1903977 - Add a blob tile pool. r=gfx-reviewers,gw
The tile pool keeps a strong reference to all of its allocations and reuses them when their reference count gets down to one.
Jemalloc only uses thread-local arenas for small allocations (<496 bytes) so it does not matter what thread the blob tiles which are typically much larger, are deallocated in.

Differential Revision: https://phabricator.services.mozilla.com/D218547
2024-08-07 12:08:48 +00:00
Nicolas Silva
66ad9230b3 Bug 1911538 - Avoid allocating a string in gecko_profiler::add_marker. r=profiler-reviewers,canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D218520
2024-08-07 07:33:57 +00:00
Norisz Fay
ebaeeedc6c Backed out changeset bd37586e34ed (bug 1903977) for causing WR bustages CLOSED TREE 2024-08-07 10:37:22 +03:00
Nicolas Silva
8252cf3aa6 Bug 1903977 - Add a blob tile pool. r=gfx-reviewers,gw
The tile pool keeps a strong reference to all of its allocations and reuses them when their reference count gets down to one.
Jemalloc only uses thread-local arenas for small allocations (<496 bytes) so it does not matter what thread the blob tiles which are typically much larger, are deallocated in.

Differential Revision: https://phabricator.services.mozilla.com/D218547
2024-08-07 07:17:19 +00:00
Brad Werth
94fbd5e7d6 Bug 1906527 Part 3: Add YUV422P10 and NV16 formats. r=gfx-reviewers,ahale
YUV422P10 is needed to properly tag decoded YUV422P10 video. NV16 is
needed to describe the macOS 10-bit YUV422 formats.

Differential Revision: https://phabricator.services.mozilla.com/D217334
2024-08-05 17:59:15 +00:00
Brad Werth
0ac2dc146e Bug 1906527 Part 1: Rename SurfaceFormat::YUV422 to YUY2, and rename YUV to YUV420. r=jgilbert
This is just a renaming patch, motivated by a need for clarity before
addding more YUV formats. Comments and log messages are updated as well,
and one function in MacIOSurface is renamed.

There is one small change in TextureHost.cpp  to satisfy clang-tidy.

Differential Revision: https://phabricator.services.mozilla.com/D217883
2024-08-05 17:59:15 +00:00
sotaro
69fe397293 Bug 1910637 - Call DisableVideoOverlay() in DCSurfaceVideo::PresentVideo() if necessary r=gfx-reviewers,lsalzman
Bug 1908585 fix forgot to call DisableVideoOverlay() in DCSurfaceVideo::PresentVideo() by mistake. It is necessary to disable video overlay when the overlay is slow.

Differential Revision: https://phabricator.services.mozilla.com/D218097
2024-07-30 22:14:53 +00:00