Backed out 3 changesets (bug 1340398) for static build bustage a=backout

Backed out changeset 7d0a9bb0a642 (bug 1340398)
Backed out changeset a8af64e23154 (bug 1340398)
Backed out changeset 588942cf8807 (bug 1340398)

MozReview-Commit-ID: BZveA35jLBL
This commit is contained in:
Wes Kocher
2017-03-07 13:39:49 -08:00
parent f5b476c922
commit 3ad6b8eadd
13 changed files with 2944 additions and 4372 deletions

View File

@@ -12,9 +12,6 @@
#include "mozilla/layers/CompositableClient.h"
#include "mozilla/layers/CompositableForwarder.h"
#include "d3d11.h"
#include "gfxPrefs.h"
#include "DXVA2Manager.h"
#include <memory>
namespace mozilla {
namespace layers {
@@ -31,11 +28,7 @@ bool
D3D11ShareHandleImage::AllocateTexture(D3D11RecycleAllocator* aAllocator, ID3D11Device* aDevice)
{
if (aAllocator) {
if (gfxPrefs::PDMWMFUseNV12Format()) {
mTextureClient = aAllocator->CreateOrRecycleClient(gfx::SurfaceFormat::NV12, mSize);
} else {
mTextureClient = aAllocator->CreateOrRecycleClient(gfx::SurfaceFormat::B8G8R8A8, mSize);
}
mTextureClient = aAllocator->CreateOrRecycleClient(gfx::SurfaceFormat::B8G8R8A8, mSize);
if (mTextureClient) {
mTexture = static_cast<D3D11TextureData*>(mTextureClient->GetInternalData())->GetD3D11Texture();
return true;
@@ -80,30 +73,6 @@ D3D11ShareHandleImage::GetAsSourceSurface()
D3D11_TEXTURE2D_DESC desc;
texture->GetDesc(&desc);
HRESULT hr;
if (desc.Format == DXGI_FORMAT_NV12) {
nsAutoCString error;
std::unique_ptr<DXVA2Manager> manager(DXVA2Manager::CreateD3D11DXVA(nullptr, error, device));
if (!manager) {
gfxWarning() << "Failed to create DXVA2 manager!";
return nullptr;
}
RefPtr<ID3D11Texture2D> outTexture;
hr = manager->CopyToBGRATexture(texture, getter_AddRefs(outTexture));
if (FAILED(hr)) {
gfxWarning() << "Failed to copy NV12 to BGRA texture.";
return nullptr;
}
texture = outTexture;
texture->GetDesc(&desc);
}
CD3D11_TEXTURE2D_DESC softDesc(desc.Format, desc.Width, desc.Height);
softDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
softDesc.BindFlags = 0;
@@ -112,7 +81,7 @@ D3D11ShareHandleImage::GetAsSourceSurface()
softDesc.Usage = D3D11_USAGE_STAGING;
RefPtr<ID3D11Texture2D> softTexture;
hr = device->CreateTexture2D(&softDesc,
HRESULT hr = device->CreateTexture2D(&softDesc,
NULL,
static_cast<ID3D11Texture2D**>(getter_AddRefs(softTexture)));
@@ -192,16 +161,12 @@ already_AddRefed<TextureClient>
D3D11RecycleAllocator::CreateOrRecycleClient(gfx::SurfaceFormat aFormat,
const gfx::IntSize& aSize)
{
TextureAllocationFlags allocFlags = TextureAllocationFlags::ALLOC_DEFAULT;
if (gfxPrefs::PDMWMFUseSyncTexture()) {
allocFlags = TextureAllocationFlags::ALLOC_MANUAL_SYNCHRONIZATION;
}
RefPtr<TextureClient> textureClient =
CreateOrRecycle(aFormat,
aSize,
BackendSelector::Content,
layers::TextureFlags::DEFAULT,
allocFlags);
TextureAllocationFlags::ALLOC_DEFAULT);
return textureClient.forget();
}