Backed out changeset edc0db4368a0 (bug 1199361) for suspicion of making OS X 10.6 reftest failing very frequently
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 03 Sep 2015 08:39:48 +0200
changeset 260662 5a7b3500d6d3f8c55d565ed63d1ae61ea276a609
parent 260661 76d35d4fd84777ebe504b10aedf8bd9b414294f6
child 260663 74fbd245369c474beaa7f2b1959570243e3dafaa
child 260679 3ecb75931636a5eaf85dd6a3b220de9b826684ff
push id17297
push usercbook@mozilla.com
push dateThu, 03 Sep 2015 12:21:04 +0000
treeherderb2g-inbound@70f7c00f7fe6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1199361
milestone43.0a1
backs outedc0db4368a01ee51e80ad241a78a95145405277
Backed out changeset edc0db4368a0 (bug 1199361) for suspicion of making OS X 10.6 reftest failing very frequently
gfx/layers/IMFYCbCrImage.cpp
gfx/layers/d3d11/TextureD3D11.cpp
gfx/layers/d3d11/TextureD3D11.h
--- a/gfx/layers/IMFYCbCrImage.cpp
+++ b/gfx/layers/IMFYCbCrImage.cpp
@@ -265,21 +265,38 @@ IMFYCbCrImage::GetTextureClient(Composit
     ctx->UpdateSubresource(textureY, 0, nullptr, mData.mYChannel,
                            mData.mYStride, mData.mYStride * mData.mYSize.height);
     ctx->UpdateSubresource(textureCb, 0, nullptr, mData.mCbChannel,
                            mData.mCbCrStride, mData.mCbCrStride * mData.mCbCrSize.height);
     ctx->UpdateSubresource(textureCr, 0, nullptr, mData.mCrChannel,
                            mData.mCbCrStride, mData.mCbCrStride * mData.mCbCrSize.height);
   }
 
+  RefPtr<IDXGIResource> resource;
+
+  HANDLE shareHandleY;
+  textureY->QueryInterface((IDXGIResource**)byRef(resource));
+  hr = resource->GetSharedHandle(&shareHandleY);
+
+  HANDLE shareHandleCb;
+  textureCb->QueryInterface((IDXGIResource**)byRef(resource));
+  hr = resource->GetSharedHandle(&shareHandleCb);
+
+  HANDLE shareHandleCr;
+  textureCr->QueryInterface((IDXGIResource**)byRef(resource));
+  hr = resource->GetSharedHandle(&shareHandleCr);
+
   mTextureClient = DXGIYCbCrTextureClient::Create(aClient->GetForwarder(),
                                                   TextureFlags::DEFAULT,
                                                   textureY,
                                                   textureCb,
                                                   textureCr,
+                                                  shareHandleY,
+                                                  shareHandleCb,
+                                                  shareHandleCr,
                                                   GetSize(),
                                                   mData.mYSize,
                                                   mData.mCbCrSize);
 
   return mTextureClient;
 }
 
 } // namespace layers
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -662,105 +662,45 @@ DXGIYCbCrTextureClient::~DXGIYCbCrTextur
   }
   MOZ_COUNT_DTOR(DXGIYCbCrTextureClient);
 }
 
 // static
 already_AddRefed<DXGIYCbCrTextureClient>
 DXGIYCbCrTextureClient::Create(ISurfaceAllocator* aAllocator,
                                TextureFlags aFlags,
-                               IDirect3DTexture9* aTextureY,
-                               IDirect3DTexture9* aTextureCb,
-                               IDirect3DTexture9* aTextureCr,
+                               IUnknown* aTextureY,
+                               IUnknown* aTextureCb,
+                               IUnknown* aTextureCr,
                                HANDLE aHandleY,
                                HANDLE aHandleCb,
                                HANDLE aHandleCr,
                                const gfx::IntSize& aSize,
                                const gfx::IntSize& aSizeY,
                                const gfx::IntSize& aSizeCbCr)
 {
   if (!aHandleY || !aHandleCb || !aHandleCr ||
       !aTextureY || !aTextureCb || !aTextureCr) {
     return nullptr;
   }
 
-  aTextureY->SetPrivateData(sD3D11TextureUsage,
-    new TextureMemoryMeasurer(aSizeY.width * aSizeY.height), sizeof(IUnknown*), D3DSPD_IUNKNOWN);
-  aTextureCb->SetPrivateData(sD3D11TextureUsage,
-    new TextureMemoryMeasurer(aSizeCbCr.width * aSizeCbCr.height), sizeof(IUnknown*), D3DSPD_IUNKNOWN);
-  aTextureCr->SetPrivateData(sD3D11TextureUsage,
-    new TextureMemoryMeasurer(aSizeCbCr.width * aSizeCbCr.height), sizeof(IUnknown*), D3DSPD_IUNKNOWN);
-
   RefPtr<DXGIYCbCrTextureClient> texture =
     new DXGIYCbCrTextureClient(aAllocator, aFlags);
   texture->mHandles[0] = aHandleY;
   texture->mHandles[1] = aHandleCb;
   texture->mHandles[2] = aHandleCr;
   texture->mHoldRefs[0] = aTextureY;
   texture->mHoldRefs[1] = aTextureCb;
   texture->mHoldRefs[2] = aTextureCr;
   texture->mSize = aSize;
   texture->mSizeY = aSizeY;
   texture->mSizeCbCr = aSizeCbCr;
   return texture.forget();
 }
 
-already_AddRefed<DXGIYCbCrTextureClient>
-DXGIYCbCrTextureClient::Create(ISurfaceAllocator* aAllocator,
-                               TextureFlags aFlags,
-                               ID3D11Texture2D* aTextureY,
-                               ID3D11Texture2D* aTextureCb,
-                               ID3D11Texture2D* aTextureCr,
-                               const gfx::IntSize& aSize,
-                               const gfx::IntSize& aSizeY,
-                               const gfx::IntSize& aSizeCbCr)
-{
-  if (!aTextureY || !aTextureCb || !aTextureCr) {
-    return nullptr;
-  }
-
-  aTextureY->SetPrivateDataInterface(sD3D11TextureUsage,
-    new TextureMemoryMeasurer(aSize.width * aSize.height));
-  aTextureCb->SetPrivateDataInterface(sD3D11TextureUsage,
-    new TextureMemoryMeasurer(aSizeCbCr.width * aSizeCbCr.height));
-  aTextureCr->SetPrivateDataInterface(sD3D11TextureUsage,
-    new TextureMemoryMeasurer(aSizeCbCr.width * aSizeCbCr.height));
-
-  RefPtr<DXGIYCbCrTextureClient> texture =
-    new DXGIYCbCrTextureClient(aAllocator, aFlags);
-
-  RefPtr<IDXGIResource> resource;
-
-  aTextureY->QueryInterface((IDXGIResource**)byRef(resource));
-  HRESULT hr = resource->GetSharedHandle(&texture->mHandles[0]);
-  if (FAILED(hr)) {
-    return nullptr;
-  }
-
-  aTextureCb->QueryInterface((IDXGIResource**)byRef(resource));
-  hr = resource->GetSharedHandle(&texture->mHandles[1]);
-  if (FAILED(hr)) {
-    return nullptr;
-  }
-
-  aTextureCr->QueryInterface((IDXGIResource**)byRef(resource));
-  hr = resource->GetSharedHandle(&texture->mHandles[2]);
-  if (FAILED(hr)) {
-    return nullptr;
-  }
-
-  texture->mHoldRefs[0] = aTextureY;
-  texture->mHoldRefs[1] = aTextureCb;
-  texture->mHoldRefs[2] = aTextureCr;
-  texture->mSize = aSize;
-  texture->mSizeY = aSizeY;
-  texture->mSizeCbCr = aSizeCbCr;
-  return texture.forget();
-}
-
 bool
 DXGIYCbCrTextureClient::Lock(OpenMode)
 {
   MOZ_ASSERT(!mIsLocked);
   if (!IsValid()) {
     return false;
   }
   mIsLocked = true;
--- a/gfx/layers/d3d11/TextureD3D11.h
+++ b/gfx/layers/d3d11/TextureD3D11.h
@@ -7,17 +7,16 @@
 #define MOZILLA_GFX_TEXTURED3D11_H
 
 #include "mozilla/layers/Compositor.h"
 #include "mozilla/layers/TextureClient.h"
 #include "mozilla/layers/TextureHost.h"
 #include "gfxWindowsPlatform.h"
 #include "mozilla/GfxMessageUtils.h"
 #include <d3d11.h>
-#include "d3d9.h"
 #include <vector>
 
 namespace mozilla {
 namespace layers {
 
 class CompositorD3D11;
 
 /**
@@ -105,37 +104,26 @@ public:
                          TextureFlags aFlags);
 
   virtual ~DXGIYCbCrTextureClient();
 
   // Creates a TextureClient and init width.
   static already_AddRefed<DXGIYCbCrTextureClient>
   Create(ISurfaceAllocator* aAllocator,
          TextureFlags aFlags,
-         IDirect3DTexture9* aTextureY,
-         IDirect3DTexture9* aTextureCb,
-         IDirect3DTexture9* aTextureCr,
+         IUnknown* aTextureY,
+         IUnknown* aTextureCb,
+         IUnknown* aTextureCr,
          HANDLE aHandleY,
          HANDLE aHandleCb,
          HANDLE aHandleCr,
          const gfx::IntSize& aSize,
          const gfx::IntSize& aSizeY,
          const gfx::IntSize& aSizeCbCr);
 
-  // Creates a TextureClient and init width.
-  static already_AddRefed<DXGIYCbCrTextureClient>
-  Create(ISurfaceAllocator* aAllocator,
-         TextureFlags aFlags,
-         ID3D11Texture2D* aTextureY,
-         ID3D11Texture2D* aTextureCb,
-         ID3D11Texture2D* aTextureCr,
-         const gfx::IntSize& aSize,
-         const gfx::IntSize& aSizeY,
-         const gfx::IntSize& aSizeCbCr);
-
   // TextureClient
 
   virtual bool IsAllocated() const override{ return !!mHoldRefs[0]; }
 
   virtual bool Lock(OpenMode aOpenMode) override;
 
   virtual void Unlock() override;