Changeset 33171 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Display
- Timestamp:
- Oct 15, 2010 11:10:10 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxCrHgsmi.cpp
r33146 r33171 54 54 if (g_hVBoxCrHgsmiProvider) 55 55 { 56 if (g_pfnVBoxDispCrHgsmiInit) 57 { 58 g_pfnVBoxDispCrHgsmiInit(pCallbacks); 59 } 56 60 ++g_cVBoxCrHgsmiProvider; 57 61 return VINF_SUCCESS; … … 73 77 { 74 78 hClient = g_pfnVBoxDispCrHgsmiQueryClient(); 79 #ifdef DEBUG_misha 80 Assert(hClient); 81 #endif 75 82 if (hClient) 76 83 return hClient; … … 78 85 PVBOXUHGSMI_PRIVATE_KMT pHgsmiGL = gt_pHgsmiGL; 79 86 if (pHgsmiGL) 87 { 88 Assert(pHgsmiGL->BasePrivate.hClient); 80 89 return pHgsmiGL->BasePrivate.hClient; 90 } 81 91 pHgsmiGL = (PVBOXUHGSMI_PRIVATE_KMT)RTMemAllocZ(sizeof (*pHgsmiGL)); 82 92 if (pHgsmiGL) … … 84 94 HRESULT hr = vboxUhgsmiKmtCreate(pHgsmiGL, TRUE /* bD3D tmp for injection thread*/); 85 95 Assert(hr == S_OK); 86 hClient = g_VBoxCrHgsmiCallbacks.pfnClientCreate(&pHgsmiGL->BasePrivate.Base); 87 Assert(hClient); 88 pHgsmiGL->BasePrivate.hClient = hClient; 89 gt_pHgsmiGL = pHgsmiGL; 96 if (hr == S_OK) 97 { 98 hClient = g_VBoxCrHgsmiCallbacks.pfnClientCreate(&pHgsmiGL->BasePrivate.Base); 99 Assert(hClient); 100 pHgsmiGL->BasePrivate.hClient = hClient; 101 gt_pHgsmiGL = pHgsmiGL; 102 } 90 103 } 91 104 else -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r33117 r33171 732 732 #endif 733 733 734 VBOXWDDMDISP_DECL(int) VBoxDispCrHgsmiInit(PVBOXCRHGSMI_CALLBACKS pCallbacks)735 {736 #ifdef VBOX_WITH_CRHGSMI737 g_VBoxCrHgsmiCallbacks = *pCallbacks;738 #endif739 return VINF_SUCCESS;740 }741 742 734 #ifdef VBOX_WITH_CRHGSMI 743 735 static __declspec(thread) PVBOXUHGSMI_PRIVATE_BASE gt_pHgsmi = NULL; 744 736 #endif 745 737 738 VBOXWDDMDISP_DECL(int) VBoxDispCrHgsmiInit(PVBOXCRHGSMI_CALLBACKS pCallbacks) 739 { 740 #ifdef VBOX_WITH_CRHGSMI 741 vboxDispLock(); /* the lock is needed here only to ensure callbacks are not initialized & used concurrently 742 * @todo: make a separate call used to init the per-thread info and make the VBoxDispCrHgsmiInit be called only once */ 743 g_VBoxCrHgsmiCallbacks = *pCallbacks; 744 PVBOXUHGSMI_PRIVATE_BASE pHgsmi = gt_pHgsmi; 745 #ifdef DEBUG_misha 746 Assert(pHgsmi); 747 #endif 748 if (pHgsmi) 749 { 750 if (!pHgsmi->hClient) 751 { 752 pHgsmi->hClient = g_VBoxCrHgsmiCallbacks.pfnClientCreate(&pHgsmi->Base); 753 Assert(pHgsmi->hClient); 754 } 755 } 756 vboxDispUnlock(); 757 #endif 758 return VINF_SUCCESS; 759 } 760 746 761 VBOXWDDMDISP_DECL(int) VBoxDispCrHgsmiTerm() 747 762 { … … 753 768 #ifdef VBOX_WITH_CRHGSMI 754 769 PVBOXUHGSMI_PRIVATE_BASE pHgsmi = gt_pHgsmi; 770 #ifdef DEBUG_misha 771 Assert(pHgsmi); 772 #endif 755 773 if (pHgsmi) 774 { 775 Assert(pHgsmi->hClient); 756 776 return pHgsmi->hClient; 777 } 757 778 #endif 758 779 return NULL; … … 760 781 761 782 #ifdef VBOX_WITH_CRHGSMI 762 static intvboxUhgsmiGlobalRetain()763 { 764 int rc = VINF_SUCCESS;783 static HRESULT vboxUhgsmiGlobalRetain() 784 { 785 HRESULT hr = S_OK; 765 786 vboxDispLock(); 766 787 if (!g_cVBoxUhgsmiKmtRefs) 767 788 { 768 rc = vboxUhgsmiKmtCreate(&g_VBoxUhgsmiKmt, TRUE); 769 AssertRC(rc); 770 } 771 772 if (RT_SUCCESS(rc)) 789 hr = vboxUhgsmiKmtCreate(&g_VBoxUhgsmiKmt, TRUE); 790 Assert(hr == S_OK); 791 /* can not do it here because callbacks may not be set yet 792 * @todo: need to call the cr lib from here to get the callbacks 793 * rather than making the cr lib call us */ 794 // if (hr == S_OK) 795 // { 796 // g_VBoxUhgsmiKmt.BasePrivate.hClient = g_VBoxCrHgsmiCallbacks.pfnClientCreate(&g_VBoxUhgsmiKmt.BasePrivate.Base); 797 // Assert(g_VBoxUhgsmiKmt.BasePrivate.hClient); 798 // } 799 } 800 801 if (hr == S_OK) 773 802 { 774 803 ++g_cVBoxUhgsmiKmtRefs; … … 776 805 vboxDispUnlock(); 777 806 778 return rc;779 } 780 781 static intvboxUhgsmiGlobalRelease()782 { 783 int rc = VINF_SUCCESS;807 return hr; 808 } 809 810 static HRESULT vboxUhgsmiGlobalRelease() 811 { 812 HRESULT hr = S_OK; 784 813 vboxDispLock(); 785 814 --g_cVBoxUhgsmiKmtRefs; 786 815 if (!g_cVBoxUhgsmiKmtRefs) 787 816 { 788 rc = vboxUhgsmiKmtDestroy(&g_VBoxUhgsmiKmt); 789 AssertRC(rc); 817 if (g_VBoxUhgsmiKmt.BasePrivate.hClient) 818 g_VBoxCrHgsmiCallbacks.pfnClientDestroy(g_VBoxUhgsmiKmt.BasePrivate.hClient); 819 hr = vboxUhgsmiKmtDestroy(&g_VBoxUhgsmiKmt); 820 Assert(hr == S_OK); 790 821 } 791 822 vboxDispUnlock(); 792 return rc;823 return hr; 793 824 } 794 825 … … 803 834 } 804 835 805 intvboxUhgsmiGlobalSetCurrent()806 { 807 int rc= vboxUhgsmiGlobalRetain();808 Assert RC(rc);809 if ( RT_SUCCESS(rc))836 HRESULT vboxUhgsmiGlobalSetCurrent() 837 { 838 HRESULT hr = vboxUhgsmiGlobalRetain(); 839 Assert(hr == S_OK); 840 if (hr == S_OK) 810 841 vboxDispCrHgsmiClientSet(&g_VBoxUhgsmiKmt.BasePrivate); 811 return rc;812 } 813 814 intvboxUhgsmiGlobalClearCurrent()842 return hr; 843 } 844 845 HRESULT vboxUhgsmiGlobalClearCurrent() 815 846 { 816 847 vboxUhgsmiGlobalRelease(); 817 848 vboxDispCrHgsmiClientClear(); 818 return VINF_SUCCESS;849 return S_OK; 819 850 } 820 851 … … 6967 6998 pDevice->pDevice9If->Release(); 6968 6999 } 7000 7001 #ifdef VBOX_WITH_CRHGSMI 7002 vboxDispLock(); 7003 if (pDevice->Uhgsmi.BasePrivate.hClient) 7004 g_VBoxCrHgsmiCallbacks.pfnClientDestroy(pDevice->Uhgsmi.BasePrivate.hClient); 7005 vboxDispUnlock(); 7006 #endif 6969 7007 6970 7008 HRESULT hr = vboxDispCmCtxDestroy(pDevice, &pDevice->DefaultContext); … … 7727 7765 { 7728 7766 #ifdef VBOX_WITH_CRHGSMI 7729 int rc= vboxUhgsmiGlobalRetain();7730 Assert RC(rc);7731 if ( RT_SUCCESS(rc))7767 hr = vboxUhgsmiGlobalRetain(); 7768 Assert(hr == S_OK); 7769 if (hr == S_OK) 7732 7770 #endif 7733 7771 { … … 7772 7810 #endif 7773 7811 } 7774 #ifdef VBOX_WITH_CRHGSMI7775 else7776 {7777 hr = E_FAIL;7778 }7779 #endif7780 7812 } while (0); 7781 7813 } -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h
r33116 r33171 267 267 268 268 #ifdef VBOX_WITH_CRHGSMI 269 intvboxUhgsmiGlobalSetCurrent();270 intvboxUhgsmiGlobalClearCurrent();269 HRESULT vboxUhgsmiGlobalSetCurrent(); 270 HRESULT vboxUhgsmiGlobalClearCurrent(); 271 271 #endif 272 272 -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiBase.h
r33146 r33171 93 93 fLockFlags.WriteOnly = fFlags.bWriteOnly; 94 94 fLockFlags.DonotWait = fFlags.bDonotWait; 95 fLockFlags.Discard = fFlags.bDiscard;95 // fLockFlags.Discard = fFlags.bDiscard; 96 96 *pfFlags = fLockFlags; 97 97 return VINF_SUCCESS; … … 129 129 NULL, /* LPSECURITY_ATTRIBUTES lpSemaphoreAttributes */ 130 130 0, /* LONG lInitialCount */ 131 ~0L, /* LONG lMaximumCount */131 (LONG)((~0UL) >> 1), /* LONG lMaximumCount */ 132 132 NULL /* LPCTSTR lpName */ 133 133 ); … … 187 187 memset(pAllocationList, 0, sizeof (D3DDDI_ALLOCATIONLIST)); 188 188 pAllocationList->hAllocation = pBuffer->hAllocation; 189 pAllocationList->Value = 0; 189 190 pAllocationList->WriteOperation = !pBufInfo->fFlags.bHostReadOnly; 190 191 pAllocationList->DoNotRetireInstance = pBufInfo->fFlags.bDoNotRetire;
Note:
See TracChangeset
for help on using the changeset viewer.