Backed out changeset fa524e77ef3e (bug 1383786)

This commit is contained in:
Sebastian Hengst 2017-09-22 16:22:40 +02:00
Родитель fa3031e45f
Коммит c2765f570f
12 изменённых файлов: 100 добавлений и 93 удалений

Просмотреть файл

@ -119,13 +119,13 @@ GPUVideoTextureHost::NumSubTextures() const
} }
void void
GPUVideoTextureHost::PushResourceUpdates(wr::ResourceUpdateQueue& aResources, GPUVideoTextureHost::AddWRImage(wr::ResourceUpdateQueue& aResources,
ResourceUpdateOp aOp, Range<const wr::ImageKey>& aImageKeys,
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID)
const wr::ExternalImageId& aExtID)
{ {
MOZ_ASSERT(mWrappedTextureHost); MOZ_ASSERT(mWrappedTextureHost);
mWrappedTextureHost->PushResourceUpdates(aResources, aOp, aImageKeys, aExtID);
mWrappedTextureHost->AddWRImage(aResources, aImageKeys, aExtID);
} }
void void

Просмотреть файл

@ -50,10 +50,9 @@ public:
virtual uint32_t NumSubTextures() const override; virtual uint32_t NumSubTextures() const override;
virtual void PushResourceUpdates(wr::ResourceUpdateQueue& aResources, virtual void AddWRImage(wr::ResourceUpdateQueue& aResources,
ResourceUpdateOp aOp, Range<const wr::ImageKey>& aImageKeys,
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) override;
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder, virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
const wr::LayoutRect& aBounds, const wr::LayoutRect& aBounds,

Просмотреть файл

@ -577,31 +577,38 @@ BufferTextureHost::NumSubTextures() const
} }
void void
BufferTextureHost::PushResourceUpdates(wr::ResourceUpdateQueue& aResources, BufferTextureHost::AddWRImage(wr::ResourceUpdateQueue& aResources,
ResourceUpdateOp aOp, Range<const wr::ImageKey>& aImageKeys,
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID)
const wr::ExternalImageId& aExtID)
{ {
auto method = aOp == TextureHost::ADD_IMAGE ? &wr::ResourceUpdateQueue::AddExternalImage
: &wr::ResourceUpdateQueue::UpdateExternalImage;
auto bufferType = wr::WrExternalImageBufferType::ExternalBuffer;
if (GetFormat() != gfx::SurfaceFormat::YUV) { if (GetFormat() != gfx::SurfaceFormat::YUV) {
MOZ_ASSERT(aImageKeys.length() == 1); MOZ_ASSERT(aImageKeys.length() == 1);
wr::ImageDescriptor descriptor(GetSize(), wr::ImageDescriptor descriptor(GetSize(),
ImageDataSerializer::ComputeRGBStride(GetFormat(), GetSize().width), ImageDataSerializer::ComputeRGBStride(GetFormat(), GetSize().width),
GetFormat()); GetFormat());
(aResources.*method)(aImageKeys[0], descriptor, aExtID, bufferType, 0); aResources.AddExternalImageBuffer(aImageKeys[0], descriptor, aExtID);
} else { } else {
MOZ_ASSERT(aImageKeys.length() == 3); MOZ_ASSERT(aImageKeys.length() == 3);
const layers::YCbCrDescriptor& desc = mDescriptor.get_YCbCrDescriptor(); const layers::YCbCrDescriptor& desc = mDescriptor.get_YCbCrDescriptor();
wr::ImageDescriptor yDescriptor(desc.ySize(), desc.ySize().width, gfx::SurfaceFormat::A8); wr::ImageDescriptor yDescriptor(desc.ySize(), desc.ySize().width, gfx::SurfaceFormat::A8);
wr::ImageDescriptor cbcrDescriptor(desc.cbCrSize(), desc.cbCrSize().width, gfx::SurfaceFormat::A8); wr::ImageDescriptor cbcrDescriptor(desc.cbCrSize(), desc.cbCrSize().width, gfx::SurfaceFormat::A8);
(aResources.*method)(aImageKeys[0], yDescriptor, aExtID, bufferType, 0); aResources.AddExternalImage(aImageKeys[0],
(aResources.*method)(aImageKeys[1], cbcrDescriptor, aExtID, bufferType, 1); yDescriptor,
(aResources.*method)(aImageKeys[2], cbcrDescriptor, aExtID, bufferType, 2); aExtID,
wr::WrExternalImageBufferType::ExternalBuffer,
0);
aResources.AddExternalImage(aImageKeys[1],
cbcrDescriptor,
aExtID,
wr::WrExternalImageBufferType::ExternalBuffer,
1);
aResources.AddExternalImage(aImageKeys[2],
cbcrDescriptor,
aExtID,
wr::WrExternalImageBufferType::ExternalBuffer,
2);
} }
} }

Просмотреть файл

@ -625,18 +625,13 @@ public:
/// For example in a lot of YUV cases it will be 3 /// For example in a lot of YUV cases it will be 3
virtual uint32_t NumSubTextures() const { return 1; } virtual uint32_t NumSubTextures() const { return 1; }
enum ResourceUpdateOp {
ADD_IMAGE,
UPDATE_IMAGE,
};
// Add all necessary TextureHost informations to the resource update queue. // Add all necessary TextureHost informations to the resource update queue.
virtual void PushResourceUpdates(wr::ResourceUpdateQueue& aResources, // Then, WR will use this informations to read from the TextureHost.
ResourceUpdateOp aOp, virtual void AddWRImage(wr::ResourceUpdateQueue& aResources,
const Range<wr::ImageKey>& aImageKeys, Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID) const wr::ExternalImageId& aExtID)
{ {
MOZ_ASSERT_UNREACHABLE("Unimplemented"); MOZ_ASSERT_UNREACHABLE("No AddWRImage() implementation for this TextureHost type.");
} }
// Put all necessary WR commands into DisplayListBuilder for this textureHost rendering. // Put all necessary WR commands into DisplayListBuilder for this textureHost rendering.
@ -746,10 +741,9 @@ public:
virtual uint32_t NumSubTextures() const override; virtual uint32_t NumSubTextures() const override;
virtual void PushResourceUpdates(wr::ResourceUpdateQueue& aResources, virtual void AddWRImage(wr::ResourceUpdateQueue& aResources,
ResourceUpdateOp aOp, Range<const wr::ImageKey>& aImageKeys,
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) override;
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder, virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
const wr::LayoutRect& aBounds, const wr::LayoutRect& aBounds,

Просмотреть файл

@ -1063,15 +1063,11 @@ DXGITextureHostD3D11::NumSubTextures() const
} }
void void
DXGITextureHostD3D11::PushResourceUpdates(wr::ResourceUpdateQueue& aResources, DXGITextureHostD3D11::AddWRImage(wr::ResourceUpdateQueue& aResources,
ResourceUpdateOp aOp, Range<const wr::ImageKey>& aImageKeys,
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID)
const wr::ExternalImageId& aExtID) override;
{ {
MOZ_ASSERT(mHandle); MOZ_ASSERT(mHandle);
auto method = aOp == TextureHost::ADD_IMAGE ? &wr::ResourceUpdateQueue::AddExternalImage
: &wr::ResourceUpdateQueue::UpdateExternalImage;
auto bufferType = wr::WrExternalImageBufferType::TextureExternalHandle;
switch (mFormat) { switch (mFormat) {
case gfx::SurfaceFormat::R8G8B8X8: case gfx::SurfaceFormat::R8G8B8X8:
@ -1081,7 +1077,11 @@ DXGITextureHostD3D11::PushResourceUpdates(wr::ResourceUpdateQueue& aResources,
MOZ_ASSERT(aImageKeys.length() == 1); MOZ_ASSERT(aImageKeys.length() == 1);
wr::ImageDescriptor descriptor(GetSize(), GetFormat()); wr::ImageDescriptor descriptor(GetSize(), GetFormat());
(aResources.*method)(aImageKeys[0], descriptor, aExtID, bufferType, 0); aResources.AddExternalImage(aImageKeys[0],
descriptor,
aExtID,
wr::WrExternalImageBufferType::Texture2DHandle,
0);
break; break;
} }
case gfx::SurfaceFormat::NV12: { case gfx::SurfaceFormat::NV12: {
@ -1089,8 +1089,16 @@ DXGITextureHostD3D11::PushResourceUpdates(wr::ResourceUpdateQueue& aResources,
wr::ImageDescriptor descriptor0(GetSize(), gfx::SurfaceFormat::A8); wr::ImageDescriptor descriptor0(GetSize(), gfx::SurfaceFormat::A8);
wr::ImageDescriptor descriptor1(GetSize() / 2, gfx::SurfaceFormat::R8G8); wr::ImageDescriptor descriptor1(GetSize() / 2, gfx::SurfaceFormat::R8G8);
(aResources.*method)(aImageKeys[0], descriptor0, aExtID, bufferType, 0); aResources.AddExternalImage(aImageKeys[0],
(aResources.*method)(aImageKeys[1], descriptor1, aExtID, bufferType, 1); descriptor0,
aExtID,
wr::WrExternalImageBufferType::TextureExternalHandle,
0);
aResources.AddExternalImage(aImageKeys[1],
descriptor1,
aExtID,
wr::WrExternalImageBufferType::TextureExternalHandle,
1);
break; break;
} }
default: { default: {
@ -1295,10 +1303,9 @@ DXGIYCbCrTextureHostD3D11::CreateRenderTexture(const wr::ExternalImageId& aExter
} }
void void
DXGIYCbCrTextureHostD3D11::PushResourceUpdates(wr::ResourceUpdateQueue& aResources, DXGIYCbCrTextureHostD3D11::AddWRImage(wr::ResourceUpdateQueue& aResources,
ResourceUpdateOp aOp, Range<const wr::ImageKey>& aImageKeys,
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID)
const wr::ExternalImageId& aExtID) override;
{ {
// TODO - This implementation is very slow (read-back, copy on the copy and re-upload). // TODO - This implementation is very slow (read-back, copy on the copy and re-upload).
@ -1324,11 +1331,7 @@ DXGIYCbCrTextureHostD3D11::PushResourceUpdates(wr::ResourceUpdateQueue& aResourc
wr::ImageDescriptor descriptor(size, map.mStride, dataSourceSurface->GetFormat()); wr::ImageDescriptor descriptor(size, map.mStride, dataSourceSurface->GetFormat());
wr::Vec_u8 imgBytes; wr::Vec_u8 imgBytes;
imgBytes.PushBytes(Range<uint8_t>(map.mData, size.height * map.mStride)); imgBytes.PushBytes(Range<uint8_t>(map.mData, size.height * map.mStride));
if (aOp == TextureHost::ADD_IMAGE) { aResources.AddImage(aImageKeys[0], descriptor, imgBytes);
aResources.AddImage(aImageKeys[0], descriptor, imgBytes);
} else {
aResource.UpdateImage(aImageKeys[0], descriptor, imgBytes);
}
dataSourceSurface->Unmap(); dataSourceSurface->Unmap();
} }

Просмотреть файл

@ -337,10 +337,9 @@ public:
virtual uint32_t NumSubTextures() const override; virtual uint32_t NumSubTextures() const override;
virtual void PushResourceUpdates(wr::ResourceUpdateQueue& aResources, virtual void AddWRImage(wr::ResourceUpdateQueue& aAPI,
ResourceUpdateOp aOp, Range<const wr::ImageKey>& aImageKeys,
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) override;
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder, virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
const wr::LayoutRect& aBounds, const wr::LayoutRect& aBounds,
@ -398,10 +397,9 @@ public:
virtual void CreateRenderTexture(const wr::ExternalImageId& aExternalImageId) override; virtual void CreateRenderTexture(const wr::ExternalImageId& aExternalImageId) override;
virtual void PushResourceUpdates(wr::ResourceUpdateQueue& aResources, virtual void AddWRImage(wr::ResourceUpdateQueue& aResources,
ResourceUpdateOp aOp, Range<const wr::ImageKey>& aImageKeys,
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) override;
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder, virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
const wr::LayoutRect& aBounds, const wr::LayoutRect& aBounds,

Просмотреть файл

@ -147,17 +147,12 @@ MacIOSurfaceTextureHostOGL::NumSubTextures() const
} }
void void
MacIOSurfaceTextureHostOGL::PushResourceUpdates(wr::ResourceUpdateQueue& aResources, MacIOSurfaceTextureHostOGL::AddWRImage(wr::ResourceUpdateQueue& aResources,
ResourceUpdateOp aOp, Range<const wr::ImageKey>& aImageKeys,
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID)
const wr::ExternalImageId& aExtID) override;
{ {
MOZ_ASSERT(mSurface); MOZ_ASSERT(mSurface);
auto method = aOp == TextureHost::ADD_IMAGE ? &wr::ResourceUpdateQueue::AddExternalImage
: &wr::ResourceUpdateQueue::UpdateExternalImage;
auto bufferType = wr::WrExternalImageBufferType::TextureRectHandle;
switch (GetFormat()) { switch (GetFormat()) {
case gfx::SurfaceFormat::R8G8B8X8: case gfx::SurfaceFormat::R8G8B8X8:
case gfx::SurfaceFormat::R8G8B8A8: case gfx::SurfaceFormat::R8G8B8A8:
@ -166,7 +161,11 @@ MacIOSurfaceTextureHostOGL::PushResourceUpdates(wr::ResourceUpdateQueue& aResour
MOZ_ASSERT(aImageKeys.length() == 1); MOZ_ASSERT(aImageKeys.length() == 1);
MOZ_ASSERT(mSurface->GetPlaneCount() == 0); MOZ_ASSERT(mSurface->GetPlaneCount() == 0);
wr::ImageDescriptor descriptor(GetSize(), GetFormat()); wr::ImageDescriptor descriptor(GetSize(), GetFormat());
(aResources.*method)(aImageKeys[0], descriptor, aExtID, bufferType, 0); aResources.AddExternalImage(aImageKeys[0],
descriptor,
aExtID,
wr::WrExternalImageBufferType::TextureRectHandle,
0);
break; break;
} }
case gfx::SurfaceFormat::YUV422: { case gfx::SurfaceFormat::YUV422: {
@ -177,7 +176,11 @@ MacIOSurfaceTextureHostOGL::PushResourceUpdates(wr::ResourceUpdateQueue& aResour
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::R8G8B8X8); wr::ImageDescriptor descriptor(GetSize(), gfx::SurfaceFormat::R8G8B8X8);
(aResources.*method)(aImageKeys[0], descriptor, aExtID, bufferType, 0); aResources.AddExternalImage(aImageKeys[0],
descriptor,
aExtID,
wr::WrExternalImageBufferType::TextureRectHandle,
0);
break; break;
} }
case gfx::SurfaceFormat::NV12: { case gfx::SurfaceFormat::NV12: {
@ -187,8 +190,16 @@ MacIOSurfaceTextureHostOGL::PushResourceUpdates(wr::ResourceUpdateQueue& aResour
gfx::SurfaceFormat::A8); gfx::SurfaceFormat::A8);
wr::ImageDescriptor descriptor1(gfx::IntSize(mSurface->GetDevicePixelWidth(1), mSurface->GetDevicePixelHeight(1)), wr::ImageDescriptor descriptor1(gfx::IntSize(mSurface->GetDevicePixelWidth(1), mSurface->GetDevicePixelHeight(1)),
gfx::SurfaceFormat::R8G8); gfx::SurfaceFormat::R8G8);
(aResources.*method)(aImageKeys[0], descriptor0, aExtID, bufferType, 0); aResources.AddExternalImage(aImageKeys[0],
(aResources.*method)(aImageKeys[1], descriptor1, aExtID, bufferType, 1); descriptor0,
aExtID,
wr::WrExternalImageBufferType::TextureRectHandle,
0);
aResources.AddExternalImage(aImageKeys[1],
descriptor1,
aExtID,
wr::WrExternalImageBufferType::TextureRectHandle,
1);
break; break;
} }
default: { default: {

Просмотреть файл

@ -66,10 +66,9 @@ public:
virtual uint32_t NumSubTextures() const override; virtual uint32_t NumSubTextures() const override;
virtual void PushResourceUpdates(wr::ResourceUpdateQueue& aResources, virtual void AddWRImage(wr::ResourceUpdateQueue& aResources,
ResourceUpdateOp aOp, Range<const wr::ImageKey>& aImageKeys,
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) override;
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder, virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
const wr::LayoutRect& aBounds, const wr::LayoutRect& aBounds,

Просмотреть файл

@ -178,9 +178,8 @@ AsyncImagePipelineManager::GenerateImageKeyForTextureHost(wr::ResourceUpdateQueu
aKeys.AppendElement(GenerateImageKey()); aKeys.AppendElement(GenerateImageKey());
} }
MOZ_ASSERT(!aKeys.IsEmpty()); MOZ_ASSERT(!aKeys.IsEmpty());
Range<wr::ImageKey> keys(&aKeys[0], aKeys.Length()); Range<const wr::ImageKey> keys(&aKeys[0], aKeys.Length());
wrTexture->PushResourceUpdates(aResources, TextureHost::ADD_IMAGE, wrTexture->AddWRImage(aResources, keys, wrTexture->GetExternalImageKey());
keys, wrTexture->GetExternalImageKey());
return true; return true;
} else { } else {
RefPtr<gfx::DataSourceSurface> dSurf = aTexture->GetAsSurface(); RefPtr<gfx::DataSourceSurface> dSurf = aTexture->GetAsSurface();

Просмотреть файл

@ -329,7 +329,7 @@ bool
WebRenderBridgeParent::AddExternalImage(wr::ExternalImageId aExtId, wr::ImageKey aKey, WebRenderBridgeParent::AddExternalImage(wr::ExternalImageId aExtId, wr::ImageKey aKey,
wr::ResourceUpdateQueue& aResources) wr::ResourceUpdateQueue& aResources)
{ {
Range<wr::ImageKey> keys(&aKey, 1); Range<const wr::ImageKey> keys(&aKey, 1);
// Check if key is obsoleted. // Check if key is obsoleted.
if (keys[0].mNamespace != mIdNamespace) { if (keys[0].mNamespace != mIdNamespace) {
return true; return true;
@ -349,8 +349,7 @@ WebRenderBridgeParent::AddExternalImage(wr::ExternalImageId aExtId, wr::ImageKey
} }
WebRenderTextureHost* wrTexture = texture->AsWebRenderTextureHost(); WebRenderTextureHost* wrTexture = texture->AsWebRenderTextureHost();
if (wrTexture) { if (wrTexture) {
wrTexture->PushResourceUpdates(aResources, TextureHost::ADD_IMAGE, keys, wrTexture->AddWRImage(aResources, keys, wrTexture->GetExternalImageKey());
wrTexture->GetExternalImageKey());
return true; return true;
} }
} }

Просмотреть файл

@ -142,15 +142,14 @@ WebRenderTextureHost::NumSubTextures() const
} }
void void
WebRenderTextureHost::PushResourceUpdates(wr::ResourceUpdateQueue& aResources, WebRenderTextureHost::AddWRImage(wr::ResourceUpdateQueue& aResources,
ResourceUpdateOp aOp, Range<const wr::ImageKey>& aImageKeys,
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID)
const wr::ExternalImageId& aExtID)
{ {
MOZ_ASSERT(mWrappedTextureHost); MOZ_ASSERT(mWrappedTextureHost);
MOZ_ASSERT(mExternalImageId == aExtID); MOZ_ASSERT(mExternalImageId == aExtID);
mWrappedTextureHost->PushResourceUpdates(aResources, aOp, aImageKeys, aExtID); mWrappedTextureHost->AddWRImage(aResources, aImageKeys, aExtID);
} }
void void

Просмотреть файл

@ -65,10 +65,9 @@ public:
virtual uint32_t NumSubTextures() const override; virtual uint32_t NumSubTextures() const override;
virtual void PushResourceUpdates(wr::ResourceUpdateQueue& aResources, virtual void AddWRImage(wr::ResourceUpdateQueue& aResources,
ResourceUpdateOp aOp, Range<const wr::ImageKey>& aImageKeys,
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) override;
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder, virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
const wr::LayoutRect& aBounds, const wr::LayoutRect& aBounds,