VirtualBox

Changeset 33997 in vbox


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

Additions/WINNT/Graphics: more refactoring and some cleanup

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxHGSMI.h

    r33890 r33997  
    4141typedef VP_STATUS (*PFNCREATEEVENT) (IN PVOID  HwDeviceExtension, IN ULONG  EventFlag, IN PVOID  Unused, OUT PEVENT  *ppEvent);
    4242typedef VP_STATUS (*PFNDELETEEVENT) (IN PVOID  HwDeviceExtension, IN PEVENT  pEvent);
    43 
    44 typedef VP_STATUS (*PFNCREATESPINLOCK) (IN PVOID  HwDeviceExtension, OUT PSPIN_LOCK  *SpinLock);
    45 typedef VP_STATUS (*PFNDELETESPINLOCK) (IN PVOID  HwDeviceExtension, IN PSPIN_LOCK  SpinLock);
    46 
    47 typedef VOID (*PFNACQUIRESPINLOCK) (IN PVOID  HwDeviceExtension, IN PSPIN_LOCK  SpinLock, OUT PUCHAR  OldIrql);
    48 typedef VOID (*PFNRELEASESPINLOCK) (IN PVOID  HwDeviceExtension, IN PSPIN_LOCK  SpinLock, IN UCHAR  NewIrql);
    49 typedef VOID (*PFNACQUIRESPINLOCKATDPCLEVEL) (IN PVOID  HwDeviceExtension, IN PSPIN_LOCK  SpinLock);
    50 typedef VOID (*PFNRELEASESPINLOCKFROMDPCLEVEL) (IN PVOID  HwDeviceExtension, IN PSPIN_LOCK  SpinLock);
    5143#endif
    5244
     
    7567typedef VBOXVP_STATUS (*PFNDELETEEVENT) (void*  HwDeviceExtension, VBOXPEVENT  pEvent);
    7668
    77 typedef VBOXVP_STATUS (*PFNCREATESPINLOCK) (void*  HwDeviceExtension, VBOXPSPIN_LOCK  *SpinLock);
    78 typedef VBOXVP_STATUS (*PFNDELETESPINLOCK) (void*  HwDeviceExtension, VBOXPSPIN_LOCK  SpinLock);
    79 
    80 typedef void (*PFNACQUIRESPINLOCK) (void*  HwDeviceExtension, VBOXPSPIN_LOCK  SpinLock, unsigned char * OldIrql);
    81 typedef void (*PFNRELEASESPINLOCK) (void*  HwDeviceExtension, VBOXPSPIN_LOCK  SpinLock, unsigned char  NewIrql);
    82 typedef void (*PFNACQUIRESPINLOCKATDPCLEVEL) (void*  HwDeviceExtension, VBOXPSPIN_LOCK  SpinLock);
    83 typedef void (*PFNRELEASESPINLOCKFROMDPCLEVEL) (void*  HwDeviceExtension, VBOXPSPIN_LOCK  SpinLock);
    84 
    8569typedef void* (*PFNALLOCATEPOOL) (void*  HwDeviceExtension, VBOXVP_POOL_TYPE PoolType, size_t NumberOfBytes, unsigned long Tag);
    8670typedef void (*PFNFREEPOOL) (void*  HwDeviceExtension, void*  Ptr);
     
    8872typedef unsigned char (*PFNQUEUEDPC) (void* HwDeviceExtension, void (*CallbackRoutine)(void* HwDeviceExtension, void *Context), void *Context);
    8973
    90 /* pfn*SpinLock* functions are available */
    91 #define VBOXVIDEOPORTPROCS_SPINLOCK 0x00000001
    9274/* pfn*Event and pfnWaitForSingleObject functions are available */
    9375#define VBOXVIDEOPORTPROCS_EVENT    0x00000002
     
    10991    PFNDELETEEVENT pfnDeleteEvent;
    11092
    111     PFNCREATESPINLOCK pfnCreateSpinLock;
    112     PFNDELETESPINLOCK pfnDeleteSpinLock;
    113     PFNACQUIRESPINLOCK pfnAcquireSpinLock;
    114     PFNRELEASESPINLOCK pfnReleaseSpinLock;
    115     PFNACQUIRESPINLOCKATDPCLEVEL pfnAcquireSpinLockAtDpcLevel;
    116     PFNRELEASESPINLOCKFROMDPCLEVEL pfnReleaseSpinLockFromDpcLevel;
    117 
    11893    PFNALLOCATEPOOL pfnAllocatePool;
    11994    PFNFREEPOOL pfnFreePool;
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp

    r33890 r33997  
    5959#endif /* !VBOX_WITH_MULTIMONITOR_FIX */
    6060
     61/*******************************************************************************
     62*   Structures and Typedefs                                                    *
     63*******************************************************************************/
     64
     65#ifndef VBOX_WITH_WDDM
     66typedef struct _DEVICE_EXTENSION * VBOXCMNREG;
     67#else
     68typedef HANDLE VBOXCMNREG;
     69#endif
     70
     71/*******************************************************************************
     72*   Internal Functions                                                         *
     73*******************************************************************************/
     74
    6175int vboxVbvaEnable (PDEVICE_EXTENSION pDevExt, ULONG ulEnable, VBVAENABLERESULT *pVbvaResult);
    6276
     
    101115   PULONG pUId,
    102116   PULONG pUnused);
    103 
    104 /*******************************************************************************
    105 *   Internal Functions                                                         *
    106 *******************************************************************************/
    107117
    108118#ifndef VBOX_WITH_WDDM
     
    41184128}
    41194129
    4120 VP_STATUS vboxCreateSpinLockVoid (IN PVOID  HwDeviceExtension, OUT PSPIN_LOCK  *SpinLock)
    4121 {
    4122     return ERROR_INVALID_FUNCTION;
    4123 }
    4124 
    4125 VP_STATUS vboxDeleteSpinLockVoid (IN PVOID  HwDeviceExtension, IN PSPIN_LOCK  SpinLock)
    4126 {
    4127     return ERROR_INVALID_FUNCTION;
    4128 }
    4129 
    4130 VOID vboxAcquireSpinLockVoid (IN PVOID  HwDeviceExtension, IN PSPIN_LOCK  SpinLock, OUT PUCHAR  OldIrql)
    4131 {
    4132 }
    4133 
    4134 VOID vboxReleaseSpinLockVoid (IN PVOID  HwDeviceExtension, IN PSPIN_LOCK  SpinLock, IN UCHAR  NewIrql)
    4135 {
    4136 }
    4137 
    4138 VOID vboxAcquireSpinLockAtDpcLevelVoid (IN PVOID  HwDeviceExtension, IN PSPIN_LOCK  SpinLock)
    4139 {
    4140 }
    4141 
    4142 VOID vboxReleaseSpinLockFromDpcLevelVoid (IN PVOID  HwDeviceExtension, IN PSPIN_LOCK  SpinLock)
    4143 {
    4144 }
    4145 
    41464130PVOID vboxAllocatePoolVoid(IN PVOID  HwDeviceExtension, IN VBOXVP_POOL_TYPE  PoolType, IN size_t  NumberOfBytes, IN ULONG  Tag)
    41474131{
     
    41704154        pCallbacks->pfnCreateEvent = vboxCreateEventVoid;
    41714155        pCallbacks->pfnDeleteEvent = vboxDeleteEventVoid;
    4172         pCallbacks->pfnCreateSpinLock = vboxCreateSpinLockVoid;
    4173         pCallbacks->pfnDeleteSpinLock = vboxDeleteSpinLockVoid;
    4174         pCallbacks->pfnAcquireSpinLock = vboxAcquireSpinLockVoid;
    4175         pCallbacks->pfnReleaseSpinLock = vboxReleaseSpinLockVoid;
    4176         pCallbacks->pfnAcquireSpinLockAtDpcLevel = vboxAcquireSpinLockAtDpcLevelVoid;
    4177         pCallbacks->pfnReleaseSpinLockFromDpcLevel = vboxReleaseSpinLockFromDpcLevelVoid;
    41784156        pCallbacks->pfnAllocatePool = vboxAllocatePoolVoid;
    41794157        pCallbacks->pfnFreePool = vboxFreePoolVoid;
     
    42244202    }
    42254203
    4226     pCallbacks->pfnCreateSpinLock = (PFNCREATESPINLOCK)(pConfigInfo->VideoPortGetProcAddress)
    4227             (PrimaryExtension,
    4228              (PUCHAR)"VideoPortCreateSpinLock");
    4229     Assert(pCallbacks->pfnCreateSpinLock);
    4230 
    4231     pCallbacks->pfnDeleteSpinLock = (PFNDELETESPINLOCK)(pConfigInfo->VideoPortGetProcAddress)
    4232             (PrimaryExtension,
    4233              (PUCHAR)"VideoPortDeleteSpinLock");
    4234     Assert(pCallbacks->pfnDeleteSpinLock);
    4235 
    4236     pCallbacks->pfnAcquireSpinLock = (PFNACQUIRESPINLOCK)(pConfigInfo->VideoPortGetProcAddress)
    4237             (PrimaryExtension,
    4238              (PUCHAR)"VideoPortAcquireSpinLock");
    4239     Assert(pCallbacks->pfnAcquireSpinLock);
    4240 
    4241     pCallbacks->pfnReleaseSpinLock = (PFNRELEASESPINLOCK)(pConfigInfo->VideoPortGetProcAddress)
    4242             (PrimaryExtension,
    4243              (PUCHAR)"VideoPortReleaseSpinLock");
    4244     Assert(pCallbacks->pfnReleaseSpinLock);
    4245 
    4246     pCallbacks->pfnAcquireSpinLockAtDpcLevel = (PFNACQUIRESPINLOCKATDPCLEVEL)(pConfigInfo->VideoPortGetProcAddress)
    4247             (PrimaryExtension,
    4248              (PUCHAR)"VideoPortAcquireSpinLockAtDpcLevel");
    4249     Assert(pCallbacks->pfnAcquireSpinLockAtDpcLevel);
    4250 
    4251     pCallbacks->pfnReleaseSpinLockFromDpcLevel = (PFNRELEASESPINLOCKFROMDPCLEVEL)(pConfigInfo->VideoPortGetProcAddress)
    4252                 (PrimaryExtension,
    4253                  (PUCHAR)"VideoPortReleaseSpinLockFromDpcLevel");
    4254     Assert(pCallbacks->pfnReleaseSpinLockFromDpcLevel);
    4255 
    4256     if(pCallbacks->pfnCreateSpinLock
    4257             && pCallbacks->pfnDeleteSpinLock
    4258             && pCallbacks->pfnAcquireSpinLock
    4259             && pCallbacks->pfnReleaseSpinLock
    4260             && pCallbacks->pfnAcquireSpinLockAtDpcLevel
    4261             && pCallbacks->pfnReleaseSpinLockFromDpcLevel)
    4262     {
    4263         pCallbacks->fSupportedTypes |= VBOXVIDEOPORTPROCS_SPINLOCK;
    4264     }
    4265     else
    4266     {
    4267         pCallbacks->pfnCreateSpinLock = vboxCreateSpinLockVoid;
    4268         pCallbacks->pfnDeleteSpinLock = vboxDeleteSpinLockVoid;
    4269         pCallbacks->pfnAcquireSpinLock = vboxAcquireSpinLockVoid;
    4270         pCallbacks->pfnReleaseSpinLock = vboxReleaseSpinLockVoid;
    4271         pCallbacks->pfnAcquireSpinLockAtDpcLevel = vboxAcquireSpinLockAtDpcLevelVoid;
    4272         pCallbacks->pfnReleaseSpinLockFromDpcLevel = vboxReleaseSpinLockFromDpcLevelVoid;
    4273     }
    4274 
    42754204    pCallbacks->pfnAllocatePool = (PFNALLOCATEPOOL)(pConfigInfo->VideoPortGetProcAddress)
    42764205            (PrimaryExtension,
     
    43104239#ifdef DEBUG_misha
    43114240    Assert(pCallbacks->fSupportedTypes & VBOXVIDEOPORTPROCS_EVENT);
    4312     Assert(pCallbacks->fSupportedTypes & VBOXVIDEOPORTPROCS_SPINLOCK);
    43134241#endif
    43144242}
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h

    r33890 r33997  
    108108
    109109/* common API types */
    110 #ifndef VBOX_WITH_WDDM
    111 typedef PSPIN_LOCK VBOXVCMNSPIN_LOCK, *PVBOXVCMNSPIN_LOCK;
    112 typedef UCHAR VBOXVCMNIRQL, *PVBOXVCMNIRQL;
    113 
    114 typedef struct _DEVICE_EXTENSION * VBOXCMNREG;
    115 #else
     110#ifdef VBOX_WITH_WDDM
    116111#define VBOX_WITH_GENERIC_MULTIMONITOR
    117112typedef struct _DEVICE_EXTENSION *PDEVICE_EXTENSION;
     
    130125# include "wddm/VBoxVideoVhwa.h"
    131126#endif
    132 
    133 
    134 typedef KSPIN_LOCK VBOXVCMNSPIN_LOCK, *PVBOXVCMNSPIN_LOCK;
    135 typedef KIRQL VBOXVCMNIRQL, *PVBOXVCMNIRQL;
    136 
    137 typedef HANDLE VBOXCMNREG;
    138127
    139128#define VBOXWDDM_POINTER_ATTRIBUTES_SIZE VBOXWDDM_ROUNDBOUND( \
     
    397386
    398387#ifndef VBOX_WITH_WDDM
    399 /* XPDM-WDDM common API */
    400 
    401 DECLINLINE(VOID) VBoxVideoCmnSpinLockAcquire(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, OUT PVBOXVCMNIRQL OldIrql)
    402 {
    403     pDeviceExtension->u.primary.VideoPortProcs.pfnAcquireSpinLock(pDeviceExtension, *SpinLock, OldIrql);
    404 }
    405 
    406 DECLINLINE(VOID) VBoxVideoCmnSpinLockRelease(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, IN VBOXVCMNIRQL NewIrql)
    407 {
    408     pDeviceExtension->u.primary.VideoPortProcs.pfnReleaseSpinLock(pDeviceExtension, *SpinLock, NewIrql);
    409 }
    410 
    411 DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockCreate(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
    412 {
    413     return pDeviceExtension->u.primary.VideoPortProcs.pfnCreateSpinLock(pDeviceExtension, SpinLock);
    414 }
    415 
    416 DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockDelete(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
    417 {
    418     return pDeviceExtension->u.primary.VideoPortProcs.pfnDeleteSpinLock(pDeviceExtension, *SpinLock);
    419 }
    420 
    421 /* */
    422388
    423389RT_C_DECLS_BEGIN
     
    426392
    427393#else
    428 
    429 /* XPDM-WDDM common API */
    430 
    431 DECLINLINE(VOID) VBoxVideoCmnSpinLockAcquire(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, OUT PVBOXVCMNIRQL OldIrql)
    432 {
    433     KeAcquireSpinLock(SpinLock, OldIrql);
    434 }
    435 
    436 DECLINLINE(VOID) VBoxVideoCmnSpinLockRelease(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, IN VBOXVCMNIRQL NewIrql)
    437 {
    438     KeReleaseSpinLock(SpinLock, NewIrql);
    439 }
    440 
    441 DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockCreate(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
    442 {
    443     KeInitializeSpinLock(SpinLock);
    444     return NO_ERROR;
    445 }
    446 
    447 DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockDelete(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
    448 {
    449     return NO_ERROR;
    450 }
    451 
    452 /* */
    453394
    454395RT_C_DECLS_BEGIN
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp

    r33951 r33997  
    241241    }
    242242
    243     dprintf(("VBoxVideo::vboxQueryConf: u32Value = %d\n", p->u32Value));
     243    Log(("VBoxVideo::vboxQueryConf: u32Value = %d\n", p->u32Value));
    244244    return VINF_SUCCESS;
    245245}
     
    247247static int vboxQueryConfHGSMI (PVBOXVIDEO_COMMON pCommon, uint32_t u32Index, ULONG *pulValue)
    248248{
    249     dprintf(("VBoxVideo::vboxQueryConf: u32Index = %d\n", u32Index));
     249    Log(("VBoxVideo::vboxQueryConf: u32Index = %d\n", u32Index));
    250250
    251251    QUERYCONFCTX context;
     
    261261                           &context);
    262262
    263     dprintf(("VBoxVideo::vboxQueryConf: rc = %d\n", rc));
     263    Log(("VBoxVideo::vboxQueryConf: rc = %d\n", rc));
    264264
    265265    return rc;
     
    330330static int vboxSetupAdapterInfoHGSMI (PVBOXVIDEO_COMMON pCommon)
    331331{
    332     dprintf(("VBoxVideo::vboxSetupAdapterInfo\n"));
     332    Log(("VBoxVideo::vboxSetupAdapterInfo\n"));
    333333
    334334    /* setup the flags first to ensure they are initialized by the time the host heap is ready */
     
    365365
    366366
    367     dprintf(("VBoxVideo::vboxSetupAdapterInfo finished rc = %d\n", rc));
     367    Log(("VBoxVideo::vboxSetupAdapterInfo finished rc = %d\n", rc));
    368368
    369369    return rc;
     
    384384    VP_STATUS rc = NO_ERROR;
    385385
    386     dprintf(("VBoxVideo::VBoxSetupDisplays: pCommon = %p\n", pCommon));
     386    Log(("VBoxVideo::VBoxSetupDisplays: pCommon = %p\n", pCommon));
    387387
    388388    memset(pCommon, 0, sizeof(*pCommon));
     
    408408        if (rc != NO_ERROR)
    409409        {
    410             dprintf(("VBoxVideo::VBoxSetupDisplays: VBoxMapAdapterMemory pvAdapterInfoirrmation failed rc = %d\n",
     410            Log(("VBoxVideo::VBoxSetupDisplays: VBoxMapAdapterMemory pvAdapterInfoirrmation failed rc = %d\n",
    411411                     rc));
    412412
     
    424424            if (RT_FAILURE (rc))
    425425            {
    426                 dprintf(("VBoxVideo::VBoxSetupDisplays: HGSMIHeapSetup failed rc = %d\n",
     426                Log(("VBoxVideo::VBoxSetupDisplays: HGSMIHeapSetup failed rc = %d\n",
    427427                         rc));
    428428
     
    462462            pCommon->cbMiniportHeap = (cbMiniportHeap + 0xFFF) & ~0xFFF;
    463463
    464             dprintf(("VBoxVideo::VBoxSetupDisplays: cbMiniportHeap = 0x%08X, pCommon->cbMiniportHeap = 0x%08X, cbMiniportHeapMaxSize = 0x%08X\n",
     464            Log(("VBoxVideo::VBoxSetupDisplays: cbMiniportHeap = 0x%08X, pCommon->cbMiniportHeap = 0x%08X, cbMiniportHeapMaxSize = 0x%08X\n",
    465465                     cbMiniportHeap, pCommon->cbMiniportHeap, cbMiniportHeapMaxSize));
    466466
     
    511511        vboxQueryConfHGSMI (pCommon, VBOX_VBVA_CONF32_MONITOR_COUNT, &cDisplays);
    512512
    513         dprintf(("VBoxVideo::VBoxSetupDisplays: cDisplays = %d\n",
     513        Log(("VBoxVideo::VBoxSetupDisplays: cDisplays = %d\n",
    514514                 cDisplays));
    515515
     
    536536        VBoxFreeDisplaysHGSMI(pCommon);
    537537
    538     dprintf(("VBoxVideo::VBoxSetupDisplays: finished\n"));
     538    Log(("VBoxVideo::VBoxSetupDisplays: finished\n"));
    539539}
    540540
     
    621621
    622622#ifndef DEBUG_misha
    623     dprintf(("vboxUpdatePointerShape: cbData %d, %dx%d\n",
     623    Log(("vboxUpdatePointerShape: cbData %d, %dx%d\n",
    624624             cbData, pointerAttr->Width, pointerAttr->Height));
    625625#endif
     
    627627    if (cbData > cbLength - sizeof(VIDEO_POINTER_ATTRIBUTES))
    628628    {
    629         dprintf(("vboxUpdatePointerShape: calculated pointer data size is too big (%d bytes, limit %d)\n",
     629        Log(("vboxUpdatePointerShape: calculated pointer data size is too big (%d bytes, limit %d)\n",
    630630                 cbData, cbLength - sizeof(VIDEO_POINTER_ATTRIBUTES)));
    631631        return FALSE;
     
    644644                           &ctx);
    645645#ifndef DEBUG_misha
    646     dprintf(("VBoxVideo::vboxMousePointerShape: rc %d, i32Result = %d\n", rc, ctx.i32Result));
     646    Log(("VBoxVideo::vboxMousePointerShape: rc %d, i32Result = %d\n", rc, ctx.i32Result));
    647647#endif
    648648
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