- Timestamp:
- Dec 14, 2012 10:27:28 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxGuestLib.h
r43462 r44130 478 478 * @{ */ 479 479 VBGLR3DECL(int) VbglR3GetDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay, bool fAck); 480 VBGLR3DECL(int) VbglR3GetDisplayChangeRequestEx(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, 481 uint32_t *piDisplay, uint32_t *pcOriginX, uint32_t *pcOriginY, 482 bool *pfEnabled, bool fAck); 480 483 VBGLR3DECL(bool) VbglR3HostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits); 481 484 VBGLR3DECL(int) VbglR3SaveVideoMode(const char *pszName, uint32_t cx, uint32_t cy, uint32_t cBits); -
trunk/include/VBox/VMMDev.h
r40310 r44130 171 171 VMMDevReq_SetGuestCapabilities = 56, 172 172 VMMDevReq_VideoModeSupported2 = 57, /* since version 3.2.0 */ 173 VMMDevReq_GetDisplayChangeRequestEx = 80, /* since version 4.2.4 */ 173 174 #ifdef VBOX_WITH_HGCM 174 175 VMMDevReq_HGCMConnect = 60, … … 1073 1074 1074 1075 /** 1076 * Display change request structure, version Extended. 1077 * 1078 * Used by VMMDevReq_GetDisplayChangeRequestEx. 1079 */ 1080 typedef struct 1081 { 1082 /** Header. */ 1083 VMMDevRequestHeader header; 1084 /** Horizontal pixel resolution (0 = do not change). */ 1085 uint32_t xres; 1086 /** Vertical pixel resolution (0 = do not change). */ 1087 uint32_t yres; 1088 /** Bits per pixel (0 = do not change). */ 1089 uint32_t bpp; 1090 /** Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates 1091 * that the request is a response to that event. 1092 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */ 1093 uint32_t eventAck; 1094 /** 0 for primary display, 1 for the first secondary, etc. */ 1095 uint32_t display; 1096 /** New OriginX of secondary virtual screen */ 1097 uint32_t cxOrigin; 1098 /** New OriginY of secondary virtual screen */ 1099 uint32_t cyOrigin; 1100 /** Change in origin of the secondary virtaul scree is 1101 * required */ 1102 bool fChangeOrigin; 1103 /** secondary virtual screen enabled or disabled */ 1104 bool fEnabled; 1105 } VMMDevDisplayChangeRequestEx; 1106 AssertCompileSize(VMMDevDisplayChangeRequestEx, 24+32); 1107 1108 1109 /** 1075 1110 * Video mode supported request structure. 1076 1111 * … … 1840 1875 case VMMDevReq_GetDisplayChangeRequest2: 1841 1876 return sizeof(VMMDevDisplayChangeRequest2); 1877 case VMMDevReq_GetDisplayChangeRequestEx: 1878 return sizeof(VMMDevDisplayChangeRequestEx); 1842 1879 case VMMDevReq_VideoModeSupported: 1843 1880 return sizeof(VMMDevVideoModeSupportedRequest); -
trunk/include/VBox/vmm/pdmifs.h
r40637 r44130 2067 2067 * @param idxDisplay The display index. 2068 2068 */ 2069 DECLR3CALLBACKMEMBER(int, pfnRequestDisplayChange,(PPDMIVMMDEVPORT pInterface, uint32_t cx, uint32_t cy, uint32_t cBits, uint32_t idxDisplay)); 2069 DECLR3CALLBACKMEMBER(int, pfnRequestDisplayChange,(PPDMIVMMDEVPORT pInterface, uint32_t cx, 2070 uint32_t cy, uint32_t cBits, uint32_t idxDisplay, 2071 uint32_t cxOrigin, uint32_t cyOrigin, bool fEnable, bool fChangeOrigin)); 2070 2072 2071 2073 /** -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
r42366 r44130 1569 1569 case VMMDevReq_VideoAccelFlush: 1570 1570 case VMMDevReq_VideoSetVisibleRegion: 1571 case VMMDevReq_GetDisplayChangeRequestEx: 1571 1572 case VMMDevReq_GetSeamlessChangeRequest: 1572 1573 case VMMDevReq_GetVRDPChangeRequest: -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibVideo.cpp
r33540 r44130 140 140 return rc; 141 141 } 142 143 144 142 /** 145 143 * Query the last display change request sent from the host to the guest. … … 160 158 * last request to be acknowledged. 161 159 * 160 * @param pcOriginX New horizontal position of the secondary monitor. 161 * @param pcOriginY New vertical position of the secondary monitor. 162 * param pfEnabled Secondary monitor is enabled or not. 163 * 164 */ 165 VBGLR3DECL(int) VbglR3GetDisplayChangeRequestEx(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, 166 uint32_t *piDisplay, uint32_t *pcOriginX, uint32_t *pcOriginY, 167 bool *pfEnabled, bool fAck) 168 { 169 VMMDevDisplayChangeRequestEx Req; 170 int rc = VINF_SUCCESS; 171 AssertPtrReturn(pcx, VERR_INVALID_PARAMETER); 172 AssertPtrReturn(pcy, VERR_INVALID_PARAMETER); 173 AssertPtrReturn(pcBits, VERR_INVALID_PARAMETER); 174 AssertPtrReturn(pcOriginX, VERR_INVALID_PARAMETER); 175 AssertPtrReturn(pcOriginY, VERR_INVALID_PARAMETER); 176 AssertPtrReturn(piDisplay, VERR_INVALID_PARAMETER); 177 AssertPtrReturn(pfEnabled, VERR_INVALID_PARAMETER); 178 RT_ZERO(Req); 179 rc = vmmdevInitRequest(&Req.header, VMMDevReq_GetDisplayChangeRequestEx); 180 if (RT_FAILURE(rc)) 181 { 182 LogRelFlowFunc(("DisplayChangeRequest Extended not supported. Can't Init the Req.\n")); 183 return rc; 184 } 185 186 if (fAck) 187 Req.eventAck = VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST; 188 rc = vbglR3GRPerform(&Req.header); 189 if (RT_SUCCESS(rc)) 190 rc = Req.header.rc; 191 if (RT_SUCCESS(rc)) 192 { 193 *pcx = Req.xres; 194 *pcy = Req.yres; 195 *pcBits = Req.bpp; 196 *piDisplay = Req.display; 197 *pcOriginX = Req.cxOrigin; 198 *pcOriginY = Req.cyOrigin; 199 *pfEnabled = Req.fEnabled; 200 LogRel(("VbglR3GetDisplayChangeRequestEx: pcx=%d pcy=%d display=%d orgX=%d orgY=%d and Enabled=%d\n", 201 *pcx, *pcy, *piDisplay, *pcOriginX, *pcOriginY, *pfEnabled)); 202 } 203 return rc; 204 } 205 206 207 /** 208 * Query the last display change request sent from the host to the guest. 209 * 210 * @returns iprt status value 211 * @param pcx Where to store the horizontal pixel resolution 212 * @param pcy Where to store the vertical pixel resolution 213 * requested (a value of zero means do not change). 214 * @param pcBits Where to store the bits per pixel requested (a value 215 * of zero means do not change). 216 * @param iDisplay Where to store the display number the request was for 217 * - 0 for the primary display, 1 for the first 218 * secondary display, etc. 219 * @param fAck whether or not to acknowledge the newest request sent by 220 * the host. If this is set, the function will return the 221 * most recent host request, otherwise it will return the 222 * last request to be acknowledged. 223 * 162 224 */ 163 225 VBGLR3DECL(int) VbglR3GetDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay, bool fAck) -
trunk/src/VBox/Additions/x11/VBoxClient/display.cpp
r41207 r44130 158 158 Cursor hArrowCursor = XCreateFontCursor(pDisplay, XC_left_ptr); 159 159 int RRMaj, RRMin; 160 bool fExtDispReqSupport = true; 160 161 if (!XRRQueryVersion(pDisplay, &RRMaj, &RRMin)) 161 162 RRMin = 0; … … 169 170 while (true) 170 171 { 171 uint32_t fEvents = 0, cx = 0, cy = 0, cBits = 0, iDisplay = 0; 172 uint32_t fEvents = 0, cx = 0, cy = 0, cBits = 0, iDisplay = 0, cxOrg = 0, cyOrg = 0; 173 bool fEnabled = false; 172 174 rc = VbglR3WaitEvent( VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST 173 175 | VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED, … … 190 192 if (RT_SUCCESS(rc) && (fEvents & VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST)) 191 193 { 192 int rc2 = VbglR3GetDisplayChangeRequest(&cx, &cy, &cBits, 193 &iDisplay, true); 194 int rc2 = VbglR3GetDisplayChangeRequestEx(&cx, &cy, &cBits, 195 &iDisplay, &cxOrg, &cyOrg, &fEnabled, true); 196 /* Extended display version not supported on host */ 197 if (RT_FAILURE(rc2)) 198 { 199 LogRel(("GetDisplayChangeReq Extended Version not supported. \ 200 Trying for Normal Mode with cx=%d & cy=%d\n", cx, cy)); 201 fExtDispReqSupport = false; 202 rc2 = VbglR3GetDisplayChangeRequest(&cx, &cy, &cBits, &iDisplay, true); 203 } 204 else 205 LogRelFlowFunc(("Got Extended Param from Host cx=%d, cy=%d, bpp=%d, iDisp=%d, \ 206 OrgX=%d, OrgY=%d Enb=%d\n", cx, cy, cBits, iDisplay, 207 cxOrg, cyOrg, fEnabled)); 194 208 /* If we are not stopping, sleep for a bit to avoid using up 195 209 too much CPU while retrying. */ … … 202 216 { 203 217 char szCommand[256]; 204 RTStrPrintf(szCommand, sizeof(szCommand), 205 "%s --output VBOX%u --set VBOX_MODE %dx%d", 206 pcszXrandr, iDisplay, cx, cy); 207 system(szCommand); 208 RTStrPrintf(szCommand, sizeof(szCommand), 209 "%s --output VBOX%u --preferred", 210 pcszXrandr, iDisplay); 211 system(szCommand); 218 if (fExtDispReqSupport) 219 { 220 if (fEnabled) 221 { 222 if (cx != 0 && cy != 0) 223 { 224 RTStrPrintf(szCommand, sizeof(szCommand), 225 "%s --output VBOX%u --set VBOX_MODE %dx%d", 226 pcszXrandr, iDisplay, cx, cy); 227 system(szCommand); 228 } 229 /* Extended Display support possible . Secondary monitor position supported */ 230 if (cxOrg != 0 || cyOrg != 0) 231 { 232 RTStrPrintf(szCommand, sizeof(szCommand), 233 "%s --output VBOX%u --auto --pos %dx%d", 234 pcszXrandr, iDisplay, cxOrg, cyOrg); 235 system(szCommand); 236 } 237 RTStrPrintf(szCommand, sizeof(szCommand), 238 "%s --output VBOX%u --preferred", 239 pcszXrandr, iDisplay); 240 system(szCommand); 241 } 242 else /* disable the virtual monitor */ 243 { 244 RTStrPrintf(szCommand, sizeof(szCommand), 245 "%s --output VBOX%u --off", 246 pcszXrandr, iDisplay); 247 system(szCommand); 248 } 249 } 250 else /* Extended display support not possible */ 251 { 252 if (cx != 0 && cy != 0) 253 { 254 RTStrPrintf(szCommand, sizeof(szCommand), 255 "%s --output VBOX%u --set VBOX_MODE %dx%d", 256 pcszXrandr, iDisplay, cx, cy); 257 system(szCommand); 258 RTStrPrintf(szCommand, sizeof(szCommand), 259 "%s --output VBOX%u --preferred", 260 pcszXrandr, iDisplay); 261 system(szCommand); 262 } 263 } 264 212 265 } 213 266 } 214 267 } 215 LogRelFlowFunc(("returning VINF_SUCCESS\n"));216 268 return VINF_SUCCESS; 217 269 } -
trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
r43876 r44130 1525 1525 1526 1526 /* 1527 * Retrieve a display resize request sent by the host using 1528 * @a IDisplay:setVideoModeHint. 1529 * See documentation in VMMDev.h. 1530 */ 1531 case VMMDevReq_GetDisplayChangeRequestEx: 1532 { 1533 LogFlowFunc(("VMMDevReq_GetDisplayChangeRequestEx\n")); 1534 if (pRequestHeader->size != sizeof(VMMDevDisplayChangeRequestEx)) 1535 { 1536 pRequestHeader->rc = VERR_INVALID_PARAMETER; 1537 } 1538 else 1539 { 1540 VMMDevDisplayChangeRequestEx *displayChangeRequest = (VMMDevDisplayChangeRequestEx*)pRequestHeader; 1541 1542 DISPLAYCHANGEREQUEST *pRequest = NULL; 1543 1544 if (displayChangeRequest->eventAck == VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST) 1545 { 1546 /* Select a pending request to report. */ 1547 unsigned i; 1548 for (i = 0; i < RT_ELEMENTS(pThis->displayChangeData.aRequests); i++) 1549 { 1550 if (pThis->displayChangeData.aRequests[i].fPending) 1551 { 1552 pRequest = &pThis->displayChangeData.aRequests[i]; 1553 /* Remember which request should be reported. */ 1554 pThis->displayChangeData.iCurrentMonitor = i; 1555 Log3(("VMMDev: will report pending request for %d\n", 1556 i)); 1557 break; 1558 } 1559 } 1560 1561 /* Check if there are more pending requests. */ 1562 i++; 1563 for (; i < RT_ELEMENTS(pThis->displayChangeData.aRequests); i++) 1564 { 1565 if (pThis->displayChangeData.aRequests[i].fPending) 1566 { 1567 VMMDevNotifyGuest (pThis, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST); 1568 Log3(("VMMDev: another pending at %d\n", 1569 i)); 1570 break; 1571 } 1572 } 1573 1574 if (pRequest) 1575 { 1576 /* Current request has been read at least once. */ 1577 pRequest->fPending = false; 1578 1579 /* Remember which resolution the client has queried, subsequent reads 1580 * will return the same values. */ 1581 pRequest->lastReadDisplayChangeRequest = pRequest->displayChangeRequest; 1582 pThis->displayChangeData.fGuestSentChangeEventAck = true; 1583 } 1584 else 1585 { 1586 Log3(("VMMDev: no pending request!!!\n")); 1587 } 1588 } 1589 1590 if (!pRequest) 1591 { 1592 Log3(("VMMDev: default to %d\n", 1593 pThis->displayChangeData.iCurrentMonitor)); 1594 pRequest = &pThis->displayChangeData.aRequests[pThis->displayChangeData.iCurrentMonitor]; 1595 } 1596 1597 if (pThis->displayChangeData.fGuestSentChangeEventAck) 1598 { 1599 displayChangeRequest->xres = pRequest->lastReadDisplayChangeRequest.xres; 1600 displayChangeRequest->yres = pRequest->lastReadDisplayChangeRequest.yres; 1601 displayChangeRequest->bpp = pRequest->lastReadDisplayChangeRequest.bpp; 1602 displayChangeRequest->display = pRequest->lastReadDisplayChangeRequest.display; 1603 displayChangeRequest->cxOrigin = pRequest->lastReadDisplayChangeRequest.xOrigin; 1604 displayChangeRequest->cyOrigin = pRequest->lastReadDisplayChangeRequest.yOrigin; 1605 displayChangeRequest->fEnabled = pRequest->lastReadDisplayChangeRequest.fEnabled; 1606 displayChangeRequest->fChangeOrigin = pRequest->lastReadDisplayChangeRequest.fChangeOrigin; 1607 } 1608 else 1609 { 1610 /* This is not a response to a VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST, just 1611 * read the last valid video mode hint. This happens when the guest X server 1612 * determines the initial video mode. */ 1613 displayChangeRequest->xres = pRequest->displayChangeRequest.xres; 1614 displayChangeRequest->yres = pRequest->displayChangeRequest.yres; 1615 displayChangeRequest->bpp = pRequest->displayChangeRequest.bpp; 1616 displayChangeRequest->display = pRequest->displayChangeRequest.display; 1617 displayChangeRequest->cxOrigin = pRequest->displayChangeRequest.xOrigin; 1618 displayChangeRequest->cyOrigin = pRequest->displayChangeRequest.yOrigin; 1619 displayChangeRequest->fEnabled = pRequest->displayChangeRequest.fEnabled; 1620 displayChangeRequest->fChangeOrigin = pRequest->displayChangeRequest.fChangeOrigin; 1621 1622 } 1623 Log(("VMMDevEx: returning display change request xres = %d, yres = %d, bpp = %d id %d \ 1624 xPos = %d, yPos = %d & Enabled=%d\n", 1625 displayChangeRequest->xres, displayChangeRequest->yres, 1626 displayChangeRequest->bpp, displayChangeRequest->display, 1627 displayChangeRequest->cxOrigin, displayChangeRequest->cyOrigin, 1628 displayChangeRequest->fEnabled)); 1629 1630 pRequestHeader->rc = VINF_SUCCESS; 1631 } 1632 break; 1633 } 1634 1635 1636 /* 1527 1637 * Query whether the given video mode is supported 1528 1638 */ … … 2604 2714 2605 2715 2606 static DECLCALLBACK(int) vmmdevRequestDisplayChange(PPDMIVMMDEVPORT pInterface, uint32_t xres, uint32_t yres, uint32_t bpp, uint32_t display) 2716 static DECLCALLBACK(int) vmmdevRequestDisplayChange(PPDMIVMMDEVPORT pInterface, uint32_t xres, uint32_t yres, 2717 uint32_t bpp, uint32_t display, uint32_t u32OriginX, 2718 uint32_t u32OriginY, bool fEnabled, bool fChangeOrigin) 2607 2719 { 2608 2720 VMMDevState *pThis = IVMMDEVPORT_2_VMMDEVSTATE(pInterface); … … 2621 2733 (!yres || (pRequest->lastReadDisplayChangeRequest.yres == yres)) && 2622 2734 (!bpp || (pRequest->lastReadDisplayChangeRequest.bpp == bpp)) && 2735 (pRequest->lastReadDisplayChangeRequest.xOrigin == u32OriginX) && 2736 (pRequest->lastReadDisplayChangeRequest.yOrigin == u32OriginY) && 2737 (pRequest->lastReadDisplayChangeRequest.fEnabled == fEnabled) && 2623 2738 pRequest->lastReadDisplayChangeRequest.display == display; 2624 2739 … … 2629 2744 } 2630 2745 2631 Log3(("vmmdevRequestDisplayChange: same=%d. new: xres=%d, yres=%d, bpp=%d, display=%d. old: xres=%d, yres=%d, bpp=%d, display=%d.\n", 2632 fSameResolution, xres, yres, bpp, display, pRequest->lastReadDisplayChangeRequest.xres, pRequest->lastReadDisplayChangeRequest.yres, pRequest->lastReadDisplayChangeRequest.bpp, pRequest->lastReadDisplayChangeRequest.display)); 2746 Log3(("vmmdevRequestDisplayChange: same=%d. new: xres=%d, yres=%d, bpp=%d, display=%d.\ 2747 old: xres=%d, yres=%d, bpp=%d, display=%d. \n \ 2748 ,OriginX = %d , OriginY=%d, Enabled=%d, ChangeOrigin=%d\n", 2749 fSameResolution, xres, yres, bpp, display, pRequest->lastReadDisplayChangeRequest.xres, 2750 pRequest->lastReadDisplayChangeRequest.yres, pRequest->lastReadDisplayChangeRequest.bpp, 2751 pRequest->lastReadDisplayChangeRequest.display, 2752 u32OriginX, u32OriginY, fEnabled, fChangeOrigin)); 2633 2753 2634 2754 if (!fSameResolution) … … 2638 2758 2639 2759 /* we could validate the information here but hey, the guest can do that as well! */ 2640 pRequest->displayChangeRequest.xres = xres; 2641 pRequest->displayChangeRequest.yres = yres; 2642 pRequest->displayChangeRequest.bpp = bpp; 2643 pRequest->displayChangeRequest.display = display; 2760 pRequest->displayChangeRequest.xres = xres; 2761 pRequest->displayChangeRequest.yres = yres; 2762 pRequest->displayChangeRequest.bpp = bpp; 2763 pRequest->displayChangeRequest.display = display; 2764 pRequest->displayChangeRequest.xOrigin = u32OriginX; 2765 pRequest->displayChangeRequest.yOrigin = u32OriginY; 2766 pRequest->displayChangeRequest.fEnabled = fEnabled; 2767 pRequest->displayChangeRequest.fChangeOrigin = fChangeOrigin; 2768 2644 2769 pRequest->fPending = true; 2645 2770 -
trunk/src/VBox/Devices/VMMDev/VMMDevState.h
r39890 r44130 31 31 uint32_t bpp; 32 32 uint32_t display; 33 uint32_t xOrigin; 34 uint32_t yOrigin; 35 bool fEnabled; 36 bool fChangeOrigin; 33 37 } DISPLAYCHANGEINFO; 34 38 -
trunk/src/VBox/Frontends/VBoxBFE/DisplayImpl.cpp
r42248 r44130 832 832 { 833 833 PPDMIVMMDEVPORT pVMMDevPort = gVMMDev->getVMMDevPort (); 834 NOREF(aEnabled);835 NOREF(aChangeOrigin);836 NOREF(aOriginX);837 NOREF(aOriginY);838 834 839 835 if (pVMMDevPort) 840 pVMMDevPort->pfnRequestDisplayChange(pVMMDevPort, aWidth, aHeight, aBitsPerPixel, aDisplay); 836 pVMMDevPort->pfnRequestDisplayChange(pVMMDevPort, aWidth, aHeight, aBitsPerPixel, 837 aDisplay, aOriginX, aOriginY, aEnabled, aChangeOrigin); 841 838 } 842 839 -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r43934 r44130 2172 2172 CHECK_CONSOLE_DRV (mpDrv); 2173 2173 2174 /* XXX Ignore these parameters for now: */2175 NOREF(aChangeOrigin);2176 NOREF(aOriginX);2177 NOREF(aOriginY);2178 NOREF(aEnabled);2179 2180 2174 /* 2181 2175 * Do some rough checks for valid input … … 2216 2210 PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort(); 2217 2211 if (pVMMDevPort) 2218 pVMMDevPort->pfnRequestDisplayChange(pVMMDevPort, aWidth, aHeight, aBitsPerPixel, aDisplay); 2212 pVMMDevPort->pfnRequestDisplayChange(pVMMDevPort, aWidth, aHeight, aBitsPerPixel, 2213 aDisplay, aOriginX, aOriginY, aEnabled, aChangeOrigin); 2219 2214 } 2220 2215 return S_OK;
Note:
See TracChangeset
for help on using the changeset viewer.