]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Windows updates
authorChris Tallon <chris@vomp.tv>
Sat, 27 Jan 2007 01:12:39 +0000 (01:12 +0000)
committerChris Tallon <chris@vomp.tv>
Sat, 27 Jan 2007 01:12:39 +0000 (01:12 +0000)
GNUmakefile
dsallocator.cc
dsallocator.h
osdwin.cc
osdwin.h

index ae83373fb32ff47393595e3e6e36884f9065e9c4..011e9da5cbd3ce44b538a02b88992f5f678c334a 100644 (file)
@@ -1,16 +1,17 @@
-CC=/home/chris/mvp/vomp/compiler/crosstool/gcc-3.4.5-glibc-2.2.5/powerpc-405-linux-gnu/bin/powerpc-405-linux-gnu-g++
-#CC = /opt/crosstool/powerpc-405-linux-gnu/gcc-2.95.3-glibc-2.2.5/bin/powerpc-405-linux-gnu-g++
-STRIP = /opt/crosstool/powerpc-405-linux-gnu/gcc-2.95.3-glibc-2.2.5/bin/powerpc-405-linux-gnu-strip
+include ../crosstool/cross-var
+
+CC=$(CROSS)g++
+STRIP=$(CROSS)strip
 
 CXX = $(CC)
-INCLUDES = -I../jpeg-6b
+INCLUDES = -I../jpeg/jpeg-6b
 CXXFLAGS_DEV = -g -O0 -Wall -Wshadow -Werror -DDEV -D_GNU_SOURCE $(INCLUDES)
 CXXFLAGS_REL = -O3 -Wall -Wshadow -Werror -D_GNU_SOURCE $(INCLUDES)
 LDFLAGS = -Wall -static
 
 LIBPATHS =
 LIBS = -lpthread -lrt
-CROSSLIBS = ../jpeg-6b/libjpeg.a
+CROSSLIBS = ../jpeg/jpeg-6b/libjpeg.a
 
 # This is the only thing windows and linux share
 include objects.mk
index eb7b8f90aea11cf627e02862e5caf651203fb613..44cb11f3543cc7543f1ee97930ee66674b215dc0 100644 (file)
@@ -52,13 +52,12 @@ HRESULT STDMETHODCALLTYPE DsAllocator::InitializeDevice(DWORD_PTR userid,VMR9All
        return hres;
 }
 
-void DsAllocator::LostDevice() {
+void DsAllocator::LostDevice(IDirect3DDevice9 *d3ddev, IDirect3D9* d3d) {
        if (!surfallocnotify) return ;
        Lock();
        CleanupSurfaces();
-       IDirect3DDevice9 *d3ddev;
-       d3ddev=((OsdWin*)Osd::getInstance())->getD3dDev();
-       HMONITOR hmon=((OsdWin*)Osd::getInstance())->getD3d()->GetAdapterMonitor(D3DADAPTER_DEFAULT);
+//     d3ddev=((OsdWin*)Osd::getInstance())->getD3dDev();
+       HMONITOR hmon=d3d->GetAdapterMonitor(D3DADAPTER_DEFAULT);
        surfallocnotify->ChangeD3DDevice(d3ddev,hmon);
        Unlock();
 
index 32cf5531b036873a50ad16682fe07c600da84bdf..27ba2ef44b6728faf86eb4e8e8de93f4b5647522 100644 (file)
@@ -52,7 +52,7 @@ public:
        virtual ULONG STDMETHODCALLTYPE AddRef();
        virtual ULONG STDMETHODCALLTYPE Release();
 
-    void LostDevice();
+    void LostDevice(IDirect3DDevice9 *d3ddev, IDirect3D9* d3d);
 
 protected:
        
index 9896779ae18d7e68d843913a44703fbe684fd040..943201bd75049a192cffac9e4d1a9b4366ad4e88 100644 (file)
--- a/osdwin.cc
+++ b/osdwin.cc
@@ -25,6 +25,8 @@
 #include "surfacewin.h"
 
 #include "dsallocator.h"
+#include "message.h"
+#include "command.h"
 
 
 //This is stuff for rendering the OSD
@@ -205,8 +207,19 @@ void OsdWin::RenderDS(LPDIRECT3DSURFACE9 present){
 
 
 void OsdWin::InternalRendering(LPDIRECT3DSURFACE9 present){
+    WaitForSingleObject(d3dmutex,INFINITE);
+    HRESULT losty=d3ddevice->TestCooperativeLevel();
+    if (losty==D3DERR_DEVICELOST) {
+        Sleep(10);
+        return; //Device Lost
+    }
+    if (losty==D3DERR_DEVICENOTRESET){
+       DoLost();
+       return;
+    }
        WaitForSingleObject(event,INFINITE);
-       WaitForSingleObject(d3dmutex,INFINITE);
+       
+   
        BeginPainting();
        if (external_driving) {
                //Copy video to Backbuffer
@@ -262,7 +275,7 @@ void OsdWin::InternalRendering(LPDIRECT3DSURFACE9 present){
                //Show it to the user!
                if (d3ddevice->Present(NULL,NULL,NULL,NULL)==D3DERR_DEVICELOST){
                        EndPainting();
-                       DoLost();
+                       if (!external_driving) DoLost();
                }
                EndPainting();
        }
@@ -272,17 +285,18 @@ void OsdWin::InternalRendering(LPDIRECT3DSURFACE9 present){
        }
 }
 
-void OsdWin::DoLost(){
+bool OsdWin::DoLost(){
        Log::getInstance()->log("OSD", Log::WARN, "Direct3D Device Lost! Reobtaining...");
        ResetEvent(event);
        if (external_driving && dsallocator!=NULL) {
-               dsallocator->LostDevice(); //Propagate the information through DS
+               dsallocator->LostDevice(d3ddevice,d3d); //Propagate the information through DS
        }
        //First we free up all resources
        Video* video = Video::getInstance();
        ((SurfaceWin*)screen)->ReleaseSurface();
-       d3drtsurf->Release();
-       d3dvb->Release();
+       if (d3drtsurf) d3drtsurf->Release();
+    d3drtsurf=NULL;
+       if (d3dvb) d3dvb->Release();
        d3dvb=NULL;
        D3DPRESENT_PARAMETERS d3dparas;
        ZeroMemory(&d3dparas,sizeof(d3dparas));
@@ -291,18 +305,22 @@ void OsdWin::DoLost(){
        d3dparas.Windowed=TRUE;
        d3dparas.SwapEffect=D3DSWAPEFFECT_COPY;
        if (d3ddevice->Reset(&d3dparas)!=D3D_OK){
-               return;
+               return false;
        }
-       screen->create(video->getScreenWidth(), video->getScreenHeight());
-       screen->display();
-       d3ddevice->GetRenderTarget(0,&d3drtsurf);
+    d3ddevice->GetRenderTarget(0,&d3drtsurf);
        InitVertexBuffer();
-       //Redraw Views, Chris could you add a member function to viewman, so that
+    //Redraw Views, Chris could you add a member function to viewman, so that
        // I can cause it to completely redraw the Views?
        // Otherwise the OSD would be distorted after Device Lost
        
        SetEvent(event);
 
+
+       screen->create(video->getScreenWidth(), video->getScreenHeight());
+       screen->display();
+       
+       return true;
+
 }
 LPDIRECT3DDEVICE9 OsdWin::getD3dDev() {
        WaitForSingleObject(event,INFINITE);//We will only return if we are initted
index 13237583ea60210db8dc870adf839199b4da58db..df99899d38f2685edceff2cbd76092aacd8cba1a 100644 (file)
--- a/osdwin.h
+++ b/osdwin.h
@@ -73,7 +73,7 @@ private:
        HANDLE d3dmutex;
        DWORD lastrendertime;
        void InternalRendering(LPDIRECT3DSURFACE9 present);
-       void DoLost();
+       bool DoLost();
        int InitVertexBuffer();
        OSDVERTEX osdvertices[4];
        HANDLE event;