Changeset 60115 in vbox for trunk/src/VBox/Additions/x11
- Timestamp:
- Mar 21, 2016 11:26:27 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c
r60083 r60115 1011 1011 #endif 1012 1012 1013 #ifdef VBOXVIDEO_13 1014 1015 static void setVirtualSizeRandR12(ScrnInfoPtr pScrn, bool fScreenInitTime) 1016 { 1017 VBOXPtr pVBox = VBOXGetRec(pScrn); 1018 unsigned i; 1019 unsigned cx = 0; 1020 unsigned cy = 0; 1021 1022 for (i = 0; i < pVBox->cScreens; ++i) 1023 { 1024 if ( pVBox->fHaveHGSMIModeHints && pVBox->pScreens[i].afHaveLocation) 1025 { 1026 pVBox->pScreens[i].paCrtcs->x = pVBox->pScreens[i].aPreferredLocation.x; 1027 pVBox->pScreens[i].paCrtcs->y = pVBox->pScreens[i].aPreferredLocation.y; 1028 } 1029 if ( pVBox->pScreens[i].paOutputs->status == XF86OutputStatusConnected 1030 && pVBox->pScreens[i].paCrtcs->x + pVBox->pScreens[i].aPreferredSize.cx < VBOX_VIDEO_MAX_VIRTUAL 1031 && pVBox->pScreens[i].paCrtcs->y + pVBox->pScreens[i].aPreferredSize.cy < VBOX_VIDEO_MAX_VIRTUAL) 1032 { 1033 cx = max(cx, pVBox->pScreens[i].paCrtcs->x + pVBox->pScreens[i].aPreferredSize.cx); 1034 cy = max(cy, pVBox->pScreens[i].paCrtcs->y + pVBox->pScreens[i].aPreferredSize.cy); 1035 } 1036 } 1037 if (cx != 0 && cy != 0) 1038 { 1039 /* Do not set the virtual resolution in limited context as that can 1040 * cause problems setting up RandR 1.2 which needs it set to the 1041 * maximum size at this point. */ 1042 if (!fScreenInitTime) 1043 { 1044 TRACE_LOG("cx=%u, cy=%u\n", cx, cy); 1045 xf86ScrnToScreen(pScrn)->width = cx; 1046 xf86ScrnToScreen(pScrn)->height = cy; 1047 xf86ScrnToScreen(pScrn)->mmWidth = cx * 254 / 960; 1048 xf86ScrnToScreen(pScrn)->mmHeight = cy * 254 / 960; 1049 adjustScreenPixmap(pScrn, cx, cy); 1050 vbvxSetSolarisMouseRange(cx, cy); 1051 } 1052 } 1053 } 1054 1055 static void setScreenSizesRandR12(ScrnInfoPtr pScrn, bool fScreenInitTime) 1056 { 1057 VBOXPtr pVBox = VBOXGetRec(pScrn); 1058 unsigned i; 1059 1060 for (i = 0; i < pVBox->cScreens; ++i) 1061 { 1062 if (!pVBox->pScreens[i].afConnected) 1063 continue; 1064 /* The Crtc can get "unset" if the screen was disconnected previously. 1065 * I couldn't find an API to re-set it which did not have side-effects. 1066 */ 1067 pVBox->pScreens[i].paOutputs->crtc = pVBox->pScreens[i].paCrtcs; 1068 xf86CrtcSetMode(pVBox->pScreens[i].paCrtcs, pVBox->pScreens[i].paOutputs->probed_modes, RR_Rotate_0, 1069 pVBox->pScreens[i].paCrtcs->x, pVBox->pScreens[i].paCrtcs->y); 1070 if (!fScreenInitTime) 1071 RRCrtcNotify(pVBox->pScreens[i].paCrtcs->randr_crtc, pVBox->pScreens[i].paOutputs->randr_output->modes[0], 1072 pVBox->pScreens[i].paCrtcs->x, pVBox->pScreens[i].paCrtcs->y, RR_Rotate_0, 1073 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5 1074 NULL, 1075 #endif 1076 1, &pVBox->pScreens[i].paOutputs->randr_output); 1077 } 1078 } 1079 1080 static void setSizesRandR12(ScrnInfoPtr pScrn, bool fScreenInitTime) 1081 { 1082 VBOXPtr pVBox = VBOXGetRec(pScrn); 1083 1084 if (!fScreenInitTime) 1085 { 1086 # if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5 1087 RRGetInfo(xf86ScrnToScreen(pScrn), TRUE); 1088 # else 1089 RRGetInfo(xf86ScrnToScreen(pScrn)); 1090 # endif 1091 } 1092 setVirtualSizeRandR12(pScrn, fScreenInitTime); 1093 setScreenSizesRandR12(pScrn, fScreenInitTime); 1094 if (!fScreenInitTime) 1095 { 1096 /* We use RRScreenSizeSet() here and not RRScreenSizeNotify() because 1097 * the first also pushes the virtual screen size to the input driver. 1098 * We were doing this manually by setting screenInfo.width and height 1099 * and calling xf86UpdateDesktopDimensions() where appropriate, but this 1100 * failed on Ubuntu 12.04.0 due to a problematic X server back-port. */ 1101 RRScreenSizeSet(xf86ScrnToScreen(pScrn), xf86ScrnToScreen(pScrn)->width, xf86ScrnToScreen(pScrn)->height, 1102 xf86ScrnToScreen(pScrn)->mmWidth, xf86ScrnToScreen(pScrn)->mmHeight); 1103 RRTellChanged(xf86ScrnToScreen(pScrn)); 1104 } 1105 } 1106 1107 #else 1013 #ifndef VBOXVIDEO_13 1108 1014 1109 1015 #define PREFERRED_MODE_ATOM_NAME "VBOXVIDEO_PREFERRED_MODE" … … 1132 1038 TRACE_LOG("fScreenInitTime=%d\n", (int)fScreenInitTime); 1133 1039 #ifdef VBOXVIDEO_13 1134 setSizesRandR12(pScrn, fScreenInitTime); 1040 # if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5 1041 RRGetInfo(xf86ScrnToScreen(pScrn), TRUE); 1042 # else 1043 RRGetInfo(xf86ScrnToScreen(pScrn)); 1044 # endif 1135 1045 #else 1136 1046 setSizesRandR11(pScrn); … … 1247 1157 return FALSE; 1248 1158 VBoxInitialiseSizeHints(pScrn); 1249 /* Get any screen size hints from HGSMI. */1250 vbvxReadSizesAndCursorIntegrationFromHGSMI(pScrn, NULL);1251 1159 1252 1160 #ifdef VBOXVIDEO_13 … … 1305 1213 1306 1214 /* set first video mode */ 1307 setSizesAndCursorIntegration(pScrn, true); 1215 if (!xf86SetDesiredModes(pScrn)) { 1216 return FALSE; 1217 } 1308 1218 #else 1309 1219 /* set first video mode */ … … 1369 1279 /* Re-set video mode */ 1370 1280 #ifdef VBOXVIDEO_13 1371 vbvxReadSizesAndCursorIntegrationFromHGSMI(pScrn, NULL); 1372 setSizesAndCursorIntegration(pScrn, false); 1281 if (!xf86SetDesiredModes(pScrn)) { 1282 return FALSE; 1283 } 1373 1284 #else 1374 1285 updateGraphicsCapability(pScrn, TRUE);
Note:
See TracChangeset
for help on using the changeset viewer.