vbox的更動 49628 路徑 trunk/src/VBox
- 時間撮記:
- 2013-11-22 下午03:17:39 (11 年 以前)
- 位置:
- trunk/src/VBox/Additions/x11/vboxvideo
- 檔案:
-
- 修改 4 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Additions/x11/vboxvideo/undefined
r49477 r49628 30 30 drmFreeVersion 31 31 drmGetVersion 32 drmIoctl 32 33 fbPictureInit 33 34 fbScreenInit -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c
r49187 r49628 76 76 77 77 #include "vboxvideo.h" 78 #include <VBox/VBoxGuest.h> 78 79 #include "version-generated.h" 79 80 #include "product-generated.h" … … 101 102 # include "xf86Modes.h" 102 103 # include <X11/Xatom.h> 104 #endif 105 106 #ifdef VBOX_DRI 107 # include "xf86drm.h" 103 108 #endif 104 109 … … 1014 1019 #ifdef VBOX_DRI 1015 1020 pVBox->useDRI = VBOXDRIScreenInit(pScrn, pScreen, pVBox); 1021 # ifndef VBOX_DRI_OLD /* DRI2 */ 1022 if (pVBox->drmFD >= 0) 1023 /* Tell the kernel driver, if present, that we are taking over. */ 1024 drmIoctl(pVBox->drmFD, VBOXVIDEO_IOCTL_DISABLE_HGSMI, NULL); 1025 # endif 1016 1026 #endif 1017 1027 … … 1179 1189 TRACE_ENTRY(); 1180 1190 vboxClearVRAM(pScrn, 0, 0); 1181 if (pVBox->fHaveHGSMI)1182 vboxEnableVbva(pScrn);1183 1191 #ifdef VBOX_DRI_OLD 1184 1192 if (pVBox->useDRI) 1185 1193 DRIUnlock(xf86ScrnToScreen(pScrn)); 1186 #endif 1194 #elif defined(VBOX_DRI) /* DRI2 */ 1195 if (pVBox->drmFD >= 0) 1196 /* Tell the kernel driver, if present, that we are taking over. */ 1197 drmIoctl(pVBox->drmFD, VBOXVIDEO_IOCTL_DISABLE_HGSMI, NULL); 1198 #endif 1199 if (pVBox->fHaveHGSMI) 1200 vboxEnableVbva(pScrn); 1187 1201 /* Re-assert this in case we had a change request while switched out. */ 1188 1202 if (pVBox->FBSize.cx && pVBox->FBSize.cy) … … 1208 1222 vboxDisableVbva(pScrn); 1209 1223 vboxClearVRAM(pScrn, 0, 0); 1210 VBOXRestoreMode(pScrn);1211 1224 vboxDisableGraphicsCap(pVBox); 1212 1225 #ifdef VBOX_DRI_OLD 1213 1226 if (pVBox->useDRI) 1214 1227 DRILock(xf86ScrnToScreen(pScrn), 0); 1215 #endif 1228 #elif defined(VBOX_DRI) /* DRI2 */ 1229 if (pVBox->drmFD >= 0) 1230 /* Tell the kernel driver, if present, that it can use the framebuffer 1231 * driver again. */ 1232 drmIoctl(pVBox->drmFD, VBOXVIDEO_IOCTL_ENABLE_HGSMI, NULL); 1233 else 1234 #endif 1235 VBOXRestoreMode(pScrn); 1216 1236 TRACE_EXIT(); 1217 1237 } … … 1231 1251 } 1232 1252 #ifdef VBOX_DRI 1253 # ifndef VBOX_DRI_OLD /* DRI2 */ 1254 if (pVBox->drmFD >= 0) 1255 /* Tell the kernel driver, if present, that we are going away. */ 1256 drmIoctl(pVBox->drmFD, VBOXVIDEO_IOCTL_ENABLE_HGSMI, NULL); 1257 # endif 1233 1258 if (pVBox->useDRI) 1234 1259 VBOXDRICloseScreen(pScreen, pVBox); -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h
r49187 r49628 57 57 58 58 #ifdef DEBUG 59 60 #include <xf86.h> 59 61 60 62 #define TRACE_ENTRY() \ … … 196 198 __GLXvisualConfig *pVisualConfigs; 197 199 DRIInfoRec *pDRIInfo; 200 # endif 198 201 int drmFD; 199 # endif200 202 #endif 201 203 } VBOXRec, *VBOXPtr; -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_dri2.c
r49187 r49628 17 17 18 18 #include "vboxvideo.h" 19 #include <xf86drm.h> 19 20 #include <drm.h> 20 21 #include <dri2.h> 22 #include <fcntl.h> 23 #include <unistd.h> 21 24 22 25 static void VBOXDRICopyRegion(DrawablePtr pDraw, RegionPtr pRegion, … … 37 40 } 38 41 42 /* We need to pass a constant path string to the screen initialisation function. 43 * The format is hard-coded in "drmOpen" in libdrm, and libdrm contains a 44 * comment to say that open should be done manually in future and not using 45 * "drmOpen", so we will do it manually but also hard-coding the format. The 46 * maximum minor number (15) is also hard-coded. */ 47 #define PATH(minor) "/dev/dri/card" #minor 48 const char *devicePaths[] = 49 { 50 PATH(0), PATH(1), PATH(2), PATH(3), PATH(4), PATH(5), PATH(6), PATH(7), 51 PATH(8), PATH(9), PATH(10), PATH(11), PATH(12), PATH(13), PATH(14), PATH(15) 52 }; 53 #undef PATH 54 39 55 /** As long as we are using our fake DRI driver inside of Mesa, we only want 40 56 * to implement the minimum here to make Mesa load it. Notably we just set … … 43 59 { 44 60 DRI2InfoRec DRI2Info; 61 unsigned i; 45 62 46 63 memset(&DRI2Info, 0, sizeof(DRI2Info)); 64 for (i = 0; i < RT_ELEMENTS(devicePaths); ++i) 65 { 66 int fd = open(devicePaths[i], O_RDWR); 67 if (fd >= 0) 68 { 69 drmVersionPtr pVersion = drmGetVersion(fd); 70 if ( pVersion 71 && pVersion->name_len 72 && !strcmp(pVersion->name, VBOX_DRM_DRIVER_NAME)) 73 { 74 TRACE_LOG("Opened drm device %s\n", devicePaths[i]); 75 DRI2Info.deviceName = devicePaths[i]; 76 /* Keep the driver open and hope that the path won't change. */ 77 pVBox->drmFD = fd; 78 drmFreeVersion(pVersion); 79 break; 80 } 81 close(fd); 82 drmFreeVersion(pVersion); 83 } 84 } 85 if (!DRI2Info.deviceName) 86 return FALSE; 47 87 DRI2Info.version = 3; 48 88 DRI2Info.fd = -1; 49 89 DRI2Info.driverName = VBOX_DRI_DRIVER_NAME; 50 DRI2Info.deviceName = "/dev/dri/card0"; /** @todo: do this right. */51 90 DRI2Info.CopyRegion = VBOXDRICopyRegion; 52 91 DRI2Info.Wait = NULL; … … 56 95 } 57 96 58 void 59 VBOXDRICloseScreen(ScreenPtr pScreen, VBOXPtr pVBox) 97 void VBOXDRICloseScreen(ScreenPtr pScreen, VBOXPtr pVBox) 60 98 { 61 99 DRI2CloseScreen(pScreen); 100 if (pVBox->drmFD) 101 close(pVBox->drmFD); 62 102 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器