Changeset 51762 in vbox
- Timestamp:
- Jun 30, 2014 9:31:20 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 94576
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/DisplayImpl.h
r51627 r51762 335 335 void handleResizeCompletedEMT(unsigned uScreenId, BOOL fResizeContext); 336 336 337 /* Old guest additions (3.x?) use VMMDev for VBVA and the host VBVA code (VideoAccel*) 338 * can be executed concurrently by VGA refresh timer and the guest VMMDev request 339 * in SMP VMs. The lock serialized this. 340 */ 337 341 RTCRITSECT mVBVALock; 338 342 volatile uint32_t mfu32PendingVideoAccelDisable; … … 342 346 343 347 public: 348 bool vbvaLockIsOwner(void); 349 344 350 static int displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height); 345 351 … … 369 375 /* Functions run under VBVA lock. */ 370 376 int videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory); 371 voidvideoAccelFlush(void);377 int videoAccelFlush(void); 372 378 373 379 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r51724 r51762 399 399 400 400 /* This can be called from any thread. */ 401 Assert(!that->vbvaLockIsOwner()); 401 402 that->mpDrv->pUpPort->pfnFreeScreenshot(that->mpDrv->pUpPort, pu8Data); 402 403 } … … 917 918 if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN) 918 919 { 920 Assert(!vbvaLockIsOwner()); 919 921 mpDrv->pUpPort->pfnSetRenderVRAM(mpDrv->pUpPort, false); 920 922 … … 1160 1162 { 1161 1163 #endif /* VBOX_WITH_HGSMI */ 1162 /* When VBVA is enabled, the VRDP server is informed in the VideoAccelFlush. 1164 /* When VBVA is enabled, the VRDP server is informed 1165 * either in VideoAccelFlush or displayVBVAUpdateProcess. 1163 1166 * Inform the server here only if VBVA is disabled. 1164 1167 */ … … 1561 1564 } 1562 1565 1566 bool Display::vbvaLockIsOwner(void) 1567 { 1568 return RTCritSectIsOwner(&mVBVALock); 1569 } 1563 1570 1564 1571 /** … … 1568 1575 { 1569 1576 int rc; 1577 1578 if (fEnable) 1579 { 1580 /* Process any pending VGA device changes, resize. */ 1581 Assert(!vbvaLockIsOwner()); 1582 mpDrv->pUpPort->pfnUpdateDisplay(mpDrv->pUpPort); 1583 } 1584 1570 1585 vbvaLock(); 1571 1586 rc = videoAccelEnable (fEnable, pVbvaMemory); 1572 1587 vbvaUnlock(); 1588 1589 if (!fEnable) 1590 { 1591 Assert(!vbvaLockIsOwner()); 1592 mpDrv->pUpPort->pfnUpdateDisplay(mpDrv->pUpPort); 1593 } 1594 1573 1595 return rc; 1574 1596 } … … 1576 1598 int Display::videoAccelEnable (bool fEnable, VBVAMEMORY *pVbvaMemory) 1577 1599 { 1600 Assert(vbvaLockIsOwner()); 1601 1578 1602 int rc = VINF_SUCCESS; 1579 1603 … … 1633 1657 mfVideoAccelEnabled = false; 1634 1658 1635 /* Update entire display. */1636 mpDrv->pUpPort->pfnUpdateDisplayAll(mpDrv->pUpPort);1637 1638 1659 /* Everything OK. VBVA status can be changed. */ 1639 1660 … … 2014 2035 { 2015 2036 vbvaLock(); 2016 videoAccelFlush(); 2037 int rc = videoAccelFlush(); 2038 if (RT_FAILURE(rc)) 2039 { 2040 /* Disable on errors. */ 2041 videoAccelEnable(false, NULL); 2042 } 2017 2043 vbvaUnlock(); 2018 } 2019 2020 /* Under VBVA lock. DevVGA is not taken. */ 2021 void Display::videoAccelFlush (void) 2022 { 2044 2045 if (RT_FAILURE(rc)) 2046 { 2047 /* VideoAccel was disabled because of a failure, switching back to VGA updates. Redraw the screen. */ 2048 Assert(!vbvaLockIsOwner()); 2049 mpDrv->pUpPort->pfnUpdateDisplay(mpDrv->pUpPort); 2050 } 2051 } 2052 2053 int Display::videoAccelFlush (void) 2054 { 2055 Assert(vbvaLockIsOwner()); 2056 2023 2057 #ifdef DEBUG_sunlover_2 2024 2058 LogFlowFunc(("mfVideoAccelEnabled = %d\n", mfVideoAccelEnabled)); … … 2028 2062 { 2029 2063 Log(("Display::VideoAccelFlush: called with disabled VBVA!!! Ignoring.\n")); 2030 return ;2064 return VINF_SUCCESS; 2031 2065 } 2032 2066 … … 2043 2077 if (mpVbvaMemory->indexRecordFirst == mpVbvaMemory->indexRecordFree) 2044 2078 { 2045 return ;2079 return VINF_SUCCESS; 2046 2080 } 2047 2081 … … 2063 2097 Log(("Display::VideoAccelFlush: unable to fetch command. off32Data = %d, off32Free = %d. Disabling VBVA!!!\n", 2064 2098 mpVbvaMemory->off32Data, mpVbvaMemory->off32Free)); 2065 2066 /* Disable VBVA on those processing errors. */ 2067 videoAccelEnable (false, NULL); 2068 2069 break; 2099 return VERR_INVALID_STATE; 2070 2100 } 2071 2101 … … 2128 2158 vbvaRgnUpdateFramebuffer (&rgn, uScreenId); 2129 2159 } 2160 return VINF_SUCCESS; 2130 2161 } 2131 2162 … … 2143 2174 { 2144 2175 /* Acceleration was enabled while machine was not yet running 2145 * due to restoring from saved state. Update entire display and 2146 * actually enable acceleration. 2176 * due to restoring from saved state. Actually enable acceleration. 2147 2177 */ 2148 2178 Assert(mpPendingVbvaMemory); … … 2171 2201 { 2172 2202 Assert(mpVbvaMemory); 2173 videoAccelFlush (); 2174 2175 rc = VINF_SUCCESS; /* VBVA processed, no need to a display update. */ 2203 rc = videoAccelFlush(); 2204 if (RT_FAILURE(rc)) 2205 { 2206 /* Disable on errors. */ 2207 videoAccelEnable(false, NULL); 2208 rc = VWRN_INVALID_STATE; /* Do a display update in VGA device. */ 2209 } 2210 else 2211 { 2212 rc = VINF_SUCCESS; 2213 } 2176 2214 } 2177 2215 } … … 2235 2273 u32Width = mpDrv->IConnector.cx; 2236 2274 u32Height = mpDrv->IConnector.cy; 2275 2276 alock.release(); 2277 2278 Assert(!vbvaLockIsOwner()); 2237 2279 int rc = mpDrv->pUpPort->pfnQueryColorDepth(mpDrv->pUpPort, &u32BitsPerPixel); 2238 2280 AssertRC(rc); 2281 2282 alock.acquire(); 2239 2283 } 2240 2284 } … … 2405 2449 if (!bpp) 2406 2450 { 2451 alock.release(); 2452 2407 2453 uint32_t cBits = 0; 2454 Assert(!vbvaLockIsOwner()); 2408 2455 int rc = mpDrv->pUpPort->pfnQueryColorDepth(mpDrv->pUpPort, &cBits); 2409 2456 AssertRC(rc); 2410 2457 bpp = cBits; 2458 2459 alock.acquire(); 2411 2460 } 2412 2461 ULONG cMonitors; … … 2547 2596 { 2548 2597 int rc; 2549 pDisplay->vbvaLock(); 2598 2550 2599 if ( aScreenId == VBOX_VIDEO_PRIMARY_SCREEN 2551 2600 && pDisplay->maFramebuffers[aScreenId].fVBVAEnabled == false) /* A non-VBVA mode. */ 2552 2601 { 2602 Assert(!pDisplay->vbvaLockIsOwner()); 2553 2603 rc = pDisplay->mpDrv->pUpPort->pfnTakeScreenshot(pDisplay->mpDrv->pUpPort, ppu8Data, pcbData, pu32Width, pu32Height); 2554 2604 } … … 2590 2640 uint32_t u32DstBitsPerPixel = 32; 2591 2641 2642 Assert(!pDisplay->vbvaLockIsOwner()); 2592 2643 rc = pDisplay->mpDrv->pUpPort->pfnCopyRect(pDisplay->mpDrv->pUpPort, 2593 2644 width, height, … … 2615 2666 && aScreenId == VBOX_VIDEO_PRIMARY_SCREEN) 2616 2667 { 2668 Assert(!pDisplay->vbvaLockIsOwner()); 2617 2669 rc = pDisplay->mpDrv->pUpPort->pfnTakeScreenshot(pDisplay->mpDrv->pUpPort, 2618 2670 ppu8Data, pcbData, pu32Width, pu32Height); … … 2635 2687 rc = VERR_INVALID_PARAMETER; 2636 2688 } 2637 pDisplay->vbvaUnlock(); 2689 2638 2690 return rc; 2639 2691 } … … 2700 2752 { 2701 2753 /* This can be called from any thread. */ 2754 Assert(!pDisplay->vbvaLockIsOwner()); 2702 2755 pDrv->pUpPort->pfnFreeScreenshot(pDrv->pUpPort, pu8Data); 2703 2756 } … … 3060 3113 { 3061 3114 int rc = VINF_SUCCESS; 3062 pDisplay->vbvaLock();3063 3115 3064 3116 DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[aScreenId]; … … 3066 3118 if (aScreenId == VBOX_VIDEO_PRIMARY_SCREEN) 3067 3119 { 3120 Assert(!pDisplay->vbvaLockIsOwner()); 3068 3121 rc = pDisplay->mpDrv->pUpPort->pfnDisplayBlt(pDisplay->mpDrv->pUpPort, address, x, y, width, height); 3069 3122 } … … 3087 3140 uint32_t u32DstBitsPerPixel = pFBInfo->u16BitsPerPixel; 3088 3141 3142 Assert(!pDisplay->vbvaLockIsOwner()); 3089 3143 rc = pDisplay->mpDrv->pUpPort->pfnCopyRect(pDisplay->mpDrv->pUpPort, 3090 3144 width, height, … … 3139 3193 u32DstBitsPerPixel = 32; 3140 3194 3195 Assert(!pDisplay->vbvaLockIsOwner()); 3141 3196 pDisplay->mpDrv->pUpPort->pfnCopyRect(pDisplay->mpDrv->pUpPort, 3142 3197 width, height, … … 3164 3219 pDisplay->mParent->i_consoleVRDPServer()->SendUpdateBitmap(aScreenId, x, y, width, height); 3165 3220 3166 pDisplay->vbvaUnlock();3167 3221 return rc; 3168 3222 } … … 3231 3285 void Display::InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll) 3232 3286 { 3233 pDisplay->vbvaLock();3234 3287 unsigned uScreenId; 3235 3288 for (uScreenId = (fUpdateAll ? 0 : uId); uScreenId < pDisplay->mcMonitors; uScreenId++) … … 3240 3293 && uScreenId == VBOX_VIDEO_PRIMARY_SCREEN) 3241 3294 { 3295 Assert(!pDisplay->vbvaLockIsOwner()); 3242 3296 pDisplay->mpDrv->pUpPort->pfnUpdateDisplayAll(pDisplay->mpDrv->pUpPort); 3243 3297 } … … 3293 3347 { 3294 3348 3349 Assert(!pDisplay->vbvaLockIsOwner()); 3295 3350 pDisplay->mpDrv->pUpPort->pfnCopyRect(pDisplay->mpDrv->pUpPort, 3296 3351 width, height, … … 3313 3368 break; 3314 3369 } 3315 pDisplay->vbvaUnlock();3316 3370 } 3317 3371 … … 3487 3541 { 3488 3542 if (fSetRenderVRAM) 3543 { 3544 Assert(!vbvaLockIsOwner()); 3489 3545 mpDrv->pUpPort->pfnSetRenderVRAM(mpDrv->pUpPort, true); 3490 3491 // @todo later 3492 //if (fInvalidate)3493 //VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::InvalidateAndUpdateEMT,3494 //3, this, aScreenId, false);3546 } 3547 3548 if (fInvalidate) 3549 VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::InvalidateAndUpdateEMT, 3550 3, this, aScreenId, false); 3495 3551 } 3496 3552 … … 3731 3787 /* No VBVA do a display update. */ 3732 3788 DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN]; 3733 pDisplay->vbvaLock();3789 Assert(!pDisplay->vbvaLockIsOwner()); 3734 3790 pDrv->pUpPort->pfnUpdateDisplay(pDrv->pUpPort); 3735 pDisplay->vbvaUnlock();3736 3791 } 3737 3792 … … 4517 4572 { 4518 4573 /* Force full screen update, because VGA device must take control, do resize, etc. */ 4519 pThis->mpDrv->pUpPort->pfnUpdateDisplayAll(pThis->mpDrv->pUpPort); 4574 Assert(!pThis->vbvaLockIsOwner()); 4575 pThis->mpDrv->pUpPort->pfnUpdateDisplay(pThis->mpDrv->pUpPort); 4520 4576 } 4521 4577 } … … 4552 4608 && !pFBInfo->fDisabled) 4553 4609 { 4610 Assert(!pThis->vbvaLockIsOwner()); 4554 4611 pDrv->pUpPort->pfnUpdateDisplayRect (pDrv->pUpPort, pCmd->x, pCmd->y, pCmd->w, pCmd->h); 4555 4612 } … … 4592 4649 uint32_t u32DstBitsPerPixel = 32; 4593 4650 4651 Assert(!pThis->vbvaLockIsOwner()); 4594 4652 pDrv->pUpPort->pfnCopyRect(pDrv->pUpPort, 4595 4653 width, height, … … 4876 4934 LogRelFlowFunc(("iInstance=%d\n", pDrvIns->iInstance)); 4877 4935 4936 if (pThis->pDisplay) 4937 Assert(!pThis->pDisplay->vbvaLockIsOwner()); 4938 4878 4939 pThis->pUpPort->pfnSetRenderVRAM(pThis->pUpPort, false); 4879 4940 … … 4983 5044 4984 5045 /* Disable VRAM to a buffer copy initially. */ 5046 Assert(!pDisplay->vbvaLockIsOwner()); 4985 5047 pThis->pUpPort->pfnSetRenderVRAM (pThis->pUpPort, false); 4986 5048 pThis->IConnector.cBits = 32; /* DevVGA does nothing otherwise. */ … … 4989 5051 * Start periodic screen refreshes 4990 5052 */ 5053 Assert(!pDisplay->vbvaLockIsOwner()); 4991 5054 pThis->pUpPort->pfnSetRefreshRate(pThis->pUpPort, 20); 4992 5055
Note:
See TracChangeset
for help on using the changeset viewer.