VirtualBox

Ignore:
Timestamp:
Nov 5, 2010 4:40:26 PM (14 years ago)
Author:
vboxsync
Message:

Additions/WINNT/Graphics: more refactoring and disabling of some unused code

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Miniport
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp

    r33761 r33800  
    205205    return VideoPortSetRegistryParameters(Reg, pName, &Val, sizeof(Val));
    206206}
     207
     208void VBoxVideoCmnSignalEvent(PVBOXVIDEO_COMMON pCommon, uint64_t pvEvent)
     209{
     210    PDEVICE_EXTENSION PrimaryExtension = commonToPrimaryExt(pCommon);
     211#ifndef VBOX_WITH_WDDM
     212    PEVENT pEvent = (PEVENT)pvEvent;
     213    PrimaryExtension->u.primary.VideoPortProcs.pfnSetEvent(PrimaryExtension,
     214                                                           pEvent);
     215#else
     216    PKEVENT pEvent = (PKEVENT)pvEvent;
     217    KeSetEvent(pEvent, 0, FALSE);
     218#endif
     219}
     220
     221
     222#define MEM_TAG 'HVBV'
     223
     224void *VBoxVideoCmnMemAllocDriver(PVBOXVIDEO_COMMON pCommon, size_t cb)
     225{
     226    ULONG Tag = MEM_TAG;
     227#ifndef VBOX_WITH_WDDM
     228    PDEVICE_EXTENSION PrimaryExtension = commonToPrimaryExt(pCommon);
     229    return PrimaryExtension->u.primary.VideoPortProcs.pfnAllocatePool(PrimaryExtension, (VBOXVP_POOL_TYPE)VpNonPagedPool, cb, Tag);
     230#else
     231    return ExAllocatePoolWithTag(NonPagedPool, cb, Tag);
     232#endif
     233}
     234
     235
     236void VBoxVideoCmnMemFreeDriver(PVBOXVIDEO_COMMON pCommon, void *pv)
     237{
     238#ifndef VBOX_WITH_WDDM
     239    PDEVICE_EXTENSION PrimaryExtension = commonToPrimaryExt(pCommon);
     240    PrimaryExtension->u.primary.VideoPortProcs.pfnFreePool(PrimaryExtension,
     241                                                           pv);
     242#else
     243    ExFreePool(pv);
     244#endif
     245}
     246
    207247
    208248static void VBoxSetupVideoPortFunctions(PDEVICE_EXTENSION PrimaryExtension,
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h

    r33761 r33800  
    372372extern "C"
    373373{
     374/** Signal an event in a guest-OS-specific way.  pvEvent will be re-cast to
     375 * something OS-specific. */
     376void VBoxVideoCmnSignalEvent(PVBOXVIDEO_COMMON pCommon, uint64_t pvEvent);
     377
     378/** Allocate memory to be used in normal driver operation (dispatch level in
     379 * Windows) but not necessarily in IRQ context. */
     380void *VBoxVideoCmnMemAllocDriver(PVBOXVIDEO_COMMON pCommon, size_t cb);
     381
     382/** Free memory allocated by @a VBoxVideoCmnMemAllocDriver */
     383void VBoxVideoCmnMemFreeDriver(PVBOXVIDEO_COMMON pCommon, void *pv);
     384
    374385#ifndef VBOX_WITH_WDDM
    375386/* XPDM-WDDM common API */
     
    462473}
    463474
    464 DECLINLINE(PVOID) VBoxVideoCmnMemAllocNonPaged(IN PDEVICE_EXTENSION pDeviceExtension, IN SIZE_T NumberOfBytes, IN ULONG Tag)
    465 {
    466     return pDeviceExtension->u.primary.VideoPortProcs.pfnAllocatePool(pDeviceExtension, (VBOXVP_POOL_TYPE)VpNonPagedPool, NumberOfBytes, Tag);
    467 }
    468 
    469 DECLINLINE(VOID) VBoxVideoCmnMemFree(IN PDEVICE_EXTENSION pDeviceExtension, IN PVOID Ptr)
    470 {
    471     pDeviceExtension->u.primary.VideoPortProcs.pfnFreePool(pDeviceExtension, Ptr);
    472 }
    473 
    474475DECLINLINE(VP_STATUS) VBoxVideoCmnRegInit(IN PDEVICE_EXTENSION pDeviceExtension, OUT VBOXCMNREG *pReg)
    475476{
     
    576577{
    577578    return NO_ERROR;
    578 }
    579 
    580 DECLINLINE(PVOID) VBoxVideoCmnMemAllocNonPaged(IN PDEVICE_EXTENSION pDeviceExtension, IN SIZE_T NumberOfBytes, IN ULONG Tag)
    581 {
    582     return ExAllocatePoolWithTag(NonPagedPool, NumberOfBytes, Tag);
    583 }
    584 
    585 DECLINLINE(VOID) VBoxVideoCmnMemFree(IN PDEVICE_EXTENSION pDeviceExtension, IN PVOID Ptr)
    586 {
    587     ExFreePool(Ptr);
    588579}
    589580
     
    839830}
    840831
     832
    841833BOOLEAN VBoxHGSMIIsSupported (void);
    842834
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp

    r33761 r33800  
    3030
    3131#include "vboxioctl.h"
    32 
    33 #define MEM_TAG 'HVBV'
    3432
    3533void HGSMINotifyHostCmdComplete (PVBOXVIDEO_COMMON pCommon, HGSMIOFFSET offt)
     
    719717}VBVA_CHANNELCONTEXTS;
    720718
    721 static int vboxVBVADeleteChannelContexts(PDEVICE_EXTENSION PrimaryExtension, VBVA_CHANNELCONTEXTS * pContext)
    722 {
    723     VBoxVideoCmnMemFree(PrimaryExtension,pContext);
     719static int vboxVBVADeleteChannelContexts(PVBOXVIDEO_COMMON pCommon,
     720                                         VBVA_CHANNELCONTEXTS * pContext)
     721{
     722    VBoxVideoCmnMemFreeDriver(pCommon, pContext);
    724723    return VINF_SUCCESS;
    725724}
     
    729728    uint32_t cDisplays = (uint32_t)commonFromDeviceExt(PrimaryExtension)->cDisplays;
    730729    const size_t size = RT_OFFSETOF(VBVA_CHANNELCONTEXTS, aContexts[cDisplays]);
    731     VBVA_CHANNELCONTEXTS * pContext = (VBVA_CHANNELCONTEXTS*)VBoxVideoCmnMemAllocNonPaged(PrimaryExtension, size, MEM_TAG);
     730    VBVA_CHANNELCONTEXTS * pContext = (VBVA_CHANNELCONTEXTS*)VBoxVideoCmnMemAllocDriver(commonFromDeviceExt(PrimaryExtension), size);
    732731    if(pContext)
    733732    {
     
    802801    return VERR_INVALID_PARAMETER;
    803802}
     803
    804804
    805805static DECLCALLBACK(int) vboxVBVAChannelGenericHandler(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer)
     
    829829                        case VBVAHG_DISPLAY_CUSTOM:
    830830                        {
     831#if 0  /* Never taken */
    831832                            if(pLast)
    832833                            {
     
    835836                            }
    836837                            else
     838#endif
    837839                            {
    838840                                pFirst = pCur;
     
    840842                            }
    841843                            Assert(!pCur->u.Data);
     844#if 0  /* Who is supposed to set pNext? */
    842845                            //TODO: use offset here
    843846                            pCur = pCur->u.pNext;
    844847                            Assert(!pCur);
     848#else
     849                            Assert(!pCur->u.pNext);
     850                            pCur = NULL;
     851#endif
    845852                            Assert(pFirst);
    846853                            Assert(pFirst == pLast);
     
    850857                        {
    851858                            VBVAHOSTCMDEVENT *pEventCmd = VBVAHOSTCMD_BODY(pCur, VBVAHOSTCMDEVENT);
    852 #ifndef VBOX_WITH_WDDM
    853                             PEVENT pEvent = (PEVENT)pEventCmd->pEvent;
    854                             pCallbacks->PrimaryExtension->u.primary.VideoPortProcs.pfnSetEvent(
    855                                     pCallbacks->PrimaryExtension,
    856                                     pEvent);
    857 #else
    858                             PKEVENT pEvent = (PKEVENT)pEventCmd->pEvent;
    859                             KeSetEvent(pEvent, 0, FALSE);
    860 #endif
     859                            VBoxVideoCmnSignalEvent(commonFromDeviceExt(pCallbacks->PrimaryExtension), pEventCmd->pEvent);
    861860                        }
    862861                        default:
     
    865864                            Assert(u16ChannelInfo==VBVAHG_EVENT);
    866865                            Assert(!pCur->u.Data);
     866#if 0  /* pLast has been asserted to be NULL, and who should set pNext? */
    867867                            //TODO: use offset here
    868868                            if(pLast)
     
    870870                            VBVAHOSTCMD * pNext = pCur->u.pNext;
    871871                            pCur->u.pNext = NULL;
     872#else
     873                            Assert(!pCur->u.pNext);
     874#endif
    872875                            HGSMIHostCmdComplete(commonFromDeviceExt(pCallbacks->PrimaryExtension), pCur);
     876#if 0  /* pNext is NULL, and the other things have already been asserted */
    873877                            pCur = pNext;
    874878                            Assert(!pCur);
    875879                            Assert(!pFirst);
    876880                            Assert(pFirst == pLast);
     881#else
     882                            pCur = NULL;
     883#endif
    877884                            break;
    878885                        }
     
    10051012    if(!pChannel)
    10061013    {
    1007         vboxVBVADeleteChannelContexts(PrimaryExtension, pContexts);
     1014        vboxVBVADeleteChannelContexts(commonFromDeviceExt(PrimaryExtension), pContexts);
    10081015    }
    10091016
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