VirtualBox

Changeset 40897 in vbox


Ignore:
Timestamp:
Apr 12, 2012 6:16:40 PM (13 years ago)
Author:
vboxsync
Message:

wddm: disable driver load for win8 if 3D support is unavailable

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/Makefile.kmk

    r40483 r40897  
    8787 endif
    8888 VBoxVideoWddm_DEFS       += LOG_TO_BACKDOOR
    89  VBoxVideoWddm_INCS       += ../../../include .. . ../../../../common/VBoxGuestLib
     89 VBoxVideoWddm_INCS       += ../../../include .. . ../../../../common/VBoxGuestLib $(VBOX_PATH_CROGL_INCLUDE)
    9090 VBoxVideoWddm_LDFLAGS.x86 += /Entry:DriverEntry@8
    9191 VBoxVideoWddm_LDFLAGS.amd64 += /Entry:DriverEntry
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPDevExt.h

    r40747 r40897  
    105105   volatile BOOLEAN fRenderToShadowDisabled;
    106106
    107    HVBOXCRCTL hCrCtl;
    108    uint32_t cCrCtlRefs;
     107   VBOXMP_CRCTLCON CrCtlCon;
    109108
    110109   VBOXWDDM_GLOBAL_POINTER_INFO PointerInfo;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCr.cpp

    r40483 r40897  
    2020#include "VBoxMPCr.h"
    2121
     22#include <cr_protocol.h>
     23
    2224#include <VBox/HostServices/VBoxCrOpenGLSvc.h>
    2325
    24 static int vboxMpCrCtlAddRef(struct _VBOXMP_DEVEXT *pDevExt)
    25 {
    26     if (pDevExt->cCrCtlRefs++)
     26static int vboxMpCrCtlAddRef(PVBOXMP_CRCTLCON pCrCtlCon)
     27{
     28    if (pCrCtlCon->cCrCtlRefs++)
    2729        return VINF_ALREADY_INITIALIZED;
    2830
    29     int rc = vboxCrCtlCreate(&pDevExt->hCrCtl);
    30     if (RT_SUCCESS(rc))
    31     {
    32         Assert(pDevExt->hCrCtl);
     31    int rc = vboxCrCtlCreate(&pCrCtlCon->hCrCtl);
     32    if (RT_SUCCESS(rc))
     33    {
     34        Assert(pCrCtlCon->hCrCtl);
    3335        return VINF_SUCCESS;
    3436    }
     
    3638    WARN(("vboxCrCtlCreate failed, rc (%d)", rc));
    3739
    38     --pDevExt->cCrCtlRefs;
    39     return rc;
    40 }
    41 
    42 static int vboxMpCrCtlRelease(struct _VBOXMP_DEVEXT *pDevExt)
    43 {
    44     Assert(pDevExt->cCrCtlRefs);
    45     if (--pDevExt->cCrCtlRefs)
    46     {
    47         return VINF_SUCCESS;
    48     }
    49 
    50     int rc = vboxCrCtlDestroy(pDevExt->hCrCtl);
    51     if (RT_SUCCESS(rc))
    52     {
    53         pDevExt->hCrCtl = NULL;
     40    --pCrCtlCon->cCrCtlRefs;
     41    return rc;
     42}
     43
     44static int vboxMpCrCtlRelease(PVBOXMP_CRCTLCON pCrCtlCon)
     45{
     46    Assert(pCrCtlCon->cCrCtlRefs);
     47    if (--pCrCtlCon->cCrCtlRefs)
     48    {
     49        return VINF_SUCCESS;
     50    }
     51
     52    int rc = vboxCrCtlDestroy(pCrCtlCon->hCrCtl);
     53    if (RT_SUCCESS(rc))
     54    {
     55        pCrCtlCon->hCrCtl = NULL;
    5456        return VINF_SUCCESS;
    5557    }
     
    5759    WARN(("vboxCrCtlDestroy failed, rc (%d)", rc));
    5860
    59     ++pDevExt->cCrCtlRefs;
    60     return rc;
    61 }
    62 
    63 static int vboxMpCrCtlConSetVersion(struct _VBOXMP_DEVEXT *pDevExt, uint32_t u32ClientID, uint32_t vMajor, uint32_t vMinor)
     61    ++pCrCtlCon->cCrCtlRefs;
     62    return rc;
     63}
     64
     65static int vboxMpCrCtlConSetVersion(PVBOXMP_CRCTLCON pCrCtlCon, uint32_t u32ClientID, uint32_t vMajor, uint32_t vMinor)
    6466{
    6567    CRVBOXHGCMSETVERSION parms;
     
    7678    parms.vMinor.u.value32 = vMinor;
    7779
    78     rc = vboxCrCtlConCall(pDevExt->hCrCtl, &parms.hdr, sizeof (parms));
     80    rc = vboxCrCtlConCall(pCrCtlCon->hCrCtl, &parms.hdr, sizeof (parms));
    7981    if (RT_FAILURE(rc))
    8082    {
     
    9193}
    9294
    93 static int vboxMpCrCtlConSetPID(struct _VBOXMP_DEVEXT *pDevExt, uint32_t u32ClientID)
     95static int vboxMpCrCtlConSetPID(PVBOXMP_CRCTLCON pCrCtlCon, uint32_t u32ClientID)
    9496{
    9597    CRVBOXHGCMSETPID parms;
     
    106108    Assert(parms.u64PID.u.value64);
    107109
    108     rc = vboxCrCtlConCall(pDevExt->hCrCtl, &parms.hdr, sizeof (parms));
     110    rc = vboxCrCtlConCall(pCrCtlCon->hCrCtl, &parms.hdr, sizeof (parms));
    109111    if (RT_FAILURE(rc))
    110112    {
     
    121123}
    122124
    123 int VBoxMpCrCtlConConnect(struct _VBOXMP_DEVEXT *pDevExt,
     125int VBoxMpCrCtlConConnect(PVBOXMP_CRCTLCON pCrCtlCon,
    124126        uint32_t crVersionMajor, uint32_t crVersionMinor,
    125127        uint32_t *pu32ClientID)
    126128{
    127129    uint32_t u32ClientID;
    128     int rc = vboxMpCrCtlAddRef(pDevExt);
    129     if (RT_SUCCESS(rc))
    130     {
    131         rc = vboxCrCtlConConnect(pDevExt->hCrCtl, &u32ClientID);
     130    int rc = vboxMpCrCtlAddRef(pCrCtlCon);
     131    if (RT_SUCCESS(rc))
     132    {
     133        rc = vboxCrCtlConConnect(pCrCtlCon->hCrCtl, &u32ClientID);
    132134        if (RT_SUCCESS(rc))
    133135        {
    134             rc = vboxMpCrCtlConSetVersion(pDevExt, u32ClientID, crVersionMajor, crVersionMinor);
     136            rc = vboxMpCrCtlConSetVersion(pCrCtlCon, u32ClientID, crVersionMajor, crVersionMinor);
    135137            if (RT_SUCCESS(rc))
    136138            {
    137                 rc = vboxMpCrCtlConSetPID(pDevExt, u32ClientID);
     139                rc = vboxMpCrCtlConSetPID(pCrCtlCon, u32ClientID);
    138140                if (RT_SUCCESS(rc))
    139141                {
     
    150152                WARN(("vboxMpCrCtlConSetVersion failed, rc (%d)", rc));
    151153            }
    152             vboxCrCtlConDisconnect(pDevExt->hCrCtl, u32ClientID);
     154            vboxCrCtlConDisconnect(pCrCtlCon->hCrCtl, u32ClientID);
    153155        }
    154156        else
     
    156158            WARN(("vboxCrCtlConConnect failed, rc (%d)", rc));
    157159        }
    158         vboxMpCrCtlRelease(pDevExt);
     160        vboxMpCrCtlRelease(pCrCtlCon);
    159161    }
    160162    else
     
    168170}
    169171
    170 int VBoxMpCrCtlConDisconnect(struct _VBOXMP_DEVEXT *pDevExt, uint32_t u32ClientID)
    171 {
    172     int rc = vboxCrCtlConDisconnect(pDevExt->hCrCtl, u32ClientID);
    173     if (RT_SUCCESS(rc))
    174     {
    175         vboxMpCrCtlRelease(pDevExt);
     172int VBoxMpCrCtlConDisconnect(PVBOXMP_CRCTLCON pCrCtlCon, uint32_t u32ClientID)
     173{
     174    int rc = vboxCrCtlConDisconnect(pCrCtlCon->hCrCtl, u32ClientID);
     175    if (RT_SUCCESS(rc))
     176    {
     177        vboxMpCrCtlRelease(pCrCtlCon);
    176178        return VINF_SUCCESS;
    177179    }
     
    183185}
    184186
    185 int VBoxMpCrCtlConCall(struct _VBOXMP_DEVEXT *pDevExt, VBoxGuestHGCMCallInfo *pData, uint32_t cbData)
    186 {
    187     int rc = vboxCrCtlConCall(pDevExt->hCrCtl, pData, cbData);
     187int VBoxMpCrCtlConCall(PVBOXMP_CRCTLCON pCrCtlCon, VBoxGuestHGCMCallInfo *pData, uint32_t cbData)
     188{
     189    int rc = vboxCrCtlConCall(pCrCtlCon->hCrCtl, pData, cbData);
    188190    if (RT_SUCCESS(rc))
    189191        return VINF_SUCCESS;
     
    193195}
    194196
    195 int VBoxMpCrCtlConCallUserData(struct _VBOXMP_DEVEXT *pDevExt, VBoxGuestHGCMCallInfo *pData, uint32_t cbData)
    196 {
    197     int rc = vboxCrCtlConCallUserData(pDevExt->hCrCtl, pData, cbData);
     197int VBoxMpCrCtlConCallUserData(PVBOXMP_CRCTLCON pCrCtlCon, VBoxGuestHGCMCallInfo *pData, uint32_t cbData)
     198{
     199    int rc = vboxCrCtlConCallUserData(pCrCtlCon->hCrCtl, pData, cbData);
    198200    if (RT_SUCCESS(rc))
    199201        return VINF_SUCCESS;
     
    202204    return rc;
    203205}
     206
     207bool VBoxMpCrCtlConIs3DSupported()
     208{
     209    VBOXMP_CRCTLCON CrCtlCon = {0};
     210    uint32_t u32ClientID = 0;
     211    int rc = VBoxMpCrCtlConConnect(&CrCtlCon, CR_PROTOCOL_VERSION_MAJOR, CR_PROTOCOL_VERSION_MINOR, &u32ClientID);
     212    if (RT_FAILURE(rc))
     213    {
     214        LOGREL(("VBoxMpCrCtlConConnect failed with rc(%d), 3D not supported!"));
     215        return false;
     216    }
     217
     218    rc = VBoxMpCrCtlConDisconnect(&CrCtlCon, u32ClientID);
     219    if (RT_FAILURE(rc))
     220        WARN(("VBoxMpCrCtlConDisconnect failed, ignoring.."));
     221
     222    return true;
     223}
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCr.h

    r40483 r40897  
    2222#include <VBoxGuestR0LibCrOgl.h>
    2323
    24 int VBoxMpCrCtlConConnect(struct _VBOXMP_DEVEXT *pDevExt,
     24typedef struct VBOXMP_CRCTLCON
     25{
     26    HVBOXCRCTL hCrCtl;
     27    uint32_t cCrCtlRefs;
     28} VBOXMP_CRCTLCON, *PVBOXMP_CRCTLCON;
     29
     30bool VBoxMpCrCtlConIs3DSupported();
     31
     32int VBoxMpCrCtlConConnect(PVBOXMP_CRCTLCON pCrCtlCon,
    2533        uint32_t crVersionMajor, uint32_t crVersionMinor,
    2634        uint32_t *pu32ClientID);
    27 int VBoxMpCrCtlConDisconnect(struct _VBOXMP_DEVEXT *pDevExt, uint32_t u32ClientID);
    28 int VBoxMpCrCtlConCall(struct _VBOXMP_DEVEXT *pDevExt, struct VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
    29 int VBoxMpCrCtlConCallUserData(struct _VBOXMP_DEVEXT *pDevExt, struct VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
     35int VBoxMpCrCtlConDisconnect(PVBOXMP_CRCTLCON pCrCtlCon, uint32_t u32ClientID);
     36int VBoxMpCrCtlConCall(PVBOXMP_CRCTLCON pCrCtlCon, struct VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
     37int VBoxMpCrCtlConCallUserData(PVBOXMP_CRCTLCON pCrCtlCon, struct VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
    3038
    3139#endif /* #ifndef ___VBoxMPCr_h__ */
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r40842 r40897  
    974974}
    975975
     976
    976977/* driver callbacks */
    977978NTSTATUS DxgkDdiAddDevice(
     
    10621063            if (Status == STATUS_SUCCESS)
    10631064            {
    1064                 /* Initialize VBoxGuest library, which is used for requests which go through VMMDev. */
    1065                 VbglInit ();
    1066 
    10671065                /* Guest supports only HGSMI, the old VBVA via VMMDev is not supported.
    10681066                 * The host will however support both old and new interface to keep compatibility
     
    11081106                    LOGREL(("HGSMI failed to initialize, returning err"));
    11091107
    1110                     VbglTerminate();
    11111108                    /* @todo: report a better status */
    11121109                    Status = STATUS_UNSUCCESSFUL;
     
    11651162    if (RT_SUCCESS(rc))
    11661163    {
    1167         VbglTerminate();
    1168 
    11691164        vboxWddmVGuidFree(pDevExt);
    11701165
     
    16531648
    16541649    vboxVDbgBreakFv();
     1650
     1651    VbglTerminate();
    16551652
    16561653    VBoxWddmVrTerm();
     
    18601857    if (pCreateDevice->Flags.SystemDevice)
    18611858        pDevice->enmType = VBOXWDDM_DEVICE_TYPE_SYSTEM;
    1862 //    else
    1863 //    {
    1864 //        AssertBreakpoint(); /* we do not support custom contexts for now */
    1865 //        LOGREL(("we do not support custom devices for now, hAdapter (0x%x)", hAdapter));
    1866 //    }
    18671859
    18681860    pDevice->pAdapter = pDevExt;
     
    38633855                    /* this is true due to the above condition */
    38643856                    Assert(pEscape->PrivateDriverDataSize > RT_OFFSETOF(VBOXDISPIFESCAPE_CRHGSMICTLCON_CALL, CallInfo));
    3865                     int rc = VBoxMpCrCtlConCallUserData(pDevExt, &pCall->CallInfo, pEscape->PrivateDriverDataSize - RT_OFFSETOF(VBOXDISPIFESCAPE_CRHGSMICTLCON_CALL, CallInfo));
     3857                    int rc = VBoxMpCrCtlConCallUserData(&pDevExt->CrCtlCon, &pCall->CallInfo, pEscape->PrivateDriverDataSize - RT_OFFSETOF(VBOXDISPIFESCAPE_CRHGSMICTLCON_CALL, CallInfo));
    38663858                    if (RT_SUCCESS(rc))
    38673859                        Status = STATUS_SUCCESS;
     
    58405832                                    if (pInfo->crVersionMajor || pInfo->crVersionMinor)
    58415833                                    {
    5842                                         rc = VBoxMpCrCtlConConnect(pDevExt,
     5834                                        rc = VBoxMpCrCtlConConnect(&pDevExt->CrCtlCon,
    58435835                                            pInfo->crVersionMajor, pInfo->crVersionMinor,
    58445836                                            &pContext->u32CrConClientID);
     
    58745866                            if (pInfo->crVersionMajor || pInfo->crVersionMinor)
    58755867                            {
    5876                                 rc = VBoxMpCrCtlConConnect(pDevExt,
     5868                                rc = VBoxMpCrCtlConConnect(&pDevExt->CrCtlCon,
    58775869                                    pInfo->crVersionMajor, pInfo->crVersionMinor,
    58785870                                    &pContext->u32CrConClientID);
     
    59525944            if (pContext->u32CrConClientID)
    59535945            {
    5954                 VBoxMpCrCtlConDisconnect(pDevExt, pContext->u32CrConClientID);
     5946                VBoxMpCrCtlConDisconnect(&pDevExt->CrCtlCon, pContext->u32CrConClientID);
    59555947            }
    59565948            break;
     
    60386030    vboxVDbgBreakFv();
    60396031
    6040 /*
    6041     int irc = RTR0Init(0);
    6042     if (RT_FAILURE(irc))
    6043     {
    6044         LOGREL(("VBoxMP::failed to init IPRT (rc=%#x)", irc));
    6045         return ERROR_INVALID_FUNCTION;
    6046     }
    6047 */
    6048 
    60496032#ifdef DEBUG_misha
    60506033    RTLogGroupSettings(0, "+default.e.l.f.l2.l3");
     
    60536036    LOGREL(("Built %s %s", __DATE__, __TIME__));
    60546037
    6055     NTSTATUS Status = VBoxWddmVrInit();
    6056     if (!NT_SUCCESS(Status))
    6057     {
    6058         WARN(("VBoxWddmVrInit failed!"));
    6059         return Status;
    6060     }
    6061 
    6062     DRIVER_INITIALIZATION_DATA DriverInitializationData = {'\0'};
    6063 
    60646038    if (! ARGUMENT_PRESENT(DriverObject) ||
    60656039        ! ARGUMENT_PRESENT(RegistryPath))
     
    60686042    }
    60696043
    6070     // Fill in the DriverInitializationData structure and call DxgkInitialize()
    6071     DriverInitializationData.Version = DXGKDDI_INTERFACE_VERSION;
    6072 
    6073     DriverInitializationData.DxgkDdiAddDevice = DxgkDdiAddDevice;
    6074     DriverInitializationData.DxgkDdiStartDevice = DxgkDdiStartDevice;
    6075     DriverInitializationData.DxgkDdiStopDevice = DxgkDdiStopDevice;
    6076     DriverInitializationData.DxgkDdiRemoveDevice = DxgkDdiRemoveDevice;
    6077     DriverInitializationData.DxgkDdiDispatchIoRequest = DxgkDdiDispatchIoRequest;
    6078     DriverInitializationData.DxgkDdiInterruptRoutine = DxgkDdiInterruptRoutine;
    6079     DriverInitializationData.DxgkDdiDpcRoutine = DxgkDdiDpcRoutine;
    6080     DriverInitializationData.DxgkDdiQueryChildRelations = DxgkDdiQueryChildRelations;
    6081     DriverInitializationData.DxgkDdiQueryChildStatus = DxgkDdiQueryChildStatus;
    6082     DriverInitializationData.DxgkDdiQueryDeviceDescriptor = DxgkDdiQueryDeviceDescriptor;
    6083     DriverInitializationData.DxgkDdiSetPowerState = DxgkDdiSetPowerState;
    6084     DriverInitializationData.DxgkDdiNotifyAcpiEvent = DxgkDdiNotifyAcpiEvent;
    6085     DriverInitializationData.DxgkDdiResetDevice = DxgkDdiResetDevice;
    6086     DriverInitializationData.DxgkDdiUnload = DxgkDdiUnload;
    6087     DriverInitializationData.DxgkDdiQueryInterface = DxgkDdiQueryInterface;
    6088     DriverInitializationData.DxgkDdiControlEtwLogging = DxgkDdiControlEtwLogging;
    6089 
    6090     DriverInitializationData.DxgkDdiQueryAdapterInfo = DxgkDdiQueryAdapterInfo;
    6091     DriverInitializationData.DxgkDdiCreateDevice = DxgkDdiCreateDevice;
    6092     DriverInitializationData.DxgkDdiCreateAllocation = DxgkDdiCreateAllocation;
    6093     DriverInitializationData.DxgkDdiDestroyAllocation = DxgkDdiDestroyAllocation;
    6094     DriverInitializationData.DxgkDdiDescribeAllocation = DxgkDdiDescribeAllocation;
    6095     DriverInitializationData.DxgkDdiGetStandardAllocationDriverData = DxgkDdiGetStandardAllocationDriverData;
    6096     DriverInitializationData.DxgkDdiAcquireSwizzlingRange = DxgkDdiAcquireSwizzlingRange;
    6097     DriverInitializationData.DxgkDdiReleaseSwizzlingRange = DxgkDdiReleaseSwizzlingRange;
    6098     DriverInitializationData.DxgkDdiPatch = DxgkDdiPatch;
    6099     DriverInitializationData.DxgkDdiSubmitCommand = DxgkDdiSubmitCommand;
    6100     DriverInitializationData.DxgkDdiPreemptCommand = DxgkDdiPreemptCommand;
    6101     DriverInitializationData.DxgkDdiBuildPagingBuffer = DxgkDdiBuildPagingBuffer;
    6102     DriverInitializationData.DxgkDdiSetPalette = DxgkDdiSetPalette;
    6103     DriverInitializationData.DxgkDdiSetPointerPosition = DxgkDdiSetPointerPosition;
    6104     DriverInitializationData.DxgkDdiSetPointerShape = DxgkDdiSetPointerShape;
    6105     DriverInitializationData.DxgkDdiResetFromTimeout = DxgkDdiResetFromTimeout;
    6106     DriverInitializationData.DxgkDdiRestartFromTimeout = DxgkDdiRestartFromTimeout;
    6107     DriverInitializationData.DxgkDdiEscape = DxgkDdiEscape;
    6108     DriverInitializationData.DxgkDdiCollectDbgInfo = DxgkDdiCollectDbgInfo;
    6109     DriverInitializationData.DxgkDdiQueryCurrentFence = DxgkDdiQueryCurrentFence;
    6110     DriverInitializationData.DxgkDdiIsSupportedVidPn = DxgkDdiIsSupportedVidPn;
    6111     DriverInitializationData.DxgkDdiRecommendFunctionalVidPn = DxgkDdiRecommendFunctionalVidPn;
    6112     DriverInitializationData.DxgkDdiEnumVidPnCofuncModality = DxgkDdiEnumVidPnCofuncModality;
    6113     DriverInitializationData.DxgkDdiSetVidPnSourceAddress = DxgkDdiSetVidPnSourceAddress;
    6114     DriverInitializationData.DxgkDdiSetVidPnSourceVisibility = DxgkDdiSetVidPnSourceVisibility;
    6115     DriverInitializationData.DxgkDdiCommitVidPn = DxgkDdiCommitVidPn;
    6116     DriverInitializationData.DxgkDdiUpdateActiveVidPnPresentPath = DxgkDdiUpdateActiveVidPnPresentPath;
    6117     DriverInitializationData.DxgkDdiRecommendMonitorModes = DxgkDdiRecommendMonitorModes;
    6118     DriverInitializationData.DxgkDdiRecommendVidPnTopology = DxgkDdiRecommendVidPnTopology;
    6119     DriverInitializationData.DxgkDdiGetScanLine = DxgkDdiGetScanLine;
    6120     DriverInitializationData.DxgkDdiStopCapture = DxgkDdiStopCapture;
    6121     DriverInitializationData.DxgkDdiControlInterrupt = DxgkDdiControlInterrupt;
    6122     DriverInitializationData.DxgkDdiCreateOverlay = DxgkDdiCreateOverlay;
    6123 
    6124     DriverInitializationData.DxgkDdiDestroyDevice = DxgkDdiDestroyDevice;
    6125     DriverInitializationData.DxgkDdiOpenAllocation = DxgkDdiOpenAllocation;
    6126     DriverInitializationData.DxgkDdiCloseAllocation = DxgkDdiCloseAllocation;
    6127     DriverInitializationData.DxgkDdiRender = DxgkDdiRender;
    6128     DriverInitializationData.DxgkDdiPresent = DxgkDdiPresent;
    6129 
    6130     DriverInitializationData.DxgkDdiUpdateOverlay = DxgkDdiUpdateOverlay;
    6131     DriverInitializationData.DxgkDdiFlipOverlay = DxgkDdiFlipOverlay;
    6132     DriverInitializationData.DxgkDdiDestroyOverlay = DxgkDdiDestroyOverlay;
    6133 
    6134     DriverInitializationData.DxgkDdiCreateContext = DxgkDdiCreateContext;
    6135     DriverInitializationData.DxgkDdiDestroyContext = DxgkDdiDestroyContext;
    6136 
    6137     DriverInitializationData.DxgkDdiLinkDevice = NULL; //DxgkDdiLinkDevice;
    6138     DriverInitializationData.DxgkDdiSetDisplayPrivateDriverFormat = DxgkDdiSetDisplayPrivateDriverFormat;
    6139 //#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7)
    6140 //# error port to Win7 DDI
    6141 //    DriverInitializationData.DxgkDdiRenderKm  = DxgkDdiRenderKm;
    6142 //    DriverInitializationData.DxgkDdiRestartFromTimeout  = DxgkDdiRestartFromTimeout;
    6143 //    DriverInitializationData.DxgkDdiSetVidPnSourceVisibility  = DxgkDdiSetVidPnSourceVisibility;
    6144 //    DriverInitializationData.DxgkDdiUpdateActiveVidPnPresentPath  = DxgkDdiUpdateActiveVidPnPresentPath;
    6145 //    DriverInitializationData.DxgkDdiQueryVidPnHWCapability  = DxgkDdiQueryVidPnHWCapability;
    6146 //#endif
    6147 
    6148     return DxgkInitialize(DriverObject,
    6149                           RegistryPath,
    6150                           &DriverInitializationData);
    6151 }
     6044    ULONG major, minor, build;
     6045    BOOLEAN checkedBuild = PsGetVersion(&major, &minor, &build, NULL);
     6046    BOOLEAN f3Drequired = FALSE;
     6047
     6048    LOGREL(("OsVersion( %d, %d, %d )", major, minor, build));
     6049
     6050    NTSTATUS Status = STATUS_SUCCESS;
     6051    /* Initialize VBoxGuest library, which is used for requests which go through VMMDev. */
     6052    int rc = VbglInit();
     6053    if (RT_SUCCESS(rc))
     6054    {
     6055        if (major > 6)
     6056        {
     6057            WARN(("Unknow win version, newer major release, assuming 3D is required"));
     6058            f3Drequired = TRUE;
     6059        }
     6060        else if (major == 6)
     6061        {
     6062            if (minor > 2)
     6063            {
     6064                WARN(("Unknow win version, newer minor release, assuming 3D is required"));
     6065                f3Drequired = TRUE;
     6066            }
     6067            else if (minor == 2)
     6068            {
     6069                LOG(("3D is required!"));
     6070                f3Drequired = TRUE;
     6071            }
     6072            else
     6073            {
     6074                LOG(("3D is NOT required!"));
     6075                f3Drequired = FALSE;
     6076            }
     6077        }
     6078        else
     6079        {
     6080            WARN(("Unsupported OLDER win version, ignore and assume 3D is NOT required"));
     6081            f3Drequired = FALSE;
     6082        }
     6083
     6084        Status = STATUS_SUCCESS;
     6085
     6086        if (f3Drequired)
     6087        {
     6088            LOG(("3D is required, doing the 3D check.."));
     6089            if (!VBoxMpCrCtlConIs3DSupported())
     6090            {
     6091                LOGREL(("3D is NOT supported by the host, but is required for the current guest version.."));
     6092                Status = STATUS_UNSUCCESSFUL;
     6093            }
     6094        }
     6095
     6096        if (NT_SUCCESS(Status))
     6097        {
     6098            Status = VBoxWddmVrInit();
     6099            if (NT_SUCCESS(Status))
     6100            {
     6101                DRIVER_INITIALIZATION_DATA DriverInitializationData = {'\0'};
     6102
     6103                // Fill in the DriverInitializationData structure and call DxgkInitialize()
     6104                DriverInitializationData.Version = DXGKDDI_INTERFACE_VERSION;
     6105
     6106                DriverInitializationData.DxgkDdiAddDevice = DxgkDdiAddDevice;
     6107                DriverInitializationData.DxgkDdiStartDevice = DxgkDdiStartDevice;
     6108                DriverInitializationData.DxgkDdiStopDevice = DxgkDdiStopDevice;
     6109                DriverInitializationData.DxgkDdiRemoveDevice = DxgkDdiRemoveDevice;
     6110                DriverInitializationData.DxgkDdiDispatchIoRequest = DxgkDdiDispatchIoRequest;
     6111                DriverInitializationData.DxgkDdiInterruptRoutine = DxgkDdiInterruptRoutine;
     6112                DriverInitializationData.DxgkDdiDpcRoutine = DxgkDdiDpcRoutine;
     6113                DriverInitializationData.DxgkDdiQueryChildRelations = DxgkDdiQueryChildRelations;
     6114                DriverInitializationData.DxgkDdiQueryChildStatus = DxgkDdiQueryChildStatus;
     6115                DriverInitializationData.DxgkDdiQueryDeviceDescriptor = DxgkDdiQueryDeviceDescriptor;
     6116                DriverInitializationData.DxgkDdiSetPowerState = DxgkDdiSetPowerState;
     6117                DriverInitializationData.DxgkDdiNotifyAcpiEvent = DxgkDdiNotifyAcpiEvent;
     6118                DriverInitializationData.DxgkDdiResetDevice = DxgkDdiResetDevice;
     6119                DriverInitializationData.DxgkDdiUnload = DxgkDdiUnload;
     6120                DriverInitializationData.DxgkDdiQueryInterface = DxgkDdiQueryInterface;
     6121                DriverInitializationData.DxgkDdiControlEtwLogging = DxgkDdiControlEtwLogging;
     6122
     6123                DriverInitializationData.DxgkDdiQueryAdapterInfo = DxgkDdiQueryAdapterInfo;
     6124                DriverInitializationData.DxgkDdiCreateDevice = DxgkDdiCreateDevice;
     6125                DriverInitializationData.DxgkDdiCreateAllocation = DxgkDdiCreateAllocation;
     6126                DriverInitializationData.DxgkDdiDestroyAllocation = DxgkDdiDestroyAllocation;
     6127                DriverInitializationData.DxgkDdiDescribeAllocation = DxgkDdiDescribeAllocation;
     6128                DriverInitializationData.DxgkDdiGetStandardAllocationDriverData = DxgkDdiGetStandardAllocationDriverData;
     6129                DriverInitializationData.DxgkDdiAcquireSwizzlingRange = DxgkDdiAcquireSwizzlingRange;
     6130                DriverInitializationData.DxgkDdiReleaseSwizzlingRange = DxgkDdiReleaseSwizzlingRange;
     6131                DriverInitializationData.DxgkDdiPatch = DxgkDdiPatch;
     6132                DriverInitializationData.DxgkDdiSubmitCommand = DxgkDdiSubmitCommand;
     6133                DriverInitializationData.DxgkDdiPreemptCommand = DxgkDdiPreemptCommand;
     6134                DriverInitializationData.DxgkDdiBuildPagingBuffer = DxgkDdiBuildPagingBuffer;
     6135                DriverInitializationData.DxgkDdiSetPalette = DxgkDdiSetPalette;
     6136                DriverInitializationData.DxgkDdiSetPointerPosition = DxgkDdiSetPointerPosition;
     6137                DriverInitializationData.DxgkDdiSetPointerShape = DxgkDdiSetPointerShape;
     6138                DriverInitializationData.DxgkDdiResetFromTimeout = DxgkDdiResetFromTimeout;
     6139                DriverInitializationData.DxgkDdiRestartFromTimeout = DxgkDdiRestartFromTimeout;
     6140                DriverInitializationData.DxgkDdiEscape = DxgkDdiEscape;
     6141                DriverInitializationData.DxgkDdiCollectDbgInfo = DxgkDdiCollectDbgInfo;
     6142                DriverInitializationData.DxgkDdiQueryCurrentFence = DxgkDdiQueryCurrentFence;
     6143                DriverInitializationData.DxgkDdiIsSupportedVidPn = DxgkDdiIsSupportedVidPn;
     6144                DriverInitializationData.DxgkDdiRecommendFunctionalVidPn = DxgkDdiRecommendFunctionalVidPn;
     6145                DriverInitializationData.DxgkDdiEnumVidPnCofuncModality = DxgkDdiEnumVidPnCofuncModality;
     6146                DriverInitializationData.DxgkDdiSetVidPnSourceAddress = DxgkDdiSetVidPnSourceAddress;
     6147                DriverInitializationData.DxgkDdiSetVidPnSourceVisibility = DxgkDdiSetVidPnSourceVisibility;
     6148                DriverInitializationData.DxgkDdiCommitVidPn = DxgkDdiCommitVidPn;
     6149                DriverInitializationData.DxgkDdiUpdateActiveVidPnPresentPath = DxgkDdiUpdateActiveVidPnPresentPath;
     6150                DriverInitializationData.DxgkDdiRecommendMonitorModes = DxgkDdiRecommendMonitorModes;
     6151                DriverInitializationData.DxgkDdiRecommendVidPnTopology = DxgkDdiRecommendVidPnTopology;
     6152                DriverInitializationData.DxgkDdiGetScanLine = DxgkDdiGetScanLine;
     6153                DriverInitializationData.DxgkDdiStopCapture = DxgkDdiStopCapture;
     6154                DriverInitializationData.DxgkDdiControlInterrupt = DxgkDdiControlInterrupt;
     6155                DriverInitializationData.DxgkDdiCreateOverlay = DxgkDdiCreateOverlay;
     6156
     6157                DriverInitializationData.DxgkDdiDestroyDevice = DxgkDdiDestroyDevice;
     6158                DriverInitializationData.DxgkDdiOpenAllocation = DxgkDdiOpenAllocation;
     6159                DriverInitializationData.DxgkDdiCloseAllocation = DxgkDdiCloseAllocation;
     6160                DriverInitializationData.DxgkDdiRender = DxgkDdiRender;
     6161                DriverInitializationData.DxgkDdiPresent = DxgkDdiPresent;
     6162
     6163                DriverInitializationData.DxgkDdiUpdateOverlay = DxgkDdiUpdateOverlay;
     6164                DriverInitializationData.DxgkDdiFlipOverlay = DxgkDdiFlipOverlay;
     6165                DriverInitializationData.DxgkDdiDestroyOverlay = DxgkDdiDestroyOverlay;
     6166
     6167                DriverInitializationData.DxgkDdiCreateContext = DxgkDdiCreateContext;
     6168                DriverInitializationData.DxgkDdiDestroyContext = DxgkDdiDestroyContext;
     6169
     6170                DriverInitializationData.DxgkDdiLinkDevice = NULL; //DxgkDdiLinkDevice;
     6171                DriverInitializationData.DxgkDdiSetDisplayPrivateDriverFormat = DxgkDdiSetDisplayPrivateDriverFormat;
     6172        //#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7)
     6173        //# error port to Win7 DDI
     6174        //            DriverInitializationData.DxgkDdiRenderKm  = DxgkDdiRenderKm;
     6175        //            DriverInitializationData.DxgkDdiRestartFromTimeout  = DxgkDdiRestartFromTimeout;
     6176        //            DriverInitializationData.DxgkDdiSetVidPnSourceVisibility  = DxgkDdiSetVidPnSourceVisibility;
     6177        //            DriverInitializationData.DxgkDdiUpdateActiveVidPnPresentPath  = DxgkDdiUpdateActiveVidPnPresentPath;
     6178        //            DriverInitializationData.DxgkDdiQueryVidPnHWCapability  = DxgkDdiQueryVidPnHWCapability;
     6179        //#endif
     6180
     6181                Status = DxgkInitialize(DriverObject,
     6182                                      RegistryPath,
     6183                                      &DriverInitializationData);
     6184                if (NT_SUCCESS(Status))
     6185                    return Status;
     6186                VBoxWddmVrTerm();
     6187            }
     6188            else
     6189                WARN(("VBoxWddmVrInit failed, Status(0x%x)", Status));
     6190        }
     6191        else
     6192            LOGREL(("Aborting the video driver load due to 3D support missing"));
     6193
     6194        VbglTerminate();
     6195    }
     6196    else
     6197    {
     6198        WARN(("VbglInit failed, rc(%d)", rc));
     6199        Status = STATUS_UNSUCCESSFUL;
     6200    }
     6201
     6202    AssertRelease(!NT_SUCCESS(Status));
     6203
     6204    PRTLOGGER pLogger = RTLogRelSetDefaultInstance(NULL);
     6205    if (pLogger)
     6206    {
     6207        RTLogDestroy(pLogger);
     6208    }
     6209    pLogger = RTLogSetDefaultInstance(NULL);
     6210    if (pLogger)
     6211    {
     6212        RTLogDestroy(pLogger);
     6213    }
     6214
     6215    return Status;
     6216}
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