VirtualBox

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


Ignore:
Timestamp:
Oct 5, 2010 8:12:46 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
66416
Message:

wddm: bugfix

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

Legend:

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

    r32904 r32930  
    73817381VOID vboxVDbgDoMpPrint(const PVBOXWDDMDISP_DEVICE pDevice, LPCSTR szString)
    73827382{
    7383     uint32_t cbString = strlen(szString) + 1;
     7383    uint32_t cbString = (uint32_t)strlen(szString) + 1;
    73847384    uint32_t cbCmd = RT_OFFSETOF(VBOXDISPIFESCAPE_DBGPRINT, aStringBuf[cbString]);
    73857385    PVBOXDISPIFESCAPE_DBGPRINT pCmd = (PVBOXDISPIFESCAPE_DBGPRINT)RTMemAllocZ(cbCmd);
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoMisc.cpp

    r32889 r32930  
    511511    const WCHAR* pKeyPrefix;
    512512    UINT cbKeyPrefix;
     513    UNICODE_STRING* pVGuid = vboxWddmVGuidGet(pDevExt);
     514    Assert(pVGuid);
     515    if (!pVGuid)
     516        return STATUS_UNSUCCESSFUL;
     517
    513518    winVersion_t ver = vboxQueryWinVersion();
    514519    if (ver == WINVISTA)
     
    524529    }
    525530
    526     ULONG cbResult = cbKeyPrefix + pDevExt->VideoGuid.Length + 2 + 8; // L"\\" + "XXXX"
     531    ULONG cbResult = cbKeyPrefix + pVGuid->Length + 2 + 8; // L"\\" + "XXXX"
    527532    if (cbBuf >= cbResult)
    528533    {
    529534        wcscpy(pBuf, pKeyPrefix);
    530535        pSuffix = pBuf + (cbKeyPrefix-2)/2;
    531         memcpy(pSuffix, pDevExt->VideoGuid.Buffer, pDevExt->VideoGuid.Length);
    532         pSuffix += pDevExt->VideoGuid.Length/2;
     536        memcpy(pSuffix, pVGuid->Buffer, pVGuid->Length);
     537        pSuffix += pVGuid->Length/2;
    533538        pSuffix[0] = L'\\';
    534539        pSuffix += 1;
     
    757762            sizeof(val));
    758763}
     764
     765UNICODE_STRING* vboxWddmVGuidGet(PDEVICE_EXTENSION pDevExt)
     766{
     767    if (pDevExt->VideoGuid.Buffer)
     768        return &pDevExt->VideoGuid;
     769
     770    Assert(KeGetCurrentIrql() == PASSIVE_LEVEL);
     771    WCHAR VideoGuidBuf[512];
     772    ULONG cbVideoGuidBuf = sizeof (VideoGuidBuf);
     773    NTSTATUS Status = vboxWddmRegQueryVideoGuidString(cbVideoGuidBuf, VideoGuidBuf, &cbVideoGuidBuf);
     774    Assert(Status == STATUS_SUCCESS);
     775    if (Status == STATUS_SUCCESS)
     776    {
     777        PWCHAR pBuf = (PWCHAR)vboxWddmMemAllocZero(cbVideoGuidBuf);
     778        Assert(pBuf);
     779        if (pBuf)
     780        {
     781            memcpy(pBuf, VideoGuidBuf, cbVideoGuidBuf);
     782            RtlInitUnicodeString(&pDevExt->VideoGuid, pBuf);
     783            return &pDevExt->VideoGuid;
     784        }
     785    }
     786
     787    return NULL;
     788}
     789
     790VOID vboxWddmVGuidFree(PDEVICE_EXTENSION pDevExt)
     791{
     792    if (pDevExt->VideoGuid.Buffer)
     793    {
     794        vboxWddmMemFree(pDevExt->VideoGuid.Buffer);
     795        pDevExt->VideoGuid.Buffer = NULL;
     796    }
     797}
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoMisc.h

    r32823 r32930  
    9393NTSTATUS vboxWddmRegQueryValueDword(IN HANDLE hKey, IN PWCHAR pName, OUT PDWORD pDword);
    9494NTSTATUS vboxWddmRegSetValueDword(IN HANDLE hKey, IN PWCHAR pName, OUT DWORD val);
     95
     96UNICODE_STRING* vboxWddmVGuidGet(PDEVICE_EXTENSION pDevExt);
     97VOID vboxWddmVGuidFree(PDEVICE_EXTENSION pDevExt);
     98
    9599#endif /* #ifndef ___VBoxVideoMisc_h__ */
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp

    r32915 r32930  
    475475    PWCHAR pName = (PWCHAR)(((uint8_t*)pDevExt) + VBOXWDDM_ROUNDBOUND(sizeof (DEVICE_EXTENSION), 8));
    476476    RtlInitUnicodeString(&pDevExt->RegKeyName, pName);
    477     pName += (pDevExt->RegKeyName.Length + 2)/2;
    478     RtlInitUnicodeString(&pDevExt->VideoGuid, pName);
    479477#ifdef VBOXWDDM_RENDER_FROM_SHADOW
    480478    for (int i = 0; i < RT_ELEMENTS(pDevExt->aSources); ++i)
     
    512510    if (Status == STATUS_SUCCESS)
    513511    {
    514         WCHAR VideoGuidBuf[512];
    515         ULONG cbVideoGuidBuf = sizeof (VideoGuidBuf);
    516 
    517         Status = vboxWddmRegQueryVideoGuidString(cbVideoGuidBuf, VideoGuidBuf, &cbVideoGuidBuf);
    518         Assert(Status == STATUS_SUCCESS);
    519         if (Status == STATUS_SUCCESS)
    520         {
    521             pDevExt = (PDEVICE_EXTENSION)vboxWddmMemAllocZero(VBOXWDDM_ROUNDBOUND(sizeof (DEVICE_EXTENSION), 8) + cbRegKeyBuf + cbVideoGuidBuf);
    522             if (pDevExt)
    523             {
    524                 PWCHAR pName = (PWCHAR)(((uint8_t*)pDevExt) + VBOXWDDM_ROUNDBOUND(sizeof (DEVICE_EXTENSION), 8));
    525                 memcpy(pName, RegKeyBuf, cbRegKeyBuf);
    526                 pName += cbRegKeyBuf/2;
    527                 memcpy(pName, VideoGuidBuf, cbVideoGuidBuf);
    528                 vboxWddmDevExtZeroinit(pDevExt, PhysicalDeviceObject);
    529                 *MiniportDeviceContext = pDevExt;
    530             }
    531             else
    532             {
    533                 Status  = STATUS_NO_MEMORY;
    534                 drprintf(("VBoxVideoWddm: ERROR, failed to create context\n"));
    535             }
     512        pDevExt = (PDEVICE_EXTENSION)vboxWddmMemAllocZero(VBOXWDDM_ROUNDBOUND(sizeof (DEVICE_EXTENSION), 8) + cbRegKeyBuf);
     513        if (pDevExt)
     514        {
     515            PWCHAR pName = (PWCHAR)(((uint8_t*)pDevExt) + VBOXWDDM_ROUNDBOUND(sizeof (DEVICE_EXTENSION), 8));
     516            memcpy(pName, RegKeyBuf, cbRegKeyBuf);
     517            vboxWddmDevExtZeroinit(pDevExt, PhysicalDeviceObject);
     518            *MiniportDeviceContext = pDevExt;
     519        }
     520        else
     521        {
     522            Status  = STATUS_NO_MEMORY;
     523            drprintf(("VBoxVideoWddm: ERROR, failed to create context\n"));
    536524        }
    537525    }
     
    567555    {
    568556        PDEVICE_EXTENSION pContext = (PDEVICE_EXTENSION)MiniportDeviceContext;
     557
     558        vboxWddmVGuidGet(pContext);
    569559
    570560        /* Save DeviceHandle and function pointers supplied by the DXGKRNL_INTERFACE structure passed to DxgkInterface. */
     
    665655    {
    666656        VbglTerminate();
     657
     658        vboxWddmVGuidFree(pDevExt);
    667659
    668660        /* revert back to the state we were right after the DxgkDdiAddDevice */
     
    34383430    PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter;
    34393431    Assert((UINT)pDevExt->u.primary.cDisplays > pSetVidPnSourceAddress->VidPnSourceId);
     3432
     3433    PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pSetVidPnSourceAddress->VidPnSourceId];
     3434    Status= vboxWddmDisplaySettingsQueryPos(pDevExt, pSetVidPnSourceAddress->VidPnSourceId, &pSource->VScreenPos);
     3435    Assert(Status == STATUS_SUCCESS);
     3436    Status = STATUS_SUCCESS;
     3437
    34403438    if ((UINT)pDevExt->u.primary.cDisplays > pSetVidPnSourceAddress->VidPnSourceId)
    34413439    {
    3442         PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pSetVidPnSourceAddress->VidPnSourceId];
    34433440        PVBOXWDDM_ALLOCATION pAllocation;
    34443441        Assert(pSetVidPnSourceAddress->hAllocation);
     
    34633460            Assert(pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE
    34643461                    || pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC);
     3462
    34653463            if (
    34663464#ifdef VBOXWDDM_RENDER_FROM_SHADOW
     
    34733471                /* to ensure the resize request gets issued in case we exit a full-screen D3D mode */
    34743472                pSource->offVram = VBOXVIDEOOFFSET_VOID;
    3475 #endif
    3476                 Status= vboxWddmDisplaySettingsQueryPos(pDevExt, pSetVidPnSourceAddress->VidPnSourceId, &pSource->VScreenPos);
    3477                 Assert(Status == STATUS_SUCCESS);
     3473#else
    34783474                /* should not generally happen, but still inform host*/
    34793475                Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource, pSetVidPnSourceAddress->VidPnSourceId);
     
    34813477                if (Status != STATUS_SUCCESS)
    34823478                    drprintf((__FUNCTION__": vboxWddmGhDisplaySetInfo failed, Status (0x%x)\n", Status));
     3479#endif
    34833480            }
    34843481        }
     
    35173514    PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter;
    35183515    Assert((UINT)pDevExt->u.primary.cDisplays > pSetVidPnSourceVisibility->VidPnSourceId);
     3516
     3517    PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pSetVidPnSourceVisibility->VidPnSourceId];
     3518    Status= vboxWddmDisplaySettingsQueryPos(pDevExt, pSetVidPnSourceVisibility->VidPnSourceId, &pSource->VScreenPos);
     3519    Assert(Status == STATUS_SUCCESS);
     3520    Status = STATUS_SUCCESS;
     3521
    35193522    if ((UINT)pDevExt->u.primary.cDisplays > pSetVidPnSourceVisibility->VidPnSourceId)
    35203523    {
    3521         PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pSetVidPnSourceVisibility->VidPnSourceId];
    35223524        PVBOXWDDM_ALLOCATION pAllocation = pSource->pPrimaryAllocation;
    35233525        if (pAllocation)
     
    35413543                        /* to ensure the resize request gets issued in case we exit a full-screen D3D mode */
    35423544                        pSource->offVram = VBOXVIDEOOFFSET_VOID;
    3543 #endif
    3544                         Status= vboxWddmDisplaySettingsQueryPos(pDevExt, pSetVidPnSourceVisibility->VidPnSourceId, &pSource->VScreenPos);
    3545                         Assert(Status == STATUS_SUCCESS);
     3545#else
    35463546                        Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource, pSetVidPnSourceVisibility->VidPnSourceId);
    35473547                        Assert(Status == STATUS_SUCCESS);
    35483548                        if (Status != STATUS_SUCCESS)
    35493549                            drprintf((__FUNCTION__": vboxWddmGhDisplaySetInfo failed, Status (0x%x)\n", Status));
     3550#endif
    35503551                    }
    35513552                }
     
    47174718            {
    47184719                pDevExt->aSources[i].offVram = VBOXVIDEOOFFSET_VOID;
    4719                 Status= vboxWddmDisplaySettingsQueryPos(pDevExt, i, &pDevExt->aSources[i].VScreenPos);
    4720                 Assert(Status == STATUS_SUCCESS);
     4720                NTSTATUS tmpStatus= vboxWddmDisplaySettingsQueryPos(pDevExt, i, &pDevExt->aSources[i].VScreenPos);
     4721                Assert(tmpStatus == STATUS_SUCCESS);
    47214722            }
    47224723        }
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