-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
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();
#include "surfacewin.h"
#include "dsallocator.h"
+#include "message.h"
+#include "command.h"
//This is stuff for rendering the OSD
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
//Show it to the user!
if (d3ddevice->Present(NULL,NULL,NULL,NULL)==D3DERR_DEVICELOST){
EndPainting();
- DoLost();
+ if (!external_driving) DoLost();
}
EndPainting();
}
}
}
-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));
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