VirtualBox

Changeset 33929 in vbox


Ignore:
Timestamp:
Nov 10, 2010 9:31:48 AM (14 years ago)
Author:
vboxsync
Message:

wddm: fix guest misbehave on driver update, bugfixing

Location:
trunk/src/VBox
Files:
6 edited

Legend:

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

    r33540 r33929  
    137137        pContext->pDevice = pDevice;
    138138    }
     139    else
     140    {
     141        exit(1);
     142    }
     143
    139144    return hr;
    140145}
     
    190195            if (!pCmd->Hdr.cbCmdsReturned && !pCmd->Hdr.cbRemainingFirstCmd)
    191196                hr = S_FALSE;
     197        }
     198        else
     199        {
     200            exit(1);
    192201        }
    193202    }
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiKmt.cpp

    r33715 r33929  
    572572}
    573573
     574HRESULT vboxDispKmtAdpHdcCreate(HDC *phDc)
     575{
     576    HRESULT hr = E_FAIL;
     577    DISPLAY_DEVICE DDev;
     578    memset(&DDev, 0, sizeof (DDev));
     579    DDev.cb = sizeof (DDev);
     580
     581    for (int i = 0; ; ++i)
     582    {
     583        if (EnumDisplayDevices(NULL, /* LPCTSTR lpDevice */ i, /* DWORD iDevNum */
     584                &DDev, 0 /* DWORD dwFlags*/))
     585        {
     586            if (DDev.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
     587            {
     588                HDC hDc = CreateDC(NULL, DDev.DeviceName, NULL, NULL);
     589                if (hDc)
     590                {
     591                    *phDc = hDc;
     592                    return S_OK;
     593                }
     594                else
     595                {
     596                    DWORD winEr = GetLastError();
     597                    Assert(0);
     598                    hr = HRESULT_FROM_WIN32(winEr);
     599                    Assert(FAILED(hr));
     600                    break;
     601                }
     602            }
     603        }
     604        else
     605        {
     606            DWORD winEr = GetLastError();
     607            Assert(0);
     608            hr = HRESULT_FROM_WIN32(winEr);
     609            Assert(FAILED(hr));
     610            break;
     611        }
     612    }
     613
     614    return hr;
     615}
     616
    574617HRESULT vboxDispKmtOpenAdapter(PVBOXDISPKMT_CALLBACKS pCallbacks, PVBOXDISPKMT_ADAPTER pAdapter)
    575618{
    576     D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME OpenAdapterData = {0};
    577     wcsncpy(OpenAdapterData.DeviceName, L"\\\\.\\DISPLAY1", RT_ELEMENTS(OpenAdapterData.DeviceName) - 1 /* the last one is always \0 */);
    578     HRESULT hr = S_OK;
    579     NTSTATUS Status = pCallbacks->pfnD3DKMTOpenAdapterFromGdiDisplayName(&OpenAdapterData);
    580     Assert(!Status);
    581     if (!Status)
    582     {
    583         pAdapter->hAdapter = OpenAdapterData.hAdapter;
    584         pAdapter->pCallbacks = pCallbacks;
    585         return S_OK;
    586     }
    587     else
    588     {
    589         Log((__FUNCTION__": pfnD3DKMTOpenAdapterFromGdiDisplayName failed, Status (0x%x)\n", Status));
    590         hr = E_FAIL;
     619    D3DKMT_OPENADAPTERFROMHDC OpenAdapterData = {0};
     620    OpenAdapterData.hDc = GetWindowDC(NULL);
     621    HRESULT hr = vboxDispKmtAdpHdcCreate(&OpenAdapterData.hDc);
     622    if (OpenAdapterData.hDc)
     623    {
     624        NTSTATUS Status = pCallbacks->pfnD3DKMTOpenAdapterFromHdc(&OpenAdapterData);
     625        Assert(!Status);
     626        if (!Status)
     627        {
     628            pAdapter->hAdapter = OpenAdapterData.hAdapter;
     629            pAdapter->hDc = OpenAdapterData.hDc;
     630            pAdapter->pCallbacks = pCallbacks;
     631            return S_OK;
     632        }
     633        else
     634        {
     635            Log((__FUNCTION__": pfnD3DKMTOpenAdapterFromGdiDisplayName failed, Status (0x%x)\n", Status));
     636            hr = E_FAIL;
     637        }
     638
     639        ReleaseDC(NULL, OpenAdapterData.hDc);
    591640    }
    592641
    593642    return hr;
    594 
    595643}
    596644
     
    603651    if (!Status)
    604652    {
     653        ReleaseDC(NULL, pAdapter->hDc);
    605654        return S_OK;
    606655    }
    607656
    608657    Log((__FUNCTION__": pfnD3DKMTCloseAdapter failed, Status (0x%x)\n", Status));
    609     /* ignore */
    610     Status = 0;
     658
    611659    return E_FAIL;
    612660}
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiKmt.h

    r33530 r33929  
    5252{
    5353    D3DKMT_HANDLE hAdapter;
     54    HDC hDc;
    5455    PVBOXDISPKMT_CALLBACKS pCallbacks;
    5556}VBOXDISPKMT_ADAPTER, *PVBOXDISPKMT_ADAPTER;
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.cpp

    r33879 r33929  
    17171717    return Status == STATUS_SUCCESS;
    17181718}
     1719
     1720#define VBOXVIDPNDUMP_STRCASE(_t) \
     1721        case _t: return #_t;
     1722#define VBOXVIDPNDUMP_STRCASE_UNKNOWN() \
     1723        default: return "Unknown";
     1724
     1725#define VBOXVIDPNDUMP_STRFLAGS(_v, _t) \
     1726        if ((_v)._t return #_t;
     1727
     1728const char* vboxVidPnDumpStrImportance(D3DKMDT_VIDPN_PRESENT_PATH_IMPORTANCE ImportanceOrdinal)
     1729{
     1730    switch (ImportanceOrdinal)
     1731    {
     1732        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_UNINITIALIZED);
     1733        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_PRIMARY);
     1734        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_SECONDARY);
     1735        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_TERTIARY);
     1736        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_QUATERNARY);
     1737        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_QUINARY);
     1738        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_SENARY);
     1739        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_SEPTENARY);
     1740        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_OCTONARY);
     1741        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_NONARY);
     1742        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPI_DENARY);
     1743        VBOXVIDPNDUMP_STRCASE_UNKNOWN();
     1744    }
     1745}
     1746
     1747const char* vboxVidPnDumpStrScaling(D3DKMDT_VIDPN_PRESENT_PATH_SCALING Scaling)
     1748{
     1749    switch (Scaling)
     1750    {
     1751        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPS_UNINITIALIZED);
     1752        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPS_IDENTITY);
     1753        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPS_CENTERED);
     1754        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPS_STRETCHED);
     1755        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPS_UNPINNED);
     1756        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPS_NOTSPECIFIED);
     1757        VBOXVIDPNDUMP_STRCASE_UNKNOWN();
     1758    }
     1759}
     1760
     1761const char* vboxVidPnDumpStrRotation(D3DKMDT_VIDPN_PRESENT_PATH_ROTATION Rotation)
     1762{
     1763    switch (Rotation)
     1764    {
     1765        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPR_UNINITIALIZED);
     1766        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPR_IDENTITY);
     1767        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPR_ROTATE90);
     1768        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPR_ROTATE180);
     1769        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPR_ROTATE270);
     1770        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPR_UNPINNED);
     1771        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPR_NOTSPECIFIED);
     1772        VBOXVIDPNDUMP_STRCASE_UNKNOWN();
     1773    }
     1774}
     1775
     1776const char* vboxVidPnDumpStrColorBasis(D3DKMDT_COLOR_BASIS ColorBasis)
     1777{
     1778    switch (ColorBasis)
     1779    {
     1780        VBOXVIDPNDUMP_STRCASE(D3DKMDT_CB_UNINITIALIZED);
     1781        VBOXVIDPNDUMP_STRCASE(D3DKMDT_CB_INTENSITY);
     1782        VBOXVIDPNDUMP_STRCASE(D3DKMDT_CB_SRGB);
     1783        VBOXVIDPNDUMP_STRCASE(D3DKMDT_CB_SCRGB);
     1784        VBOXVIDPNDUMP_STRCASE(D3DKMDT_CB_YCBCR);
     1785        VBOXVIDPNDUMP_STRCASE(D3DKMDT_CB_YPBPR);
     1786        VBOXVIDPNDUMP_STRCASE_UNKNOWN();
     1787    }
     1788}
     1789
     1790const char* vboxVidPnDumpStrContent(D3DKMDT_VIDPN_PRESENT_PATH_CONTENT Content)
     1791{
     1792    switch (Content)
     1793    {
     1794        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPC_UNINITIALIZED);
     1795        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPC_GRAPHICS);
     1796        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPC_VIDEO);
     1797        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPC_NOTSPECIFIED);
     1798        VBOXVIDPNDUMP_STRCASE_UNKNOWN();
     1799    }
     1800}
     1801
     1802const char* vboxVidPnDumpStrCopyProtectionType(D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION_TYPE CopyProtectionType)
     1803{
     1804    switch (CopyProtectionType)
     1805    {
     1806        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPMT_UNINITIALIZED);
     1807        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPMT_NOPROTECTION);
     1808        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPMT_MACROVISION_APSTRIGGER);
     1809        VBOXVIDPNDUMP_STRCASE(D3DKMDT_VPPMT_MACROVISION_FULLSUPPORT);
     1810        VBOXVIDPNDUMP_STRCASE_UNKNOWN();
     1811    }
     1812}
     1813
     1814const char* vboxVidPnDumpStrGammaRampType(D3DDDI_GAMMARAMP_TYPE Type)
     1815{
     1816    switch (Type)
     1817    {
     1818        VBOXVIDPNDUMP_STRCASE(D3DDDI_GAMMARAMP_UNINITIALIZED);
     1819        VBOXVIDPNDUMP_STRCASE(D3DDDI_GAMMARAMP_DEFAULT);
     1820        VBOXVIDPNDUMP_STRCASE(D3DDDI_GAMMARAMP_RGB256x3x16);
     1821        VBOXVIDPNDUMP_STRCASE(D3DDDI_GAMMARAMP_DXGI_1);
     1822        VBOXVIDPNDUMP_STRCASE_UNKNOWN();
     1823    }
     1824}
     1825
     1826
     1827void vboxVidPnDumpCopyProtectoin(const D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION *pCopyProtection)
     1828{
     1829    drprintf(("CopyProtection: CopyProtectionType(%s),  TODO: Dump All the rest\n",
     1830            vboxVidPnDumpStrCopyProtectionType(pCopyProtection->CopyProtectionType)));
     1831}
     1832
     1833
     1834void vboxVidPnDumpPathTransformation(const D3DKMDT_VIDPN_PRESENT_PATH_TRANSFORMATION *pContentTransformation)
     1835{
     1836    drprintf(("Transformation: Scaling(%s),  ScalingSupport(%d), Rotation(%s), RotationSupport(%d)\n",
     1837            vboxVidPnDumpStrScaling(pContentTransformation->Scaling), pContentTransformation->ScalingSupport,
     1838            vboxVidPnDumpStrRotation(pContentTransformation->Rotation), pContentTransformation->RotationSupport));
     1839}
     1840
     1841void vboxVidPnDumpRegion(const char *pPrefix, const D3DKMDT_2DREGION *pRegion, const char *pSuffix)
     1842{
     1843    drprintf(("%scx(%d), cy(%d)%s", pPrefix, pRegion->cx, pRegion->cy, pSuffix));
     1844}
     1845
     1846void vboxVidPnDumpRanges(const char *pPrefix, const D3DKMDT_COLOR_COEFF_DYNAMIC_RANGES *pDynamicRanges, const char *pSuffix)
     1847{
     1848    drprintf(("%sFirstChannel(%d), SecondChannel(%d), ThirdChannel(%d), FourthChannel(%d)%s", pPrefix,
     1849            pDynamicRanges->FirstChannel,
     1850            pDynamicRanges->SecondChannel,
     1851            pDynamicRanges->ThirdChannel,
     1852            pDynamicRanges->FourthChannel,
     1853            pSuffix));
     1854}
     1855
     1856void vboxVidPnDumpGammaRamp(const char *pPrefix, const D3DKMDT_GAMMA_RAMP *pGammaRamp, const char *pSuffix)
     1857{
     1858    drprintf(("%Type(%s), DataSize(%d), TODO: dump the rest%s", pPrefix,
     1859            vboxVidPnDumpStrGammaRampType(pGammaRamp->Type), pGammaRamp->DataSize,
     1860            pSuffix));
     1861}
     1862
     1863
     1864void vboxVidPnDumpPath(struct _DEVICE_EXTENSION* pDevExt, const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
     1865        const D3DKMDT_VIDPN_PRESENT_PATH *pVidPnPresentPathInfo)
     1866{
     1867    drprintf((" >>Start Dump VidPn Path>>\n"));
     1868    drprintf(("VidPnSourceId(%d),  VidPnTargetId(%d), ImportanceOrdinal(%s), VidPnTargetColorBasis(%s), Content(%s)\n",
     1869            pVidPnPresentPathInfo->VidPnSourceId, pVidPnPresentPathInfo->VidPnTargetId,
     1870            vboxVidPnDumpStrImportance(pVidPnPresentPathInfo->ImportanceOrdinal),
     1871            vboxVidPnDumpStrColorBasis(pVidPnPresentPathInfo->VidPnTargetColorBasis),
     1872            vboxVidPnDumpStrContent(pVidPnPresentPathInfo->Content)));
     1873    vboxVidPnDumpPathTransformation(&pVidPnPresentPathInfo->ContentTransformation);
     1874    vboxVidPnDumpRegion("VisibleFromActiveTLOffset: ", &pVidPnPresentPathInfo->VisibleFromActiveTLOffset, "\n");
     1875    vboxVidPnDumpRegion("VisibleFromActiveBROffset: ", &pVidPnPresentPathInfo->VisibleFromActiveBROffset, "\n");
     1876    vboxVidPnDumpRanges("VidPnTargetColorCoeffDynamicRanges: ", &pVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges, "\n");
     1877    vboxVidPnDumpCopyProtectoin(&pVidPnPresentPathInfo->CopyProtection);
     1878    vboxVidPnDumpGammaRamp("GammaRamp: ", &pVidPnPresentPathInfo->GammaRamp, "\n");
     1879
     1880    drprintf((" <<Stop Dump VidPn Path<<\n"));
     1881}
     1882
     1883static DECLCALLBACK(BOOLEAN) vboxVidPnDumpPathEnum(struct _DEVICE_EXTENSION* pDevExt, const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
     1884        D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
     1885        const D3DKMDT_VIDPN_PRESENT_PATH *pVidPnPresentPathInfo, PVOID pContext)
     1886{
     1887    vboxVidPnDumpPath(pDevExt, hVidPn, pVidPnInterface, pVidPnPresentPathInfo);
     1888
     1889    pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pVidPnPresentPathInfo);
     1890    return TRUE;
     1891}
     1892
     1893void vboxVidPnDumpVidPn(PDEVICE_EXTENSION pDevExt, D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface)
     1894{
     1895    drprintf ((">>>>>>>>>>>>>>>>>Start Dumping VidPn>>>>>>>>>>>>>>>>>>>>>>\n"));
     1896
     1897    D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology;
     1898    const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface;
     1899    NTSTATUS Status = pVidPnInterface->pfnGetTopology(hVidPn, &hVidPnTopology, &pVidPnTopologyInterface);
     1900    Assert(Status == STATUS_SUCCESS);
     1901    if (Status == STATUS_SUCCESS)
     1902    {
     1903        Status = vboxVidPnEnumPaths(pDevExt, hVidPn, pVidPnInterface,
     1904                                        hVidPnTopology, pVidPnTopologyInterface,
     1905                                        vboxVidPnDumpPathEnum, NULL);
     1906        Assert(Status == STATUS_SUCCESS);
     1907    }
     1908
     1909    drprintf (("<<<<<<<<<<<<<<<<<Stop Dumping VidPn<<<<<<<<<<<<<<<<<<<<<<\n"));
     1910}
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.cpp

    r32622 r33929  
    115115    DWORD err = NO_ERROR;
    116116    NTSTATUS Status = pIf->modeData.wddm.pfnD3DKMTOpenAdapterFromGdiDisplayName(&OpenAdapterData);
     117    Assert(!Status);
    117118    if (!Status)
    118119    {
  • trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c

    r33714 r33929  
    12371237    if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr.result))
    12381238    {
     1239        Assert(0);
     1240
    12391241        crWarning("Host doesn't accept our version %d.%d. Make sure you have appropriate additions installed!",
    12401242                  parms.vMajor.u.value32, parms.vMinor.u.value32);
     
    12781280        if (g_crvboxhgcm.hGuestDrv == INVALID_HANDLE_VALUE)
    12791281        {
     1282            Assert(0);
    12801283            crDebug("could not open VBox Guest Additions driver! rc = %d\n", GetLastError());
    12811284            VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
     
    12921295            crDebug("could not open Guest Additions kernel module! rc = %d\n", errno);
    12931296            VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
     1297            Assert(0);
    12941298            return FALSE;
    12951299        }
     
    13331337        {
    13341338            crDebug("HGCM connect failed with rc=0x%x\n", info.result);
     1339            Assert(0);
    13351340
    13361341            VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
     
    13411346    {
    13421347#ifdef RT_OS_WINDOWS
    1343         crDebug("IOCTL for HGCM connect failed with rc=0x%x\n", GetLastError());
     1348        DWORD winEr = GetLastError();
     1349        Assert(0);
     1350        crDebug("IOCTL for HGCM connect failed with rc=0x%x\n", winEr);
    13441351#else
    13451352        crDebug("IOCTL for HGCM connect failed with rc=0x%x\n", errno);
     
    16271634    if (RT_FAILURE(rc))
    16281635    {
    1629         crWarning("pfnBufferSubmitAsynch failed with %d \n", rc);
     1636        crError("pfnBufferSubmitAsynch failed with %d \n", rc);
    16301637        return;
    16311638    }
     
    17611768        if (RT_FAILURE(rc))
    17621769        {
    1763             crWarning("pfnBufferSubmitAsynch failed with %d \n", rc);
     1770            crError("pfnBufferSubmitAsynch failed with %d \n", rc);
    17641771            break;
    17651772        }
     
    18811888            callRes = _crVBoxHGSMICmdBufferGetRc(pClient);
    18821889        }
     1890        else
     1891        {
     1892            /* we can not recover at this point, report error & exit */
     1893            crError("pfnBufferSubmitAsynch failed with %d \n", rc);
     1894        }
    18831895    }
    18841896    else
     
    19141926
    19151927            callRes = _crVBoxHGSMICmdBufferGetRc(pClient);
     1928        }
     1929        else
     1930        {
     1931            /* we can not recover at this point, report error & exit */
     1932            crError("Failed to submit CrHhgsmi buffer");
    19161933        }
    19171934    }
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