VirtualBox

Changeset 46783 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jun 25, 2013 4:09:37 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86715
Message:

wddm/crOpenGL: more TexPresent impl

Location:
trunk/src/VBox/Additions/WINNT/Graphics
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/common/wddm/VBoxMPIf.h

    r46757 r46783  
    3535
    3636/* One would increase this whenever definitions in this file are changed */
    37 #define VBOXVIDEOIF_VERSION 17
     37#define VBOXVIDEOIF_VERSION 18
    3838
    3939#define VBOXWDDM_NODE_ID_SYSTEM           0
     
    485485{
    486486    uint32_t u32Version;
     487    uint32_t u32VBox3DCaps;
    487488    uint32_t cInfos;
    488489    VBOXVHWA_INFO aInfos[VBOX_VIDEO_MAX_SCREENS];
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxD3DIf.cpp

    r43621 r46783  
    571571            HANDLE hSharedHandle = pAllocation->hSharedHandle;
    572572            IDirect3DSurface9* pD3D9Surf;
    573             switch (pAllocation->enmType)
    574             {
    575                 case VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC:
    576                 {
    577                     hr = pDevice9If->CreateRenderTarget(pAllocation->SurfDesc.width,
    578                             pAllocation->SurfDesc.height,
    579                             vboxDDI2D3DFormat(pRc->RcDesc.enmFormat),
    580                             vboxDDI2D3DMultiSampleType(pRc->RcDesc.enmMultisampleType),
    581                             pRc->RcDesc.MultisampleQuality,
    582                             !pRc->RcDesc.fFlags.NotLockable /* BOOL Lockable */,
    583                             &pD3D9Surf,
     573            if ((pDevice->pAdapter->u32VBox3DCaps & CR_VBOX_CAP_TEX_PRESENT) || pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC)
     574            {
     575                hr = pDevice9If->CreateRenderTarget(pAllocation->SurfDesc.width,
     576                        pAllocation->SurfDesc.height,
     577                        vboxDDI2D3DFormat(pRc->RcDesc.enmFormat),
     578                        vboxDDI2D3DMultiSampleType(pRc->RcDesc.enmMultisampleType),
     579                        pRc->RcDesc.MultisampleQuality,
     580                        !pRc->RcDesc.fFlags.NotLockable /* BOOL Lockable */,
     581                        &pD3D9Surf,
    584582#ifdef VBOXWDDMDISP_DEBUG_NOSHARED
    585                             NULL
     583                        NULL
    586584#else
    587                             pRc->RcDesc.fFlags.SharedResource ? &hSharedHandle : NULL
     585                        pRc->RcDesc.fFlags.SharedResource ? &hSharedHandle : NULL
    588586#endif
    589                     );
    590                     Assert(hr == S_OK);
    591                     break;
    592                 }
    593                 case VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE:
    594                 {
     587                );
     588                Assert(hr == S_OK);
     589            }
     590            else if (pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE)
     591            {
     592                do {
    595593                    BOOL bNeedPresent;
    596594                    if (pRc->cAllocations != 1)
     
    623621                    pD3D9Surf = (IDirect3DSurface9*)pAllocation->pD3DIf;
    624622                    break;
    625                 }
    626                 default:
    627                 {
    628                     WARN(("unexpected alloc type %d", pAllocation->enmType));
    629                     hr = E_FAIL;
    630                     break;
    631                 }
     623                } while (0);
     624            }
     625            else
     626            {
     627                WARN(("unexpected alloc type %d", pAllocation->enmType));
     628                hr = E_FAIL;
    632629            }
    633630
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp

    r46757 r46783  
    44934493    VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice);
    44944494    HRESULT hr = S_OK;
    4495     if (VBOXDISPMODE_IS_3D(pDevice->pAdapter))
     4495    PVBOXWDDMDISP_ADAPTER pAdapter = pDevice->pAdapter;
     4496    PVBOXWDDMDISP_RESOURCE pSrcRc = NULL, pDstRc = NULL;
     4497    PVBOXWDDMDISP_ALLOCATION pSrcAlloc = NULL, pDstAlloc = NULL;
     4498
     4499    if (pData->hSrcResource)
     4500    {
     4501        pSrcRc = (PVBOXWDDMDISP_RESOURCE)pData->hSrcResource;
     4502        Assert(pSrcRc->cAllocations > pData->SrcSubResourceIndex);
     4503        pSrcAlloc = &pSrcRc->aAllocations[pData->SrcSubResourceIndex];
     4504        Assert(pSrcAlloc->hAllocation);
     4505    }
     4506
     4507    if (pData->hDstResource)
     4508    {
     4509        pDstRc = (PVBOXWDDMDISP_RESOURCE)pData->hDstResource;
     4510        Assert(pDstRc->cAllocations > pData->DstSubResourceIndex);
     4511        pDstAlloc = &pDstRc->aAllocations[pData->DstSubResourceIndex];
     4512        Assert(pDstAlloc->hAllocation);
     4513    }
     4514
     4515    if (VBOXDISPMODE_IS_3D(pAdapter))
    44964516    {
    44974517#ifdef VBOXWDDM_TEST_UHGSMI
     
    45044524        }
    45054525#endif
    4506         pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9FlushToHost((IDirect3DDevice9Ex*)pDevice->pDevice9If);
    4507         PVBOXWDDMDISP_RESOURCE pRc = (PVBOXWDDMDISP_RESOURCE)pData->hSrcResource;
    4508         Assert(pRc);
    4509         Assert(pRc->cAllocations > pData->SrcSubResourceIndex);
    4510         PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[pData->SrcSubResourceIndex];
    4511         hr = vboxWddmSwapchainPresent(pDevice, pAlloc);
    4512         Assert(hr == S_OK);
    4513     }
    4514 
    4515     {
    4516         D3DDDICB_PRESENT DdiPresent = {0};
    4517         if (pData->hSrcResource)
    4518         {
     4526        if (pAdapter->u32VBox3DCaps & CR_VBOX_CAP_TEX_PRESENT)
     4527        {
     4528            IDirect3DSurface9 *pSrcSurfIf = NULL;
     4529            hr = VBoxD3DIfSurfGet(pSrcRc, pData->DstSubResourceIndex, &pSrcSurfIf);
     4530            if (SUCCEEDED(hr))
     4531            {
     4532                pAdapter->D3D.D3D.pfnVBoxWineExD3DSurf9SyncToHost(pSrcSurfIf);
     4533            }
     4534            else
     4535            {
     4536                WARN(("VBoxD3DIfSurfGet failed, hr = 0x%x", hr));
     4537                return hr;
     4538            }
     4539
     4540            pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9FlushToHost((IDirect3DDevice9Ex*)pDevice->pDevice9If);
     4541        }
     4542        else
     4543        {
     4544            pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9FlushToHost((IDirect3DDevice9Ex*)pDevice->pDevice9If);
    45194545            PVBOXWDDMDISP_RESOURCE pRc = (PVBOXWDDMDISP_RESOURCE)pData->hSrcResource;
     4546            Assert(pRc);
    45204547            Assert(pRc->cAllocations > pData->SrcSubResourceIndex);
    45214548            PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[pData->SrcSubResourceIndex];
    4522             Assert(pAlloc->hAllocation);
    4523             DdiPresent.hSrcAllocation = pAlloc->hAllocation;
    4524         }
    4525         if (pData->hDstResource)
    4526         {
    4527             PVBOXWDDMDISP_RESOURCE pRc = (PVBOXWDDMDISP_RESOURCE)pData->hDstResource;
    4528             Assert(pRc->cAllocations > pData->DstSubResourceIndex);
    4529             PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[pData->DstSubResourceIndex];
    4530             Assert(pAlloc->hAllocation);
    4531             DdiPresent.hDstAllocation = pAlloc->hAllocation;
    4532         }
    4533         DdiPresent.hContext = pDevice->DefaultContext.ContextInfo.hContext;
     4549            hr = vboxWddmSwapchainPresent(pDevice, pAlloc);
     4550            Assert(hr == S_OK);
     4551        }
     4552    }
     4553
     4554    D3DDDICB_PRESENT DdiPresent = {0};
     4555    if (pSrcAlloc)
     4556        DdiPresent.hSrcAllocation = pSrcAlloc->hAllocation;
     4557
     4558    if (pDstAlloc)
     4559        DdiPresent.hDstAllocation = pDstAlloc->hAllocation;
     4560
     4561    DdiPresent.hContext = pDevice->DefaultContext.ContextInfo.hContext;
    45344562
    45354563#if 0 //def VBOX_WDDMDISP_WITH_PROFILE
    4536         VBoxDispProfileScopeLogger<VBoxDispProfileEntry> profilePresentCbLogger(pDevice->ProfileDdiPresentCb.alloc("pfnPresentCb"));
     4564    VBoxDispProfileScopeLogger<VBoxDispProfileEntry> profilePresentCbLogger(pDevice->ProfileDdiPresentCb.alloc("pfnPresentCb"));
    45374565#endif
     4566
    45384567#ifdef VBOXWDDMDISP_DEBUG_TIMER
    4539         HANDLE hTimer = NULL;
    4540         vboxVDbgTimerStart(pDevice->hTimerQueue, &hTimer, 1000);
     4568    HANDLE hTimer = NULL;
     4569    vboxVDbgTimerStart(pDevice->hTimerQueue, &hTimer, 1000);
    45414570#endif
    4542         hr = pDevice->RtCallbacks.pfnPresentCb(pDevice->hDevice, &DdiPresent);
     4571    hr = pDevice->RtCallbacks.pfnPresentCb(pDevice->hDevice, &DdiPresent);
    45434572#ifdef VBOXWDDMDISP_DEBUG_TIMER
    4544         vboxVDbgTimerStop(pDevice->hTimerQueue, hTimer);
     4573    vboxVDbgTimerStop(pDevice->hTimerQueue, hTimer);
    45454574#endif
    45464575#if 0 //def VBOX_WDDMDISP_WITH_PROFILE
    4547         profilePresentCbLogger.logAndDisable();
    4548         if (pDevice->ProfileDdiPresentCb.getNumEntries() == 64)
    4549         {
    4550             pDevice->ProfileDdiPresentCb.dump(pDevice);
    4551             pDevice->ProfileDdiPresentCb.reset();
    4552         }
     4576    profilePresentCbLogger.logAndDisable();
     4577    if (pDevice->ProfileDdiPresentCb.getNumEntries() == 64)
     4578    {
     4579        pDevice->ProfileDdiPresentCb.dump(pDevice);
     4580        pDevice->ProfileDdiPresentCb.reset();
     4581    }
    45534582#endif
    4554         Assert(hr == S_OK);
    4555     }
     4583    Assert(hr == S_OK);
    45564584
    45574585    vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr));
     
    61806208        pAdapter->RtCallbacks = *pOpenData->pAdapterCallbacks;
    61816209
     6210        pAdapter->u32VBox3DCaps = Query.u32VBox3DCaps;
     6211
    61826212        pAdapter->cHeads = Query.cInfos;
    6183 
    61846213
    61856214        pOpenData->hAdapter = pAdapter;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h

    r44529 r46783  
    7979    VBOXWDDMDISP_D3D D3D;
    8080    VBOXWDDMDISP_FORMATS Formats;
     81    uint32_t u32VBox3DCaps;
    8182#ifdef VBOX_WDDMDISP_WITH_PROFILE
    8283    VBoxDispProfileFpsCounter ProfileDdiFps;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DCmn.h

    r44529 r46783  
    6767#include "VBoxD3DIf.h"
    6868#endif
     69#include <cr_protocol.h>
    6970
    7071# ifdef VBOXWDDMDISP
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.cpp

    r46757 r46783  
    146146        {
    147147            WARN(("no VBoxWineExD3DSurf9GetHostId"));
     148            break;
     149        }
     150
     151        pD3D->pfnVBoxWineExD3DSurf9SyncToHost = (PFNVBOXWINEEXD3DSURF9_SYNCTOHOST)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DSurf9SyncToHost");
     152        if (!pD3D->pfnVBoxWineExD3DSurf9SyncToHost)
     153        {
     154            WARN(("no VBoxWineExD3DSurf9SyncToHost"));
    148155            break;
    149156        }
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.h

    r46757 r46783  
    8181    PFNVBOXWINEEXD3DSURF9_GETHOSTID pfnVBoxWineExD3DSurf9GetHostId;
    8282
     83    PFNVBOXWINEEXD3DSURF9_SYNCTOHOST pfnVBoxWineExD3DSurf9SyncToHost;
     84
    8385    PFNVBOXWINEEXD3DSWAPCHAIN9_GETHOSTWINID pfnVBoxWineExD3DSwapchain9GetHostWinID;
    8486
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCr.cpp

    r46757 r46783  
    2424#ifdef VBOX_WITH_CROGL
    2525#include <cr_protocol.h>
     26
     27static uint32_t g_VBoxMpCrHostCaps = 0;
     28
     29uint32_t VBoxMpCrGetHostCaps()
     30{
     31    return g_VBoxMpCrHostCaps;
     32}
    2633
    2734static void* vboxMpCrShgsmiBufferAlloc(PVBOXMP_DEVEXT pDevExt, HGSMISIZE cbData)
     
    527534    CRVBOXHGSMIWRITEREAD *pCmd = &pWrData->Cmd;
    528535
    529     pDr->fFlags = VBOXVDMACBUF_FLAG_BUF_VRAM_OFFSET;
     536    pDr->fFlags = VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR;
    530537    pDr->cbBuf = cbCmd;
    531538    pDr->rc = VERR_NOT_IMPLEMENTED;
    532     pDr->Location.offVramBuf = vboxMpCrShgsmiTransportBufOffset(pCon, pCmd);
     539//    pDr->Location.offVramBuf = vboxMpCrShgsmiTransportBufOffset(pCon, pCmd);
     540
    533541
    534542    pHdr->enmType = VBOXVDMACMD_TYPE_CHROMIUM_CMD;
     
    546554
    547555    VBOXVDMACMD_CHROMIUM_BUFFER *pBufCmd = &pBody->aBuffers[0];
    548     pBufCmd->offBuffer = vboxMpCrShgsmiTransportBufOffset(pCon, pCmd);
     556    pBufCmd->offBuffer = vboxVdmaCBufDrPtrOffset(&pDevExt->u.primary.Vdma, pCmd);
    549557    pBufCmd->cbBuffer = sizeof (*pCmd);
    550558    pBufCmd->u32GuestData = 0;
     
    569577        PFNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEASYNC_COMPLETION pfnCompletion, uint32_t cbContextData)
    570578{
    571 
    572579    const uint32_t cBuffers = 2;
    573580    const uint32_t cbCmd = VBOXMP_CRSHGSMICON_DR_SIZE(cBuffers, sizeof (VBOXMP_CRHGSMICMD_WRITE), cbContextData);
     
    708715        return parms.hdr.result;
    709716    }
     717    return VINF_SUCCESS;
     718}
     719
     720static int vboxMpCrCtlConGetCaps(PVBOXMP_CRCTLCON pCrCtlCon, uint32_t u32ClientID, uint32_t *pu32Caps)
     721{
     722    CRVBOXHGCMGETCAPS parms;
     723    int rc;
     724
     725    parms.hdr.result      = VERR_WRONG_ORDER;
     726    parms.hdr.u32ClientID = u32ClientID;
     727    parms.hdr.u32Function = SHCRGL_GUEST_FN_GET_CAPS;
     728    parms.hdr.cParms      = SHCRGL_CPARMS_GET_CAPS;
     729
     730    parms.Caps.type      = VMMDevHGCMParmType_32bit;
     731    parms.Caps.u.value32 = 0;
     732
     733    *pu32Caps = 0;
     734
     735    rc = vboxCrCtlConCall(pCrCtlCon->hCrCtl, &parms.hdr, sizeof (parms));
     736    if (RT_FAILURE(rc))
     737    {
     738        WARN(("vboxCrCtlConCall failed, rc (%d)", rc));
     739        return rc;
     740    }
     741
     742    if (RT_FAILURE(parms.hdr.result))
     743    {
     744        WARN(("SHCRGL_GUEST_FN_GET_CAPS failed, rc (%d)", parms.hdr.result));
     745        return parms.hdr.result;
     746    }
     747
     748    *pu32Caps = parms.Caps.u.value32;
     749
    710750    return VINF_SUCCESS;
    711751}
     
    835875    }
    836876
     877    rc = vboxMpCrCtlConGetCaps(&CrCtlCon, u32ClientID, &g_VBoxMpCrHostCaps);
     878    if (RT_FAILURE(rc))
     879    {
     880        WARN(("vboxMpCrCtlConGetCaps failed rc (%d), ignoring..", rc));
     881        g_VBoxMpCrHostCaps = 0;
     882    }
     883
    837884    rc = VBoxMpCrCtlConDisconnect(&CrCtlCon, u32ClientID);
    838885    if (RT_FAILURE(rc))
    839         WARN(("VBoxMpCrCtlConDisconnect failed, ignoring.."));
     886        WARN(("VBoxMpCrCtlConDisconnect failed rc (%d), ignoring..", rc));
    840887
    841888    return true;
     
    844891#endif
    845892}
     893
     894int VBoxMpCrCmdRxReadbackHandler(CRMessageReadback *pRx, uint32_t cbRx)
     895{
     896    if (cbRx < sizeof (*pRx))
     897    {
     898        WARN(("invalid rx size %d", cbRx));
     899        return VERR_INVALID_PARAMETER;
     900    }
     901    void* pvData = VBoxMpCrCmdRxReadbackData(pRx);
     902    uint32_t cbData = VBoxMpCrCmdRxReadbackDataSize(pRx, cbRx);
     903    void *pvDataPtr = *((void**)&pRx->readback_ptr);
     904    memcpy(pvDataPtr, pvData, cbData);
     905    return VINF_SUCCESS;
     906}
     907
     908int VBoxMpCrCmdRxHandler(CRMessageHeader *pRx, uint32_t cbRx)
     909{
     910    if (cbRx < sizeof (*pRx))
     911    {
     912        WARN(("invalid rx size %d", cbRx));
     913        return VERR_INVALID_PARAMETER;
     914    }
     915    CRMessageHeader *pHdr = (CRMessageHeader*)pRx;
     916    switch (pHdr->type)
     917    {
     918        case CR_MESSAGE_READBACK:
     919            return VBoxMpCrCmdRxReadbackHandler((CRMessageReadback*)pRx, cbRx);
     920        default:
     921            WARN(("unsupported rx message type: %d", pHdr->type));
     922            return VERR_INVALID_PARAMETER;
     923    }
     924}
     925
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCr.h

    r46757 r46783  
    217217    }
    218218}
     219
     220DECLINLINE(void*) VBoxMpCrCmdRxReadbackData(CRMessageReadback *pRx)
     221{
     222    return (void*)(pRx+1);
     223}
     224
     225DECLINLINE(uint32_t) VBoxMpCrCmdRxReadbackDataSize(CRMessageReadback *pRx, uint32_t cbRx)
     226{
     227    return cbRx - sizeof (*pRx);
     228}
     229int VBoxMpCrCmdRxReadbackHandler(CRMessageReadback *pRx, uint32_t cbRx);
     230int VBoxMpCrCmdRxHandler(CRMessageHeader *pRx, uint32_t cbRx);
     231
     232/* must be called after calling VBoxMpCrCtlConIs3DSupported only */
     233uint32_t VBoxMpCrGetHostCaps();
     234
    219235#define VBOXMP_CRCMD_HEADER_SIZE sizeof (CRMessageOpcodes)
    220236/* last +4 below is 4-aligned comand opcode size (i.e. ((1 + 3) & ~3)) */
     
    224240#define VBOXMP_CRCMD_SIZE_WINDOWSHOW (16 + 4)
    225241#define VBOXMP_CRCMD_SIZE_WINDOWSIZE (20 + 4)
     242#define VBOXMP_CRCMD_SIZE_GETCHROMIUMPARAMETERVCR (36 + 4)
    226243
    227244#endif /* #ifndef ___VBoxMPCr_h__ */
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp

    r46757 r46783  
    322322}
    323323
    324 NTSTATUS vboxVdmaCrSubmitWriteAsync(PVBOXMP_DEVEXT pDevExt, VBOXMP_CRPACKER *pCrPacker, uint32_t u32CrConClientID)
     324typedef struct VBOXMP_VDMACR_WRITEREADCOMPLETION
     325{
     326    void *pvBufferToFree;
     327    void *pvContext;
     328} VBOXMP_VDMACR_WRITEREADCOMPLETION, *PVBOXMP_VDMACR_WRITEREADCOMPLETION;
     329
     330void vboxVdmaCrSubmitWriteReadAsyncGenericCompletion(PVBOXMP_CRSHGSMITRANSPORT pCon, void *pvCtx)
     331{
     332    PVBOXMP_VDMACR_WRITEREADCOMPLETION pData = (PVBOXMP_VDMACR_WRITEREADCOMPLETION)pvCtx;
     333    void* pvBufferToFree = pData->pvBufferToFree;
     334    if (pvBufferToFree)
     335        VBoxMpCrShgsmiTransportBufFree(pCon, pvBufferToFree);
     336
     337    VBoxMpCrShgsmiTransportCmdTermWriteReadAsync(pCon, pvCtx);
     338}
     339
     340NTSTATUS vboxVdmaCrSubmitWriteReadAsync(PVBOXMP_DEVEXT pDevExt, VBOXMP_CRPACKER *pCrPacker, uint32_t u32CrConClientID, PFNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION pfnCompletion, void *pvCompletion)
    325341{
    326342    Assert(u32CrConClientID);
     
    331347    if (pvBuffer)
    332348    {
     349        PVBOXMP_VDMACR_WRITEREADCOMPLETION pvCompletionData = (PVBOXMP_VDMACR_WRITEREADCOMPLETION)VBoxMpCrShgsmiTransportCmdCreateWriteReadAsync(&pDevExt->CrHgsmiTransport, u32CrConClientID, pvBuffer, cbBuffer,
     350                pfnCompletion, sizeof (*pvCompletionData));
     351        if (pvCompletionData)
     352        {
     353            pvCompletionData->pvBufferToFree = pvPackBuffer;
     354            pvCompletionData->pvContext = pvCompletion;
     355            int rc = VBoxMpCrShgsmiTransportCmdSubmitWriteReadAsync(&pDevExt->CrHgsmiTransport, pvCompletionData);
     356            if (RT_SUCCESS(rc))
     357            {
     358                return STATUS_SUCCESS;
     359            }
     360            WARN(("VBoxMpCrShgsmiTransportCmdSubmitWriteAsync failed, rc %d", rc));
     361            Status = STATUS_UNSUCCESSFUL;
     362            VBoxMpCrShgsmiTransportCmdTermWriteReadAsync(&pDevExt->CrHgsmiTransport, pvCompletionData);
     363        }
     364        else
     365        {
     366            WARN(("VBoxMpCrShgsmiTransportCmdCreateWriteAsync failed"));
     367            Status = STATUS_INSUFFICIENT_RESOURCES;
     368        }
     369    }
     370
     371    return Status;
     372}
     373
     374NTSTATUS vboxVdmaCrSubmitWriteAsync(PVBOXMP_DEVEXT pDevExt, VBOXMP_CRPACKER *pCrPacker, uint32_t u32CrConClientID)
     375{
     376    Assert(u32CrConClientID);
     377    NTSTATUS Status = STATUS_SUCCESS;
     378    uint32_t cbBuffer;
     379    void * pvPackBuffer;
     380    void * pvBuffer = VBoxMpCrPackerTxBufferComplete(pCrPacker, &cbBuffer, &pvPackBuffer);
     381    if (pvBuffer)
     382    {
    333383        PVBOXMP_VDMACR_WRITECOMPLETION pvCompletionData = (PVBOXMP_VDMACR_WRITECOMPLETION)VBoxMpCrShgsmiTransportCmdCreateWriteAsync(&pDevExt->CrHgsmiTransport, u32CrConClientID, pvBuffer, cbBuffer,
    334384                vboxVdmaCrWriteCompletion, sizeof (*pvCompletionData));
     
    337387            pvCompletionData->pvBufferToFree = pvPackBuffer;
    338388            int rc = VBoxMpCrShgsmiTransportCmdSubmitWriteAsync(&pDevExt->CrHgsmiTransport, pvCompletionData);
    339             if (!RT_SUCCESS(rc))
     389            if (RT_SUCCESS(rc))
    340390            {
    341                 WARN(("VBoxMpCrShgsmiTransportCmdSubmitWriteAsync failed, rc %d", rc));
    342                 Status = STATUS_UNSUCCESSFUL;
     391                return STATUS_SUCCESS;
    343392            }
     393            WARN(("VBoxMpCrShgsmiTransportCmdSubmitWriteAsync failed, rc %d", rc));
     394            Status = STATUS_UNSUCCESSFUL;
     395            VBoxMpCrShgsmiTransportCmdTermWriteAsync(&pDevExt->CrHgsmiTransport, pvCompletionData);
    344396        }
    345397        else
    346398        {
    347399            WARN(("VBoxMpCrShgsmiTransportCmdCreateWriteAsync failed"));
    348             Status = STATUS_NO_MEMORY;
     400            Status = STATUS_INSUFFICIENT_RESOURCES;
    349401        }
    350402    }
     
    550602    {
    551603        WARN(("VBoxMpCrShgsmiTransportBufAlloc failed!"));
    552         Status = STATUS_NO_MEMORY;
     604        Status = STATUS_INSUFFICIENT_RESOURCES;
    553605        goto done;
    554606    }
     
    793845}
    794846
     847typedef struct VBOXVDMA_CRRXGENERICSYNC
     848{
     849    int rc;
     850    KEVENT Event;
     851} VBOXVDMA_CRRXGENERICSYNC, *PVBOXVDMA_CRRXGENERICSYNC;
     852
     853static DECLCALLBACK(void) vboxVdmaCrRxGenericSyncCompletion(PVBOXMP_CRSHGSMITRANSPORT pCon, int rc, void *pvRx, uint32_t cbRx, void *pvCtx)
     854{
     855    PVBOXMP_VDMACR_WRITEREADCOMPLETION pvCompletionData = (PVBOXMP_VDMACR_WRITEREADCOMPLETION)pvCtx;
     856    PVBOXVDMA_CRRXGENERICSYNC pData = (PVBOXVDMA_CRRXGENERICSYNC)pvCompletionData->pvContext;
     857    if (RT_SUCCESS(rc))
     858    {
     859        rc = VBoxMpCrCmdRxHandler((CRMessageHeader*)pvRx, cbRx);
     860        if (!RT_SUCCESS(rc))
     861        {
     862            WARN(("VBoxMpCrCmdRxHandler failed %d", rc));
     863        }
     864    }
     865    else
     866    {
     867        WARN(("rx failure %d", rc));
     868    }
     869
     870    pData->rc = rc;
     871
     872    KeSetEvent(&pData->Event, 0, FALSE);
     873
     874    vboxVdmaCrSubmitWriteReadAsyncGenericCompletion(pCon, pvCtx);
     875}
     876
     877NTSTATUS vboxVdmaCrRxGenericSync(PVBOXMP_DEVEXT pDevExt, VBOXMP_CRPACKER *pCrPacker, uint32_t u32CrConClientID)
     878{
     879    VBOXVDMA_CRRXGENERICSYNC Data;
     880    Data.rc = VERR_NOT_SUPPORTED;
     881    KeInitializeEvent(&Data.Event, SynchronizationEvent, FALSE);
     882    NTSTATUS Status = vboxVdmaCrSubmitWriteReadAsync(pDevExt, pCrPacker, u32CrConClientID, vboxVdmaCrRxGenericSyncCompletion, &Data);
     883    if (!NT_SUCCESS(Status))
     884    {
     885        WARN(("vboxVdmaCrSubmitWriteAsync failed Status 0x%x", Status));
     886        return Status;
     887    }
     888
     889     Status = KeWaitForSingleObject(&Data.Event, Executive, KernelMode, FALSE, NULL /* PLARGE_INTEGER Timeout */);
     890     if (!NT_SUCCESS(Status))
     891     {
     892         WARN(("KeWaitForSingleObject failed Status 0x%x", Status));
     893         return Status;
     894     }
     895
     896     return STATUS_SUCCESS;
     897}
     898
     899#if 0
     900NTSTATUS vboxVdmaCrCmdGetChromiumParametervCR(PVBOXMP_DEVEXT pDevExt, uint32_t u32CrConClientID, GLenum target, GLuint index, GLenum type, GLsizei count, GLvoid * values)
     901{
     902    uint32_t cbCommandBuffer = VBOXMP_CRCMD_HEADER_SIZE + VBOXMP_CRCMD_SIZE_GETCHROMIUMPARAMETERVCR;
     903    uint32_t cCommands = 1;
     904    void *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer);
     905    if (!pvCommandBuffer)
     906    {
     907        WARN(("VBoxMpCrShgsmiTransportBufAlloc failed!"));
     908        return VERR_OUT_OF_RESOURCES;
     909    }
     910
     911    VBOXMP_CRPACKER CrPacker;
     912    VBoxMpCrPackerInit(&CrPacker);
     913
     914    VBoxMpCrPackerTxBufferInit(&CrPacker, pvCommandBuffer, cbCommandBuffer, cCommands);
     915
     916    int dummy = 1;
     917
     918    crPackGetChromiumParametervCR(&CrPacker.CrPacker, target, index, type, count, values, &dummy);
     919
     920
     921    NTSTATUS Status = vboxVdmaCrRxGenericSync(pDevExt, &CrPacker, u32CrConClientID);
     922    if (!NT_SUCCESS(Status))
     923    {
     924        WARN(("vboxVdmaCrRxGenericSync failed Status 0x%x", Status));
     925        VBoxMpCrShgsmiTransportBufFree(&pDevExt->CrHgsmiTransport, pvCommandBuffer);
     926        return Status;
     927    }
     928
     929
     930    return STATUS_SUCCESS;
     931}
     932#endif
     933
    795934static NTSTATUS vboxVdmaSubitVBoxTexPresent(PVBOXMP_DEVEXT pDevExt,
    796935        VBOXMP_CRPACKER *pCrPacker,
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r46757 r46783  
    11661166
    11671167                    VBoxMpCrShgsmiTransportCreate(&pDevExt->CrHgsmiTransport, pDevExt);
    1168                     /* @todo: implement detection */
    1169                     pDevExt->fTexPresentEnabled = FALSE;
     1168
     1169                    pDevExt->fTexPresentEnabled = !!(VBoxMpCrGetHostCaps() & CR_VBOX_CAP_TEX_PRESENT);
    11701170
    11711171                    for (UINT i = 0; i < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i)
     
    19881988#endif
    19891989            {
    1990                 Assert (pQueryAdapterInfo->OutputDataSize >= sizeof (VBOXWDDM_QI));
    1991                 if (pQueryAdapterInfo->OutputDataSize >= sizeof (VBOXWDDM_QI))
     1990                if (pQueryAdapterInfo->OutputDataSize == sizeof (VBOXWDDM_QI))
    19921991                {
    19931992                    VBOXWDDM_QI * pQi = (VBOXWDDM_QI*)pQueryAdapterInfo->pOutputData;
     
    20042003                else
    20052004                {
    2006                     LOGREL(("buffer too small"));
     2005                    WARN(("incorrect buffer size %d, expected %d", pQueryAdapterInfo->OutputDataSize, sizeof (VBOXWDDM_QI)));
    20072006                    Status = STATUS_BUFFER_TOO_SMALL;
    20082007                }
     
    60776076                Assert(tmpStatus == STATUS_SUCCESS);
    60786077            }
     6078
     6079            int rc = VBoxMpCrCtlConConnect(&pDevExt->CrCtlCon, CR_PROTOCOL_VERSION_MAJOR, CR_PROTOCOL_VERSION_MINOR, &pContext->u32CrConClientID);
     6080            if (RT_SUCCESS(rc))
     6081            {
     6082                VBoxMpCrPackerInit(&pContext->CrPacker);
     6083            }
     6084            else
     6085            {
     6086                WARN(("VBoxMpCrCtlConConnect failed rc (%d)", rc));
     6087                Status = STATUS_UNSUCCESSFUL;
     6088            }
    60796089        }
    60806090        else
     
    61036113                                if (Status == STATUS_SUCCESS)
    61046114                                {
    6105                                     int rc = VINF_SUCCESS;
    61066115                                    if (pInfo->crVersionMajor || pInfo->crVersionMinor)
    61076116                                    {
    6108                                         rc = VBoxMpCrCtlConConnect(&pDevExt->CrCtlCon,
     6117                                        int rc = VBoxMpCrCtlConConnect(&pDevExt->CrCtlCon,
    61096118                                            pInfo->crVersionMajor, pInfo->crVersionMinor,
    61106119                                            &pContext->u32CrConClientID);
     
    61206129                                    }
    61216130
    6122                                     if (RT_SUCCESS(rc))
     6131                                    if (NT_SUCCESS(Status))
    61236132                                    {
    61246133                                        ASMAtomicIncU32(&pDevExt->cContexts3D);
     
    61416150                        if (Status == STATUS_SUCCESS)
    61426151                        {
    6143                             int rc = VINF_SUCCESS;
    61446152                            if (pInfo->crVersionMajor || pInfo->crVersionMinor)
    61456153                            {
    6146                                 rc = VBoxMpCrCtlConConnect(&pDevExt->CrCtlCon,
     6154                                int rc = VBoxMpCrCtlConConnect(&pDevExt->CrCtlCon,
    61476155                                    pInfo->crVersionMajor, pInfo->crVersionMinor,
    61486156                                    &pContext->u32CrConClientID);
     
    61546162                            }
    61556163
    6156                             if (RT_SUCCESS(rc))
     6164                            if (NT_SUCCESS(Status))
    61576165                            {
    61586166                                ASMAtomicIncU32(&pDevExt->cContexts3D);
     
    62206228            uint32_t cContexts = ASMAtomicDecU32(&pDevExt->cContexts3D);
    62216229            Assert(cContexts < UINT32_MAX/2);
    6222             if (pContext->u32CrConClientID)
    6223             {
    6224                 VBoxMpCrCtlConDisconnect(&pDevExt->CrCtlCon, pContext->u32CrConClientID);
    6225             }
    62266230            break;
    62276231        }
     
    62346238        default:
    62356239            break;
     6240    }
     6241
     6242    if (pContext->u32CrConClientID)
     6243    {
     6244        VBoxMpCrCtlConDisconnect(&pDevExt->CrCtlCon, pContext->u32CrConClientID);
    62366245    }
    62376246
     
    66746683    ULONG major, minor, build;
    66756684    BOOLEAN checkedBuild = PsGetVersion(&major, &minor, &build, NULL);
    6676     BOOLEAN f3DCheckRequired = FALSE;
     6685    BOOLEAN f3DRequired = FALSE;
    66776686
    66786687    LOGREL(("OsVersion( %d, %d, %d )", major, minor, build));
     
    66866695        {
    66876696            WARN(("Unknow win version, newer major release, assuming 3D check is required"));
    6688             f3DCheckRequired = TRUE;
     6697            f3DRequired = TRUE;
    66896698        }
    66906699        else if (major == 6)
     
    66936702            {
    66946703                WARN(("Unknow win version, newer minor release, assuming 3D check is required"));
    6695                 f3DCheckRequired = TRUE;
     6704                f3DRequired = TRUE;
    66966705            }
    66976706            else if (minor == 2)
    66986707            {
    66996708                LOG(("3D check is required!"));
    6700                 f3DCheckRequired = TRUE;
     6709                f3DRequired = TRUE;
    67016710            }
    67026711            else
    67036712            {
    67046713                LOG(("3D is NOT required!"));
    6705                 f3DCheckRequired = FALSE;
     6714                f3DRequired = FALSE;
    67066715            }
    67076716        }
     
    67096718        {
    67106719            WARN(("Unsupported OLDER win version, ignore and assume 3D is NOT required"));
    6711             f3DCheckRequired = FALSE;
     6720            f3DRequired = FALSE;
    67126721        }
    67136722
    67146723        Status = STATUS_SUCCESS;
    67156724
    6716         if (f3DCheckRequired)
    6717         {
    6718             LOG(("3D check is required, doing the 3D check.."));
    6719             if (!VBoxMpCrCtlConIs3DSupported())
    6720             {
     6725        /* always need to do the check to request host caps */
     6726        LOG(("Doing the 3D check.."));
     6727        if (!VBoxMpCrCtlConIs3DSupported())
     6728        {
    67216729#ifdef VBOX_WDDM_WIN8
    6722                 LOGREL(("3D is NOT supported by the host, falling back to display-only mode.."));
    6723                 g_VBoxDisplayOnly = 1;
     6730            Assert(f3DRequired);
     6731            LOGREL(("3D is NOT supported by the host, falling back to display-only mode.."));
     6732            g_VBoxDisplayOnly = 1;
    67246733#else
     6734            if (f3DRequired)
     6735            {
    67256736                LOGREL(("3D is NOT supported by the host, but is required for the current guest version using this driver.."));
    67266737                Status = STATUS_UNSUCCESSFUL;
    6727 #endif
    6728             }
     6738            }
     6739            else
     6740                LOGREL(("3D is NOT supported by the host, but is NOT required for the current guest version using this driver, continuing with Disabled 3D.."));
     6741#endif
    67296742        }
    67306743
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_gl.h

    r44306 r46783  
    38183818#define GL_RCUSAGE_TEXTURE_CLEAR_CR   0x8B2A
    38193819/*configures host to create windows initially hidden*/
    3820 #define GL_HOST_WND_CREATED_HIDDEN    0x8B2B
     3820#define GL_HOST_WND_CREATED_HIDDEN_CR    0x8B2B
    38213821
    38223822typedef void (WINE_GLAPI *PGLFNCHROMIUMPARAMETERUCR)(GLenum param, GLint value);
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/d3d9/d3d9wddm.def

    r46757 r46783  
    2424  VBoxWineExD3DSurf9GetHostId
    2525  VBoxWineExD3DSwapchain9GetHostWinID
     26  VBoxWineExD3DSurf9SyncToHost
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/d3d9/surface.c

    r46662 r46783  
    469469    return hr;
    470470}
     471
     472VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DSurf9SyncToHost(IDirect3DSurface9 *iface)
     473{
     474    struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
     475    HRESULT hr;
     476    wined3d_mutex_lock();
     477    hr = wined3d_surface_sync_to_host(surface->wined3d_surface);
     478    wined3d_mutex_unlock();
     479    return hr;
     480}
    471481#endif
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/vbox/VBoxWineEx.h

    r46757 r46783  
    8181typedef FNVBOXWINEEXD3DSURF9_GETHOSTID *PFNVBOXWINEEXD3DSURF9_GETHOSTID;
    8282
     83typedef VBOXWINEEX_DECL(HRESULT) FNVBOXWINEEXD3DSURF9_SYNCTOHOST(IDirect3DSurface9 *iface);
     84typedef FNVBOXWINEEXD3DSURF9_SYNCTOHOST *PFNVBOXWINEEXD3DSURF9_SYNCTOHOST;
     85
    8386typedef VBOXWINEEX_DECL(HRESULT) FNVBOXWINEEXD3DSWAPCHAIN9_PRESENT(IDirect3DSwapChain9 *iface, IDirect3DSurface9 *surf);
    8487typedef FNVBOXWINEEXD3DSWAPCHAIN9_PRESENT *PFNVBOXWINEEXD3DSWAPCHAIN9_PRESENT;
     
    128131VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DSurf9GetHostId(IDirect3DSurface9 *iface, uint32_t *pu32Id);
    129132
     133/* makes the surface contents to be synched with host,
     134 * i.e. typically in case wine surface's location is in sysmem, puts it to texture*/
     135VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DSurf9SyncToHost(IDirect3DSurface9 *iface);
     136
    130137/* used for backwards compatibility purposes only with older host versions not supportgin new present mechanism */
    131138VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DSwapchain9Present(IDirect3DSwapChain9 *iface,
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/vbox/libWineStub/include/wine/wined3d.h

    r46662 r46783  
    24802480HRESULT __cdecl wined3d_device_blt_voltex(struct wined3d_device *device, struct wined3d_texture *src, struct wined3d_texture *dst, const struct wined3d_box *pSrcBoxArg, const struct VBOXPOINT3D *pDstPoin3D);
    24812481HRESULT __cdecl wined3d_surface_get_host_id(struct wined3d_surface *surface, uint32_t *id);
     2482HRESULT __cdecl wined3d_surface_sync_to_host(struct wined3d_surface *surface);
    24822483
    24832484HRESULT __cdecl wined3d_swapchain_present_rt(struct wined3d_swapchain *swapchain, struct wined3d_surface *rt);
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/context.c

    r46545 r46783  
    19281928# endif
    19291929# if defined(VBOX_WITH_WDDM)
    1930     pglChromiumParameteriCR(GL_HOST_WND_CREATED_HIDDEN,  GL_TRUE);
     1930    pglChromiumParameteriCR(GL_HOST_WND_CREATED_HIDDEN_CR,  GL_TRUE);
    19311931# endif
    19321932#endif
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/surface.c

    r46662 r46783  
    77897789    return S_OK;
    77907790}
     7791
     7792HRESULT CDECL wined3d_surface_sync_to_host(struct wined3d_surface *surface)
     7793{
     7794    HRESULT hr = surface_load_location(surface, SFLAG_INTEXTURE, NULL);
     7795    if (!SUCCEEDED(hr))
     7796    {
     7797        ERR("surface_load_location failed hr 0x%x", hr);
     7798        return hr;
     7799    }
     7800
     7801    return S_OK;
     7802}
    77917803#endif
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/wined3d_gl.h

    r46757 r46783  
    177177#define GL_RCUSAGE_TEXTURE_CLEAR_CR   0x8B2A
    178178/*configures host to create windows initially hidden*/
    179 #define GL_HOST_WND_CREATED_HIDDEN    0x8B2B
     179#define GL_HOST_WND_CREATED_HIDDEN_CR 0x8B2B
    180180
    181181typedef void (WINE_GLAPI *PGLFNCHROMIUMPARAMETERUCR)(GLenum param, GLint value);
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/wined3dwddm.def

    r46757 r46783  
    259259  wined3d_swapchain_present_rt
    260260  wined3d_surface_get_host_id
     261  wined3d_surface_sync_to_host
    261262  wined3d_swapchain_get_host_win_id
Note: See TracChangeset for help on using the changeset viewer.

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