Bug 603071 - Part 2: Fix race condition in PlanarYCbCrImageD3D10. r=roc a=blocking-beta8
authorBas Schouten <bschouten@mozilla.com>
Tue, 19 Oct 2010 21:08:34 +0200
changeset 56117 7e6aa107b8157a01a89928407bfb14e1b4a2df56
parent 56116 48e88187160092d225a8e0236ab0ecbac9265d9f
child 56118 f3606eb16232bd6d03fffe9543af98f235574158
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, blocking-beta8
bugs603071
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 603071 - Part 2: Fix race condition in PlanarYCbCrImageD3D10. r=roc a=blocking-beta8
gfx/layers/d3d10/ImageLayerD3D10.cpp
gfx/layers/d3d10/ImageLayerD3D10.h
--- a/gfx/layers/d3d10/ImageLayerD3D10.cpp
+++ b/gfx/layers/d3d10/ImageLayerD3D10.cpp
@@ -209,19 +209,19 @@ ImageLayerD3D10::RenderLayer(float aOpac
   }
 
   technique->GetPassByIndex(0)->Apply(0);
   device()->Draw(4, 0);
 }
 
 PlanarYCbCrImageD3D10::PlanarYCbCrImageD3D10(mozilla::layers::LayerManagerD3D10* aManager)
   : PlanarYCbCrImage(static_cast<ImageD3D10*>(this))
-  , mManager(aManager)
   , mHasData(PR_FALSE)
 {
+  mDevice = aManager->device();
 }
 
 void
 PlanarYCbCrImageD3D10::SetData(const PlanarYCbCrImage::Data &aData)
 {
   // XXX - For D3D10Ex we really should just copy to systemmem surfaces here.
   // For now, we copy the data
   int width_shift = 0;
@@ -314,22 +314,22 @@ PlanarYCbCrImageD3D10::AllocateTextures(
 
   dataY.pSysMem = mData.mYChannel;
   dataY.SysMemPitch = mData.mYStride;
   dataCb.pSysMem = mData.mCbChannel;
   dataCb.SysMemPitch = mData.mCbCrStride;
   dataCr.pSysMem = mData.mCrChannel;
   dataCr.SysMemPitch = mData.mCbCrStride;
 
-  mManager->device()->CreateTexture2D(&descY, &dataY, getter_AddRefs(mYTexture));
-  mManager->device()->CreateTexture2D(&descCbCr, &dataCb, getter_AddRefs(mCbTexture));
-  mManager->device()->CreateTexture2D(&descCbCr, &dataCr, getter_AddRefs(mCrTexture));
-  mManager->device()->CreateShaderResourceView(mYTexture, NULL, getter_AddRefs(mYView));
-  mManager->device()->CreateShaderResourceView(mCbTexture, NULL, getter_AddRefs(mCbView));
-  mManager->device()->CreateShaderResourceView(mCrTexture, NULL, getter_AddRefs(mCrView));
+  mDevice->CreateTexture2D(&descY, &dataY, getter_AddRefs(mYTexture));
+  mDevice->CreateTexture2D(&descCbCr, &dataCb, getter_AddRefs(mCbTexture));
+  mDevice->CreateTexture2D(&descCbCr, &dataCr, getter_AddRefs(mCrTexture));
+  mDevice->CreateShaderResourceView(mYTexture, NULL, getter_AddRefs(mYView));
+  mDevice->CreateShaderResourceView(mCbTexture, NULL, getter_AddRefs(mCbView));
+  mDevice->CreateShaderResourceView(mCrTexture, NULL, getter_AddRefs(mCrView));
 }
 
 already_AddRefed<gfxASurface>
 PlanarYCbCrImageD3D10::GetAsSurface()
 {
   nsRefPtr<gfxImageSurface> imageSurface =
     new gfxImageSurface(mSize, gfxASurface::ImageFormatRGB24);
 
--- a/gfx/layers/d3d10/ImageLayerD3D10.h
+++ b/gfx/layers/d3d10/ImageLayerD3D10.h
@@ -111,17 +111,17 @@ public:
    */
   void AllocateTextures();
 
   PRBool HasData() { return mHasData; }
 
   virtual already_AddRefed<gfxASurface> GetAsSurface();
 
   nsAutoArrayPtr<PRUint8> mBuffer;
-  LayerManagerD3D10 *mManager;
+  nsRefPtr<ID3D10Device1> mDevice;
   Data mData;
   gfxIntSize mSize;
   nsRefPtr<ID3D10Texture2D> mYTexture;
   nsRefPtr<ID3D10Texture2D> mCrTexture;
   nsRefPtr<ID3D10Texture2D> mCbTexture;
   nsRefPtr<ID3D10ShaderResourceView> mYView;
   nsRefPtr<ID3D10ShaderResourceView> mCbView;
   nsRefPtr<ID3D10ShaderResourceView> mCrView;