Commit Graph

348 Commits

Author SHA1 Message Date
sotaro
958518f093 Bug 1795004 - Remove SurfaceTextureHost::NotifyNotUsed() r=gfx-reviewers,lsalzman
SurfaceTextureHost::NotifyNotUsed() is not necessary and it prevents that TextureHost::NotifyNotUsed() to be called.

Differential Revision: https://phabricator.services.mozilla.com/D159255
2022-10-13 12:47:16 +00:00
Jamie Nicol
8f0b9e407f Bug 1784109 - Override SurfaceTexture transform for videos on Mediatek 6735. r=gfx-reviewers,media-playback-reviewers,lsalzman,alwu
On Android, SurfaceTextures provide a transform matrix that should be
applied to texture coordinates when sampling from the texture. Prior
to bug 1731980 we ignored this value, and simply y-flipped the video
instead. On most devices the transform is just a y-flip, so this
produced the correct results. However, on some devices the transform
included a scale as well as the y-flip, meaning that we rendered
videos at an incorrect size.

The fix for bug 1731980 was to correctly apply the transformation.
However, it now appears that on Mediatek 6735 devices the transform
provided by the system is incorrect. On these devices, videos were
rendered correctly when we ignored the transform and just did a
y-flip, and now that we apply the transform videos are rendered at the
wrong size.

This patch makes it so that we override the system-provided transform
on these devices with a simple y-flip. The existing mIgnoreTransform
flag has been changed to an optional "transform override" value to
achieve this. We ensure that we only override the transform for
SurfaceTextures that are output from a MediaCodec, to ensure that we
don't accidentally apply the wrong transform to SurfaceTextures
attached to other sources.

Differential Revision: https://phabricator.services.mozilla.com/D155706
2022-09-09 14:43:21 +00:00
sotaro
45cbd2c770 Bug 1769254 - Add TextureHost type check for using update in AsyncImagePipelineManager::UpdateImageKeys() r=gfx-reviewers,lsalzman
The UpdateImageKeys() did not detect TextureHost change from MacIOSurfaceTextureHostOGL to ShmemTextureHost with same format and size.

If we want to use TransactionBuilder::UpdateExternalImage(), TextureHost type needs to be same.

Differential Revision: https://phabricator.services.mozilla.com/D154495
2022-08-16 00:29:51 +00:00
Jamie Nicol
dc6e889fb4 Bug 1731980 - Ensure SurfaceTextures with transforms get rendered at correct size. r=gfx-reviewers,lsalzman
On Android we use SurfaceTextures to render content from sources such
as the video decoder. These may have a transform set which is supposed
to be applied to the texture coordinates used to sample the
texture. Webrender (and software webrender), however, do not handle
this correctly, meaning videos may be rendered at the incorrect size
on some devices.

SurfaceTextures should always be rendered with their bottom-left being
their origin, eg vertically flipped. Additionally, the texture
transform returned on most devices seems to be a simple y-flip
transform with no scaling. Webrender currently just ignores the y-flip
due to the texture origin, which cancels out us not handling the
y-flip from the transform, meaning video looks correct on most
devices. Some devices, however, do return a scaling transform which we
must handle.

This patch removes the override of WebRenderTextureHost::NeedsYFlip()
that was causing us to ignore the y-flip due to the texture origin -
since we will now apply the transform we must handle this correctly
too.

It adds a virtual method RenderTextureHost::GetUvCoords(), that
returns the texture coordinates that should be used by webrender to
sample from external textures. In most cases these are simply (0, 0)
and (size.x, size.y), but in RenderAndroidSurfaceTextureHost we
override this function to apply the transformation. This ensures we
use the correct coordinates whenever the texture is rendered by
webrender, eg in both software and hardware webrender when rendering
in the non-compositing-path, and by hardware webrender's draw
compositor. Additionally, the composite.glsl shader requires a fix to
calculate the UV bounds correctly, as the coordinates may now be
inverted.

Lastly, we fix software webrender with the OpenGL
compositor. CompositorOGL already has the required functionality to
apply the texture transformation as it was used back in the layers
days. We must simply ensure that we pass the value of the
mIgnoreTransform flag from the original SurfaceTextureHost, through to
the RenderAndroidSurfaceTextureHost, and finally to the
SurfaceTextureSource which we hand to CompositorOGL.

Differential Revision: https://phabricator.services.mozilla.com/D144306
2022-04-25 16:47:51 +00:00
Nicolas Silva
55cceefeb1 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
sotaro
0a31a20caa Bug 1742052 - Remove unused code around TextureHost r=gfx-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D131701
2021-11-22 09:49:59 +00:00
Tetsuharu Ohzeki
2df65e2d1d Bug 1741175 - Remove unused GLBlitTextureImageHelper. r=gfx-reviewers,jgilbert,bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D131133
2021-11-16 00:53:16 +00:00
sotaro
c84b574340 Bug 1739553 - Use wr::ExternalImageId in more places r=gfx-reviewers,bradwerth
It could make code more explicit.

Differential Revision: https://phabricator.services.mozilla.com/D130434
2021-11-07 07:26:45 +00:00
Andi-Bogdan Postelnicu
ac52a11dcd Bug 1519636 - Reformat recent changes to the Google coding style. r=emilio
Updated with clang-format version 12.0.1 (taskcluster-dNZqCRqWRTqa6cZxPKxh7Q)

Differential Revision: https://phabricator.services.mozilla.com/D122814
2021-08-23 09:30:23 +00:00
Jeff Muizelaar
b2663f8856 Bug 1712367. Avoid TexSubImage ES slow path. r=jgilbert,sotaro
Instead of drawing updates into the correct spot in the destination
DataSourceSurface we just use it as scratch space and always
draw in the top-left with stride = bpp*width.

We add a dstOffset to the upload functions to support using
a subsurface.

Differential Revision: https://phabricator.services.mozilla.com/D116501
2021-06-17 13:24:05 +00:00
sotaro
50e69c8e0b Bug 1699588 - Enable external compositing of SurfaceTexture with sw-wr r=gfx-reviewers,lsalzman
SurfaceTexture handling for external compositing is implemented in RenderCompositorOGLSWGL::HandleExternalImage().

Differential Revision: https://phabricator.services.mozilla.com/D115338
2021-05-21 15:56:16 +00:00
Iulian Moraru
09ab094637 Backed out changeset 0c97af20bdad (bug 1699588) for causing android mda crashes in ShaderProgramOGL. 2021-05-19 03:14:23 +03:00
sotaro
0daece8654 Bug 1699588 - Enable external compositing of SurfaceTexture with sw-wr r=gfx-reviewers,lsalzman
SurfaceTexture handling for external compositing is implemented in RenderCompositorOGLSWGL::HandleExternalImage().

Differential Revision: https://phabricator.services.mozilla.com/D115338
2021-05-18 22:26:35 +00:00
Brad Werth
61e67aca78 Bug 1692029 Part 1: Make TextureHost report a native texture policy. r=lsalzman
Whether or not we use a native texture or something else is affected by our
backend and the size of the texture. This patch adds a new function to
centralize that logic in TextureHost, and applies it in callsites that were
checking the backend to determine an image type.

Differential Revision: https://phabricator.services.mozilla.com/D106568
2021-03-10 18:27:28 +00:00
Brindusan Cristian
46cb51f43c Backed out changeset b0b87c410435 (bug 1692029) for bustages in RenderTextureHostSWGL.cpp. CLOSED TREE 2021-03-10 20:17:17 +02:00
Brad Werth
663b3dcf4c Bug 1692029 Part 1: Make TextureHost report a native texture policy. r=lsalzman
Whether or not we use a native texture or something else is affected by our
backend and the size of the texture. This patch adds a new function to
centralize that logic in TextureHost, and applies it in callsites that were
checking the backend to determine an image type.

Differential Revision: https://phabricator.services.mozilla.com/D106568
2021-03-10 16:52:32 +00:00
Alexandru Michis
927a7e7bcb Backed out changeset be5184939453 (bug 1692029) for causing bustages in RenderTextureHostSWGL.cpp
CLOSED TREE
2021-03-10 07:24:05 +02:00
Brad Werth
3c2db5c126 Bug 1692029 Part 1: Make TextureHost report a native texture policy. r=lsalzman
Whether or not we use a native texture or something else is affected by our
backend and the size of the texture. This patch adds a new function to
centralize that logic in TextureHost, and applies it in callsites that were
checking the backend to determine an image type.

Differential Revision: https://phabricator.services.mozilla.com/D106568
2021-03-10 00:46:32 +00:00
Andrew Osmond
1d19fa73aa Bug 1688096 - Part 1. Merge SW-WR and WR render texture host paths to allow mixed compositors. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D104854
2021-02-24 19:39:59 +00:00
Cosmin Sabou
9ef271b5ba Backed out 2 changesets (bug 1688096) for win webrender sw_compositor related crashes. CLOSED TREE
Backed out changeset aa0d1698aff8 (bug 1688096)
Backed out changeset 3ad2f4d0c317 (bug 1688096)
2021-02-18 19:52:29 +02:00
Andrew Osmond
cd218bcf63 Bug 1688096 - Part 1. Merge SW-WR and WR render texture host paths to allow mixed compositors. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D104854
2021-02-18 15:37:46 +00:00
smolnar
f7ba61e1f9 Backed out 2 changesets (bug 1688096) for linux debug build bustage in KnowsCompositor. CLOSED TREE
Backed out changeset 6cdfa0af2278 (bug 1688096)
Backed out changeset 6471b0910f45 (bug 1688096)
2021-02-18 14:34:49 +02:00
Andrew Osmond
b76cb0a8b0 Bug 1688096 - Part 1. Merge SW-WR and WR render texture host paths to allow mixed compositors. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D104854
2021-02-18 11:50:05 +00:00
sotaro
a9e7314f2c Bug 1691895 - Make RenderCompositorSWGL work on android r=geckoview-reviewers,mattwoodrow,agi
Partial present is not supported yet with RenderCompositorSWGL on Android.

Differential Revision: https://phabricator.services.mozilla.com/D104654
2021-02-16 22:30:47 +00:00
Nicolas Silva
7b47c78015 Bug 1673387 - Don't use texture arrays for shared and standalone texture cache entries. r=gw
The patch ended up more complicated than I anticipated due to a lot of places in webrender assuming texture arrays unless specified otherwise.
The patch also merges TextureTarget into ImageBufferKind, and removes the realloc code path ing the texture cache (which is supposed to be dead code since because of performance issues on windows+intel).

Differential Revision: https://phabricator.services.mozilla.com/D95562
2020-11-12 22:25:59 +00:00
Butkovits Atila
360ba36424 Backed out 2 changesets (bug 1673387) for bustage on gradient_cache_hardstop_clip.yaml. CLOSED TREE
Backed out changeset a315ba98577f (bug 1673387)
Backed out changeset 591c4143921f (bug 1673387)
2020-11-12 15:31:08 +02:00
Nicolas Silva
ed9df8e67b Bug 1673387 - Don't use texture arrays for shared and standalone texture cache entries. r=gw
The patch ended up more complicated than I anticipated due to a lot of places in webrender assuming texture arrays unless specified otherwise.
The patch also merges TextureTarget into ImageBufferKind, and removes the realloc code path ing the texture cache (which is supposed to be dead code since because of performance issues on windows+intel).

Differential Revision: https://phabricator.services.mozilla.com/D95562
2020-11-12 11:54:47 +00:00
Bogdan Tara
b1a44a1319 Backed out 2 changesets (bug 1673387) for wrench/reftests/ failures CLOSED TREE DONTBUILD
Backed out changeset a755e87bf875 (bug 1673387)
Backed out changeset e4cf743d6916 (bug 1673387)
2020-11-05 20:00:08 +02:00
Nicolas Silva
0c9f4ccc78 Bug 1673387 - Don't use texture arrays for shared and standalone texture cache entries. r=gw
The patch ended up more complicated than I anticipated due to a lot of places in webrender assuming texture arrays unless specified otherwise.
The patch also merges TextureTarget into ImageBufferKind, and removes the realloc code path ing the texture cache (which is supposed to be dead code since because of performance issues on windows+intel).

Differential Revision: https://phabricator.services.mozilla.com/D95562
2020-11-05 16:31:46 +00:00
Matt Woodrow
e2dab80e33 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
Matt Woodrow
d517b70ca2 Bug 1666055 - Disable buffer textures as external compositor surfaces on MacOS. r=lsalzman
When using the native RenderCompositor+SWGL on MacOS, we don't support passing buffer textures directly to the compositor.

Differential Revision: https://phabricator.services.mozilla.com/D93179
2020-10-14 07:56:47 +00:00
sotaro
12c1ead09a Bug 1661371 - Use eglWaitSyncKHR() for andoid fence if possible r=jnicol
For performance, it is better to use eglWaitSyncKHR() for andoid fence if possible.

This change is not used by gecko yet.

Differential Revision: https://phabricator.services.mozilla.com/D89882
2020-09-30 06:45:30 +00:00
sotaro
f095b75999 Bug 1667927 - Do not close file descriptor of android::Fence if EGLSync is created r=jnicol
When EGLSync is created from fence file descriptor, gecko should not close it. It should be closed by gecko only when EGLSync creation is failed.

Differential Revision: https://phabricator.services.mozilla.com/D91702
2020-09-29 07:32:14 +00:00
sotaro
6c0bd3b522 Bug 1649354 - Add android Fence handling to Compositor r=jnicol
AHardwareBuffer requests to handle android fences. There are 2 type of fences, release fence and acquire fence. Some ideas were borrowed from b2g's FenceHandle implementation.

The release fence is a fence that is used for waiting until usage/composite of AHardwareBuffer is ended. It needs to be delivered from host side to client side. It is delivered via ImageBridge, since some TextureClientd str recycled without recycle callback.

The acquire fence is a fence that is used for waiting until rendering to its AHardwareBuffer is completed. It is delivered from client side to host side.

Differential Revision: https://phabricator.services.mozilla.com/D87298
2020-08-24 09:34:51 +00:00
Jeff Gilbert
d14bbba400 Bug 1656034 - Support multiple EglDisplays per GLLibraryEGL. r=lsalzman,sotaro,stransky
Have webrender use its own EGLDisplay, letting WebGL use a different
one.

Differential Revision: https://phabricator.services.mozilla.com/D85496
2020-08-07 07:14:46 +00:00
Mihai Alexandru Michis
1b5d3e2534 Backed out changeset f1f10f791e99 (bug 1656034) for causing bustages in DMABufSurface.cpp
CLOSED TREE
2020-08-07 02:36:33 +03:00
Jeff Gilbert
7e2f3cab9c Bug 1656034 - Support multiple EglDisplays per GLLibraryEGL. r=lsalzman,sotaro,stransky
Have webrender use its own EGLDisplay, letting WebGL use a different
one.

Differential Revision: https://phabricator.services.mozilla.com/D85496
2020-08-06 22:53:53 +00:00
Mihai Alexandru Michis
a41812d7ae Backed out changeset 06538f141210 (bug 1656034) for causing bustages in GLContextProviderEGL.cpp
CLOSED TREE
2020-08-07 00:19:32 +03:00
Jeff Gilbert
fc831c91e7 Bug 1656034 - Support multiple EglDisplays per GLLibraryEGL. r=lsalzman,sotaro,stransky
Have webrender use its own EGLDisplay, letting WebGL use a different
one.

Differential Revision: https://phabricator.services.mozilla.com/D85496
2020-08-06 19:56:43 +00:00
sotaro
e29e7918c2 Bug 1649122 - Add basic AHardwareBuffer support to WebRender on android r=jrmuizel
android fence is not supported yet.

Differential Revision: https://phabricator.services.mozilla.com/D82317
2020-07-10 18:50:56 +00:00
Miko Mynttinen
37ad979d86 Bug 1536515 - Part 2: Add constructors that take GLContext to GLTextureSource and DirectMapTextureSource r=nical
Differential Revision: https://phabricator.services.mozilla.com/D80505
2020-07-07 17:56:59 +00:00
sotaro
c10fefca07 Bug 1648411 - Add AHardwareBuffer layer buffer support on android r=jnicol
AHardwareBuffer is supported since Android O(APIVersion 26). Implementation of AndroidHardwareBufferTextureData referred AndroidNativeWindowTextureData. Implementation of AndroidHardwareBufferTextureHost referred obsoleted GrallocTextureHost.

android fence is not supported yet.

Differential Revision: https://phabricator.services.mozilla.com/D81808
2020-07-02 13:43:19 +00:00
sotaro
8d9c9eb55d Bug 1648076 - Use AndroidSurfaceTexture related files only on Android r=jgilbert
No functional change. AndroidSurfaceTexture related files are used on all platforms. They are needed only on Android.

Differential Revision: https://phabricator.services.mozilla.com/D80869
2020-06-24 18:59:14 +00:00
Martin Stransky
6f3e3bc7bf Bug 1645704 [Wayland] Rename WaylandDMABufSurface to DMABufSurface at gxf, r=sotaro
Differential Revision: https://phabricator.services.mozilla.com/D79637
2020-06-21 13:59:17 +00:00
sotaro
b00fb477aa Bug 1621836 - Make SurfaceTextureHost::NumSubTextures() returns 0 when SurfaceTexture does not exist r=nical
When NumSubTextures() returns 0, SurfaceTextureHost is not rendered to WebRebder by a check of AsyncImagePipelineManager::UpdateImageKeys().

Differential Revision: https://phabricator.services.mozilla.com/D66514
2020-03-13 14:42:24 +00:00
sotaro
4225d45349 Bug 1617808 - Re-deliver PREFER_COMPOSITOR_SURFACE flag to WebRender r=gw
Differential Revision: https://phabricator.services.mozilla.com/D64007
2020-03-10 03:52:08 +00:00
Narcis Beleuzu
019e5b6cbc Backed out changeset 0cb5cf87cb27 (bug 1617808) for bustages on bindings.rs . CLOSED TREE 2020-03-10 02:16:24 +02:00
sotaro
610ea8b21e Bug 1617808 - Re-deliver PREFER_COMPOSITOR_SURFACE flag to WebRender r=gw
Differential Revision: https://phabricator.services.mozilla.com/D64007
2020-03-01 22:06:11 +00:00
Simon Giesecke
83e48517da Bug 1613985 - Use default for equivalent-to-default constructors/destructors in gfx. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D65288
2020-03-04 15:39:20 +00:00
sotaro
bb2ccb6d86 Bug 1601531 - Tag image descriptors with PREFER_COMPOSITOR_SURFACE where appropriate r=gw
Differential Revision: https://phabricator.services.mozilla.com/D55922
2019-12-06 06:53:57 +00:00