Changeset 33171 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- Oct 15, 2010 11:10:10 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics
- Files:
-
- 5 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; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r33165 r33171 60 60 { 61 61 pInfo->offAlloc = (VBOXVIDEOOFFSET)pDmaAlloc->PhysicalAddress.QuadPart; 62 pInfo->segmentIdAlloc = pDmaAlloc->SegmentId; 63 } 64 else 65 pInfo->segmentIdAlloc = 0; 66 pInfo->srcId = pAlloc->SurfDesc.VidPnSourceId; 67 } 68 69 static void vboxWddmPopulateDmaAllocInfoWithOffset(PVBOXWDDM_DMA_ALLOCINFO pInfo, PVBOXWDDM_ALLOCATION pAlloc, DXGK_ALLOCATIONLIST *pDmaAlloc, uint32_t offStart) 70 { 71 pInfo->pAlloc = pAlloc; 72 if (pDmaAlloc->SegmentId) 73 { 74 pInfo->offAlloc = (VBOXVIDEOOFFSET)pDmaAlloc->PhysicalAddress.QuadPart + offStart; 62 75 pInfo->segmentIdAlloc = pDmaAlloc->SegmentId; 63 76 } … … 1437 1450 case VBOXWDDM_ALLOC_TYPE_UMD_HGSMI_BUFFER: 1438 1451 { 1439 ObDereferenceObject(pAllocation->pSynchEvent); 1452 if (pAllocation->pSynchEvent) 1453 { 1454 ObDereferenceObject(pAllocation->pSynchEvent); 1455 } 1440 1456 break; 1441 1457 } … … 1577 1593 pAllocation->SurfDesc.cbSize = pAllocInfo->cbBuffer; 1578 1594 pAllocationInfo->Flags.CpuVisible = 1; 1579 pAllocationInfo->Flags.SynchronousPaging = 1;1595 // pAllocationInfo->Flags.SynchronousPaging = 1; 1580 1596 pAllocationInfo->AllocationPriority = D3DDDI_ALLOCATIONPRIORITY_MAXIMUM; 1581 1597 switch (pAllocInfo->enmSynchType) … … 1595 1611 case VBOXUHGSMI_SYNCHOBJECT_TYPE_NONE: 1596 1612 pAllocation->pSynchEvent = NULL; 1597 Status = =STATUS_SUCCESS;1613 Status = STATUS_SUCCESS; 1598 1614 break; 1599 1615 default: … … 2033 2049 DXGK_ALLOCATIONLIST *pAllocation2Patch = (DXGK_ALLOCATIONLIST*)(pPrivateBuf + pPatchList->PatchOffset); 2034 2050 pAllocation2Patch->SegmentId = pAllocationList->SegmentId; 2035 pAllocation2Patch->PhysicalAddress = pAllocationList->PhysicalAddress; 2051 pAllocation2Patch->PhysicalAddress.QuadPart = pAllocationList->PhysicalAddress.QuadPart + pPatchList->AllocationOffset; 2052 Assert(!(pAllocationList->PhysicalAddress.QuadPart & 0xfffUL)); /* <- just a check to ensure allocation offset does not go here */ 2036 2053 } 2037 2054 } … … 2543 2560 2544 2561 NTSTATUS Status = STATUS_SUCCESS; 2562 PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter; 2545 2563 2546 2564 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", hAdapter)); … … 2551 2569 case DXGK_OPERATION_TRANSFER: 2552 2570 { 2571 PVBOXWDDM_ALLOCATION pAlloc = (PVBOXWDDM_ALLOCATION)pBuildPagingBuffer->Transfer.hAllocation; 2572 uint8_t* pvVramBase = pDevExt->pvVisibleVram; 2573 SIZE_T cbSize = pBuildPagingBuffer->Transfer.TransferSize; 2574 uint8_t *pvSrc, *pvDst; 2575 if (pBuildPagingBuffer->Transfer.Source.SegmentId) 2576 { 2577 #ifdef DEBUG_misha 2578 Assert(pBuildPagingBuffer->Transfer.Source.SegmentAddress.QuadPart); 2579 #endif 2580 pvSrc = pvVramBase + pBuildPagingBuffer->Transfer.Source.SegmentAddress.QuadPart; 2581 pvSrc += pBuildPagingBuffer->Transfer.TransferOffset; 2582 } 2583 else 2584 { 2585 pvSrc = (uint8_t*)MmGetMdlVirtualAddress(pBuildPagingBuffer->Transfer.Source.pMdl); 2586 pvSrc += pBuildPagingBuffer->Transfer.MdlOffset * 0x1000 /* page size */; 2587 } 2588 2589 if (pBuildPagingBuffer->Transfer.Destination.SegmentId) 2590 { 2591 #ifdef DEBUG_misha 2592 Assert(pBuildPagingBuffer->Transfer.Destination.SegmentAddress.QuadPart); 2593 #endif 2594 pvDst = pvVramBase + pBuildPagingBuffer->Transfer.Destination.SegmentAddress.QuadPart; 2595 pvDst += pBuildPagingBuffer->Transfer.TransferOffset; 2596 } 2597 else 2598 { 2599 pvDst = (uint8_t*)MmGetMdlVirtualAddress(pBuildPagingBuffer->Transfer.Destination.pMdl); 2600 pvDst += pBuildPagingBuffer->Transfer.MdlOffset * 0x1000 /* page size */; 2601 } 2602 2603 memcpy(pvDst, pvSrc, cbSize); 2553 2604 // pBuildPagingBuffer->pDmaBuffer = (uint8_t*)pBuildPagingBuffer->pDmaBuffer + VBOXVDMACMD_SIZE(VBOXVDMACMD_DMA_BPB_TRANSFER); 2554 2605 break; … … 4067 4118 { 4068 4119 PVBOXWDDM_ALLOCATION pAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pAllocationList); 4069 vboxWddmPopulateDmaAllocInfo (&pSubmInfo->Alloc, pAlloc, pAllocationList);4120 vboxWddmPopulateDmaAllocInfoWithOffset(&pSubmInfo->Alloc, pAlloc, pAllocationList, pSubmUmInfo->offData); 4070 4121 4071 4122 pSubmInfo->cbData = pSubmUmInfo->cbData;
Note:
See TracChangeset
for help on using the changeset viewer.