VirtualBox

Changeset 71862 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 16, 2018 12:49:15 PM (7 years ago)
Author:
vboxsync
Message:

WDDM: miniport/display drivers interface adjustments and cleanups.

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Video
Files:
7 edited

Legend:

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

    r71167 r71862  
    3333
    3434/* One would increase this whenever definitions in this file are changed */
    35 #define VBOXVIDEOIF_VERSION 20
     35#define VBOXVIDEOIF_VERSION 21
     36
     37/** @todo VBOXVIDEO_HWTYPE probably needs to be in VBoxVideo.h */
     38typedef enum VBOXVIDEO_HWTYPE
     39{
     40    VBOXVIDEO_HWTYPE_CROGL  = 0,
     41    VBOXVIDEO_HWTYPE_VMSVGA = 1,
     42    VBOXVIDEO_HWTYPE_32BIT  = 0x7fffffff
     43} VBOXVIDEO_HWTYPE;
     44AssertCompileSize(VBOXVIDEO_HWTYPE, 4);
    3645
    3746#define VBOXWDDM_NODE_ID_SYSTEM             0
     
    491500} VBOXDISPIFESCAPE_CRHGSMICTLCON_CALL, *PVBOXDISPIFESCAPE_CRHGSMICTLCON_CALL;
    492501
    493 /* query info func */
    494 typedef struct VBOXWDDM_QI
    495 {
    496     uint32_t u32Version;
    497     uint32_t u32VBox3DCaps;
    498     uint32_t cInfos;
    499     VBOXVHWA_INFO aInfos[VBOX_VIDEO_MAX_SCREENS];
    500 } VBOXWDDM_QI;
     502
     503/* D3DDDICB_QUERYADAPTERINFO::pPrivateDriverData */
     504typedef struct VBOXWDDM_QAI
     505{
     506    uint32_t            u32Version;      /* VBOXVIDEOIF_VERSION */
     507    uint32_t            u32Reserved;     /* Must be 0. */
     508    VBOXVIDEO_HWTYPE    enmHwType;       /* Hardware type. Determines what kind of data is returned. */
     509    uint32_t            cInfos;          /* Number of initialized elements in aInfos (equal to number of guest
     510                                          * displays). 0 if VBOX_WITH_VIDEOHWACCEL is not defined. */
     511    VBOXVHWA_INFO       aInfos[VBOX_VIDEO_MAX_SCREENS]; /* cInfos elements are initialized. */
     512    union
     513    {
     514        struct
     515        {
     516            /* VBOXVIDEO_HWTYPE_CROGL */
     517            uint32_t    u32VBox3DCaps;   /* CR_VBOX_CAP_* */
     518        } crogl;
     519    } u;
     520} VBOXWDDM_QAI;
    501521
    502522/** Convert a given FourCC code to a D3DDDIFORMAT enum. */
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp

    r71329 r71862  
    66466646    LOGREL(("Built %s %s", __DATE__, __TIME__));
    66476647
    6648     VBOXWDDM_QI Query;
     6648    VBOXWDDM_QAI Query;
    66496649    D3DDDICB_QUERYADAPTERINFO DdiQuery;
    66506650    DdiQuery.PrivateDriverDataSize = sizeof(Query);
     
    66736673    PVBOXWDDMDISP_ADAPTER pAdapter = (PVBOXWDDMDISP_ADAPTER)RTMemAllocZ(RT_OFFSETOF(VBOXWDDMDISP_ADAPTER, aHeads[Query.cInfos]));
    66746674#else
    6675     PVBOXWDDMDISP_ADAPTER pAdapter = (PVBOXWDDMDISP_ADAPTER)RTMemAllocZ(sizeof (VBOXWDDMDISP_ADAPTER));
     6675    Assert(Query.cInfos == 0);
     6676    PVBOXWDDMDISP_ADAPTER pAdapter = (PVBOXWDDMDISP_ADAPTER)RTMemAllocZ(sizeof(VBOXWDDMDISP_ADAPTER));
    66766677#endif
    66776678    Assert(pAdapter);
     
    66836684        pAdapter->RtCallbacks = *pOpenData->pAdapterCallbacks;
    66846685
    6685         pAdapter->u32VBox3DCaps = Query.u32VBox3DCaps;
    6686 
     6686        pAdapter->enmHwType = Query.enmHwType;
     6687
     6688        if (Query.enmHwType == VBOXVIDEO_HWTYPE_CROGL)
     6689            pAdapter->u32VBox3DCaps = Query.u.crogl.u32VBox3DCaps;
     6690
     6691#ifdef VBOX_WITH_VIDEOHWACCEL
    66876692        pAdapter->cHeads = Query.cInfos;
     6693#endif
    66886694
    66896695        pOpenData->hAdapter = pAdapter;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h

    r70052 r71862  
    7676    UINT uRtVersion;
    7777    D3DDDI_ADAPTERCALLBACKS RtCallbacks;
     78
     79    VBOXVIDEO_HWTYPE enmHwType;     /* VBOXVIDEO_HWTYPE* */
     80
    7881    VBOXWDDMDISP_D3D D3D;
    7982    VBOXWDDMDISP_FORMATS Formats;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxUhgsmiKmt.cpp

    r69500 r71862  
    309309static HRESULT vboxUhgsmiKmtQueryCaps(PVBOXUHGSMI_PRIVATE_KMT pHgsmi, uint32_t *pu32Caps)
    310310{
    311     VBOXWDDM_QI Query;
     311    VBOXWDDM_QAI Query;
    312312    D3DKMT_QUERYADAPTERINFO Info;
    313313    Info.hAdapter = pHgsmi->Adapter.hAdapter;
     
    329329    }
    330330
    331     *pu32Caps = Query.u32VBox3DCaps;
     331    if (Query.enmHwType == VBOXVIDEO_HWTYPE_CROGL)
     332        *pu32Caps = Query.u.crogl.u32VBox3DCaps;
     333    else
     334        *pu32Caps = 0;
    332335
    333336    return S_OK;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPDevExt.h

    r71511 r71862  
    3434# include "wddm/VBoxMPTypes.h"
    3535#endif
    36 
    37 typedef enum VBOX_HWTYPE
    38 {
    39     VBOX_HWTYPE_CROGL = 0,
    40     VBOX_HWTYPE_VMSVGA = 1
    41 } VBOX_HWTYPE;
    4236
    4337#ifdef VBOX_WDDM_MINIPORT
     
    218212   HGSMIAREA areaDisplay;                      /* Entire VRAM chunk for this display device. */
    219213
    220    VBOX_HWTYPE enmHwType;
    221 #ifdef VBOX_WDDM_MINIPORT
     214#ifdef VBOX_WDDM_MINIPORT
     215   VBOXVIDEO_HWTYPE enmHwType;
    222216   VBOXWDDM_HWRESOURCES HwResources;
    223217#endif
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp

    r71658 r71862  
    11821182static NTSTATUS vboxVdmaCrCtlGetDefaultClientId(PVBOXMP_DEVEXT pDevExt, uint32_t *pu32ClienID)
    11831183{
    1184     if (pDevExt->enmHwType != VBOX_HWTYPE_CROGL)
     1184    if (pDevExt->enmHwType != VBOXVIDEO_HWTYPE_CROGL)
    11851185    {
    11861186        /* Should not be called at all in this case. */
     
    13361336NTSTATUS vboxVdmaTexPresentSetAlloc(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData)
    13371337{
    1338     if (pDevExt->enmHwType != VBOX_HWTYPE_CROGL)
     1338    if (pDevExt->enmHwType != VBOXVIDEO_HWTYPE_CROGL)
    13391339    {
    13401340        /* Not used in this case. */
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r71658 r71862  
    816816    }
    817817
    818     pDevExt->enmHwType = u32 ? VBOX_HWTYPE_VMSVGA : VBOX_HWTYPE_CROGL;
    819 
    820     if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL)
     818    pDevExt->enmHwType = u32 ? VBOXVIDEO_HWTYPE_VMSVGA : VBOXVIDEO_HWTYPE_CROGL;
     819
     820    if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
    821821    {
    822822        pDevExt->f3DEnabled = VBoxMpCrCtlConIs3DSupported();
     
    11491149            {
    11501150#ifdef VBOX_WITH_CROGL
    1151                 if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL)
     1151                if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
    11521152                {
    11531153                    if (pDevExt->f3DEnabled)
     
    13771377
    13781378#ifdef VBOX_WITH_CROGL
    1379     if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL && pDevExt->u32CrConDefaultClientID)
     1379    if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL && pDevExt->u32CrConDefaultClientID)
    13801380        VBoxMpCrCtlConDisconnect(pDevExt, &pDevExt->CrCtlCon, pDevExt->u32CrConDefaultClientID);
    13811381
     
    23302330            if (!g_VBoxDisplayOnly)
    23312331            {
    2332                 if (pQueryAdapterInfo->OutputDataSize == sizeof (VBOXWDDM_QI))
    2333                 {
    2334                     VBOXWDDM_QI * pQi = (VBOXWDDM_QI*)pQueryAdapterInfo->pOutputData;
    2335                     memset (pQi, 0, sizeof (VBOXWDDM_QI));
    2336                     pQi->u32Version = VBOXVIDEOIF_VERSION;
    2337                     if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL)
     2332                if (pQueryAdapterInfo->OutputDataSize >= sizeof(VBOXWDDM_QAI))
     2333                {
     2334                    VBOXWDDM_QAI *pQAI = (VBOXWDDM_QAI *)pQueryAdapterInfo->pOutputData;
     2335                    memset(pQAI, 0, sizeof(VBOXWDDM_QAI));
     2336
     2337                    pQAI->u32Version = VBOXVIDEOIF_VERSION;
     2338                    pQAI->enmHwType = pDevExt->enmHwType;
     2339                    if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
    23382340                    {
    23392341#ifdef VBOX_WITH_CROGL
    2340                         pQi->u32VBox3DCaps = VBoxMpCrGetHostCaps();
     2342                        pQAI->u.crogl.u32VBox3DCaps = VBoxMpCrGetHostCaps();
    23412343#endif
    23422344                    }
    2343                     else
    2344                         pQi->u32VBox3DCaps = 0;
    2345                     pQi->cInfos = VBoxCommonFromDeviceExt(pDevExt)->cDisplays;
    23462345#ifdef VBOX_WITH_VIDEOHWACCEL
    2347                     for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i)
     2346                    pQAI->cInfos = VBoxCommonFromDeviceExt(pDevExt)->cDisplays;
     2347                    for (uint32_t i = 0; i < pQAI->cInfos; ++i)
    23482348                    {
    2349                         pQi->aInfos[i] = pDevExt->aSources[i].Vhwa.Settings;
     2349                        pQAI->aInfos[i] = pDevExt->aSources[i].Vhwa.Settings;
    23502350                    }
    23512351#endif
     
    23532353                else
    23542354                {
    2355                     WARN(("incorrect buffer size %d, expected %d", pQueryAdapterInfo->OutputDataSize, sizeof (VBOXWDDM_QI)));
     2355                    WARN(("incorrect buffer size %d, expected %d", pQueryAdapterInfo->OutputDataSize, sizeof(VBOXWDDM_QAI)));
    23562356                    Status = STATUS_BUFFER_TOO_SMALL;
    23572357                }
     
    28542854        /* wait for all current allocation-related ops are completed */
    28552855        vboxWddmAllocationCleanup(pDevExt, pAlloc);
    2856         if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL && pAlloc->hSharedHandle && pAlloc->AllocData.hostID)
     2856        if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL && pAlloc->hSharedHandle && pAlloc->AllocData.hostID)
    28572857            VBoxVdmaChromiumParameteriCRSubmit(pDevExt, GL_PIN_TEXTURE_CLEAR_CR, pAlloc->AllocData.hostID);
    28582858        vboxWddmAllocationDestroy(pAlloc);
     
    45604560                if (pEscape->PrivateDriverDataSize == sizeof (*pEscapeHdr))
    45614561                {
    4562                     if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL)
     4562                    if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
    45634563                        pEscapeHdr->u32CmdSpecific = VBoxMpCrGetHostCaps();
    45644564                    else
     
    68996899            }
    69006900
    6901             if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL)
     6901            if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
    69026902            {
    69036903#ifdef VBOX_WITH_CROGL
     
    69506950                                        if (pDevExt->f3DEnabled)
    69516951                                        {
    6952                                             if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL)
     6952                                            if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
    69536953                                            {
    69546954                                                int rc = VBoxMpCrCtlConConnect(pDevExt, &pDevExt->CrCtlCon,
     
    70057005                                if (pDevExt->f3DEnabled)
    70067006                                {
    7007                                     if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL)
     7007                                    if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
    70087008                                    {
    70097009                                        int rc = VBoxMpCrCtlConConnect(pDevExt, &pDevExt->CrCtlCon,
     
    71457145
    71467146#ifdef VBOX_WITH_CROGL
    7147     if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL && pContext->u32CrConClientID)
     7147    if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL && pContext->u32CrConClientID)
    71487148    {
    71497149        VBoxMpCrCtlConDisconnect(pDevExt, &pDevExt->CrCtlCon, pContext->u32CrConClientID);
     
    73177317    if (bUpdateRectInited && pSource->bVisible)
    73187318    {
    7319         VBOXVBVA_OP_WITHLOCK(ReportDirtyRect, pDevExt, pSource, &UpdateRect);
     7319        if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
     7320            VBOXVBVA_OP_WITHLOCK(ReportDirtyRect, pDevExt, pSource, &UpdateRect);
    73207321    }
    73217322
     
    76577658
    76587659        /* Check whether 3D is provided by the host. */
    7659         VBOX_HWTYPE enmHwType = VBOX_HWTYPE_CROGL;
     7660        VBOXVIDEO_HWTYPE enmHwType = VBOXVIDEO_HWTYPE_CROGL;
    76607661        BOOL f3DSupported = FALSE;
    76617662
     
    76757676            if (u32)
    76767677            {
    7677                 enmHwType = VBOX_HWTYPE_VMSVGA;
     7678                enmHwType = VBOXVIDEO_HWTYPE_VMSVGA;
    76787679            }
    76797680        }
    76807681
    76817682        BOOL fCmdVbva = FALSE;
    7682         if (enmHwType == VBOX_HWTYPE_CROGL)
     7683        if (enmHwType == VBOXVIDEO_HWTYPE_CROGL)
    76837684        {
    76847685            /* Try to establish connection to the host 3D service. */
     
    76937694#endif
    76947695        }
    7695         else if (enmHwType == VBOX_HWTYPE_VMSVGA)
     7696        else if (enmHwType == VBOXVIDEO_HWTYPE_VMSVGA)
    76967697        {
    76977698            fCmdVbva = TRUE;
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