From ab4ac7fed06469fc7cfd2e52f920afa012681911 Mon Sep 17 00:00:00 2001 From: cxgeorge <> Date: Tue, 8 Oct 2002 05:56:30 +0000 Subject: [PATCH] put in override of fullscrn res mem estimator for intel i810 --- panda/src/wdxdisplay/wdxGraphicsWindow.cxx | 64 ++++++++++++++------ panda/src/wdxdisplay/wdxGraphicsWindow.h | 1 + panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx | 48 ++++++++++++--- panda/src/wdxdisplay8/wdxGraphicsWindow8.h | 1 + 4 files changed, 89 insertions(+), 25 deletions(-) diff --git a/panda/src/wdxdisplay/wdxGraphicsWindow.cxx b/panda/src/wdxdisplay/wdxGraphicsWindow.cxx index 67cfaccbdf..dee6876b8a 100644 --- a/panda/src/wdxdisplay/wdxGraphicsWindow.cxx +++ b/panda/src/wdxdisplay/wdxGraphicsWindow.cxx @@ -1539,6 +1539,29 @@ bool wdxGraphicsWindow::resize(unsigned int xsize,unsigned int ysize) { return true; } + +// overrides of the general estimator for known working cases +bool wdxGraphicsWindow:: +special_check_fullscreen_resolution(UINT xsize,UINT ysize) { + assert(IS_VALID_PTR(_dxgsg)); + + DWORD VendorId=_dxgsg->scrn.DXDeviceID.dwVendorId; + DWORD DeviceId=_dxgsg->scrn.DXDeviceID.dwDeviceId; + switch(VendorId) { + case 0x8086: // Intel + // Intel i810,i815 + if((DeviceId==0x7121)||(DeviceId==0x7121)||(DeviceId==0x1132)) { + if((xsize==800)&&(ysize==600)) + return true; + if((xsize==1024)&&(ysize==768)) + return true; + } + break; + } + + return false; +} + unsigned int wdxGraphicsWindow:: verify_window_sizes(unsigned int numsizes,unsigned int *dimen) { DWORD num_valid_modes=0; @@ -1573,25 +1596,30 @@ verify_window_sizes(unsigned int numsizes,unsigned int *dimen) { bool bIsGoodMode=false; - if(_dxgsg->scrn.bIsLowVidMemCard) - bIsGoodMode=(((float)xsize*(float)ysize)<=(float)(640*480)); - else if(DMI.supportedBitDepths & (DDBD_16 | DDBD_24 | DDBD_32)) { - // assume user is testing fullscreen, not windowed, so use the dwTotal value - // see if 3 scrnbufs (front/back/z)at 16bpp at xsize*ysize will fit with a few - // extra megs for texmem - - // 8MB Rage Pro says it has 6.8 megs Total free and will run at 1024x768, so - // formula makes it so that is OK - - #define REQD_TEXMEM 1800000.0f - - if(_dxgsg->scrn.MaxAvailVidMem==0) { - //assume buggy drivers return bad val of 0 and everything will be OK - bIsGoodMode=true; - } else { - bIsGoodMode = ((((float)xsize*(float)ysize)*6+REQD_TEXMEM) < (float)_dxgsg->scrn.MaxAvailVidMem); + if(special_check_fullscreen_resolution(xsize,ysize)) { + // bypass the test below for certain cards we know have valid modes + bIsGoodMode=true; + } else { + if(_dxgsg->scrn.bIsLowVidMemCard) + bIsGoodMode=(((float)xsize*(float)ysize)<=(float)(640*480)); + else if(DMI.supportedBitDepths & (DDBD_16 | DDBD_24 | DDBD_32)) { + // assume user is testing fullscreen, not windowed, so use the dwTotal value + // see if 3 scrnbufs (front/back/z)at 16bpp at xsize*ysize will fit with a few + // extra megs for texmem + + // 8MB Rage Pro says it has 6.8 megs Total free and will run at 1024x768, so + // formula makes it so that is OK + + #define REQD_TEXMEM 1800000.0f + + if(_dxgsg->scrn.MaxAvailVidMem==0) { + //assume buggy drivers return bad val of 0 and everything will be OK + bIsGoodMode=true; + } else { + bIsGoodMode = ((((float)xsize*(float)ysize)*6+REQD_TEXMEM) < (float)_dxgsg->scrn.MaxAvailVidMem); + } } - } + } if(bIsGoodMode) num_valid_modes++; diff --git a/panda/src/wdxdisplay/wdxGraphicsWindow.h b/panda/src/wdxdisplay/wdxGraphicsWindow.h index b34815af8d..9eb1fa8e80 100644 --- a/panda/src/wdxdisplay/wdxGraphicsWindow.h +++ b/panda/src/wdxdisplay/wdxGraphicsWindow.h @@ -80,6 +80,7 @@ public: void show_frame(); virtual bool resize(unsigned int xsize,unsigned int ysize); virtual unsigned int verify_window_sizes(unsigned int numsizes,unsigned int *dimen); + bool special_check_fullscreen_resolution(UINT xsize,UINT ysize); virtual int get_depth_bitwidth(void); protected: diff --git a/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx b/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx index d4c3a5f934..eb3b7ba9c4 100644 --- a/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx +++ b/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx @@ -1628,6 +1628,28 @@ bool wdxGraphicsWindow::resize(unsigned int xsize,unsigned int ysize) { return bResizeSucceeded; } +// overrides of the general estimator for known working cases +bool wdxGraphicsWindow:: +special_check_fullscreen_resolution(UINT xsize,UINT ysize) { + assert(IS_VALID_PTR(_dxgsg)); + + DWORD VendorId=_dxgsg->scrn.DXDeviceID.VendorId; + DWORD DeviceId=_dxgsg->scrn.DXDeviceID.DeviceId; + switch(VendorId) { + case 0x8086: // Intel + // Intel i810,i815 + if((DeviceId==0x7121)||(DeviceId==0x7121)||(DeviceId==0x1132)) { + if((xsize==800)&&(ysize==600)) + return true; + if((xsize==1024)&&(ysize==768)) + return true; + } + break; + } + + return false; +} + UINT wdxGraphicsWindow:: verify_window_sizes(UINT numsizes,UINT *dimen) { // unfortunately this only works AFTER you make the window initially, @@ -1648,20 +1670,32 @@ verify_window_sizes(UINT numsizes,UINT *dimen) { bool CouldntFindAnyValidZBuf; D3DFORMAT newPixFmt=D3DFMT_UNKNOWN; - if(!(_dxgsg->scrn.bIsLowVidMemCard && ((xsize!=640) || (ysize!=480)))) - search_for_valid_displaymode(xsize,ysize,_dxgsg->scrn.PresParams.EnableAutoDepthStencil!=false, - IS_STENCIL_FORMAT(_dxgsg->scrn.PresParams.AutoDepthStencilFormat), - &_dxgsg->scrn.SupportedScreenDepthsMask,&CouldntFindAnyValidZBuf, - &newPixFmt); - if(newPixFmt!=D3DFMT_UNKNOWN) { + + if(special_check_fullscreen_resolution(xsize,ysize)) { + // bypass the test below for certain cards we know have valid modes + bIsGoodMode=true; + } else { + if(_dxgsg->scrn.bIsLowVidMemCard) { + bIsGoodMode=((xsize==640) && (ysize==480)); + } else { + search_for_valid_displaymode(xsize,ysize,_dxgsg->scrn.PresParams.EnableAutoDepthStencil!=false, + IS_STENCIL_FORMAT(_dxgsg->scrn.PresParams.AutoDepthStencilFormat), + &_dxgsg->scrn.SupportedScreenDepthsMask,&CouldntFindAnyValidZBuf, + &newPixFmt); + bIsGoodMode=(newPixFmt!=D3DFMT_UNKNOWN); + } + } + + if(bIsGoodMode) { num_valid_modes++; } else { // tell caller the mode is invalid pCurDim[0] = 0; pCurDim[1] = 0; } + if(wdxdisplay_cat.is_spam()) - wdxdisplay_cat.spam() << "Fullscrn Mode (" << xsize << "," << ysize << ")\t" << ((newPixFmt!=D3DFMT_UNKNOWN) ? "V" : "Inv") <<"alid\n"; + wdxdisplay_cat.spam() << "Fullscrn Mode (" << xsize << "," << ysize << ")\t" << (bIsGoodMode ? "V" : "Inv") <<"alid\n"; } return num_valid_modes; diff --git a/panda/src/wdxdisplay8/wdxGraphicsWindow8.h b/panda/src/wdxdisplay8/wdxGraphicsWindow8.h index ad52331775..540ffd6c83 100644 --- a/panda/src/wdxdisplay8/wdxGraphicsWindow8.h +++ b/panda/src/wdxdisplay8/wdxGraphicsWindow8.h @@ -89,6 +89,7 @@ public: virtual bool resize(unsigned int xsize,unsigned int ysize); virtual unsigned int verify_window_sizes(unsigned int numsizes,unsigned int *dimen); + bool special_check_fullscreen_resolution(UINT xsize,UINT ysize); virtual int get_depth_bitwidth(void); protected: