Backed out changeset a52fb149b9ee (bug 1072501) for talos e10s failures resulting in crashes with UpdateFromSurface in the signature CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Wed, 02 Dec 2015 11:59:07 -0800
changeset 309460 d49a71d3b20a24eccdfc7cb194406d21ffb5d085
parent 309459 e3ae43ee51fa19f4ab685e5dfd8d1e051d011566
child 309461 3b3cf9f8e17590d025c44f8a7d00bce46c7ece15
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1072501
milestone45.0a1
backs outa52fb149b9ee7b3bd99c1b0161d6b9ad4505b9f8
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
Backed out changeset a52fb149b9ee (bug 1072501) for talos e10s failures resulting in crashes with UpdateFromSurface in the signature CLOSED TREE
gfx/layers/TextureDIB.cpp
gfx/layers/client/TextureClient.cpp
--- a/gfx/layers/TextureDIB.cpp
+++ b/gfx/layers/TextureDIB.cpp
@@ -123,20 +123,17 @@ DIBTextureData::UpdateFromSurface(gfx::S
   RefPtr<DataSourceSurface> srcSurf = aSurface->GetDataSurface();
 
   if (!srcSurf) {
     gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface.";
     return false;
   }
 
   DataSourceSurface::MappedSurface sourceMap;
-  if (!srcSurf->Map(gfx::DataSourceSurface::READ, &sourceMap)) {
-    gfxCriticalError() << "Failed to map source surface for UpdateFromSurface.";
-    return false;
-  }
+  srcSurf->Map(DataSourceSurface::READ, &sourceMap);
 
   for (int y = 0; y < srcSurf->GetSize().height; y++) {
     memcpy(imgSurf->Data() + imgSurf->Stride() * y,
            sourceMap.mData + sourceMap.mStride * y,
            srcSurf->GetSize().width * BytesPerPixel(srcSurf->GetFormat()));
   }
 
   srcSurf->Unmap();
@@ -228,19 +225,20 @@ ShmemDIBTextureData::Create(gfx::IntSize
   HANDLE fileMapping = ::CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, mapSize, NULL);
 
   if (!fileMapping) {
     gfxCriticalError() << "Failed to create memory file mapping for " << mapSize << " bytes.";
     return nullptr;
   }
 
   uint8_t* data = (uint8_t*)::MapViewOfFile(fileMapping, FILE_MAP_WRITE | FILE_MAP_READ,
-                                            0, 0, mapSize);
+                                            0, 0, aSize.width * aSize.height
+                                                  * BytesPerPixel(aFormat));
 
-  memset(data, 0x80, mapSize);
+  memset(data, 0x80, aSize.width * aSize.height * BytesPerPixel(aFormat));
 
   ::UnmapViewOfFile(fileMapping);
 
   BITMAPV4HEADER header;
   memset(&header, 0, sizeof(BITMAPV4HEADER));
   header.bV4Size          = sizeof(BITMAPV4HEADER);
   header.bV4Width         = aSize.width;
   header.bV4Height        = -LONG(aSize.height); // top-to-buttom DIB
@@ -384,24 +382,16 @@ TextureHostFileMapping::TextureHostFileM
 {
 }
 
 TextureHostFileMapping::~TextureHostFileMapping()
 {
   ::CloseHandle(mFileMapping);
 }
 
-UserDataKey kFileMappingKey;
-
-static void UnmapFileData(void* aData)
-{
-  MOZ_ASSERT(aData);
-  ::UnmapViewOfFile(aData);
-}
-
 void
 TextureHostFileMapping::UpdatedInternal(const nsIntRegion* aRegion)
 {
   if (!mCompositor) {
     // This can happen if we send textures to a compositable that isn't yet
     // attached to a layer.
     return;
   }
@@ -410,20 +400,20 @@ TextureHostFileMapping::UpdatedInternal(
     mTextureSource = mCompositor->CreateDataTextureSource(mFlags);
   }
 
   uint8_t* data = (uint8_t*)::MapViewOfFile(mFileMapping, FILE_MAP_READ, 0, 0, mSize.width * mSize.height * BytesPerPixel(mFormat));
 
   if (data) {
     RefPtr<DataSourceSurface> surf = Factory::CreateWrappingDataSourceSurface(data, mSize.width * BytesPerPixel(mFormat), mSize, mFormat);
 
-    surf->AddUserData(&kFileMappingKey, data, UnmapFileData);
-
     if (!mTextureSource->Update(surf, const_cast<nsIntRegion*>(aRegion))) {
       mTextureSource = nullptr;
     }
   } else {
     mTextureSource = nullptr;
   }
+
+  ::UnmapViewOfFile(data);
 }
 
 }
 }
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -727,16 +727,17 @@ TextureClient::CreateForDrawing(Composit
       aSize.width <= maxTextureSize &&
       aSize.height <= maxTextureSize &&
       NS_IsMainThread() &&
       gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) {
     data = D3D9TextureData::Create(aSize, aFormat, aAllocFlags);
   }
 
   if (!data && aFormat == SurfaceFormat::B8G8R8X8 &&
+      aAllocator->IsSameProcess() &&
       moz2DBackend == gfx::BackendType::CAIRO &&
       NS_IsMainThread()) {
     data = DIBTextureData::Create(aSize, aFormat, aAllocator);
   }
 #endif
 
 #ifdef MOZ_X11
   gfxSurfaceType type =