VirtualBox

Ignore:
Timestamp:
Nov 2, 2010 11:36:10 PM (14 years ago)
Author:
vboxsync
Message:

wddm/3d: CrHgsmi cleanup, free resources correctly; 2D fixes

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

Legend:

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

    r33684 r33714  
    44#include "VBoxUhgsmiKmt.h"
    55
     6static VBOXDISPKMT_CALLBACKS g_VBoxCrHgsmiKmtCallbacks;
     7static int g_bVBoxKmtCallbacksInited = 0;
     8
     9#ifdef VBOX_CRHGSMI_WITH_D3DDEV
    610static VBOXCRHGSMI_CALLBACKS g_VBoxCrHgsmiCallbacks;
    711static HMODULE g_hVBoxCrHgsmiProvider = NULL;
    812static uint32_t g_cVBoxCrHgsmiProvider = 0;
    913
    10 static VBOXDISPKMT_CALLBACKS g_VBoxCrHgsmiKmtCallbacks;
    1114
    1215typedef VBOXWDDMDISP_DECL(int) FNVBOXDISPCRHGSMI_INIT(PVBOXCRHGSMI_CALLBACKS pCallbacks);
     
    2528VBOXCRHGSMI_DECL(int) VBoxCrHgsmiInit(PVBOXCRHGSMI_CALLBACKS pCallbacks)
    2629{
    27     static int bKmtCallbacksInited = 0;
    28     if (!bKmtCallbacksInited)
     30    if (!g_bVBoxKmtCallbacksInited)
    2931    {
    3032        HRESULT hr = vboxDispKmtCallbacksInit(&g_VBoxCrHgsmiKmtCallbacks);
    3133        Assert(hr == S_OK);
    3234        if (hr == S_OK)
    33             bKmtCallbacksInited = 1;
     35            g_bVBoxKmtCallbacksInited = 1;
    3436        else
    35             bKmtCallbacksInited = -1;
    36     }
    37 
    38     Assert(bKmtCallbacksInited);
    39     if (bKmtCallbacksInited < 0)
     37            g_bVBoxKmtCallbacksInited = -1;
     38    }
     39
     40    Assert(g_bVBoxKmtCallbacksInited);
     41    if (g_bVBoxKmtCallbacksInited < 0)
    4042    {
    4143        Assert(0);
     
    135137    return NULL;
    136138}
     139#else
     140VBOXCRHGSMI_DECL(int) VBoxCrHgsmiInit()
     141{
     142    if (!g_bVBoxKmtCallbacksInited)
     143    {
     144        HRESULT hr = vboxDispKmtCallbacksInit(&g_VBoxCrHgsmiKmtCallbacks);
     145        Assert(hr == S_OK);
     146        if (hr == S_OK)
     147            g_bVBoxKmtCallbacksInited = 1;
     148        else
     149            g_bVBoxKmtCallbacksInited = -1;
     150    }
     151
     152    Assert(g_bVBoxKmtCallbacksInited);
     153    if (g_bVBoxKmtCallbacksInited < 0)
     154    {
     155        Assert(0);
     156        return VERR_NOT_SUPPORTED;
     157    }
     158
     159    return VINF_SUCCESS;
     160}
     161
     162VBOXCRHGSMI_DECL(PVBOXUHGSMI) VBoxCrHgsmiCreate()
     163{
     164    PVBOXUHGSMI_PRIVATE_KMT pHgsmiGL = (PVBOXUHGSMI_PRIVATE_KMT)RTMemAllocZ(sizeof (*pHgsmiGL));
     165    if (pHgsmiGL)
     166    {
     167#if 0
     168        HRESULT hr = vboxUhgsmiKmtCreate(pHgsmiGL, TRUE /* bD3D tmp for injection thread*/);
     169#else
     170        HRESULT hr = vboxUhgsmiKmtEscCreate(pHgsmiGL, TRUE /* bD3D tmp for injection thread*/);
     171#endif
     172        Assert(hr == S_OK);
     173        if (hr == S_OK)
     174        {
     175            return &pHgsmiGL->BasePrivate.Base;
     176        }
     177        RTMemFree(pHgsmiGL);
     178    }
     179
     180    return NULL;
     181}
     182
     183VBOXCRHGSMI_DECL(void) VBoxCrHgsmiDestroy(PVBOXUHGSMI pHgsmi)
     184{
     185    PVBOXUHGSMI_PRIVATE_KMT pHgsmiGL = VBOXUHGSMIKMT_GET(pHgsmi);
     186    HRESULT hr = vboxUhgsmiKmtDestroy(pHgsmiGL);
     187    Assert(hr == S_OK);
     188    if (hr == S_OK)
     189    {
     190        RTMemFree(pHgsmiGL);
     191    }
     192}
     193#endif
    137194
    138195VBOXCRHGSMI_DECL(int) VBoxCrHgsmiTerm()
    139196{
    140     Assert(0);
    141197#if 0
    142198    PVBOXUHGSMI_PRIVATE_KMT pHgsmiGL = gt_pHgsmiGL;
     
    151207        g_pfnVBoxDispCrHgsmiTerm();
    152208#endif
     209    if (g_bVBoxKmtCallbacksInited > 0)
     210    {
     211        vboxDispKmtCallbacksTerm(&g_VBoxCrHgsmiKmtCallbacks);
     212    }
    153213    return VINF_SUCCESS;
    154214}
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp

    r33684 r33714  
    740740#ifdef VBOX_WITH_CRHGSMI
    741741static __declspec(thread) PVBOXUHGSMI_PRIVATE_BASE gt_pHgsmi = NULL;
    742 #endif
    743742
    744743VBOXWDDMDISP_DECL(int) VBoxDispCrHgsmiInit(PVBOXCRHGSMI_CALLBACKS pCallbacks)
     
    786785}
    787786
    788 #ifdef VBOX_WITH_CRHGSMI
    789787static HRESULT vboxUhgsmiGlobalRetain()
    790788{
     
    876874#define VBOXDISPCRHGSMI_SCOPE_SET_DEV(_pDev) do {} while(0)
    877875#define VBOXDISPCRHGSMI_SCOPE_SET_GLOBAL() do {} while(0)
     876
     877VBOXWDDMDISP_DECL(int) VBoxDispCrHgsmiInit(void*)
     878{
     879    return VERR_NOT_IMPLEMENTED;
     880}
     881
     882VBOXWDDMDISP_DECL(int) VBoxDispCrHgsmiTerm()
     883{
     884    return VERR_NOT_IMPLEMENTED;
     885}
     886
     887VBOXWDDMDISP_DECL(void*) VBoxDispCrHgsmiQueryClient()
     888{
     889    return NULL;
     890}
    878891#endif
    879892
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiBase.h

    r33241 r33714  
    3232{
    3333    VBOXUHGSMI Base;
     34#ifdef VBOX_CRHGSMI_WITH_D3DDEV
    3435    HVBOXCRHGSMI_CLIENT hClient;
     36#endif
    3537} VBOXUHGSMI_PRIVATE_BASE, *PVBOXUHGSMI_PRIVATE_BASE;
    3638
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiKmt.cpp

    r33684 r33714  
    437437    pHgsmi->BasePrivate.Base.pfnBufferCreate = vboxUhgsmiKmtBufferCreate;
    438438    pHgsmi->BasePrivate.Base.pfnBufferSubmitAsynch = vboxUhgsmiKmtBufferSubmitAsynch;
     439#ifdef VBOX_CRHGSMI_WITH_D3DDEV
    439440    pHgsmi->BasePrivate.hClient = NULL;
     441#endif
    440442    return vboxUhgsmiKmtEngineCreate(pHgsmi, bD3D);
    441443}
     
    445447    pHgsmi->BasePrivate.Base.pfnBufferCreate = vboxUhgsmiKmtEscBufferCreate;
    446448    pHgsmi->BasePrivate.Base.pfnBufferSubmitAsynch = vboxUhgsmiKmtEscBufferSubmitAsynch;
     449#ifdef VBOX_CRHGSMI_WITH_D3DDEV
    447450    pHgsmi->BasePrivate.hClient = NULL;
     451#endif
    448452    return vboxUhgsmiKmtEngineCreate(pHgsmi, bD3D);
    449453}
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