Bläddra i källkod

put in override of fullscrn res mem estimator for intel i810

cxgeorge 23 år sedan
förälder
incheckning
ab4ac7fed0

+ 46 - 18
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++;

+ 1 - 0
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:

+ 41 - 7
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;

+ 1 - 0
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: