VirtualBox

Ignore:
Timestamp:
Oct 1, 2010 8:38:01 PM (14 years ago)
Author:
vboxsync
Message:

Additions/WINNT/VBoxVideo: start refactoring the HGSMI code

File:
1 edited

Legend:

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

    r32622 r32876  
    3535void HGSMINotifyHostCmdComplete (PDEVICE_EXTENSION PrimaryExtension, HGSMIOFFSET offt)
    3636{
    37     VBoxHGSMIHostWrite(PrimaryExtension, offt);
     37    VBoxHGSMIHostWrite(hgsmiFromDeviceExt(PrimaryExtension), offt);
    3838}
    3939
    4040void HGSMIClearIrq (PDEVICE_EXTENSION PrimaryExtension)
    4141{
    42     VBoxHGSMIHostWrite(PrimaryExtension, HGSMIOFFSET_VOID);
     42    VBoxHGSMIHostWrite(hgsmiFromDeviceExt(PrimaryExtension), HGSMIOFFSET_VOID);
    4343}
    4444
    4545static void HGSMIHostCmdComplete (PDEVICE_EXTENSION PrimaryExtension, void * pvMem)
    4646{
    47     HGSMIOFFSET offMem = HGSMIPointerToOffset (&PrimaryExtension->u.primary.areaHostHeap, HGSMIBufferHeaderFromData (pvMem));
     47    HGSMIOFFSET offMem = HGSMIPointerToOffset (&hgsmiFromDeviceExt(PrimaryExtension)->areaHostHeap, HGSMIBufferHeaderFromData (pvMem));
    4848    Assert(offMem != HGSMIOFFSET_VOID);
    4949    if(offMem != HGSMIOFFSET_VOID)
     
    5555static void hgsmiHostCmdProcess(PDEVICE_EXTENSION PrimaryExtension, HGSMIOFFSET offBuffer)
    5656{
    57     int rc = HGSMIBufferProcess (&PrimaryExtension->u.primary.areaHostHeap,
    58                                 &PrimaryExtension->u.primary.channels,
     57    int rc = HGSMIBufferProcess (&hgsmiFromDeviceExt(PrimaryExtension)->areaHostHeap,
     58                                &hgsmiFromDeviceExt(PrimaryExtension)->channels,
    5959                                offBuffer);
    6060    Assert(!RT_FAILURE(rc));
     
    7070static HGSMIOFFSET hgsmiGetHostBuffer (PDEVICE_EXTENSION PrimaryExtension)
    7171{
    72     return VBoxHGSMIHostRead(PrimaryExtension);
     72    return VBoxHGSMIHostRead(hgsmiFromDeviceExt(PrimaryExtension));
    7373}
    7474
     
    190190    /* @todo: add synchronization */
    191191#endif
    192     return HGSMIHeapAlloc (&PrimaryExtension->u.primary.hgsmiAdapterHeap, cbData, u8Ch, u16Op);
     192    return HGSMIHeapAlloc (&hgsmiFromDeviceExt(PrimaryExtension)->hgsmiAdapterHeap, cbData, u8Ch, u16Op);
    193193}
    194194
     
    198198    /* @todo: add synchronization */
    199199#endif
    200     HGSMIHeapFree (&PrimaryExtension->u.primary.hgsmiAdapterHeap, pvBuffer);
     200    HGSMIHeapFree (&hgsmiFromDeviceExt(PrimaryExtension)->hgsmiAdapterHeap, pvBuffer);
    201201}
    202202
     
    204204{
    205205    /* Initialize the buffer and get the offset for port IO. */
    206     HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&PrimaryExtension->u.primary.hgsmiAdapterHeap, pvBuffer);
     206    HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&hgsmiFromDeviceExt(PrimaryExtension)->hgsmiAdapterHeap, pvBuffer);
    207207
    208208    Assert(offBuffer != HGSMIOFFSET_VOID);
     
    210210    {
    211211        /* Submit the buffer to the host. */
    212         VBoxHGSMIGuestWrite(PrimaryExtension, offBuffer);
     212        VBoxHGSMIGuestWrite(hgsmiFromDeviceExt(PrimaryExtension), offBuffer);
    213213        return VINF_SUCCESS;
    214214    }
     
    236236#endif
    237237
    238     void *p = HGSMIHeapAlloc (&PrimaryExtension->u.primary.hgsmiAdapterHeap, cbData, u8Ch, u16Op);
     238    void *p = HGSMIHeapAlloc (&hgsmiFromDeviceExt(PrimaryExtension)->hgsmiAdapterHeap, cbData, u8Ch, u16Op);
    239239
    240240    if (!p)
     
    253253        {
    254254            /* Initialize the buffer and get the offset for port IO. */
    255             HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&PrimaryExtension->u.primary.hgsmiAdapterHeap,
     255            HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&hgsmiFromDeviceExt(PrimaryExtension)->hgsmiAdapterHeap,
    256256                                                           p);
    257257
    258258            /* Submit the buffer to the host. */
    259             VBoxHGSMIGuestWrite(PrimaryExtension, offBuffer);
     259            VBoxHGSMIGuestWrite(hgsmiFromDeviceExt(PrimaryExtension), offBuffer);
    260260
    261261            if (pfnFinalize)
     
    271271
    272272        /* Free the IO buffer. */
    273         HGSMIHeapFree (&PrimaryExtension->u.primary.hgsmiAdapterHeap, p);
     273        HGSMIHeapFree (&hgsmiFromDeviceExt(PrimaryExtension)->hgsmiAdapterHeap, p);
    274274    }
    275275
     
    743743    PrimaryExtension->u.primary.pHostFlags               = NULL;
    744744    PrimaryExtension->u.primary.ulMaxFrameBufferSize     = 0;
    745     PrimaryExtension->u.primary.bHGSMI                   = VBoxHGSMIIsSupported (PrimaryExtension);
    746     VBoxVideoCmnMemZero(&PrimaryExtension->u.primary.areaHostHeap, sizeof(HGSMIAREA));
     745    hgsmiFromDeviceExt(PrimaryExtension)->bHGSMI         = VBoxHGSMIIsSupported (PrimaryExtension);
     746    VBoxVideoCmnMemZero(&hgsmiFromDeviceExt(PrimaryExtension)->areaHostHeap, sizeof(HGSMIAREA));
    747747    VBoxVideoCmnMemZero(&PrimaryExtension->areaDisplay, sizeof(HGSMIAREA));
    748748
    749     if (PrimaryExtension->u.primary.IOPortGuest == 0)
    750     {
    751         PrimaryExtension->u.primary.bHGSMI = false;
    752     }
    753 
    754     if (PrimaryExtension->u.primary.bHGSMI)
     749    if (hgsmiFromDeviceExt(PrimaryExtension)->IOPortGuest == 0)
     750    {
     751        hgsmiFromDeviceExt(PrimaryExtension)->bHGSMI = false;
     752    }
     753
     754    if (hgsmiFromDeviceExt(PrimaryExtension)->bHGSMI)
    755755    {
    756756        /* Map the adapter information. It will be needed for HGSMI IO. */
     
    765765                     rc));
    766766
    767             PrimaryExtension->u.primary.bHGSMI = FALSE;
     767            hgsmiFromDeviceExt(PrimaryExtension)->bHGSMI = FALSE;
    768768        }
    769769        else
    770770        {
    771771            /* Setup a HGSMI heap within the adapter information area. */
    772             rc = HGSMIHeapSetup (&PrimaryExtension->u.primary.hgsmiAdapterHeap,
     772            rc = HGSMIHeapSetup (&hgsmiFromDeviceExt(PrimaryExtension)->hgsmiAdapterHeap,
    773773                                 PrimaryExtension->u.primary.pvAdapterInformation,
    774774                                 VBVA_ADAPTER_INFORMATION_SIZE - sizeof(HGSMIHOSTFLAGS),
     
    781781                         rc));
    782782
    783                 PrimaryExtension->u.primary.bHGSMI = FALSE;
     783                hgsmiFromDeviceExt(PrimaryExtension)->bHGSMI = FALSE;
    784784            }
    785785            else
     
    792792
    793793    /* Setup the host heap and the adapter memory. */
    794     if (PrimaryExtension->u.primary.bHGSMI)
     794    if (hgsmiFromDeviceExt(PrimaryExtension)->bHGSMI)
    795795    {
    796796        /* The miniport heap is used for the host buffers. */
     
    836836                PrimaryExtension->u.primary.pvMiniportHeap = NULL;
    837837                PrimaryExtension->u.primary.cbMiniportHeap = 0;
    838                 PrimaryExtension->u.primary.bHGSMI = FALSE;
     838                hgsmiFromDeviceExt(PrimaryExtension)->bHGSMI = FALSE;
    839839            }
    840840            else
     
    845845
    846846                /* Init the host hap area. Buffers from the host will be placed there. */
    847                 HGSMIAreaInitialize (&PrimaryExtension->u.primary.areaHostHeap,
     847                HGSMIAreaInitialize (&hgsmiFromDeviceExt(PrimaryExtension)->areaHostHeap,
    848848                                     PrimaryExtension->u.primary.pvMiniportHeap,
    849849                                     PrimaryExtension->u.primary.cbMiniportHeap,
     
    860860
    861861    /* Check whether the guest supports multimonitors. */
    862     if (PrimaryExtension->u.primary.bHGSMI)
     862    if (hgsmiFromDeviceExt(PrimaryExtension)->bHGSMI)
    863863    {
    864864#ifndef VBOX_WITH_WDDM
     
    939939#endif
    940940
    941     if (PrimaryExtension->u.primary.bHGSMI)
     941    if (hgsmiFromDeviceExt(PrimaryExtension)->bHGSMI)
    942942    {
    943943        /* Setup the information for the host. */
     
    946946        if (RT_FAILURE (rc))
    947947        {
    948             PrimaryExtension->u.primary.bHGSMI = FALSE;
     948            hgsmiFromDeviceExt(PrimaryExtension)->bHGSMI = FALSE;
    949949        }
    950950    }
    951951
    952952#ifdef VBOX_WITH_WDDM
    953     if (PrimaryExtension->u.primary.bHGSMI)
     953    if (hgsmiFromDeviceExt(PrimaryExtension)->bHGSMI)
    954954    {
    955955        ULONG ulAvailable = PrimaryExtension->u.primary.cbVRAM
     
    10401040
    10411041        if (RT_FAILURE(rc))
    1042             PrimaryExtension->u.primary.bHGSMI = FALSE;
    1043     }
    1044 #endif
    1045 
    1046     if (!PrimaryExtension->u.primary.bHGSMI)
     1042            hgsmiFromDeviceExt(PrimaryExtension)->bHGSMI = FALSE;
     1043    }
     1044#endif
     1045
     1046    if (!hgsmiFromDeviceExt(PrimaryExtension)->bHGSMI)
    10471047    {
    10481048        /* Unmap the memory if VBoxVideo is not supported. */
     
    10501050        VBoxUnmapAdapterInformation (PrimaryExtension);
    10511051
    1052         HGSMIHeapDestroy (&PrimaryExtension->u.primary.hgsmiAdapterHeap);
    1053     }
    1054 
    1055     if (PrimaryExtension->u.primary.bHGSMI)
     1052        HGSMIHeapDestroy (&hgsmiFromDeviceExt(PrimaryExtension)->hgsmiAdapterHeap);
     1053    }
     1054
     1055    if (hgsmiFromDeviceExt(PrimaryExtension)->bHGSMI)
    10561056    {
    10571057        VBoxVideoCmnSpinLockCreate(PrimaryExtension, &PrimaryExtension->u.primary.pSynchLock);
     
    10991099*/
    11001100            {
    1101                 HGSMIHeapDestroy(&PrimaryExtension->u.primary.hgsmiAdapterHeap);
     1101                HGSMIHeapDestroy(&hgsmiFromDeviceExt(PrimaryExtension)->hgsmiAdapterHeap);
    11021102
    11031103                /* Map the adapter information. It will be needed for HGSMI IO. */
     
    13691369    VBoxVideoHGSMIDpc(PrimaryExtension, NULL);
    13701370
    1371     HGSMICHANNEL * pChannel = HGSMIChannelFindById (&PrimaryExtension->u.primary.channels, u8Channel);
     1371    HGSMICHANNEL * pChannel = HGSMIChannelFindById (&hgsmiFromDeviceExt(PrimaryExtension)->channels, u8Channel);
    13721372    if(pChannel)
    13731373    {
     
    15471547{
    15481548    VBVA_CHANNELCONTEXTS * pContexts;
    1549     HGSMICHANNEL * pChannel = HGSMIChannelFindById (&PrimaryExtension->u.primary.channels, u8Channel);
     1549    HGSMICHANNEL * pChannel = HGSMIChannelFindById (&hgsmiFromDeviceExt(PrimaryExtension)->channels, u8Channel);
    15501550    if(!pChannel)
    15511551    {
     
    15841584            if(!pChannel)
    15851585            {
    1586                 rc = HGSMIChannelRegister (&PrimaryExtension->u.primary.channels,
     1586                rc = HGSMIChannelRegister (&hgsmiFromDeviceExt(PrimaryExtension)->channels,
    15871587                                           u8Channel,
    15881588                                           "VGA Miniport HGSMI channel",
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