Bug 611389 - Minefield 64-bit crash of NVIDIA driver [@ nvwgf2umx.dll@0x56f71a ]. r=bsmedberg a=blocking-beta8+
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 17 Nov 2010 14:50:39 +0900
changeset 57643 21fa0a3a8c5a9b116d59f9a768641f6aab43ee4b
parent 57642 ce47d24af7931a7eed4071e0deba10ad84c3e37c
child 57644 150c89c9132689b7d9a42659350989405ec0051b
push id17018
push userm_kato@ga2.so-net.ne.jp
push dateWed, 17 Nov 2010 05:52:37 +0000
treeherdermozilla-central@150c89c91326 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg, blocking-beta8
bugs611389
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 611389 - Minefield 64-bit crash of NVIDIA driver [@ nvwgf2umx.dll@0x56f71a ]. r=bsmedberg a=blocking-beta8+
gfx/ipc/SharedDIBSurface.cpp
gfx/ipc/SharedDIBWin.cpp
--- a/gfx/ipc/SharedDIBSurface.cpp
+++ b/gfx/ipc/SharedDIBSurface.cpp
@@ -69,21 +69,18 @@ SharedDIBSurface::Attach(Handle aHandle,
   InitSurface(aWidth, aHeight, aTransparent);
   return true;
 }
 
 void
 SharedDIBSurface::InitSurface(PRUint32 aWidth, PRUint32 aHeight,
                               bool aTransparent)
 {
-  // Windows DIBs are bottom-to-top by default, so the stride is negative
-  // and the data is the beginning of the last row.
-  long stride = -long(aWidth * kBytesPerPixel);
+  long stride = long(aWidth * kBytesPerPixel);
   unsigned char* data = reinterpret_cast<unsigned char*>(mSharedDIB.GetBits());
-  data -= (aHeight - 1) * stride;
 
   gfxImageFormat format = aTransparent ? ImageFormatARGB32 : ImageFormatRGB24;
 
   gfxImageSurface::InitWithData(data, gfxIntSize(aWidth, aHeight),
                                 stride, format);
 
   cairo_surface_set_user_data(mSurface, &SHAREDDIB_KEY, this, NULL);
 }
--- a/gfx/ipc/SharedDIBWin.cpp
+++ b/gfx/ipc/SharedDIBWin.cpp
@@ -119,31 +119,33 @@ SharedDIBWin::Attach(Handle aHandle, PRU
 
   return NS_OK;
 }
 
 PRUint32
 SharedDIBWin::SetupBitmapHeader(PRUint32 aWidth, PRUint32 aHeight,
                                 bool aTransparent, BITMAPV4HEADER *aHeader)
 {
+  // D3D cannot handle an offscreen memory that pitch (SysMemPitch) is negative.
+  // So we create top-to-bottom DIB.
   memset((void*)aHeader, 0, sizeof(BITMAPV4HEADER));
   aHeader->bV4Size          = sizeof(BITMAPV4HEADER);
   aHeader->bV4Width         = aWidth;
-  aHeader->bV4Height        = aHeight;
+  aHeader->bV4Height        = -LONG(aHeight); // top-to-buttom DIB
   aHeader->bV4Planes        = 1;
   aHeader->bV4BitCount      = 32;
   aHeader->bV4V4Compression = BI_BITFIELDS;
   aHeader->bV4RedMask       = 0x00FF0000;
   aHeader->bV4GreenMask     = 0x0000FF00;
   aHeader->bV4BlueMask      = 0x000000FF;
 
   if (aTransparent)
     aHeader->bV4AlphaMask     = 0xFF000000;
 
-  return (sizeof(BITMAPV4HEADER) + (aHeader->bV4Height * aHeader->bV4Width * kBytesPerPixel));
+  return (sizeof(BITMAPV4HEADER) + (-aHeader->bV4Height * aHeader->bV4Width * kBytesPerPixel));
 }
 
 nsresult
 SharedDIBWin::SetupSurface(HDC aHdc, BITMAPV4HEADER *aHdr)
 {
   mSharedHdc = ::CreateCompatibleDC(aHdc);
 
   if (!mSharedHdc)