ooo-build r14811 - in branches/ooo-build-3-0-1: . patches/dev300



Author: thorstenb
Date: Wed Dec 10 15:21:35 2008
New Revision: 14811
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14811&view=rev

Log:
    * patches/dev300/apply:
    * patches/dev300/canvas-directx-lostdevice-fix.diff: Fix a
    misbehaviour in DirectX canvas when the device is lost: certain
    classes of resources need to be generated from scratch
    then. n#445628. Tiny chance of that hitting in the middle of
    rendering, but then we bail out now & don't crash anymore.



Added:
   branches/ooo-build-3-0-1/patches/dev300/canvas-directx-lostdevice-fix.diff
Modified:
   branches/ooo-build-3-0-1/ChangeLog
   branches/ooo-build-3-0-1/patches/dev300/apply

Modified: branches/ooo-build-3-0-1/patches/dev300/apply
==============================================================================
--- branches/ooo-build-3-0-1/patches/dev300/apply	(original)
+++ branches/ooo-build-3-0-1/patches/dev300/apply	Wed Dec 10 15:21:35 2008
@@ -2584,6 +2584,7 @@
 instset-macos-langpacks.diff, i#64937, cloph
 slideshow-blink-text-fix.diff, i#96047, thorsten
 svx-ppt-textstyle-fix.diff, n#443127, thorsten
+canvas-directx-lostdevice-fix.diff, n#445628, thorsten
 
 [ ExtensionFixes ]
 pdfimport-system-poppler.diff, i#92920, cmc

Added: branches/ooo-build-3-0-1/patches/dev300/canvas-directx-lostdevice-fix.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-3-0-1/patches/dev300/canvas-directx-lostdevice-fix.diff	Wed Dec 10 15:21:35 2008
@@ -0,0 +1,87 @@
+? wntmsci11
+diff -u -p -r1.5 dx_9rm.cxx
+--- canvas/source/directx/dx_9rm.cxx	24 Jun 2008 10:30:05 -0000	1.5
++++ canvas/source/directx/dx_9rm.cxx	10 Dec 2008 14:51:17 -0000
+@@ -53,6 +53,7 @@
+ #include <canvas/debug.hxx>
+ #include <canvas/verbosetrace.hxx>
+ #include <tools/diagnose_ex.h>
++#include <osl/thread.h>
+ 
+ #include <canvas/elapsedtime.hxx>
+ #include <canvas/canvastools.hxx>
+@@ -956,11 +957,43 @@ namespace dxcanvas
+ 			{
+ 				if(hr != D3DERR_DEVICELOST)
+ 					return false;
+-				hr = mpDevice->Reset(&mad3dpp);
+-				if(SUCCEEDED(hr))
+-					return true;
+-				if(hr == D3DERR_DEVICELOST)
+-					return true;
++
++                // interestingly enough, sometimes the Reset() below
++                // *still* causes DeviceLost errors. So, cycle until
++                // DX was kind enough to really reset the device...
++                do
++                {
++                    mpVertexBuffer.reset();
++                    hr = mpDevice->Reset(&mad3dpp);
++                    if(SUCCEEDED(hr))
++                    {
++                        IDirect3DVertexBuffer9 *pVB(NULL);
++                        DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1);
++                        if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices,
++                                                                D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
++                                                                aFVF,
++                                                                D3DPOOL_DEFAULT,
++                                                                &pVB,
++                                                                NULL)) )
++                        {
++                            throw lang::NoSupportException(
++                                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
++                                                     "Could not create DirectX device - out of memory!")),NULL);
++                        }
++                        mpVertexBuffer=COMReference<IDirect3DVertexBuffer9>(pVB);
++
++                        // retry after the restore
++                        if(SUCCEEDED(mpSwapChain->Present(&aRect,&aRect,NULL,NULL,0)))
++                            return true;
++                    }
++
++                    TimeValue aTimeout;
++                    aTimeout.Seconds=1;
++                    aTimeout.Nanosec=0;
++                    osl_waitThread(&aTimeout);
++                }
++                while(hr == D3DERR_DEVICELOST);
++
+ 				return false;
+ 			}
+ 
+diff -u -p -r1.4 dx_surfacegraphics.cxx
+--- canvas/source/directx/dx_surfacegraphics.cxx	24 Jun 2008 10:39:29 -0000	1.4
++++ canvas/source/directx/dx_surfacegraphics.cxx	10 Dec 2008 14:51:25 -0000
+@@ -34,6 +34,8 @@
+ #include "dx_surfacegraphics.hxx"
+ #include "dx_impltools.hxx"
+ 
++using namespace ::com::sun::star;
++
+ namespace dxcanvas
+ {
+     namespace
+@@ -75,11 +77,12 @@ namespace dxcanvas
+ 	            tools::setupGraphics( *pGraphics );
+ 				pRet.reset(pGraphics,
+                            GraphicsDeleter(rSurface, aHDC));
++                return pRet;
+ 			}
+             else
+                 rSurface->ReleaseDC( aHDC );
+ 		}
+ 
+-        return pRet;
++        throw uno::RuntimeException();
+     }
+ }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]