Changeset 33365 in vbox
- Timestamp:
- Oct 22, 2010 4:28:07 PM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r33306 r33365 5665 5665 hr = pDevice->RtCallbacks.pfnSetDisplayModeCb(pDevice->hDevice, &DdiDm); 5666 5666 Assert(hr == S_OK); 5667 #if 0 5668 if (hr == S_OK) 5669 { 5670 D3DDDICB_LOCK DdiLock = {0}; 5671 DdiLock.hAllocation = pAlloc->hAllocation; 5672 DdiLock.Flags.LockEntire = 1; 5673 DdiLock.Flags.ReadOnly = 1; 5674 hr = pDevice->RtCallbacks.pfnLockCb(pDevice->hDevice, &DdiLock); 5675 Assert(hr == S_OK); 5676 if (hr == S_OK) 5677 { 5678 D3DLOCKED_RECT LockRect; 5679 IDirect3DSurface9 *pD3DIfSurf = (IDirect3DSurface9*)pAlloc->pD3DIf; 5680 hr = pD3DIfSurf->LockRect(&LockRect, NULL /* RECT*/, D3DLOCK_DISCARD); 5681 Assert(hr == S_OK); 5682 if (hr == S_OK) 5683 { 5684 /** @todo: take pitch into account */ 5685 Assert(pAlloc->SurfDesc.pitch == LockRect.Pitch); 5686 memcpy(LockRect.pBits, DdiLock.pData, LockRect.Pitch * pAlloc->SurfDesc.height); 5687 hr = pD3DIfSurf->UnlockRect(); 5688 Assert(hr == S_OK); 5689 } 5690 5691 D3DDDICB_UNLOCK DdiUnlock = {0}; 5692 DdiUnlock.NumAllocations = 1; 5693 DdiUnlock.phAllocations = &pAlloc->hAllocation; 5694 hr = pDevice->RtCallbacks.pfnUnlockCb(pDevice->hDevice, &DdiUnlock); 5695 Assert(hr == S_OK); 5696 } 5697 hr = S_OK; 5698 #endif 5699 } 5667 5700 } 5668 5701 … … 7652 7685 } 7653 7686 #else 7654 //# define VBOXDISP_TEST_SWAPCHAIN7687 # define VBOXDISP_TEST_SWAPCHAIN 7655 7688 # ifdef VBOXDISP_TEST_SWAPCHAIN 7656 7689 VBOXDISP_D3DEV(pDevice); -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r33306 r33365 1761 1761 DXGKARG_DESCRIBEALLOCATION* pDescribeAllocation) 1762 1762 { 1763 dfprintf(("==> "__FUNCTION__ ", hAdapter(0x%x)\n", hAdapter));1763 // dfprintf(("==> "__FUNCTION__ ", hAdapter(0x%x)\n", hAdapter)); 1764 1764 1765 1765 vboxVDbgBreakFv(); … … 1774 1774 pDescribeAllocation->PrivateDriverFormatAttribute = 0; 1775 1775 1776 dfprintf(("<== "__FUNCTION__ ", hAdapter(0x%x)\n", hAdapter));1776 // dfprintf(("<== "__FUNCTION__ ", hAdapter(0x%x)\n", hAdapter)); 1777 1777 1778 1778 return STATUS_SUCCESS; -
trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c
r32909 r33365 46 46 #include <VBox/HostServices/VBoxCrOpenGLSvc.h> 47 47 48 //#if defined(IN_GUEST) 49 //#define VBOX_WITH_CRHGSMIPROFILE 50 //#endif 51 #ifdef VBOX_WITH_CRHGSMIPROFILE 52 #include <iprt/time.h> 53 #include <stdio.h> 54 55 #ifdef VBOX_WITH_CRHGSMI 56 #include <VBox/VBoxCrHgsmi.h> 57 #endif 58 59 typedef struct VBOXCRHGSMIPROFILE 60 { 61 uint64_t cStartTime; 62 uint64_t cStepsTime; 63 uint64_t cSteps; 64 } VBOXCRHGSMIPROFILE, *PVBOXCRHGSMIPROFILE; 65 66 #define VBOXCRHGSMIPROFILE_GET_TIME_NANO() RTTimeNanoTS() 67 #define VBOXCRHGSMIPROFILE_GET_TIME_MILLI() RTTimeMilliTS() 68 69 /* 10 sec */ 70 #define VBOXCRHGSMIPROFILE_LOG_STEP_TIME (10000000000.) 71 72 DECLINLINE(void) vboxCrHgsmiProfileStart(PVBOXCRHGSMIPROFILE pProfile) 73 { 74 pProfile->cStepsTime = 0; 75 pProfile->cSteps = 0; 76 pProfile->cStartTime = VBOXCRHGSMIPROFILE_GET_TIME_NANO(); 77 } 78 79 DECLINLINE(void) vboxCrHgsmiProfileStep(PVBOXCRHGSMIPROFILE pProfile, uint64_t cStepTime) 80 { 81 pProfile->cStepsTime += cStepTime; 82 ++pProfile->cSteps; 83 } 84 85 typedef struct VBOXCRHGSMIPROFILE_SCOPE 86 { 87 uint64_t cStartTime; 88 // bool bDisable; 89 } VBOXCRHGSMIPROFILE_SCOPE, *PVBOXCRHGSMIPROFILE_SCOPE; 90 91 static VBOXCRHGSMIPROFILE g_VBoxProfile; 92 93 static void vboxCrHgsmiLog(char * szString, ...) 94 { 95 char szBuffer[4096] = {0}; 96 va_list pArgList; 97 va_start(pArgList, szString); 98 _vsnprintf(szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]), szString, pArgList); 99 va_end(pArgList); 100 101 #ifdef VBOX_WITH_CRHGSMI 102 VBoxCrHgsmiLog(szBuffer); 103 #else 104 OutputDebugString(szBuffer); 105 #endif 106 } 107 108 DECLINLINE(void) vboxCrHgsmiProfileLog(PVBOXCRHGSMIPROFILE pProfile, uint64_t cTime) 109 { 110 uint64_t profileTime = cTime - pProfile->cStartTime; 111 double percent = ((double)100.0) * pProfile->cStepsTime / profileTime; 112 double cps = ((double)1000000000.) * pProfile->cSteps / profileTime; 113 vboxCrHgsmiLog("hgcm: cps: %.1f, host %.1f%%\n", cps, percent); 114 } 115 116 DECLINLINE(void) vboxCrHgsmiProfileScopeEnter(PVBOXCRHGSMIPROFILE_SCOPE pScope) 117 { 118 // pScope->bDisable = false; 119 pScope->cStartTime = VBOXCRHGSMIPROFILE_GET_TIME_NANO(); 120 } 121 122 DECLINLINE(void) vboxCrHgsmiProfileScopeExit(PVBOXCRHGSMIPROFILE_SCOPE pScope) 123 { 124 // if (!pScope->bDisable) 125 { 126 uint64_t cTime = VBOXCRHGSMIPROFILE_GET_TIME_NANO(); 127 vboxCrHgsmiProfileStep(&g_VBoxProfile, cTime - pScope->cStartTime); 128 if (VBOXCRHGSMIPROFILE_LOG_STEP_TIME < cTime - g_VBoxProfile.cStartTime) 129 { 130 vboxCrHgsmiProfileLog(&g_VBoxProfile, cTime); 131 vboxCrHgsmiProfileStart(&g_VBoxProfile); 132 } 133 } 134 } 135 136 137 #define VBOXCRHGSMIPROFILE_INIT() vboxCrHgsmiProfileStart(&g_VBoxProfile) 138 #define VBOXCRHGSMIPROFILE_TERM() do {} while (0) 139 140 #define VBOXCRHGSMIPROFILE_FUNC_PROLOGUE() \ 141 VBOXCRHGSMIPROFILE_SCOPE __vboxCrHgsmiProfileScope; \ 142 vboxCrHgsmiProfileScopeEnter(&__vboxCrHgsmiProfileScope); 143 144 #define VBOXCRHGSMIPROFILE_FUNC_EPILOGUE() \ 145 vboxCrHgsmiProfileScopeExit(&__vboxCrHgsmiProfileScope); \ 146 147 148 #else 149 #ifdef IN_GUEST 150 #error "should not happen!" 151 #endif 152 #define VBOXCRHGSMIPROFILE_INIT() do {} while (0) 153 #define VBOXCRHGSMIPROFILE_TERM() do {} while (0) 154 #define VBOXCRHGSMIPROFILE_FUNC_PROLOGUE() do {} while (0) 155 #define VBOXCRHGSMIPROFILE_FUNC_EPILOGUE() do {} while (0) 156 #endif 157 48 158 typedef struct { 49 159 int initialized; … … 95 205 96 206 /* Some forward declarations */ 97 static void crVBoxHGCMReceiveMessage(CRConnection *conn);207 static void _crVBoxHGCMReceiveMessage(CRConnection *conn); 98 208 99 209 #ifndef IN_GUEST … … 233 343 } 234 344 235 static void * crVBoxHGCMAlloc(CRConnection *conn)345 static void *_crVBoxHGCMAlloc(CRConnection *conn) 236 346 { 237 347 CRVBOXHGCMBUFFER *buf; … … 358 468 } 359 469 360 static void crVBoxHGCMWriteExact(CRConnection *conn, const void *buf, unsigned int len) 470 static void *crVBoxHGCMAlloc(CRConnection *conn) 471 { 472 void *pvBuff; 473 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 474 pvBuff = _crVBoxHGCMAlloc(conn); 475 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 476 return pvBuff; 477 } 478 479 static void _crVBoxHGCMWriteExact(CRConnection *conn, const void *buf, unsigned int len) 361 480 { 362 481 int rc; … … 407 526 } 408 527 528 static void crVBoxHGCMWriteExact(CRConnection *conn, const void *buf, unsigned int len) 529 { 530 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 531 _crVBoxHGCMWriteExact(conn, buf, len); 532 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 533 } 534 409 535 static void crVBoxHGCMReadExact( CRConnection *conn, const void *buf, unsigned int len ) 410 536 { … … 441 567 442 568 if (conn->cbBuffer) 443 crVBoxHGCMReceiveMessage(conn);569 _crVBoxHGCMReceiveMessage(conn); 444 570 445 571 } … … 517 643 518 644 if (conn->cbBuffer) 519 crVBoxHGCMReceiveMessage(conn);645 _crVBoxHGCMReceiveMessage(conn); 520 646 } 521 647 … … 524 650 { 525 651 CRVBOXHGCMBUFFER *hgcm_buffer; 652 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 526 653 527 654 if (!bufp) /* We're sending a user-allocated buffer. */ … … 536 663 crVBoxHGCMWriteReadExact(conn, start, len, CR_VBOXHGCM_USERALLOCATED); 537 664 #endif 665 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 538 666 return; 539 667 } … … 553 681 if (conn->u32InjectClientID) 554 682 { 555 crVBoxHGCMWriteExact(conn, start, len);683 _crVBoxHGCMWriteExact(conn, start, len); 556 684 } 557 685 else … … 573 701 */ 574 702 *bufp = NULL; 703 704 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 575 705 } 576 706 … … 611 741 static void crVBoxHGCMSingleRecv(CRConnection *conn, void *buf, unsigned int len) 612 742 { 743 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 613 744 crVBoxHGCMReadExact(conn, buf, len); 614 } 615 616 static void crVBoxHGCMFree(CRConnection *conn, void *buf) 745 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 746 } 747 748 static void _crVBoxHGCMFree(CRConnection *conn, void *buf) 617 749 { 618 750 CRVBOXHGCMBUFFER *hgcm_buffer = (CRVBOXHGCMBUFFER *) buf - 1; … … 653 785 } 654 786 655 static void crVBoxHGCMReceiveMessage(CRConnection *conn) 787 static void crVBoxHGCMFree(CRConnection *conn, void *buf) 788 { 789 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 790 _crVBoxHGCMFree(conn, buf); 791 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 792 } 793 794 static void _crVBoxHGCMReceiveMessage(CRConnection *conn) 656 795 { 657 796 uint32_t len; … … 670 809 CRASSERT(conn->buffer_size >= sizeof(CRMessageRedirPtr)); 671 810 672 hgcm_buffer = (CRVBOXHGCMBUFFER *) crVBoxHGCMAlloc( conn ) - 1;811 hgcm_buffer = (CRVBOXHGCMBUFFER *) _crVBoxHGCMAlloc( conn ) - 1; 673 812 hgcm_buffer->len = sizeof(CRMessageRedirPtr); 674 813 … … 690 829 { 691 830 /* put in pre-allocated buffer */ 692 hgcm_buffer = (CRVBOXHGCMBUFFER *) crVBoxHGCMAlloc( conn ) - 1;831 hgcm_buffer = (CRVBOXHGCMBUFFER *) _crVBoxHGCMAlloc( conn ) - 1; 693 832 } 694 833 else … … 728 867 && cached_type != CR_MESSAGE_GATHER) 729 868 { 730 crVBoxHGCMFree(conn, msg); 731 } 732 } 869 _crVBoxHGCMFree(conn, msg); 870 } 871 } 872 873 static void crVBoxHGCMReceiveMessage(CRConnection *conn) 874 { 875 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 876 _crVBoxHGCMReceiveMessage(conn); 877 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 878 } 879 733 880 734 881 /* … … 737 884 static void crVBoxHGCMAccept( CRConnection *conn, const char *hostname, unsigned short port ) 738 885 { 886 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 739 887 CRASSERT(conn && conn->pHostBuffer); 740 888 #ifdef IN_GUEST 741 889 CRASSERT(FALSE); 742 890 #endif 891 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 743 892 } 744 893 … … 786 935 #ifdef RT_OS_WINDOWS 787 936 DWORD cbReturned; 937 938 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 788 939 789 940 if (g_crvboxhgcm.hGuestDrv == INVALID_HANDLE_VALUE) … … 802 953 { 803 954 crDebug("could not open VBox Guest Additions driver! rc = %d\n", GetLastError()); 955 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 804 956 return FALSE; 805 957 } 806 958 } 807 959 #else 960 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 808 961 if (g_crvboxhgcm.iGuestDrv == INVALID_HANDLE_VALUE) 809 962 { … … 812 965 { 813 966 crDebug("could not open Guest Additions kernel module! rc = %d\n", errno); 967 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 814 968 return FALSE; 815 969 } … … 847 1001 crDebug("HGCM connect was successful: client id =0x%x\n", conn->u32ClientID); 848 1002 1003 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 849 1004 return crVBoxHGCMSetVersion(conn, CR_PROTOCOL_VERSION_MAJOR, CR_PROTOCOL_VERSION_MINOR); 850 1005 } … … 852 1007 { 853 1008 crDebug("HGCM connect failed with rc=0x%x\n", info.result); 1009 1010 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 854 1011 return FALSE; 855 1012 } … … 862 1019 crDebug("IOCTL for HGCM connect failed with rc=0x%x\n", errno); 863 1020 #endif 1021 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 864 1022 return FALSE; 865 1023 } 866 1024 1025 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 867 1026 return TRUE; 868 1027 … … 884 1043 int i; 885 1044 #endif 1045 1046 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 886 1047 887 1048 if (conn->pHostBuffer) … … 964 1125 } 965 1126 #endif /* IN_GUEST */ 1127 1128 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 966 1129 } 967 1130 968 1131 static void crVBoxHGCMInstantReclaim(CRConnection *conn, CRMessage *mess) 969 1132 { 970 crVBoxHGCMFree(conn, mess); 1133 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1134 _crVBoxHGCMFree(conn, mess); 971 1135 CRASSERT(FALSE); 1136 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 972 1137 } 973 1138 974 1139 static void crVBoxHGCMHandleNewMessage( CRConnection *conn, CRMessage *msg, unsigned int len ) 975 1140 { 1141 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 976 1142 CRASSERT(FALSE); 1143 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 977 1144 } 978 1145 … … 987 1154 return; 988 1155 } 1156 1157 VBOXCRHGSMIPROFILE_INIT(); 989 1158 990 1159 g_crvboxhgcm.initialized = 1; … … 1142 1311 int32_t i; 1143 1312 1313 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1314 1144 1315 #ifdef IN_GUEST 1145 1316 /* we're on guest side, poll host if it got something for us */ … … 1167 1338 if (conn->cbBuffer>0) 1168 1339 { 1169 crVBoxHGCMReceiveMessage(conn); 1170 } 1171 } 1340 _crVBoxHGCMReceiveMessage(conn); 1341 } 1342 } 1343 1344 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1172 1345 1173 1346 return 0; -
trunk/src/VBox/GuestHost/OpenGL/util/vboxhgsmi.c
r33306 r33365 1457 1457 1458 1458 if (!bHasHGSMI) 1459 { 1460 #ifdef DEBUG_misha 1461 AssertRelease(0); 1462 #endif 1459 1463 return false; 1464 } 1465 1466 return false; 1460 1467 1461 1468 g_crvboxhgsmi.recv_list = rfl; … … 1588 1595 { 1589 1596 int32_t i; 1597 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1590 1598 1591 1599 #ifdef IN_GUEST … … 1620 1628 } 1621 1629 1630 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1622 1631 return 0; 1623 1632 } … … 1625 1634 CRConnection** crVBoxHGSMIDump( int *num ) 1626 1635 { 1636 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1627 1637 Assert(0); 1628 1638 *num = g_crvboxhgsmi.num_conns; 1629 1639 1640 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1630 1641 return g_crvboxhgsmi.conns; 1631 1642 } -
trunk/src/VBox/Main/DisplayImpl.cpp
r33146 r33365 2915 2915 void Display::destructCrHgsmiData(void) 2916 2916 { 2917 if (mhCrOglSvc) 2918 { 2919 VMMDev *pVMMDev = mParent->getVMMDev(); 2920 Assert(pVMMDev); 2921 if (pVMMDev) 2922 { 2923 int rc = pVMMDev->hgcmHostSvcHandleDestroy(mhCrOglSvc); 2924 AssertRC(rc); 2925 } 2926 } 2917 mhCrOglSvc = NULL; 2927 2918 } 2928 2919 #endif -
trunk/src/VBox/Main/hgcm/HGCM.cpp
r33146 r33365 108 108 uint32_t *m_paClientIds; 109 109 110 #ifdef VBOX_WITH_CRHGSMI 111 uint32_t m_cHandleAcquires; 112 #endif 113 110 114 HGCMSVCEXTHANDLE m_hExtension; 111 115 … … 153 157 154 158 #ifdef VBOX_WITH_CRHGSMI 159 int HandleAcquired(); 160 int HandleReleased(); 155 161 int HostFastCallAsync (uint32_t u32Function, VBOXHGCMSVCPARM *pParm, PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion); 156 162 #endif … … 230 236 m_cClientsAllocated (0), 231 237 m_paClientIds (NULL), 238 #ifdef VBOX_WITH_CRHGSMI 239 m_cHandleAcquires (0), 240 #endif 232 241 m_hExtension (NULL) 233 242 { … … 1109 1118 } 1110 1119 1120 #ifdef VBOX_WITH_CRHGSMI 1121 /* @todo: could this actually happen that the service is destroyed on ReleaseService? */ 1122 HGCMService *pNextSvc = pSvc->m_pSvcNext; 1123 while (pSvc->m_cHandleAcquires) 1124 { 1125 pSvc->HandleReleased (); 1126 pSvc->ReleaseService (); 1127 } 1128 pSvc = pNextSvc; 1129 #else 1111 1130 pSvc = pSvc->m_pSvcNext; 1131 #endif 1112 1132 } 1113 1133 … … 1562 1582 pMsg->pfnCompletion (result, pMsg->u32Function, &pMsg->Param, pMsg->pvCompletion); 1563 1583 } 1584 } 1585 1586 int HGCMService::HandleAcquired() 1587 { 1588 ++m_cHandleAcquires; 1589 return VINF_SUCCESS; 1590 } 1591 1592 int HGCMService::HandleReleased() 1593 { 1594 Assert(m_cHandleAcquires); 1595 if (m_cHandleAcquires) 1596 { 1597 --m_cHandleAcquires; 1598 return VINF_SUCCESS; 1599 } 1600 return VERR_INVALID_STATE; 1564 1601 } 1565 1602 … … 1844 1881 if (RT_SUCCESS(rc)) 1845 1882 { 1846 pMsg->pService = pService; 1883 rc = pService->HandleAcquired (); 1884 if (RT_SUCCESS(rc)) 1885 { 1886 pMsg->pService = pService; 1887 } 1888 else 1889 { 1890 pService->ReleaseService (); 1891 } 1847 1892 } 1848 1893 } break; … … 1856 1901 /* Resolve the service name to the pointer to service instance. */ 1857 1902 1858 pMsg->pService->ReleaseService (); 1859 1860 rc = VINF_SUCCESS; 1903 rc = pMsg->pService->HandleReleased (); 1904 if (RT_SUCCESS(rc)) 1905 { 1906 pMsg->pService->ReleaseService (); 1907 } 1861 1908 } break; 1862 1909 #endif
Note:
See TracChangeset
for help on using the changeset viewer.