зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1601531 - Tag image descriptors with PREFER_COMPOSITOR_SURFACE where appropriate r=gw
Differential Revision: https://phabricator.services.mozilla.com/D55922 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
80f82bc351
Коммит
8cbdbb0cb2
|
@ -137,13 +137,14 @@ uint32_t GPUVideoTextureHost::NumSubTextures() {
|
||||||
|
|
||||||
void GPUVideoTextureHost::PushResourceUpdates(
|
void GPUVideoTextureHost::PushResourceUpdates(
|
||||||
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
|
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) {
|
||||||
MOZ_ASSERT(EnsureWrappedTextureHost());
|
MOZ_ASSERT(EnsureWrappedTextureHost());
|
||||||
if (!EnsureWrappedTextureHost()) {
|
if (!EnsureWrappedTextureHost()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EnsureWrappedTextureHost()->PushResourceUpdates(aResources, aOp, aImageKeys,
|
EnsureWrappedTextureHost()->PushResourceUpdates(
|
||||||
aExtID);
|
aResources, aOp, aImageKeys, aExtID, aPreferCompositorSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPUVideoTextureHost::PushDisplayItems(
|
void GPUVideoTextureHost::PushDisplayItems(
|
||||||
|
|
|
@ -56,7 +56,8 @@ class GPUVideoTextureHost : public TextureHost {
|
||||||
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
||||||
ResourceUpdateOp aOp,
|
ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys,
|
const Range<wr::ImageKey>& aImageKeys,
|
||||||
const wr::ExternalImageId& aExtID) override;
|
const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) override;
|
||||||
|
|
||||||
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
||||||
const wr::LayoutRect& aBounds,
|
const wr::LayoutRect& aBounds,
|
||||||
|
|
|
@ -605,7 +605,8 @@ uint32_t BufferTextureHost::NumSubTextures() {
|
||||||
|
|
||||||
void BufferTextureHost::PushResourceUpdates(
|
void BufferTextureHost::PushResourceUpdates(
|
||||||
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
|
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) {
|
||||||
auto method = aOp == TextureHost::ADD_IMAGE
|
auto method = aOp == TextureHost::ADD_IMAGE
|
||||||
? &wr::TransactionBuilder::AddExternalImage
|
? &wr::TransactionBuilder::AddExternalImage
|
||||||
: &wr::TransactionBuilder::UpdateExternalImage;
|
: &wr::TransactionBuilder::UpdateExternalImage;
|
||||||
|
@ -617,7 +618,7 @@ void BufferTextureHost::PushResourceUpdates(
|
||||||
wr::ImageDescriptor descriptor(
|
wr::ImageDescriptor descriptor(
|
||||||
GetSize(),
|
GetSize(),
|
||||||
ImageDataSerializer::ComputeRGBStride(GetFormat(), GetSize().width),
|
ImageDataSerializer::ComputeRGBStride(GetFormat(), GetSize().width),
|
||||||
GetFormat());
|
GetFormat(), aPreferCompositorSurface);
|
||||||
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
|
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
|
||||||
} else {
|
} else {
|
||||||
MOZ_ASSERT(aImageKeys.length() == 3);
|
MOZ_ASSERT(aImageKeys.length() == 3);
|
||||||
|
@ -625,10 +626,12 @@ void BufferTextureHost::PushResourceUpdates(
|
||||||
const layers::YCbCrDescriptor& desc = mDescriptor.get_YCbCrDescriptor();
|
const layers::YCbCrDescriptor& desc = mDescriptor.get_YCbCrDescriptor();
|
||||||
wr::ImageDescriptor yDescriptor(
|
wr::ImageDescriptor yDescriptor(
|
||||||
desc.ySize(), desc.yStride(),
|
desc.ySize(), desc.yStride(),
|
||||||
SurfaceFormatForColorDepth(desc.colorDepth()));
|
SurfaceFormatForColorDepth(desc.colorDepth()),
|
||||||
|
aPreferCompositorSurface);
|
||||||
wr::ImageDescriptor cbcrDescriptor(
|
wr::ImageDescriptor cbcrDescriptor(
|
||||||
desc.cbCrSize(), desc.cbCrStride(),
|
desc.cbCrSize(), desc.cbCrStride(),
|
||||||
SurfaceFormatForColorDepth(desc.colorDepth()));
|
SurfaceFormatForColorDepth(desc.colorDepth()),
|
||||||
|
aPreferCompositorSurface);
|
||||||
(aResources.*method)(aImageKeys[0], yDescriptor, aExtID, imageType, 0);
|
(aResources.*method)(aImageKeys[0], yDescriptor, aExtID, imageType, 0);
|
||||||
(aResources.*method)(aImageKeys[1], cbcrDescriptor, aExtID, imageType, 1);
|
(aResources.*method)(aImageKeys[1], cbcrDescriptor, aExtID, imageType, 1);
|
||||||
(aResources.*method)(aImageKeys[2], cbcrDescriptor, aExtID, imageType, 2);
|
(aResources.*method)(aImageKeys[2], cbcrDescriptor, aExtID, imageType, 2);
|
||||||
|
|
|
@ -661,7 +661,8 @@ class TextureHost : public AtomicRefCountedWithFinalize<TextureHost> {
|
||||||
virtual void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
virtual void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
||||||
ResourceUpdateOp aOp,
|
ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys,
|
const Range<wr::ImageKey>& aImageKeys,
|
||||||
const wr::ExternalImageId& aExtID) {
|
const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) {
|
||||||
MOZ_ASSERT_UNREACHABLE("Unimplemented");
|
MOZ_ASSERT_UNREACHABLE("Unimplemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -792,7 +793,8 @@ class BufferTextureHost : public TextureHost {
|
||||||
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
||||||
ResourceUpdateOp aOp,
|
ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys,
|
const Range<wr::ImageKey>& aImageKeys,
|
||||||
const wr::ExternalImageId& aExtID) override;
|
const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) override;
|
||||||
|
|
||||||
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
||||||
const wr::LayoutRect& aBounds,
|
const wr::LayoutRect& aBounds,
|
||||||
|
|
|
@ -1012,7 +1012,8 @@ uint32_t DXGITextureHostD3D11::NumSubTextures() {
|
||||||
|
|
||||||
void DXGITextureHostD3D11::PushResourceUpdates(
|
void DXGITextureHostD3D11::PushResourceUpdates(
|
||||||
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
|
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) {
|
||||||
if (!gfx::gfxVars::UseWebRenderANGLE()) {
|
if (!gfx::gfxVars::UseWebRenderANGLE()) {
|
||||||
MOZ_ASSERT_UNREACHABLE("unexpected to be called without ANGLE");
|
MOZ_ASSERT_UNREACHABLE("unexpected to be called without ANGLE");
|
||||||
return;
|
return;
|
||||||
|
@ -1029,7 +1030,8 @@ void DXGITextureHostD3D11::PushResourceUpdates(
|
||||||
case gfx::SurfaceFormat::B8G8R8X8: {
|
case gfx::SurfaceFormat::B8G8R8X8: {
|
||||||
MOZ_ASSERT(aImageKeys.length() == 1);
|
MOZ_ASSERT(aImageKeys.length() == 1);
|
||||||
|
|
||||||
wr::ImageDescriptor descriptor(mSize, GetFormat());
|
wr::ImageDescriptor descriptor(mSize, GetFormat(),
|
||||||
|
aPreferCompositorSurface);
|
||||||
auto imageType =
|
auto imageType =
|
||||||
wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
|
wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
|
||||||
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
|
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
|
||||||
|
@ -1042,13 +1044,16 @@ void DXGITextureHostD3D11::PushResourceUpdates(
|
||||||
MOZ_ASSERT(mSize.width % 2 == 0);
|
MOZ_ASSERT(mSize.width % 2 == 0);
|
||||||
MOZ_ASSERT(mSize.height % 2 == 0);
|
MOZ_ASSERT(mSize.height % 2 == 0);
|
||||||
|
|
||||||
wr::ImageDescriptor descriptor0(mSize, mFormat == gfx::SurfaceFormat::NV12
|
wr::ImageDescriptor descriptor0(mSize,
|
||||||
? gfx::SurfaceFormat::A8
|
mFormat == gfx::SurfaceFormat::NV12
|
||||||
: gfx::SurfaceFormat::A16);
|
? gfx::SurfaceFormat::A8
|
||||||
|
: gfx::SurfaceFormat::A16,
|
||||||
|
aPreferCompositorSurface);
|
||||||
wr::ImageDescriptor descriptor1(mSize / 2,
|
wr::ImageDescriptor descriptor1(mSize / 2,
|
||||||
mFormat == gfx::SurfaceFormat::NV12
|
mFormat == gfx::SurfaceFormat::NV12
|
||||||
? gfx::SurfaceFormat::R8G8
|
? gfx::SurfaceFormat::R8G8
|
||||||
: gfx::SurfaceFormat::R16G16);
|
: gfx::SurfaceFormat::R16G16,
|
||||||
|
aPreferCompositorSurface);
|
||||||
auto imageType =
|
auto imageType =
|
||||||
wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
|
wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
|
||||||
(aResources.*method)(aImageKeys[0], descriptor0, aExtID, imageType, 0);
|
(aResources.*method)(aImageKeys[0], descriptor0, aExtID, imageType, 0);
|
||||||
|
@ -1259,7 +1264,8 @@ uint32_t DXGIYCbCrTextureHostD3D11::NumSubTextures() {
|
||||||
|
|
||||||
void DXGIYCbCrTextureHostD3D11::PushResourceUpdates(
|
void DXGIYCbCrTextureHostD3D11::PushResourceUpdates(
|
||||||
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
|
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) {
|
||||||
if (!gfx::gfxVars::UseWebRenderANGLE()) {
|
if (!gfx::gfxVars::UseWebRenderANGLE()) {
|
||||||
MOZ_ASSERT_UNREACHABLE("unexpected to be called without ANGLE");
|
MOZ_ASSERT_UNREACHABLE("unexpected to be called without ANGLE");
|
||||||
return;
|
return;
|
||||||
|
@ -1280,9 +1286,11 @@ void DXGIYCbCrTextureHostD3D11::PushResourceUpdates(
|
||||||
wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
|
wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
|
||||||
|
|
||||||
// y
|
// y
|
||||||
wr::ImageDescriptor descriptor0(mSize, gfx::SurfaceFormat::A8);
|
wr::ImageDescriptor descriptor0(mSize, gfx::SurfaceFormat::A8,
|
||||||
|
aPreferCompositorSurface);
|
||||||
// cb and cr
|
// cb and cr
|
||||||
wr::ImageDescriptor descriptor1(mSizeCbCr, gfx::SurfaceFormat::A8);
|
wr::ImageDescriptor descriptor1(mSizeCbCr, gfx::SurfaceFormat::A8,
|
||||||
|
aPreferCompositorSurface);
|
||||||
(aResources.*method)(aImageKeys[0], descriptor0, aExtID, imageType, 0);
|
(aResources.*method)(aImageKeys[0], descriptor0, aExtID, imageType, 0);
|
||||||
(aResources.*method)(aImageKeys[1], descriptor1, aExtID, imageType, 1);
|
(aResources.*method)(aImageKeys[1], descriptor1, aExtID, imageType, 1);
|
||||||
(aResources.*method)(aImageKeys[2], descriptor1, aExtID, imageType, 2);
|
(aResources.*method)(aImageKeys[2], descriptor1, aExtID, imageType, 2);
|
||||||
|
|
|
@ -354,7 +354,8 @@ class DXGITextureHostD3D11 : public TextureHost {
|
||||||
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
||||||
ResourceUpdateOp aOp,
|
ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys,
|
const Range<wr::ImageKey>& aImageKeys,
|
||||||
const wr::ExternalImageId& aExtID) override;
|
const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) override;
|
||||||
|
|
||||||
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
||||||
const wr::LayoutRect& aBounds,
|
const wr::LayoutRect& aBounds,
|
||||||
|
@ -422,7 +423,8 @@ class DXGIYCbCrTextureHostD3D11 : public TextureHost {
|
||||||
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
||||||
ResourceUpdateOp aOp,
|
ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys,
|
const Range<wr::ImageKey>& aImageKeys,
|
||||||
const wr::ExternalImageId& aExtID) override;
|
const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) override;
|
||||||
|
|
||||||
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
||||||
const wr::LayoutRect& aBounds,
|
const wr::LayoutRect& aBounds,
|
||||||
|
|
|
@ -160,7 +160,8 @@ uint32_t MacIOSurfaceTextureHostOGL::NumSubTextures() {
|
||||||
|
|
||||||
void MacIOSurfaceTextureHostOGL::PushResourceUpdates(
|
void MacIOSurfaceTextureHostOGL::PushResourceUpdates(
|
||||||
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
|
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) {
|
||||||
MOZ_ASSERT(mSurface);
|
MOZ_ASSERT(mSurface);
|
||||||
|
|
||||||
auto method = aOp == TextureHost::ADD_IMAGE
|
auto method = aOp == TextureHost::ADD_IMAGE
|
||||||
|
@ -179,7 +180,8 @@ void MacIOSurfaceTextureHostOGL::PushResourceUpdates(
|
||||||
auto format = GetFormat() == gfx::SurfaceFormat::R8G8B8A8
|
auto format = GetFormat() == gfx::SurfaceFormat::R8G8B8A8
|
||||||
? gfx::SurfaceFormat::B8G8R8A8
|
? gfx::SurfaceFormat::B8G8R8A8
|
||||||
: gfx::SurfaceFormat::B8G8R8X8;
|
: gfx::SurfaceFormat::B8G8R8X8;
|
||||||
wr::ImageDescriptor descriptor(GetSize(), format);
|
wr::ImageDescriptor descriptor(GetSize(), format,
|
||||||
|
aPreferCompositorSurface);
|
||||||
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
|
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +192,8 @@ void MacIOSurfaceTextureHostOGL::PushResourceUpdates(
|
||||||
// and YCbCr at OpenGL 3.1)
|
// and YCbCr at OpenGL 3.1)
|
||||||
MOZ_ASSERT(aImageKeys.length() == 1);
|
MOZ_ASSERT(aImageKeys.length() == 1);
|
||||||
MOZ_ASSERT(mSurface->GetPlaneCount() == 0);
|
MOZ_ASSERT(mSurface->GetPlaneCount() == 0);
|
||||||
wr::ImageDescriptor descriptor(GetSize(), gfx::SurfaceFormat::B8G8R8X8);
|
wr::ImageDescriptor descriptor(GetSize(), gfx::SurfaceFormat::B8G8R8X8,
|
||||||
|
aPreferCompositorSurface);
|
||||||
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
|
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -200,11 +203,11 @@ void MacIOSurfaceTextureHostOGL::PushResourceUpdates(
|
||||||
wr::ImageDescriptor descriptor0(
|
wr::ImageDescriptor descriptor0(
|
||||||
gfx::IntSize(mSurface->GetDevicePixelWidth(0),
|
gfx::IntSize(mSurface->GetDevicePixelWidth(0),
|
||||||
mSurface->GetDevicePixelHeight(0)),
|
mSurface->GetDevicePixelHeight(0)),
|
||||||
gfx::SurfaceFormat::A8);
|
gfx::SurfaceFormat::A8, aPreferCompositorSurface);
|
||||||
wr::ImageDescriptor descriptor1(
|
wr::ImageDescriptor descriptor1(
|
||||||
gfx::IntSize(mSurface->GetDevicePixelWidth(1),
|
gfx::IntSize(mSurface->GetDevicePixelWidth(1),
|
||||||
mSurface->GetDevicePixelHeight(1)),
|
mSurface->GetDevicePixelHeight(1)),
|
||||||
gfx::SurfaceFormat::R8G8);
|
gfx::SurfaceFormat::R8G8, aPreferCompositorSurface);
|
||||||
(aResources.*method)(aImageKeys[0], descriptor0, aExtID, imageType, 0);
|
(aResources.*method)(aImageKeys[0], descriptor0, aExtID, imageType, 0);
|
||||||
(aResources.*method)(aImageKeys[1], descriptor1, aExtID, imageType, 1);
|
(aResources.*method)(aImageKeys[1], descriptor1, aExtID, imageType, 1);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -71,7 +71,8 @@ class MacIOSurfaceTextureHostOGL : public TextureHost {
|
||||||
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
||||||
ResourceUpdateOp aOp,
|
ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys,
|
const Range<wr::ImageKey>& aImageKeys,
|
||||||
const wr::ExternalImageId& aExtID) override;
|
const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) override;
|
||||||
|
|
||||||
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
||||||
const wr::LayoutRect& aBounds,
|
const wr::LayoutRect& aBounds,
|
||||||
|
|
|
@ -648,7 +648,8 @@ void SurfaceTextureHost::CreateRenderTexture(
|
||||||
|
|
||||||
void SurfaceTextureHost::PushResourceUpdates(
|
void SurfaceTextureHost::PushResourceUpdates(
|
||||||
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
|
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) {
|
||||||
auto method = aOp == TextureHost::ADD_IMAGE
|
auto method = aOp == TextureHost::ADD_IMAGE
|
||||||
? &wr::TransactionBuilder::AddExternalImage
|
? &wr::TransactionBuilder::AddExternalImage
|
||||||
: &wr::TransactionBuilder::UpdateExternalImage;
|
: &wr::TransactionBuilder::UpdateExternalImage;
|
||||||
|
@ -665,7 +666,8 @@ void SurfaceTextureHost::PushResourceUpdates(
|
||||||
auto format = GetFormat() == gfx::SurfaceFormat::R8G8B8A8
|
auto format = GetFormat() == gfx::SurfaceFormat::R8G8B8A8
|
||||||
? gfx::SurfaceFormat::B8G8R8A8
|
? gfx::SurfaceFormat::B8G8R8A8
|
||||||
: gfx::SurfaceFormat::B8G8R8X8;
|
: gfx::SurfaceFormat::B8G8R8X8;
|
||||||
wr::ImageDescriptor descriptor(GetSize(), format);
|
wr::ImageDescriptor descriptor(GetSize(), format,
|
||||||
|
aPreferCompositorSurface);
|
||||||
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
|
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -854,7 +856,8 @@ void EGLImageTextureHost::CreateRenderTexture(
|
||||||
|
|
||||||
void EGLImageTextureHost::PushResourceUpdates(
|
void EGLImageTextureHost::PushResourceUpdates(
|
||||||
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
|
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) {
|
||||||
auto method = aOp == TextureHost::ADD_IMAGE
|
auto method = aOp == TextureHost::ADD_IMAGE
|
||||||
? &wr::TransactionBuilder::AddExternalImage
|
? &wr::TransactionBuilder::AddExternalImage
|
||||||
: &wr::TransactionBuilder::UpdateExternalImage;
|
: &wr::TransactionBuilder::UpdateExternalImage;
|
||||||
|
@ -870,7 +873,8 @@ void EGLImageTextureHost::PushResourceUpdates(
|
||||||
auto formatTmp = format == gfx::SurfaceFormat::R8G8B8A8
|
auto formatTmp = format == gfx::SurfaceFormat::R8G8B8A8
|
||||||
? gfx::SurfaceFormat::B8G8R8A8
|
? gfx::SurfaceFormat::B8G8R8A8
|
||||||
: gfx::SurfaceFormat::B8G8R8X8;
|
: gfx::SurfaceFormat::B8G8R8X8;
|
||||||
wr::ImageDescriptor descriptor(GetSize(), formatTmp);
|
wr::ImageDescriptor descriptor(GetSize(), formatTmp,
|
||||||
|
aPreferCompositorSurface);
|
||||||
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
|
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -433,7 +433,8 @@ class SurfaceTextureHost : public TextureHost {
|
||||||
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
||||||
ResourceUpdateOp aOp,
|
ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys,
|
const Range<wr::ImageKey>& aImageKeys,
|
||||||
const wr::ExternalImageId& aExtID) override;
|
const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) override;
|
||||||
|
|
||||||
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
||||||
const wr::LayoutRect& aBounds,
|
const wr::LayoutRect& aBounds,
|
||||||
|
@ -538,7 +539,8 @@ class EGLImageTextureHost final : public TextureHost {
|
||||||
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
||||||
ResourceUpdateOp aOp,
|
ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys,
|
const Range<wr::ImageKey>& aImageKeys,
|
||||||
const wr::ExternalImageId& aExtID) override;
|
const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) override;
|
||||||
|
|
||||||
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
||||||
const wr::LayoutRect& aBounds,
|
const wr::LayoutRect& aBounds,
|
||||||
|
|
|
@ -101,7 +101,8 @@ void WaylandDMABUFTextureHostOGL::CreateRenderTexture(
|
||||||
|
|
||||||
void WaylandDMABUFTextureHostOGL::PushResourceUpdates(
|
void WaylandDMABUFTextureHostOGL::PushResourceUpdates(
|
||||||
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
|
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) {
|
||||||
MOZ_ASSERT(mSurface);
|
MOZ_ASSERT(mSurface);
|
||||||
|
|
||||||
auto method = aOp == TextureHost::ADD_IMAGE
|
auto method = aOp == TextureHost::ADD_IMAGE
|
||||||
|
@ -120,7 +121,8 @@ void WaylandDMABUFTextureHostOGL::PushResourceUpdates(
|
||||||
auto formatTmp = format == gfx::SurfaceFormat::R8G8B8A8
|
auto formatTmp = format == gfx::SurfaceFormat::R8G8B8A8
|
||||||
? gfx::SurfaceFormat::B8G8R8A8
|
? gfx::SurfaceFormat::B8G8R8A8
|
||||||
: gfx::SurfaceFormat::B8G8R8X8;
|
: gfx::SurfaceFormat::B8G8R8X8;
|
||||||
wr::ImageDescriptor descriptor(GetSize(), formatTmp);
|
wr::ImageDescriptor descriptor(GetSize(), formatTmp,
|
||||||
|
aPreferCompositorSurface);
|
||||||
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
|
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,8 @@ class WaylandDMABUFTextureHostOGL : public TextureHost {
|
||||||
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
||||||
ResourceUpdateOp aOp,
|
ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys,
|
const Range<wr::ImageKey>& aImageKeys,
|
||||||
const wr::ExternalImageId& aExtID) override;
|
const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) override;
|
||||||
|
|
||||||
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
||||||
const wr::LayoutRect& aBounds,
|
const wr::LayoutRect& aBounds,
|
||||||
|
|
|
@ -266,7 +266,8 @@ Maybe<TextureHost::ResourceUpdateOp> AsyncImagePipelineManager::UpdateImageKeys(
|
||||||
|
|
||||||
Range<wr::ImageKey> keys(&aKeys[0], aKeys.Length());
|
Range<wr::ImageKey> keys(&aKeys[0], aKeys.Length());
|
||||||
auto externalImageKey = wrTexture->GetExternalImageKey();
|
auto externalImageKey = wrTexture->GetExternalImageKey();
|
||||||
wrTexture->PushResourceUpdates(aMaybeFastTxn, op, keys, externalImageKey);
|
wrTexture->PushResourceUpdates(aMaybeFastTxn, op, keys, externalImageKey,
|
||||||
|
/* aPreferCompositorSurface */ true);
|
||||||
|
|
||||||
return Some(op);
|
return Some(op);
|
||||||
}
|
}
|
||||||
|
|
|
@ -828,7 +828,8 @@ bool WebRenderBridgeParent::PushExternalImageForTexture(
|
||||||
WebRenderTextureHost* wrTexture = aTexture->AsWebRenderTextureHost();
|
WebRenderTextureHost* wrTexture = aTexture->AsWebRenderTextureHost();
|
||||||
if (wrTexture) {
|
if (wrTexture) {
|
||||||
wrTexture->PushResourceUpdates(aResources, op, keys,
|
wrTexture->PushResourceUpdates(aResources, op, keys,
|
||||||
wrTexture->GetExternalImageKey());
|
wrTexture->GetExternalImageKey(),
|
||||||
|
/* aPreferCompositorSurface */ false);
|
||||||
auto it = mTextureHosts.find(wr::AsUint64(aKey));
|
auto it = mTextureHosts.find(wr::AsUint64(aKey));
|
||||||
MOZ_ASSERT((it == mTextureHosts.end() && !aIsUpdate) ||
|
MOZ_ASSERT((it == mTextureHosts.end() && !aIsUpdate) ||
|
||||||
(it != mTextureHosts.end() && aIsUpdate));
|
(it != mTextureHosts.end() && aIsUpdate));
|
||||||
|
|
|
@ -197,11 +197,13 @@ uint32_t WebRenderTextureHost::NumSubTextures() {
|
||||||
|
|
||||||
void WebRenderTextureHost::PushResourceUpdates(
|
void WebRenderTextureHost::PushResourceUpdates(
|
||||||
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
|
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) {
|
||||||
MOZ_ASSERT(mWrappedTextureHost);
|
MOZ_ASSERT(mWrappedTextureHost);
|
||||||
MOZ_ASSERT(mExternalImageId == aExtID);
|
MOZ_ASSERT(mExternalImageId == aExtID);
|
||||||
|
|
||||||
mWrappedTextureHost->PushResourceUpdates(aResources, aOp, aImageKeys, aExtID);
|
mWrappedTextureHost->PushResourceUpdates(aResources, aOp, aImageKeys, aExtID,
|
||||||
|
aPreferCompositorSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRenderTextureHost::PushDisplayItems(
|
void WebRenderTextureHost::PushDisplayItems(
|
||||||
|
|
|
@ -75,7 +75,8 @@ class WebRenderTextureHost : public TextureHost {
|
||||||
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
||||||
ResourceUpdateOp aOp,
|
ResourceUpdateOp aOp,
|
||||||
const Range<wr::ImageKey>& aImageKeys,
|
const Range<wr::ImageKey>& aImageKeys,
|
||||||
const wr::ExternalImageId& aExtID) override;
|
const wr::ExternalImageId& aExtID,
|
||||||
|
const bool aPreferCompositorSurface) override;
|
||||||
|
|
||||||
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
||||||
const wr::LayoutRect& aBounds,
|
const wr::LayoutRect& aBounds,
|
||||||
|
|
|
@ -197,34 +197,41 @@ struct ImageDescriptor : public wr::WrImageDescriptor {
|
||||||
height = 0;
|
height = 0;
|
||||||
stride = 0;
|
stride = 0;
|
||||||
opacity = OpacityType::HasAlphaChannel;
|
opacity = OpacityType::HasAlphaChannel;
|
||||||
|
prefer_compositor_surface = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageDescriptor(const gfx::IntSize& aSize, gfx::SurfaceFormat aFormat) {
|
ImageDescriptor(const gfx::IntSize& aSize, gfx::SurfaceFormat aFormat,
|
||||||
|
bool aPreferCompositorSurface = false) {
|
||||||
format = wr::SurfaceFormatToImageFormat(aFormat).value();
|
format = wr::SurfaceFormatToImageFormat(aFormat).value();
|
||||||
width = aSize.width;
|
width = aSize.width;
|
||||||
height = aSize.height;
|
height = aSize.height;
|
||||||
stride = 0;
|
stride = 0;
|
||||||
opacity = gfx::IsOpaque(aFormat) ? OpacityType::Opaque
|
opacity = gfx::IsOpaque(aFormat) ? OpacityType::Opaque
|
||||||
: OpacityType::HasAlphaChannel;
|
: OpacityType::HasAlphaChannel;
|
||||||
|
prefer_compositor_surface = aPreferCompositorSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageDescriptor(const gfx::IntSize& aSize, uint32_t aByteStride,
|
ImageDescriptor(const gfx::IntSize& aSize, uint32_t aByteStride,
|
||||||
gfx::SurfaceFormat aFormat) {
|
gfx::SurfaceFormat aFormat,
|
||||||
|
bool aPreferCompositorSurface = false) {
|
||||||
format = wr::SurfaceFormatToImageFormat(aFormat).value();
|
format = wr::SurfaceFormatToImageFormat(aFormat).value();
|
||||||
width = aSize.width;
|
width = aSize.width;
|
||||||
height = aSize.height;
|
height = aSize.height;
|
||||||
stride = aByteStride;
|
stride = aByteStride;
|
||||||
opacity = gfx::IsOpaque(aFormat) ? OpacityType::Opaque
|
opacity = gfx::IsOpaque(aFormat) ? OpacityType::Opaque
|
||||||
: OpacityType::HasAlphaChannel;
|
: OpacityType::HasAlphaChannel;
|
||||||
|
prefer_compositor_surface = aPreferCompositorSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageDescriptor(const gfx::IntSize& aSize, uint32_t aByteStride,
|
ImageDescriptor(const gfx::IntSize& aSize, uint32_t aByteStride,
|
||||||
gfx::SurfaceFormat aFormat, OpacityType aOpacity) {
|
gfx::SurfaceFormat aFormat, OpacityType aOpacity,
|
||||||
|
bool aPreferCompositorSurface = false) {
|
||||||
format = wr::SurfaceFormatToImageFormat(aFormat).value();
|
format = wr::SurfaceFormatToImageFormat(aFormat).value();
|
||||||
width = aSize.width;
|
width = aSize.width;
|
||||||
height = aSize.height;
|
height = aSize.height;
|
||||||
stride = aByteStride;
|
stride = aByteStride;
|
||||||
opacity = aOpacity;
|
opacity = aOpacity;
|
||||||
|
prefer_compositor_surface = aPreferCompositorSurface;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -352,6 +352,7 @@ pub struct WrImageDescriptor {
|
||||||
pub height: i32,
|
pub height: i32,
|
||||||
pub stride: i32,
|
pub stride: i32,
|
||||||
pub opacity: OpacityType,
|
pub opacity: OpacityType,
|
||||||
|
pub prefer_compositor_surface: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Into<ImageDescriptor> for &'a WrImageDescriptor {
|
impl<'a> Into<ImageDescriptor> for &'a WrImageDescriptor {
|
||||||
|
@ -362,6 +363,10 @@ impl<'a> Into<ImageDescriptor> for &'a WrImageDescriptor {
|
||||||
flags |= ImageDescriptorFlags::IS_OPAQUE;
|
flags |= ImageDescriptorFlags::IS_OPAQUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.prefer_compositor_surface {
|
||||||
|
flags |= ImageDescriptorFlags::PREFER_COMPOSITOR_SURFACE;
|
||||||
|
}
|
||||||
|
|
||||||
ImageDescriptor {
|
ImageDescriptor {
|
||||||
size: DeviceIntSize::new(self.width, self.height),
|
size: DeviceIntSize::new(self.width, self.height),
|
||||||
stride: if self.stride != 0 {
|
stride: if self.stride != 0 {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче