儲存庫 vbox 的更動 43250
- 時間撮記:
- 2012-9-7 下午07:39:32 (12 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c
r43249 r43250 115 115 #endif 116 116 static Bool VBOXPreInit(ScrnInfoPtr pScrn, int flags); 117 static Bool VBOXScreenInit(int Index, ScreenPtr pScreen, int argc, 118 char **argv); 119 static Bool VBOXEnterVT(int scrnIndex, int flags); 120 static void VBOXLeaveVT(int scrnIndex, int flags); 121 static Bool VBOXCloseScreen(int scrnIndex, ScreenPtr pScreen); 117 static Bool VBOXScreenInit(ScreenPtr pScreen, int argc, char **argv); 118 static Bool VBOXEnterVT(ScrnInfoPtr pScrn); 119 static void VBOXLeaveVT(ScrnInfoPtr pScrn); 120 static Bool VBOXCloseScreen(ScreenPtr pScreen); 122 121 static Bool VBOXSaveScreen(ScreenPtr pScreen, int mode); 123 static Bool VBOXSwitchMode( int scrnIndex, DisplayModePtr pMode, int flags);124 static void VBOXAdjustFrame( int scrnIndex, int x, int y, int flags);125 static void VBOXFreeScreen( int scrnIndex, int flags);122 static Bool VBOXSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr pMode); 123 static void VBOXAdjustFrame(ScrnInfoPtr pScrn, int x, int y); 124 static void VBOXFreeScreen(ScrnInfoPtr pScrn); 126 125 static void VBOXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int mode, 127 126 int flags); … … 638 637 } 639 638 639 #ifndef XF86_SCRN_INTERFACE 640 # define xf86ScreenToScrn(pScreen) xf86Screens[(pScreen)->myNum] 641 # define xf86ScrnToScreen(pScrn) screenInfo.screens[(pScrn)->scrnIndex] 642 # define SCRNINDEXAPI(pfn) pfn ## Index 643 static Bool VBOXScreenInitIndex(int scrnIndex, ScreenPtr pScreen, int argc, 644 char **argv) 645 { return VBOXScreenInit(pScreen, argc, argv); } 646 647 static Bool VBOXEnterVTIndex(int scrnIndex, int flags) 648 { (void) flags; return VBOXEnterVT(xf86Screens[scrnIndex]); } 649 650 static void VBOXLeaveVTIndex(int scrnIndex, int flags) 651 { (void) flags; VBOXLeaveVT(xf86Screens[scrnIndex]); } 652 653 static Bool VBOXCloseScreenIndex(int scrnIndex, ScreenPtr pScreen) 654 { (void) scrnIndex; return VBOXCloseScreen(pScreen); } 655 656 static Bool VBOXSwitchModeIndex(int scrnIndex, DisplayModePtr pMode, int flags) 657 { (void) flags; return VBOXSwitchMode(xf86Screens[scrnIndex], pMode); } 658 659 static void VBOXAdjustFrameIndex(int scrnIndex, int x, int y, int flags) 660 { (void) flags; VBOXAdjustFrame(xf86Screens[scrnIndex], x, y); } 661 662 static void VBOXFreeScreenIndex(int scrnIndex, int flags) 663 { (void) flags; VBOXFreeScreen(xf86Screens[scrnIndex]); } 664 # else 665 # define SCRNINDEXAPI(pfn) pfn 666 #endif /* XF86_SCRN_INTERFACE */ 667 668 static void setScreenFunctions(ScrnInfoPtr pScrn, xf86ProbeProc pfnProbe) 669 { 670 pScrn->driverVersion = VBOX_VERSION; 671 pScrn->driverName = VBOX_DRIVER_NAME; 672 pScrn->name = VBOX_NAME; 673 pScrn->Probe = pfnProbe; 674 pScrn->PreInit = VBOXPreInit; 675 pScrn->ScreenInit = SCRNINDEXAPI(VBOXScreenInit); 676 pScrn->SwitchMode = SCRNINDEXAPI(VBOXSwitchMode); 677 pScrn->AdjustFrame = SCRNINDEXAPI(VBOXAdjustFrame); 678 pScrn->EnterVT = SCRNINDEXAPI(VBOXEnterVT); 679 pScrn->LeaveVT = SCRNINDEXAPI(VBOXLeaveVT); 680 pScrn->FreeScreen = SCRNINDEXAPI(VBOXFreeScreen); 681 } 682 640 683 /* 641 * This function is called once, at the start of the first server generation to642 * do a minimal probe for supported hardware.684 * One of these functions is called once, at the start of the first server 685 * generation to do a minimal probe for supported hardware. 643 686 */ 644 687 … … 660 703 if (!pVBox) 661 704 return FALSE; 662 pScrn->driverVersion = VBOX_VERSION; 663 pScrn->driverName = VBOX_DRIVER_NAME; 664 pScrn->name = VBOX_NAME; 665 pScrn->Probe = NULL; 666 pScrn->PreInit = VBOXPreInit; 667 pScrn->ScreenInit = VBOXScreenInit; 668 pScrn->SwitchMode = VBOXSwitchMode; 669 pScrn->AdjustFrame = VBOXAdjustFrame; 670 pScrn->EnterVT = VBOXEnterVT; 671 pScrn->LeaveVT = VBOXLeaveVT; 672 pScrn->FreeScreen = VBOXFreeScreen; 673 705 setScreenFunctions(pScrn, NULL); 674 706 pVBox->pciInfo = dev; 675 707 } … … 693 725 */ 694 726 if ((numDevSections = xf86MatchDevice(VBOX_NAME, 695 696 727 &devSections)) <= 0) 728 return (FALSE); 697 729 698 730 /* PCI BUS */ 699 if (xf86GetPciVideoInfo()) { 731 if (xf86GetPciVideoInfo()) 732 { 700 733 int numUsed; 701 734 int *usedChips; 702 735 int i; 703 numUsed = xf86MatchPciInstances(VBOX_NAME, VBOX_VENDORID, 704 VBOXChipsets, VBOXPCIchipsets, 705 devSections, numDevSections, 706 drv, &usedChips); 707 if (numUsed > 0) { 708 if (flags & PROBE_DETECT) 709 foundScreen = TRUE; 710 else { 711 for (i = 0; i < numUsed; i++) { 712 ScrnInfoPtr pScrn = NULL; 713 /* Allocate a ScrnInfoRec */ 714 if ((pScrn = xf86ConfigPciEntity(pScrn,0,usedChips[i], 715 VBOXPCIchipsets,NULL, 716 NULL,NULL,NULL,NULL))) { 717 pScrn->driverVersion = VBOX_VERSION; 718 pScrn->driverName = VBOX_DRIVER_NAME; 719 pScrn->name = VBOX_NAME; 720 pScrn->Probe = VBOXProbe; 721 pScrn->PreInit = VBOXPreInit; 722 pScrn->ScreenInit = VBOXScreenInit; 723 pScrn->SwitchMode = VBOXSwitchMode; 724 pScrn->AdjustFrame = VBOXAdjustFrame; 725 pScrn->EnterVT = VBOXEnterVT; 726 pScrn->LeaveVT = VBOXLeaveVT; 727 pScrn->FreeScreen = VBOXFreeScreen; 728 foundScreen = TRUE; 729 } 730 } 731 } 732 free(usedChips); 733 } 734 } 735 736 numUsed = xf86MatchPciInstances(VBOX_NAME, VBOX_VENDORID, 737 VBOXChipsets, VBOXPCIchipsets, 738 devSections, numDevSections, 739 drv, &usedChips); 740 if (numUsed > 0) 741 { 742 if (flags & PROBE_DETECT) 743 foundScreen = TRUE; 744 else 745 for (i = 0; i < numUsed; i++) 746 { 747 ScrnInfoPtr pScrn = NULL; 748 /* Allocate a ScrnInfoRec */ 749 if ((pScrn = xf86ConfigPciEntity(pScrn,0,usedChips[i], 750 VBOXPCIchipsets,NULL, 751 NULL,NULL,NULL,NULL))) 752 { 753 setScreenFunctions(pScrn, VBOXProbe); 754 foundScreen = TRUE; 755 } 756 } 757 free(usedChips); 758 } 759 } 736 760 free(devSections); 737 738 761 return (foundScreen); 739 762 } … … 963 986 * End QUOTE. 964 987 */ 965 static Bool 966 VBOXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) 967 { 968 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 988 static Bool VBOXScreenInit(ScreenPtr pScreen, int argc, char **argv) 989 { 990 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); 969 991 VBOXPtr pVBox = VBOXGetRec(pScrn); 970 992 VisualPtr visual; … … 1110 1132 1111 1133 pVBox->CloseScreen = pScreen->CloseScreen; 1112 pScreen->CloseScreen = VBOXCloseScreen;1134 pScreen->CloseScreen = SCRNINDEXAPI(VBOXCloseScreen); 1113 1135 #ifdef VBOXVIDEO_13 1114 1136 pScreen->SaveScreen = xf86SaveScreen; … … 1130 1152 1131 1153 if (vbox_cursor_init(pScreen) != TRUE) 1132 xf86DrvMsg( scrnIndex, X_ERROR,1154 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, 1133 1155 "Unable to start the VirtualBox mouse pointer integration with the host system.\n"); 1134 1156 … … 1140 1162 } 1141 1163 1142 static Bool 1143 VBOXEnterVT(int scrnIndex, int flags) 1144 { 1145 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 1164 static Bool VBOXEnterVT(ScrnInfoPtr pScrn) 1165 { 1146 1166 VBOXPtr pVBox = VBOXGetRec(pScrn); 1147 1167 … … 1152 1172 #ifdef VBOX_DRI 1153 1173 if (pVBox->useDRI) 1154 DRIUnlock( screenInfo.screens[scrnIndex]);1174 DRIUnlock(xf86ScrnToScreen(pScrn)); 1155 1175 #endif 1156 1176 /* Re-assert this in case we had a change request while switched out. */ … … 1168 1188 } 1169 1189 1170 static void 1171 VBOXLeaveVT(int scrnIndex, int flags) 1172 { 1173 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 1190 static void VBOXLeaveVT(ScrnInfoPtr pScrn) 1191 { 1174 1192 VBOXPtr pVBox = VBOXGetRec(pScrn); 1175 1193 … … 1182 1200 #ifdef VBOX_DRI 1183 1201 if (pVBox->useDRI) 1184 DRILock( screenInfo.screens[scrnIndex], 0);1202 DRILock(xf86ScrnToScreen(pScrn), 0); 1185 1203 #endif 1186 1204 TRACE_EXIT(); 1187 1205 } 1188 1206 1189 static Bool 1190 VBOXCloseScreen(int scrnIndex, ScreenPtr pScreen) 1191 { 1192 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 1207 static Bool VBOXCloseScreen(ScreenPtr pScreen) 1208 { 1209 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); 1193 1210 VBOXPtr pVBox = VBOXGetRec(pScrn); 1194 1211 … … 1208 1225 1209 1226 if (pScrn->vtSema) { 1210 VBOXRestoreMode( xf86Screens[scrnIndex]);1227 VBOXRestoreMode(pScrn); 1211 1228 VBOXUnmapVidMem(pScrn); 1212 1229 } … … 1217 1234 1218 1235 pScreen->CloseScreen = pVBox->CloseScreen; 1219 return pScreen->CloseScreen(scrnIndex, pScreen); 1220 } 1221 1222 static Bool 1223 VBOXSwitchMode(int scrnIndex, DisplayModePtr pMode, int flags) 1224 { 1225 ScrnInfoPtr pScrn; 1236 #ifndef XF86_SCRN_INTERFACE 1237 return pScreen->CloseScreen(pScreen->myNum, pScreen); 1238 #else 1239 return pScreen->CloseScreen(pScreen); 1240 #endif 1241 } 1242 1243 static Bool VBOXSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) 1244 { 1226 1245 VBOXPtr pVBox; 1227 1246 Bool rc; 1228 1247 1229 1248 TRACE_LOG("HDisplay=%d, VDisplay=%d\n", pMode->HDisplay, pMode->VDisplay); 1230 pScrn = xf86Screens[scrnIndex]; /* Why does X have three ways of referring to the screen? */1231 1249 #ifndef VBOXVIDEO_13 1232 1250 pVBox = VBOXGetRec(pScrn); … … 1264 1282 } 1265 1283 1266 static void 1267 VBOXAdjustFrame(int scrnIndex, int x, int y, int flags) 1268 { 1269 VBOXPtr pVBox = VBOXGetRec(xf86Screens[scrnIndex]); 1270 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 1284 static void VBOXAdjustFrame(ScrnInfoPtr pScrn, int x, int y) 1285 { 1286 VBOXPtr pVBox = VBOXGetRec(pScrn); 1271 1287 1272 1288 TRACE_ENTRY(); … … 1286 1302 } 1287 1303 1288 static void 1289 VBOXFreeScreen(int scrnIndex, int flags) 1290 { 1291 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 1292 1304 static void VBOXFreeScreen(ScrnInfoPtr pScrn) 1305 { 1293 1306 /* Destroy the VGA hardware record */ 1294 1307 vgaHWFreeHWRec(pScrn);
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器