VirtualBox

Changeset 31873 in vbox for trunk


Ignore:
Timestamp:
Aug 23, 2010 4:26:42 PM (14 years ago)
Author:
vboxsync
Message:

VBoxVideo: When unmapping adapter memory, make sure interrupt handler will not blow up.

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

Legend:

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

    r31863 r31873  
    14501450}
    14511451
     1452/* Unmapping adapter information must be done carefully WRT the interrupt handler. */
     1453BOOLEAN VBoxUnmapAdpInfoCallback(PVOID ext)
     1454{
     1455    PDEVICE_EXTENSION   PrimaryExtension = (PDEVICE_EXTENSION)ext;
     1456    void                *ppv;
     1457
     1458    ppv = PrimaryExtension->u.primary.pvAdapterInformation;
     1459    if (ppv)
     1460    {
     1461#ifndef VBOXWDDM
     1462        VideoPortUnmapMemory(PrimaryExtension, ppv, NULL);
     1463#else
     1464        NTSTATUS ntStatus = PrimaryExtension->u.primary.DxgkInterface.DxgkCbUnmapMemory(PrimaryExtension->u.primary.DxgkInterface.DeviceHandle,
     1465                ppv);
     1466        Assert(ntStatus == STATUS_SUCCESS);
     1467#endif
     1468        PrimaryExtension->u.primary.pvAdapterInformation = NULL;
     1469        PrimaryExtension->u.primary.pHostFlags           = NULL;    /* Mapped through pvAdapterInformation */
     1470    }
     1471    return TRUE;
     1472}
     1473
     1474void VBoxUnmapAdapterInformation(PDEVICE_EXTENSION PrimaryExtension)
     1475{
     1476    dprintf(("VBoxVideo::VBoxUnmapAdapterInformation\n"));
     1477
     1478    VideoPortSynchronizeExecution(PrimaryExtension, VpMediumPriority,
     1479                                  VBoxUnmapAdpInfoCallback, PrimaryExtension);
     1480}
     1481
    14521482void VBoxUnmapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension, void **ppv, ULONG ulSize)
    14531483{
    1454     dprintf(("VBoxVideo::VBoxMapAdapterMemory\n"));
     1484    dprintf(("VBoxVideo::VBoxUnmapAdapterMemory\n"));
    14551485
    14561486    if (*ppv)
     
    17511781        /* Unmap the memory if VBoxVideo is not supported. */
    17521782        VBoxUnmapAdapterMemory (PrimaryExtension, &PrimaryExtension->u.primary.pvMiniportHeap, PrimaryExtension->u.primary.cbMiniportHeap);
    1753         VBoxUnmapAdapterMemory (PrimaryExtension, &PrimaryExtension->u.primary.pvAdapterInformation, VBOX_VIDEO_ADAPTER_INFORMATION_SIZE);
     1783        VBoxUnmapAdapterInformation (PrimaryExtension);
    17541784    }
    17551785
     
    28442874
    28452875    VBoxUnmapAdapterMemory (pDevExt, &pDevExt->u.primary.pvMiniportHeap, pDevExt->u.primary.cbMiniportHeap);
    2846     VBoxUnmapAdapterMemory (pDevExt, &pDevExt->u.primary.pvAdapterInformation, VBVA_ADAPTER_INFORMATION_SIZE);
     2876    VBoxUnmapAdapterInformation (pDevExt);
    28472877
    28482878    return TRUE;
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h

    r31756 r31873  
    851851void VBoxUnmapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension,
    852852                             void **ppv, ULONG ulSize);
     853void VBoxUnmapAdapterInformation (PDEVICE_EXTENSION PrimaryExtension);
    853854
    854855void VBoxComputeFrameBufferSizes (PDEVICE_EXTENSION PrimaryExtension);
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp

    r30942 r31873  
    741741    PrimaryExtension->u.primary.pvMiniportHeap           = NULL;
    742742    PrimaryExtension->u.primary.pvAdapterInformation     = NULL;
     743    PrimaryExtension->u.primary.pHostFlags               = NULL;
    743744    PrimaryExtension->u.primary.ulMaxFrameBufferSize     = 0;
    744745    PrimaryExtension->u.primary.bHGSMI                   = VBoxHGSMIIsSupported (PrimaryExtension);
     
    10391040        /* Unmap the memory if VBoxVideo is not supported. */
    10401041        VBoxUnmapAdapterMemory (PrimaryExtension, &PrimaryExtension->u.primary.pvMiniportHeap, PrimaryExtension->u.primary.cbMiniportHeap);
    1041         VBoxUnmapAdapterMemory (PrimaryExtension, &PrimaryExtension->u.primary.pvAdapterInformation, VBVA_ADAPTER_INFORMATION_SIZE);
     1042        VBoxUnmapAdapterInformation (PrimaryExtension);
    10421043
    10431044        HGSMIHeapDestroy (&PrimaryExtension->u.primary.hgsmiAdapterHeap);
     
    10931094
    10941095                /* Map the adapter information. It will be needed for HGSMI IO. */
    1095                 /*rc = */VBoxUnmapAdapterMemory(PrimaryExtension, &PrimaryExtension->u.primary.pvAdapterInformation, VBVA_ADAPTER_INFORMATION_SIZE);
     1096                /*rc = */VBoxUnmapAdapterInformation(PrimaryExtension);
    10961097/*
    10971098                AssertRC(rc);
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