Changeset 55332 in vbox for trunk/src/VBox
- Timestamp:
- Apr 17, 2015 3:17:58 PM (10 years ago)
- Location:
- trunk/src/VBox/Additions/x11
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/undefined_xorg
r55262 r55332 107 107 rename 108 108 RRChangeOutputProperty 109 RRCrtcNotify 109 110 RRGetInfo 111 RRScreenSizeNotify 112 RRTellChanged 110 113 setenv 111 114 ShadowFBInit2 … … 157 160 xf86CrtcCreate 158 161 xf86CrtcScreenInit 162 xf86CrtcSetMode 159 163 xf86CrtcSetSizeRange 160 164 xf86DestroyCursorInfoRec … … 174 178 xf86SetModeDefaultName 175 179 xf86SetSingleMode 180 xf86UpdateDesktopDimensions 176 181 __xstat64 -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c
r55283 r55332 145 145 static void VBOXSaveMode(ScrnInfoPtr pScrn); 146 146 static void VBOXRestoreMode(ScrnInfoPtr pScrn); 147 static void setSizesAndCursorIntegration(ScrnInfoPtr pScrn, bool fScreenInitTime); 147 148 148 149 #ifndef XF86_SCRN_INTERFACE … … 310 311 } 311 312 313 /** Set a video mode to the hardware, RandR 1.1 version. Since we no longer do 314 * virtual frame buffers, adjust the screen pixmap dimensions to match. */ 315 static void setModeRandR11(ScrnInfoPtr pScrn, DisplayModePtr pMode, bool fLimitedContext) 316 { 317 VBOXPtr pVBox = VBOXGetRec(pScrn); 318 struct vbvxFrameBuffer frameBuffer = { 0, 0, pMode->HDisplay, pMode->VDisplay, pScrn->bitsPerPixel}; 319 320 pVBox->pScreens[0].aScreenLocation.cx = pMode->HDisplay; 321 pVBox->pScreens[0].aScreenLocation.cy = pMode->VDisplay; 322 if (fLimitedContext) 323 { 324 pScrn->displayWidth = pScrn->virtualX = pMode->HDisplay; 325 pScrn->virtualY = pMode->VDisplay; 326 } 327 else 328 adjustScreenPixmap(pScrn, pMode->HDisplay, pMode->VDisplay); 329 if (pMode->HDisplay != 0 && pMode->VDisplay != 0) 330 vbvxSetMode(pScrn, 0, pMode->HDisplay, pMode->VDisplay, 0, 0, true, true, &frameBuffer); 331 pScrn->currentMode = pMode; 332 } 333 312 334 #ifdef VBOXVIDEO_13 313 335 /* X.org 1.3+ mode-setting support ******************************************/ 336 337 /** Set a video mode to the hardware, RandR 1.2 version. If this is the first 338 * screen, re-set the current mode for all others (the offset for the first 339 * screen is always treated as zero by the hardware, so all other screens need 340 * to be changed to compensate for any changes!). The mode to set is taken 341 * from the X.Org Crtc structure. */ 342 static void setModeRandR12(ScrnInfoPtr pScrn, unsigned cScreen) 343 { 344 VBOXPtr pVBox = VBOXGetRec(pScrn); 345 unsigned i; 346 struct vbvxFrameBuffer frameBuffer = { pVBox->pScreens[0].paCrtcs->x, pVBox->pScreens[0].paCrtcs->y, pScrn->virtualX, 347 pScrn->virtualY, pScrn->bitsPerPixel }; 348 unsigned cFirst = cScreen; 349 unsigned cLast = cScreen != 0 ? cScreen + 1 : pVBox->cScreens; 350 351 for (i = cFirst; i < cLast; ++i) 352 if (pVBox->pScreens[i].paCrtcs->mode.HDisplay != 0 && pVBox->pScreens[i].paCrtcs->mode.VDisplay != 0) 353 vbvxSetMode(pScrn, i, pVBox->pScreens[i].paCrtcs->mode.HDisplay, pVBox->pScreens[i].paCrtcs->mode.VDisplay, 354 pVBox->pScreens[i].paCrtcs->x, pVBox->pScreens[i].paCrtcs->y, pVBox->pScreens[i].fPowerOn, 355 pVBox->pScreens[i].paOutputs->status == XF86OutputStatusConnected, &frameBuffer); 356 } 357 358 /** Wrapper around setModeRandR12() to avoid exposing non-obvious semantics. 359 */ 360 static void setAllModesRandR12(ScrnInfoPtr pScrn) 361 { 362 setModeRandR12(pScrn, 0); 363 } 314 364 315 365 /* For descriptions of these functions and structures, see … … 1021 1071 #endif /* SET_HAVE_VT_PROPERTY */ 1022 1072 1073 #ifdef VBOXVIDEO_13 1074 1075 static void setVirtualSizeRandR12(ScrnInfoPtr pScrn, bool fLimitedContext) 1076 { 1077 VBOXPtr pVBox = VBOXGetRec(pScrn); 1078 unsigned i; 1079 unsigned cx = 0; 1080 unsigned cy = 0; 1081 1082 for (i = 0; i < pVBox->cScreens; ++i) 1083 { 1084 if ( pVBox->fHaveHGSMIModeHints && pVBox->pScreens[i].afHaveLocation) 1085 { 1086 pVBox->pScreens[i].paCrtcs->x = pVBox->pScreens[i].aPreferredLocation.x; 1087 pVBox->pScreens[i].paCrtcs->y = pVBox->pScreens[i].aPreferredLocation.y; 1088 } 1089 if ( pVBox->pScreens[i].paOutputs->status == XF86OutputStatusConnected 1090 && pVBox->pScreens[i].paCrtcs->x + pVBox->pScreens[i].aPreferredSize.cx < VBOX_VIDEO_MAX_VIRTUAL 1091 && pVBox->pScreens[i].paCrtcs->y + pVBox->pScreens[i].aPreferredSize.cy < VBOX_VIDEO_MAX_VIRTUAL) 1092 { 1093 cx = max(cx, pVBox->pScreens[i].paCrtcs->x + pVBox->pScreens[i].aPreferredSize.cx); 1094 cy = max(cy, pVBox->pScreens[i].paCrtcs->y + pVBox->pScreens[i].aPreferredSize.cy); 1095 } 1096 } 1097 if (cx != 0 && cy != 0) 1098 { 1099 if (fLimitedContext) 1100 { 1101 pScrn->virtualX = cx; 1102 pScrn->virtualY = cy; 1103 } 1104 else 1105 { 1106 TRACE_LOG("cx=%u, cy=%u\n", cx, cy); 1107 xf86ScrnToScreen(pScrn)->width = cx; 1108 xf86ScrnToScreen(pScrn)->height = cy; 1109 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 14 1110 xf86UpdateDesktopDimensions(); 1111 #elif GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 12 1112 screenInfo.width = cx; 1113 screenInfo.height = cy; 1114 #endif 1115 adjustScreenPixmap(pScrn, cx, cy); 1116 } 1117 } 1118 } 1119 1120 static void setScreenSizesRandR12(ScrnInfoPtr pScrn, bool fLimitedContext) 1121 { 1122 VBOXPtr pVBox = VBOXGetRec(pScrn); 1123 unsigned i; 1124 1125 for (i = 0; i < pVBox->cScreens; ++i) 1126 { 1127 if (!pVBox->pScreens[i].afConnected) 1128 continue; 1129 /* The Crtc can get "unset" if the screen was disconnected previously. 1130 * I couldn't find an API to re-set it which did not have side-effects. 1131 */ 1132 pVBox->pScreens[i].paOutputs->crtc = pVBox->pScreens[i].paCrtcs; 1133 xf86CrtcSetMode(pVBox->pScreens[i].paCrtcs, pVBox->pScreens[i].paOutputs->probed_modes, RR_Rotate_0, 1134 pVBox->pScreens[i].paCrtcs->x, pVBox->pScreens[i].paCrtcs->y); 1135 if (!fLimitedContext) 1136 RRCrtcNotify(pVBox->pScreens[i].paCrtcs->randr_crtc, pVBox->pScreens[i].paOutputs->randr_output->modes[0], 1137 pVBox->pScreens[i].paCrtcs->x, pVBox->pScreens[i].paCrtcs->y, RR_Rotate_0, 1138 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5 1139 NULL, 1140 #endif 1141 1, &pVBox->pScreens[i].paOutputs->randr_output); 1142 } 1143 } 1144 1145 static void setSizesRandR12(ScrnInfoPtr pScrn, bool fLimitedContext) 1146 { 1147 VBOXPtr pVBox = VBOXGetRec(pScrn); 1148 1149 # if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5 1150 RRGetInfo(xf86ScrnToScreen(pScrn), TRUE); 1151 # else 1152 RRGetInfo(xf86ScrnToScreen(pScrn)); 1153 # endif 1154 setVirtualSizeRandR12(pScrn, fLimitedContext); 1155 setScreenSizesRandR12(pScrn, fLimitedContext); 1156 if (!fLimitedContext) 1157 { 1158 RRScreenSizeNotify(xf86ScrnToScreen(pScrn)); 1159 RRTellChanged(xf86ScrnToScreen(pScrn)); 1160 } 1161 } 1162 1163 #else 1164 1165 static void setSizesRandR11(ScrnInfoPtr pScrn, bool fLimitedContext) 1166 { 1167 VBOXPtr pVBox = VBOXGetRec(pScrn); 1168 DisplayModePtr pNewMode; 1169 1170 pNewMode = pScrn->modes != pScrn->currentMode ? pScrn->modes : pScrn->modes->next; 1171 pNewMode->HDisplay = RT_CLAMP(pVBox->pScreens[0].aPreferredSize.cx, VBOX_VIDEO_MIN_SIZE, VBOX_VIDEO_MAX_VIRTUAL); 1172 pNewMode->VDisplay = RT_CLAMP(pVBox->pScreens[0].aPreferredSize.cy, VBOX_VIDEO_MIN_SIZE, VBOX_VIDEO_MAX_VIRTUAL); 1173 setModeRandR11(pScrn, pNewMode, fLimitedContext); 1174 } 1175 1176 #endif 1177 1178 static void setSizesAndCursorIntegration(ScrnInfoPtr pScrn, bool fScreenInitTime) 1179 { 1180 VBOXPtr pVBox = VBOXGetRec(pScrn); 1181 1182 TRACE_LOG("fScreenInitTime=%d\n", (int)fScreenInitTime); 1183 #ifdef VBOXVIDEO_13 1184 setSizesRandR12(pScrn, fScreenInitTime); 1185 #else 1186 setSizesRandR11(pScrn, fScreenInitTime); 1187 #endif 1188 if (pScrn->vtSema) 1189 vbvxReprobeCursor(pScrn); 1190 } 1191 1192 /* We update the size hints from the X11 property set by VBoxClient every time 1193 * that the X server goes to sleep (to catch the property change request). 1194 * Although this is far more often than necessary it should not have real-life 1195 * performance consequences and allows us to simplify the code quite a bit. */ 1196 static void updateSizeHintsBlockHandler(pointer pData, OSTimePtr pTimeout, pointer pReadmask) 1197 { 1198 ScrnInfoPtr pScrn = (ScrnInfoPtr)pData; 1199 VBOXPtr pVBox = VBOXGetRec(pScrn); 1200 bool fNeedUpdate = false; 1201 1202 (void)pTimeout; 1203 (void)pReadmask; 1204 if (!pScrn->vtSema) 1205 return; 1206 vbvxReadSizesAndCursorIntegrationFromHGSMI(pScrn, &fNeedUpdate); 1207 if (ROOT_WINDOW(pScrn) != NULL) 1208 vbvxReadSizesAndCursorIntegrationFromProperties(pScrn, &fNeedUpdate); 1209 if (fNeedUpdate) 1210 setSizesAndCursorIntegration(pScrn, false); 1211 } 1212 1023 1213 /* 1024 1214 * QUOTE from the XFree86 DESIGN document: -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h
r55262 r55332 150 150 * sending dirty rectangle information to the right one. */ 151 151 RTRECT2 aScreenLocation; 152 /** Is this CRTC enabled or in DPMS off state? */ 153 Bool fPowerOn; 152 154 /** Is this CRTC enabled or in DPMS off state? */ 153 155 Bool fCrtcEnabled; … … 297 299 void VBoxCleanUpLinuxACPI(ScreenPtr pScreen); 298 300 #endif 301 extern void vbvxReadSizesAndCursorIntegrationFromProperties(ScrnInfoPtr pScrn, bool *pfNeedUpdate); 302 extern void vbvxReadSizesAndCursorIntegrationFromHGSMI(ScrnInfoPtr pScrn, bool *pfNeedUpdate); 299 303 300 304 /* DRI stuff */
Note:
See TracChangeset
for help on using the changeset viewer.