Changeset 3246 in vbox
- Timestamp:
- Jun 23, 2007 5:24:37 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 22265
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/xgraphics/vboxvideo.c
r3057 r3246 50 50 * Conectiva Linux. 51 51 * 52 * Authors: Paulo C �ar Pereira de Andrade <[email protected]>52 * Authors: Paulo César Pereira de Andrade <[email protected]> 53 53 */ 54 54 … … 66 66 #include "vboxvideo.h" 67 67 #include "version-generated.h" 68 #include <xf86.h> 68 69 69 70 /* All drivers initialising the SW cursor need this */ … … 94 95 static Bool VBOXSaveScreen(ScreenPtr pScreen, int mode); 95 96 static Bool VBOXSwitchMode(int scrnIndex, DisplayModePtr pMode, int flags); 97 static ModeStatus VBOXValidMode(int scrn, DisplayModePtr p, Bool flag, int pass); 96 98 static Bool VBOXSetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode); 97 99 static void VBOXAdjustFrame(int scrnIndex, int x, int y, int flags); … … 298 300 VBOXIdentify(int flags) 299 301 { 300 xf86PrintChipsets(VBOX_NAME, "guest driver for V Box", VBOXChipsets);302 xf86PrintChipsets(VBOX_NAME, "guest driver for VirtualBox", VBOXChipsets); 301 303 } 302 304 … … 346 348 pScrn->ScreenInit = VBOXScreenInit; 347 349 pScrn->SwitchMode = VBOXSwitchMode; 350 pScrn->ValidMode = VBOXValidMode; 348 351 pScrn->AdjustFrame = VBOXAdjustFrame; 349 352 pScrn->EnterVT = VBOXEnterVT; … … 820 823 pScreen->CloseScreen = pVBox->CloseScreen; 821 824 return pScreen->CloseScreen(scrnIndex, pScreen); 825 } 826 827 /** 828 * Quoted from "How to add an (S)VGA driver to XFree86" 829 * (http://www.xfree86.org/3.3.6/VGADriver.html): 830 * 831 * The ValidMode() function is required. It is used to check for any 832 * chipset-dependent reasons why a graphics mode might not be valid. It gets 833 * called by higher levels of the code after the Probe() stage. In many cases 834 * no special checking will be required and this function will simply return 835 * TRUE always. 836 */ 837 static ModeStatus 838 VBOXValidMode(int scrn, DisplayModePtr p, Bool flag, int pass) 839 { 840 static int warned = 0; 841 ScrnInfoPtr pScrn = xf86Screens[scrn]; 842 MonPtr mon = pScrn->monitor; 843 ModeStatus ret; 844 DisplayModePtr mode; 845 float v; 846 847 if (pass != MODECHECK_FINAL) { 848 if (!warned) { 849 xf86DrvMsg(scrn, X_WARNING, "VBOXValidMode called unexpectedly\n"); 850 warned = 1; 851 } 852 } 853 /* 854 * First off, if this isn't a mode we handed to the server (ie, 855 * M_T_BUILTIN), then we reject it out of hand. 856 */ 857 if (!(p->type & M_T_BUILTIN)) 858 return MODE_NOMODE; 859 /* 860 * Finally, walk through the vsync rates 1Hz at a time looking for a mode 861 * that will fit. This is assuredly a terrible way to do this, but 862 * there's no obvious method for computing a mode of a given size that 863 * will pass xf86CheckModeForMonitor. 864 */ 865 for (v = mon->vrefresh[0].lo; v <= mon->vrefresh[0].hi; v++) { 866 mode = xf86CVTMode(p->HDisplay, p->VDisplay, v, 0, 0); 867 ret = xf86CheckModeForMonitor(mode, mon); 868 xfree(mode); 869 if (ret == MODE_OK) 870 break; 871 } 872 873 return ret; 822 874 } 823 875
Note:
See TracChangeset
for help on using the changeset viewer.