VirtualBox

Changeset 43490 in vbox


Ignore:
Timestamp:
Oct 1, 2012 11:56:39 AM (12 years ago)
Author:
vboxsync
Message:

wddm/3d: profiling, flushToHost support

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

Legend:

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

    r43360 r43490  
    5151# ifdef VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_ENABLE
    5252
    53 extern volatile uint32_t g_u322VBoxDispProfileFunctionLoggerIndex = 0;
     53class VBoxDispProfileDevicePostProcess
     54{
     55public:
     56    VBoxDispProfileDevicePostProcess(PVBOXWDDMDISP_DEVICE pDevice) :
     57        m_pDevice(pDevice)
     58    {}
     59
     60    void postProcess()
     61    {
     62        if (m_pDevice->pDevice9If)
     63            m_pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9Finish((IDirect3DDevice9Ex *)m_pDevice->pDevice9If);
     64    }
     65private:
     66    PVBOXWDDMDISP_DEVICE m_pDevice;
     67};
    5468
    5569//static VBoxDispProfileSet g_VBoxDispProfileDDI("D3D_DDI");
    56 #  define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE(_pObj) VBOXDISPPROFILE_FUNCTION_LOGGER_DEFINE((_pObj)->ProfileDdiFunc)
     70#  define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE_DEV(_pObj) VBOXDISPPROFILE_FUNCTION_LOGGER_DEFINE((_pObj)->ProfileDdiFunc, VBoxDispProfileDevicePostProcess, VBoxDispProfileDevicePostProcess(_pObj))
     71#  define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE_BASE(_pObj) VBOXDISPPROFILE_FUNCTION_LOGGER_DEFINE((_pObj)->ProfileDdiFunc, VBoxDispProfileDummyPostProcess, VBoxDispProfileDummyPostProcess())
    5772#  define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_DUMP(_pObj) do {\
    5873        (_pObj)->ProfileDdiFunc.dump(_pObj); \
     
    6883
    6984#  define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_REPORT_FRAME(_pObj) do { \
    70         if (!((_pObj)->ProfileDdiFunc.reportIteration() % 31) && !VBOXVDBG_IS_DWM()) {\
     85        if (!((_pObj)->ProfileDdiFunc.reportIteration() % 31) /*&& !VBOXVDBG_IS_DWM()*/) {\
    7186            VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_DUMP(_pObj); \
    7287            VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_RESET(_pObj); \
     
    7590
    7691# else
    77 #  define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE(_pObj) do {} while(0)
     92#  define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE_DEV(_pObj) do {} while(0)
     93#  define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE_BASE(_pObj) do {} while(0)
    7894#  define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_DUMP(_pObj) do {} while(0)
    7995#  define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_RESET(_pObj) do {} while(0)
     
    85101# ifdef VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_ENABLE
    86102//static VBoxDispProfileFpsCounter g_VBoxDispFpsDDI(64);
    87 #  define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_PROLOGUE(_pObj) VBOXDISPPROFILE_STATISTIC_LOGGER_DEFINE(&(_pObj)->ProfileDdiFps)
     103#  define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_PROLOGUE(_pObj) VBOXDISPPROFILE_STATISTIC_LOGGER_DEFINE(&(_pObj)->ProfileDdiFps, VBoxDispProfileDummyPostProcess, VBoxDispProfileDummyPostProcess())
    88104#  define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_DISABLE_CURRENT() do {\
    89105        VBOXDISPPROFILE_STATISTIC_LOGGER_DISABLE_CURRENT();\
     
    114130# endif
    115131
    116 # define VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE(_pObj) \
    117         VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE(_pObj); \
     132# define VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE_DEV(_pObj) \
     133        VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE_DEV(_pObj); \
     134        VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_PROLOGUE(_pObj);
     135
     136# define VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE_BASE(_pObj) \
     137        VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE_BASE(_pObj); \
    118138        VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_PROLOGUE(_pObj);
    119139
     
    128148    } while (0)
    129149
     150#if 0
    130151# define VBOXDISPPROFILE_DDI_REPORT_FLUSH(_pDev) do {\
    131152        VBOXDISPPROFILE_DDI_LOG_AND_DISABLE_CURRENT(); \
     
    133154        VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_REPORT_FRAME(_pDev); \
    134155    } while (0)
     156#else
     157# define VBOXDISPPROFILE_DDI_REPORT_FLUSH(_pDev) do {} while (0)
     158#endif
    135159
    136160# define VBOXDISPPROFILE_DDI_INIT_CMN(_pObj, _name, _cEntries) do { \
     
    157181# define VBOXDISPPROFILE_DDI_INIT_DEV(_pDev) VBOXDISPPROFILE_DDI_INIT_CMN(_pDev, "DDI_Dev", 64)
    158182#else
    159 # define VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE(_pObj) do {} while (0)
     183# define VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE_DEV(_pObj) do {} while (0)
     184# define VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE_BASE(_pObj) do {} while (0)
    160185# define VBOXDISPPROFILE_DDI_REPORT_FRAME(_pDev) do {} while (0)
    161186# define VBOXDISPPROFILE_DDI_REPORT_FLUSH(_pDev) do {} while (0)
     
    175200#define VBOXDISP_DDI_PROLOGUE_DEV(_hDevice) \
    176201    VBOXDISP_DDI_PROLOGUE_CMN(); \
    177     VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE((PVBOXWDDMDISP_DEVICE)(_hDevice));
     202    VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE_DEV((PVBOXWDDMDISP_DEVICE)(_hDevice));
    178203
    179204#define VBOXDISP_DDI_PROLOGUE_ADP(_hAdapter) \
    180205    VBOXDISP_DDI_PROLOGUE_CMN(); \
    181     VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE((PVBOXWDDMDISP_ADAPTER)(_hAdapter));
     206    VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE_BASE((PVBOXWDDMDISP_ADAPTER)(_hAdapter));
    182207
    183208#define VBOXDISP_DDI_PROLOGUE_GLBL() \
    184209    VBOXDISP_DDI_PROLOGUE_CMN(); \
    185     VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE(&g_VBoxDispProfile);
     210    VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE_BASE(&g_VBoxDispProfile);
    186211
    187212#ifdef VBOXDISPMP_TEST
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.cpp

    r43334 r43490  
    7777        {
    7878            WARN(("no VBoxWineExD3DDev9Flush"));
     79            break;
     80        }
     81
     82        pD3D->pfnVBoxWineExD3DDev9FlushToHost = (PFNVBOXWINEEXD3DDEV9_FLUSHTOHOST)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9FlushToHost");
     83        if (!pD3D->pfnVBoxWineExD3DDev9FlushToHost)
     84        {
     85            WARN(("no VBoxWineExD3DDev9FlushToHost"));
     86            break;
     87        }
     88
     89        pD3D->pfnVBoxWineExD3DDev9Finish = (PFNVBOXWINEEXD3DDEV9_FINISH)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9Finish");
     90        if (!pD3D->pfnVBoxWineExD3DDev9Finish)
     91        {
     92            WARN(("no VBoxWineExD3DDev9Finish"));
    7993            break;
    8094        }
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.h

    r43334 r43490  
    7575    PFNVBOXWINEEXD3DSWAPCHAIN9_PRESENT pfnVBoxWineExD3DSwapchain9Present;
    7676
     77    PFNVBOXWINEEXD3DDEV9_FLUSHTOHOST pfnVBoxWineExD3DDev9FlushToHost;
     78
     79    PFNVBOXWINEEXD3DDEV9_FINISH pfnVBoxWineExD3DDev9Finish;
     80
    7781    /* module handle */
    7882    HMODULE hD3DLib;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispProfile.h

    r41637 r43490  
    194194};
    195195
    196 template<typename T> class VBoxDispProfileScopeLogger
     196class VBoxDispProfileDummyPostProcess
    197197{
    198198public:
    199     VBoxDispProfileScopeLogger(T *pEntry) :
     199    void postProcess(){}
     200};
     201
     202template<typename T, typename P> class VBoxDispProfileScopeLogger
     203{
     204public:
     205    VBoxDispProfileScopeLogger(T *pEntry, P PostProcess) :
    200206        m_pEntry(pEntry),
     207        m_PostProcess(PostProcess),
    201208        m_bDisable(FALSE)
    202209    {
     
    226233    void logStep()
    227234    {
     235        m_PostProcess.postProcess();
    228236        uint64_t cNewTime = VBOXDISPPROFILE_GET_TIME_NANO();
    229237        m_pEntry->step(cNewTime - m_cTime);
    230238    }
    231239    T *m_pEntry;
     240    P m_PostProcess;
    232241    uint64_t m_cTime;
    233242    BOOL m_bDisable;
     
    373382
    374383#ifdef VBOXDISPPROFILE_FUNCTION_LOGGER_GLOBAL_PROFILE
    375 # define VBOXDISPPROFILE_FUNCTION_LOGGER_DEFINE(_p)  \
     384# define VBOXDISPPROFILE_FUNCTION_LOGGER_DEFINE(_p, _T, _v)  \
    376385        static VBoxDispProfileEntry * __pVBoxDispProfileEntry = NULL; \
    377386        if (!__pVBoxDispProfileEntry) { __pVBoxDispProfileEntry = _p.alloc(__FUNCTION__); } \
    378         VBoxDispProfileScopeLogger<VBoxDispProfileEntry> __vboxDispProfileFunctionLogger(__pVBoxDispProfileEntry);
     387        VBoxDispProfileScopeLogger<VBoxDispProfileEntry, _T> __vboxDispProfileFunctionLogger(__pVBoxDispProfileEntry, _v);
    379388#else
    380389# ifndef VBOXDISPPROFILE_FUNCTION_LOGGER_INDEX_GEN
    381390#  error "VBOXDISPPROFILE_FUNCTION_LOGGER_INDEX_GEN should be fedined!"
    382391# endif
    383 # define VBOXDISPPROFILE_FUNCTION_LOGGER_DEFINE(_p)  \
     392# define VBOXDISPPROFILE_FUNCTION_LOGGER_DEFINE(_p, _T, _v)  \
    384393        static uint32_t __u32VBoxDispProfileIndex = VBOXDISPPROFILE_FUNCTION_LOGGER_INDEX_GEN(); \
    385394        VBoxDispProfileEntry * __pVBoxDispProfileEntry = _p.get(__u32VBoxDispProfileIndex, __FUNCTION__); \
    386         VBoxDispProfileScopeLogger<VBoxDispProfileEntry> __vboxDispProfileFunctionLogger(__pVBoxDispProfileEntry);
     395        VBoxDispProfileScopeLogger<VBoxDispProfileEntry, _T> __vboxDispProfileFunctionLogger(__pVBoxDispProfileEntry, _v);
    387396#endif
    388397
     
    396405
    397406
    398 #define VBOXDISPPROFILE_STATISTIC_LOGGER_DEFINE(_p)  \
    399         VBoxDispProfileScopeLogger<VBoxDispProfileFpsCounter> __vboxDispProfileStatisticLogger(_p);
     407#define VBOXDISPPROFILE_STATISTIC_LOGGER_DEFINE(_p, _T, _v)  \
     408        VBoxDispProfileScopeLogger<VBoxDispProfileFpsCounter, _T> __vboxDispProfileStatisticLogger(_p, _v);
    400409
    401410//#define VBOXDISPPROFILE_FUNCTION_PROLOGUE(_p) \
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