VirtualBox

Ignore:
Timestamp:
Aug 25, 2009 11:12:49 PM (15 years ago)
Author:
vboxsync
Message:

hgsmi/guest video driver: backwards compatibility with < WinXP: make newer videoport functions picked up at runtime

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

Legend:

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

    r22446 r22448  
    11581158
    11591159#ifdef VBOX_WITH_HGSMI
    1160    VideoPortCreateSpinLock(HwDeviceExtension, &((PDEVICE_EXTENSION)HwDeviceExtension)->u.primary.pGHRWLock);
     1160   VBoxSetupVideoPortFunctions((PDEVICE_EXTENSION)HwDeviceExtension, &((PDEVICE_EXTENSION)HwDeviceExtension)->u.primary.VideoPortProcs, ConfigInfo);
     1161   ((PDEVICE_EXTENSION)HwDeviceExtension)->u.primary.VideoPortProcs.pfnCreateSpinLock(HwDeviceExtension, &((PDEVICE_EXTENSION)HwDeviceExtension)->u.primary.pGHRWLock);
    11611162#endif
    11621163
     
    19981999            break;
    19992000        }
     2001        case IOCTL_VIDEO_HGSMI_QUERY_PORTPROCS:
     2002        {
     2003            dprintf(("VBoxVideo::VBoxVideoStartIO: IOCTL_VIDEO_HGSMI_QUERY_PORTPROCS\n"));
     2004
     2005            if (RequestPacket->OutputBufferLength < sizeof(HGSMIQUERYCPORTPROCS))
     2006            {
     2007                dprintf(("VBoxVideo::VBoxVideoStartIO: Output buffer too small: %d needed: %d!!!\n",
     2008                         RequestPacket->OutputBufferLength, sizeof(HGSMIQUERYCPORTPROCS)));
     2009                RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
     2010                return FALSE;
     2011            }
     2012
     2013            if (!pDevExt->pPrimary->u.primary.bHGSMI)
     2014            {
     2015                RequestPacket->StatusBlock->Status = ERROR_INVALID_FUNCTION;
     2016                return FALSE;
     2017            }
     2018
     2019            HGSMIQUERYCPORTPROCS *pInfo = (HGSMIQUERYCPORTPROCS *)RequestPacket->OutputBuffer;
     2020            pInfo->pContext = pDevExt->pPrimary;
     2021            pInfo->VideoPortProcs = pDevExt->pPrimary->u.primary.VideoPortProcs;
     2022
     2023            RequestPacket->StatusBlock->Information = sizeof(HGSMIQUERYCPORTPROCS);
     2024            Result = TRUE;
     2025            break;
     2026        }
    20002027        case IOCTL_VIDEO_HGSMI_HANDLER_ENABLE:
    20012028        {
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h

    r22446 r22448  
    4040RT_C_DECLS_END
    4141
    42 
    4342#define VBE_DISPI_IOPORT_INDEX          0x01CE
    4443#define VBE_DISPI_IOPORT_DATA           0x01CF
     
    151150           /* The IO Port Number for guest commands. */
    152151           RTIOPORT IOPortGuest;
     152
     153           /* Video Port API dynamically picked up at runtime for binary backwards compatibility with older NT versions */
     154           VBOXVIDEOPORTPROCS VideoPortProcs;
    153155#endif /* VBOX_WITH_HGSMI */
    154156       } primary;
     
    296298{
    297299    UCHAR oldIrql;
    298     VideoPortAcquireSpinLock(PrimaryExtension,
     300    PrimaryExtension->u.primary.VideoPortProcs.pfnAcquireSpinLock(PrimaryExtension,
    299301                PrimaryExtension->u.primary.pGHRWLock,
    300302            &oldIrql);
    301303    VBoxVideoVBEWriteUlongLocked(dataType, data);
    302     VideoPortReleaseSpinLock(PrimaryExtension,
     304    PrimaryExtension->u.primary.VideoPortProcs.pfnReleaseSpinLock(PrimaryExtension,
    303305                PrimaryExtension->u.primary.pGHRWLock,
    304306            oldIrql);
     
    308310{
    309311    UCHAR oldIrql;
    310     VideoPortAcquireSpinLock(PrimaryExtension,
     312    PrimaryExtension->u.primary.VideoPortProcs.pfnAcquireSpinLock(PrimaryExtension,
    311313                PrimaryExtension->u.primary.pGHRWLock,
    312314            &oldIrql);
    313315    VBoxVideoVBEWriteUshortLocked(dataType, data);
    314     VideoPortReleaseSpinLock(PrimaryExtension,
     316    PrimaryExtension->u.primary.VideoPortProcs.pfnReleaseSpinLock(PrimaryExtension,
    315317                PrimaryExtension->u.primary.pGHRWLock,
    316318            oldIrql);
     
    321323    ULONG data;
    322324    UCHAR oldIrql;
    323     VideoPortAcquireSpinLock(PrimaryExtension,
     325    PrimaryExtension->u.primary.VideoPortProcs.pfnAcquireSpinLock(PrimaryExtension,
    324326                PrimaryExtension->u.primary.pGHRWLock,
    325327            &oldIrql);
    326328    data = VBoxVideoVBEReadUlongLocked(dataType);
    327     VideoPortReleaseSpinLock(PrimaryExtension,
     329    PrimaryExtension->u.primary.VideoPortProcs.pfnReleaseSpinLock(PrimaryExtension,
    328330                PrimaryExtension->u.primary.pGHRWLock,
    329331            oldIrql);
     
    355357
    356358BOOLEAN VBoxHGSMIIsSupported (PDEVICE_EXTENSION PrimaryExtension);
     359
     360void VBoxSetupVideoPortFunctions(PDEVICE_EXTENSION PrimaryExtension,
     361                                VBOXVIDEOPORTPROCS *pCallbacks,
     362                                PVIDEO_PORT_CONFIG_INFO pConfigInfo);
    357363
    358364VOID VBoxSetupDisplaysHGSMI (PDEVICE_EXTENSION PrimaryExtension,
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/vboxioctl.h

    r22136 r22448  
    6060#define IOCTL_VIDEO_HGSMI_HANDLER_DISABLE \
    6161    CTL_CODE(FILE_DEVICE_VIDEO, 0x433, METHOD_BUFFERED, FILE_ANY_ACCESS)
     62
     63#define IOCTL_VIDEO_HGSMI_QUERY_PORTPROCS \
     64    CTL_CODE(FILE_DEVICE_VIDEO, 0x434, METHOD_BUFFERED, FILE_ANY_ACCESS)
    6265
    6366#endif /* VBOX_WITH_HGSMI */
     
    136139
    137140/**
     141 * Data returned by IOCTL_VIDEO_HGSMI_QUERY_PORTPROCS
     142 */
     143typedef struct _HGSMIQUERYCPORTPROCS
     144{
     145    PVOID pContext;
     146    VBOXVIDEOPORTPROCS VideoPortProcs;
     147} HGSMIQUERYCPORTPROCS;
     148
     149/**
    138150 * Data returned by IOCTL_VIDEO_HGSMI_HANDLER_ENABLE.
    139151 *
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