VirtualBox

Ignore:
Timestamp:
Oct 13, 2010 9:06:35 PM (14 years ago)
Author:
vboxsync
Message:

wddm/3d: chromium hgsmi transport (guest part, disabled)

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispCm.cpp

    r30855 r33116  
    109109    VBOXWDDM_CREATECONTEXT_INFO Info;
    110110    Info.u32IfVersion = pDevice->u32IfVersion;
    111     Info.u32IsD3D = VBOXDISPMODE_IS_3D(pDevice->pAdapter);
     111    Info.enmType = VBOXDISPMODE_IS_3D(pDevice->pAdapter) ? VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D : VBOXWDDM_CONTEXT_TYPE_CUSTOM_2D;
    112112    Info.hUmEvent = (uint64_t)g_pVBoxCmMgr.Session.hEvent;
    113113    Info.u64UmInfo = (uint64_t)pContext;
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.def

    r30483 r33116  
    2020        OpenAdapter
    2121        VBoxDispMpGetCallbacks
    22 
     22    VBoxDispCrHgsmiInit
     23    VBoxDispCrHgsmiTerm
     24    VBoxDispCrHgsmiQueryClient
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h

    r32889 r33116  
    1818#include "VBoxDispD3DIf.h"
    1919#include "../../Miniport/wddm/VBoxVideoIf.h"
     20#ifdef VBOX_WITH_CRHGSMI
    2021#include "VBoxUhgsmiDisp.h"
     22#endif
    2123
    2224#include <iprt/cdefs.h>
     
    178180    D3DVIEWPORT9 ViewPort;
    179181    VBOXWDDMDISP_CONTEXT DefaultContext;
     182#ifdef VBOX_WITH_CRHGSMI
    180183    VBOXUHGSMI_PRIVATE_D3D Uhgsmi;
     184#endif
    181185
    182186    CRITICAL_SECTION DirtyAllocListLock;
     
    262266} VBOXWDDMDISP_OVERLAY, *PVBOXWDDMDISP_OVERLAY;
    263267
     268#ifdef VBOX_WITH_CRHGSMI
     269int vboxUhgsmiGlobalSetCurrent();
     270int vboxUhgsmiGlobalClearCurrent();
     271#endif
     272
    264273#define VBOXDISPMODE_IS_3D(_p) (!!((_p)->pD3D9If))
    265274#ifdef VBOXDISP_EARLYCREATEDEVICE
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D64.def

    r30483 r33116  
    2020        OpenAdapter
    2121        VBoxDispMpGetCallbacks
    22 
     22    VBoxDispCrHgsmiInit
     23    VBoxDispCrHgsmiTerm
     24    VBoxDispCrHgsmiQueryClient
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxScreen.cpp

    r32061 r33116  
    364364        pMon->pfnD3DKMTEscape = (PFND3DKMT_ESCAPE)GetProcAddress(pMon->hGdi32, "D3DKMTEscape");
    365365        Log((__FUNCTION__": pfnD3DKMTEscape = %p\n", pMon->pfnD3DKMTEscape));
    366         bSupported &= !!(pMon->pfnD3DKMTCloseAdapter);
     366        bSupported &= !!(pMon->pfnD3DKMTEscape);
    367367
    368368        Assert(bSupported);
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiDisp.cpp

    r32889 r33116  
    2020typedef struct VBOXUHGSMI_BUFFER_PRIVATE_D3D
    2121{
    22     VBOXUHGSMI_BUFFER Base;
     22    VBOXUHGSMI_BUFFER_PRIVATE_BASE BasePrivate;
    2323    PVBOXWDDMDISP_DEVICE pDevice;
    24     D3DKMT_HANDLE hAllocation;
    2524    UINT aLockPageIndices[1];
    2625} VBOXUHGSMI_BUFFER_PRIVATE_D3D, *PVBOXUHGSMI_BUFFER_PRIVATE_D3D;
    2726
    28 #define VBOXUHGSMID3D_GET_PRIVATE(_p, _t) ((_t*)(((uint8_t*)_p) - RT_OFFSETOF(_t, Base)))
     27#define VBOXUHGSMID3D_GET_PRIVATE(_p, _t) ((_t*)(((uint8_t*)_p) - RT_OFFSETOF(_t, BasePrivate.Base)))
    2928#define VBOXUHGSMID3D_GET(_p) VBOXUHGSMID3D_GET_PRIVATE(_p, VBOXUHGSMI_PRIVATE_D3D)
    3029#define VBOXUHGSMID3D_GET_BUFFER(_p) VBOXUHGSMID3D_GET_PRIVATE(_p, VBOXUHGSMI_BUFFER_PRIVATE_D3D)
     
    3635    DdiDealloc.hResource = 0;
    3736    DdiDealloc.NumAllocations = 1;
    38     DdiDealloc.HandleList = &pBuffer->hAllocation;
     37    DdiDealloc.HandleList = &pBuffer->BasePrivate.hAllocation;
    3938    HRESULT hr = pBuffer->pDevice->RtCallbacks.pfnDeallocateCb(pBuffer->pDevice->hDevice, &DdiDealloc);
    4039    Assert(hr == S_OK);
    4140    if (hr == S_OK)
    4241    {
    43         if (pBuffer->Base.bSynchCreated)
     42        if (pBuffer->BasePrivate.Base.bSynchCreated)
    4443        {
    45             CloseHandle(pBuffer->Base.hSynch);
     44            CloseHandle(pBuffer->BasePrivate.Base.hSynch);
    4645        }
    4746        RTMemFree(pBuffer);
     
    5554    PVBOXUHGSMI_BUFFER_PRIVATE_D3D pBuffer = VBOXUHGSMID3D_GET_BUFFER(pBuf);
    5655    D3DDDICB_LOCK DdiLock;
    57     DdiLock.hAllocation = pBuffer->hAllocation;
     56    DdiLock.hAllocation = pBuffer->BasePrivate.hAllocation;
    5857    DdiLock.PrivateDriverData = 0;
    5958
    60     if (fFlags.bLockEntire)
    61     {
    62         offLock = 0;
    63         DdiLock.Flags.Value = 0;
    64         DdiLock.Flags.LockEntire = 1;
    65     }
    66     else
    67     {
    68         if (!cbLock)
    69         {
    70             Assert(0);
    71             return VERR_INVALID_PARAMETER;
    72         }
    73         if (offLock + cbLock > pBuf->cbBuffer)
    74         {
    75             Assert(0);
    76             return VERR_INVALID_PARAMETER;
    77         }
    78 
    79         uint32_t iFirstPage = offLock >> 0x1000;
    80         uint32_t iAfterLastPage = (cbLock + 0xfff) >> 0x1000;
    81         uint32_t cPages = iAfterLastPage - iFirstPage;
    82         uint32_t cBufPages = pBuf->cbBuffer >> 0x1000;
    83         Assert(cPages <= (cBufPages));
    84 
    85         if (cPages == cBufPages)
    86         {
    87             DdiLock.NumPages = 0;
    88             DdiLock.pPages = NULL;
    89             DdiLock.Flags.Value = 0;
    90             DdiLock.Flags.LockEntire = 1;
    91         }
    92         else
    93         {
    94             DdiLock.NumPages = cPages;
    95             DdiLock.pPages = pBuffer->aLockPageIndices;
    96             DdiLock.Flags.Value = 0;
    97             for (UINT i = 0, j = iFirstPage; i < cPages; ++i, ++j)
    98             {
    99                 pBuffer->aLockPageIndices[i] = j;
    100             }
    101         }
    102 
    103     }
    104     DdiLock.pData = NULL;
    105     DdiLock.Flags.ReadOnly = fFlags.bReadOnly;
    106     DdiLock.Flags.WriteOnly = fFlags.bWriteOnly;
    107     DdiLock.Flags.DonotWait = fFlags.bDonotWait;
    108 //    DdiLock.Flags.Discard = fFlags.bDiscard;
     59    int rc = vboxUhgsmiBaseLockData(pBuf, offLock, cbLock, fFlags,
     60                                         &DdiLock.Flags, pBuffer->aLockPageIndices, &DdiLock.NumPages);
     61    AssertRC(rc);
     62    if (RT_FAILURE(rc))
     63        return rc;
     64
     65    DdiLock.pPages = pBuffer->aLockPageIndices;
    10966
    11067    HRESULT hr = pBuffer->pDevice->RtCallbacks.pfnLockCb(pBuffer->pDevice->hDevice, &DdiLock);
     
    12380    D3DDDICB_UNLOCK DdiUnlock;
    12481    DdiUnlock.NumAllocations = 1;
    125     DdiUnlock.phAllocations = &pBuffer->hAllocation;
     82    DdiUnlock.phAllocations = &pBuffer->BasePrivate.hAllocation;
    12683    HRESULT hr = pBuffer->pDevice->RtCallbacks.pfnUnlockCb(pBuffer->pDevice->hDevice, &DdiUnlock);
    12784    Assert(hr == S_OK);
     
    13996        return VERR_INVALID_PARAMETER;
    14097
    141     switch (enmSynchType)
    142     {
    143         case VBOXUHGSMI_SYNCHOBJECT_TYPE_EVENT:
    144             if (!hSynch)
    145             {
    146                 hSynch = CreateEvent(
    147                   NULL, /* LPSECURITY_ATTRIBUTES lpEventAttributes */
    148                   FALSE, /* BOOL bManualReset */
    149                   FALSE, /* BOOL bInitialState */
    150                   NULL /* LPCTSTR lpName */
    151                 );
    152                 Assert(hSynch);
    153                 if (!hSynch)
    154                 {
    155                     DWORD winEr = GetLastError();
    156                     /* todo: translate winer */
    157                     return VERR_GENERAL_FAILURE;
    158                 }
    159                 bSynchCreated = true;
    160             }
    161             break;
    162         case VBOXUHGSMI_SYNCHOBJECT_TYPE_SEMAPHORE:
    163             if (!hSynch)
    164             {
    165                 hSynch = CreateSemaphore(
    166                   NULL, /* LPSECURITY_ATTRIBUTES lpSemaphoreAttributes */
    167                   0, /* LONG lInitialCount */
    168                   ~0L, /* LONG lMaximumCount */
    169                   NULL /* LPCTSTR lpName */
    170                 );
    171                 Assert(hSynch);
    172                 if (!hSynch)
    173                 {
    174                     DWORD winEr = GetLastError();
    175                     /* todo: translate winer */
    176                     return VERR_GENERAL_FAILURE;
    177                 }
    178                 bSynchCreated = true;
    179             }
    180             break;
    181         default:
    182             Assert(0);
    183             return VERR_INVALID_PARAMETER;
    184     }
     98    int rc = vboxUhgsmiBaseEventChkCreate(enmSynchType, &hSynch, &bSynchCreated);
     99    AssertRC(rc);
     100    if (RT_FAILURE(rc))
     101        return rc;
    185102
    186103    cbBuf = VBOXWDDM_ROUNDBOUND(cbBuf, 0x1000);
     
    189106    Assert(cPages);
    190107
    191     int rc;
    192108    PVBOXUHGSMI_PRIVATE_D3D pPrivate = VBOXUHGSMID3D_GET(pHgsmi);
    193109    PVBOXUHGSMI_BUFFER_PRIVATE_D3D pBuf = (PVBOXUHGSMI_BUFFER_PRIVATE_D3D)RTMemAllocZ(RT_OFFSETOF(VBOXUHGSMI_BUFFER_PRIVATE_D3D, aLockPageIndices));
     
    218134        {
    219135            Assert(Buf.DdiAllocInfo.hAllocation);
    220             pBuf->Base.pfnLock = vboxUhgsmiD3DBufferLock;
    221             pBuf->Base.pfnUnlock = vboxUhgsmiD3DBufferUnlock;
     136            pBuf->BasePrivate.Base.pfnLock = vboxUhgsmiD3DBufferLock;
     137            pBuf->BasePrivate.Base.pfnUnlock = vboxUhgsmiD3DBufferUnlock;
    222138//            pBuf->Base.pfnAdjustValidDataRange = vboxUhgsmiD3DBufferAdjustValidDataRange;
    223             pBuf->Base.pfnDestroy = vboxUhgsmiD3DBufferDestroy;
    224 
    225             pBuf->Base.hSynch = hSynch;
    226             pBuf->Base.enmSynchType =enmSynchType;
    227             pBuf->Base.cbBuffer = cbBuf;
    228             pBuf->Base.bSynchCreated = bSynchCreated;
     139            pBuf->BasePrivate.Base.pfnDestroy = vboxUhgsmiD3DBufferDestroy;
     140
     141            pBuf->BasePrivate.Base.hSynch = hSynch;
     142            pBuf->BasePrivate.Base.enmSynchType = enmSynchType;
     143            pBuf->BasePrivate.Base.cbBuffer = cbBuf;
     144            pBuf->BasePrivate.Base.bSynchCreated = bSynchCreated;
    229145
    230146            pBuf->pDevice = pPrivate->pDevice;
    231             pBuf->hAllocation = Buf.DdiAllocInfo.hAllocation;
    232 
    233             *ppBuf = &pBuf->Base;
     147            pBuf->BasePrivate.hAllocation = Buf.DdiAllocInfo.hAllocation;
     148
     149            *ppBuf = &pBuf->BasePrivate.Base;
    234150
    235151            return VINF_SUCCESS;
     
    251167    PVBOXUHGSMI_PRIVATE_D3D pHg = VBOXUHGSMID3D_GET(pHgsmi);
    252168    PVBOXWDDMDISP_DEVICE pDevice = pHg->pDevice;
    253     const uint32_t cbDmaCmd = RT_OFFSETOF(VBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD, aBufInfos[cBuffers]);
    254     if (pDevice->DefaultContext.ContextInfo.CommandBufferSize < cbDmaCmd)
    255     {
    256         Assert(0);
    257         return VERR_GENERAL_FAILURE;
    258     }
    259     if (pDevice->DefaultContext.ContextInfo.AllocationListSize < cBuffers)
    260     {
    261         Assert(0);
    262         return VERR_GENERAL_FAILURE;
    263     }
    264 
    265     PVBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD pHdr = (PVBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD)pDevice->DefaultContext.ContextInfo.pCommandBuffer;
    266     pHdr->Base.enmCmd = VBOXVDMACMD_TYPE_CHROMIUM_CMD;
    267     pHdr->Base.u32CmdReserved = cBuffers;
    268 
    269     D3DDDI_ALLOCATIONLIST* pAllocationList = pDevice->DefaultContext.ContextInfo.pAllocationList;
    270     PVBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO pBufSubmInfo = pHdr->aBufInfos;
    271 
    272     for (uint32_t i = 0; i < cBuffers; ++i)
    273     {
    274         PVBOXUHGSMI_BUFFER_SUBMIT pBufInfo = &aBuffers[i];
    275         PVBOXUHGSMI_BUFFER_PRIVATE_D3D pBuffer = VBOXUHGSMID3D_GET_BUFFER(pBufInfo->pBuf);
    276 
    277         memset(pAllocationList, 0, sizeof (D3DDDI_ALLOCATIONLIST));
    278         pAllocationList->hAllocation = pBuffer->hAllocation;
    279         pAllocationList->WriteOperation = !pBufInfo->fFlags.bHostReadOnly;
    280         pAllocationList->DoNotRetireInstance = pBufInfo->fFlags.bDoNotRetire;
    281         pBufSubmInfo->fSubFlags = pBufInfo->fFlags;
    282         if (pBufInfo->fFlags.bEntireBuffer)
    283         {
    284             pBufSubmInfo->offData = 0;
    285             pBufSubmInfo->cbData = pBuffer->Base.cbBuffer;
    286         }
    287         else
    288         {
    289             pBufSubmInfo->offData = pBufInfo->offData;
    290             pBufSubmInfo->cbData = pBufInfo->cbData;
    291         }
    292 
    293         ++pAllocationList;
    294         ++pBufSubmInfo;
    295     }
    296 
     169    UINT cbDmaCmd = pDevice->DefaultContext.ContextInfo.CommandBufferSize;
     170    int rc = vboxUhgsmiBaseDmaFill(aBuffers, cBuffers,
     171            pDevice->DefaultContext.ContextInfo.pCommandBuffer, &cbDmaCmd,
     172            pDevice->DefaultContext.ContextInfo.pAllocationList, pDevice->DefaultContext.ContextInfo.AllocationListSize,
     173            pDevice->DefaultContext.ContextInfo.pPatchLocationList, pDevice->DefaultContext.ContextInfo.PatchLocationListSize);
     174    AssertRC(rc);
     175    if (RT_FAILURE(rc))
     176        return rc;
    297177
    298178    D3DDDICB_RENDER DdiRender = {0};
     
    327207HRESULT vboxUhgsmiD3DInit(PVBOXUHGSMI_PRIVATE_D3D pHgsmi, PVBOXWDDMDISP_DEVICE pDevice)
    328208{
    329     pHgsmi->Base.pfnBufferCreate = vboxUhgsmiD3DBufferCreate;
    330     pHgsmi->Base.pfnBufferSubmitAsynch = vboxUhgsmiD3DBufferSubmitAsynch;
     209    pHgsmi->BasePrivate.Base.pfnBufferCreate = vboxUhgsmiD3DBufferCreate;
     210    pHgsmi->BasePrivate.Base.pfnBufferSubmitAsynch = vboxUhgsmiD3DBufferSubmitAsynch;
     211    pHgsmi->BasePrivate.hClient = NULL;
    331212    pHgsmi->pDevice = pDevice;
    332213    return S_OK;
    333214}
     215
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiDisp.h

    r32889 r33116  
    1616#define ___VBoxUhgsmiDisp_h__
    1717
    18 #include "../../Miniport/wddm/VBoxUhgsmi.h"
     18#include "VBoxUhgsmiBase.h"
    1919#include "VBoxDispD3DCmn.h"
    2020
    2121typedef struct VBOXUHGSMI_PRIVATE_D3D
    2222{
    23     VBOXUHGSMI Base;
     23    VBOXUHGSMI_PRIVATE_BASE BasePrivate;
    2424    struct VBOXWDDMDISP_DEVICE *pDevice;
    2525} VBOXUHGSMI_PRIVATE_D3D, *PVBOXUHGSMI_PRIVATE_D3D;
    2626
    2727HRESULT vboxUhgsmiD3DInit(PVBOXUHGSMI_PRIVATE_D3D pHgsmi, struct VBOXWDDMDISP_DEVICE *pDevice);
     28
     29
     30
    2831#endif /* #ifndef ___VBoxUhgsmiDisp_h__ */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette