VirtualBox

Ignore:
Timestamp:
Nov 24, 2010 10:19:18 PM (14 years ago)
Author:
vboxsync
Message:

Additions/WINNT/Graphics: more refactoring and the start of a common VBoxVideo header file

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

Legend:

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

    r34130 r34346  
    33823382    PDEVICE_EXTENSION PrimaryExtension = (PDEVICE_EXTENSION)HwDeviceExtension;
    33833383
    3384     hgsmiProcessHostCommandQueue(commonFromDeviceExt(PrimaryExtension));
     3384    hgsmiProcessHostCommandQueue(&commonFromDeviceExt(PrimaryExtension)->hostCtx);
    33853385}
    33863386
     
    33913391    if (PrimaryExtension)
    33923392    {
    3393         if (commonFromDeviceExt(PrimaryExtension)->pHostFlags) /* If HGSMI is enabled at all. */
    3394         {
    3395             uint32_t flags = commonFromDeviceExt(PrimaryExtension)->pHostFlags->u32HostFlags;
     3393        if (commonFromDeviceExt(PrimaryExtension)->hostCtx.pfHostFlags) /* If HGSMI is enabled at all. */
     3394        {
     3395            uint32_t flags = commonFromDeviceExt(PrimaryExtension)->hostCtx.pfHostFlags->u32HostFlags;
    33963396            if((flags & HGSMIHOSTFLAGS_IRQ) != 0)
    33973397            {
     
    34033403                }
    34043404                /* clear the IRQ */
    3405                 HGSMIClearIrq (commonFromDeviceExt(PrimaryExtension));
     3405                HGSMIClearIrq(&commonFromDeviceExt(PrimaryExtension)->hostCtx);
    34063406                return TRUE;
    34073407            }
     
    39683968            pInfo->u32MinVBVABufferSize = VBVA_MIN_BUFFER_SIZE;
    39693969
    3970             pInfo->IOPortGuestCommand = commonFromDeviceExt(pDevExt)->IOPortGuest;
     3970            pInfo->IOPortGuestCommand = commonFromDeviceExt(pDevExt)->guestCtx.port;
    39713971
    39723972            RequestPacket->StatusBlock->Information = sizeof(QUERYHGSMIRESULT);
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h

    r34079 r34346  
    2222//#include <iprt/thread.h>
    2323
    24 #include <VBox/HGSMI/HGSMI.h>
    25 #include <VBox/HGSMI/HGSMIChSetup.h>
     24#include <VBox/VBoxVideoGuest.h>
    2625#include <VBox/VBoxVideo.h>
    2726#include "VBoxHGSMI.h"
     
    6968                                         * This is mapped by miniport separately.
    7069                                         */
    71     volatile HGSMIHOSTFLAGS * pHostFlags; /* HGSMI host flags */
    72     volatile bool bHostCmdProcessing;
    73 
    7470    void *pvAdapterInformation;         /* The pointer to the last 4K of VRAM.
    7571                                         * This is mapped by miniport separately.
     
    7874    /** Host HGSMI capabilities the guest can handle */
    7975    uint32_t fCaps;
    80 
    81     bool bHGSMI;                        /* Whether HGSMI is enabled. */
    82 
    83     HGSMIAREA areaHostHeap;             /* Host heap VRAM area. */
    84 
    85     HGSMICHANNELINFO channels;
    86 
    87     HGSMIHEAP hgsmiAdapterHeap;
    88 
    89     /* The IO Port Number for host commands. */
    90     RTIOPORT IOPortHost;
    91 
    92     /* The IO Port Number for guest commands. */
    93     RTIOPORT IOPortGuest;
     76    /** Whether HGSMI is enabled. */
     77    bool bHGSMI;
     78    /** Context information needed to receive commands from the host. */
     79    HGSMIHOSTCOMMANDCONTEXT hostCtx;
     80    /** Context information needed to submit commands to the host. */
     81    HGSMIGUESTCOMMANDCONTEXT guestCtx;
    9482} VBOXVIDEO_COMMON, *PVBOXVIDEO_COMMON;
    9583
     
    125113uint32_t VBoxVideoCmnPortReadUlong(RTIOPORT Port);
    126114
    127 void* vboxHGSMIBufferAlloc(PVBOXVIDEO_COMMON pCommon,
     115void* vboxHGSMIBufferAlloc(PHGSMIGUESTCOMMANDCONTEXT pCtx,
    128116                         HGSMISIZE cbData,
    129117                         uint8_t u8Ch,
    130118                         uint16_t u16Op);
    131 void vboxHGSMIBufferFree (PVBOXVIDEO_COMMON pCommon, void *pvBuffer);
    132 int vboxHGSMIBufferSubmit (PVBOXVIDEO_COMMON pCommon, void *pvBuffer);
     119void vboxHGSMIBufferFree(PHGSMIGUESTCOMMANDCONTEXT pCtx, void *pvBuffer);
     120int vboxHGSMIBufferSubmit(PHGSMIGUESTCOMMANDCONTEXT pCtx, void *pvBuffer);
    133121
    134122int VBoxMapAdapterMemory (PVBOXVIDEO_COMMON pCommon,
     
    142130bool VBoxSyncToVideoIRQ(PVBOXVIDEO_COMMON pCommon, PFNVIDEOIRQSYNC pfnSync,
    143131                        void *pvUser);
    144 
    145 /*
    146  * Host and Guest port IO helpers.
    147  */
    148 DECLINLINE(void) VBoxHGSMIHostWrite(PVBOXVIDEO_COMMON pCommon, uint32_t data)
    149 {
    150     VBoxVideoCmnPortWriteUlong(pCommon->IOPortHost, data);
    151 }
    152 
    153 DECLINLINE(uint32_t) VBoxHGSMIHostRead(PVBOXVIDEO_COMMON pCommon)
    154 {
    155     return VBoxVideoCmnPortReadUlong(pCommon->IOPortHost);
    156 }
    157 
    158 DECLINLINE(void) VBoxHGSMIGuestWrite(PVBOXVIDEO_COMMON pCommon, uint32_t data)
    159 {
    160     VBoxVideoCmnPortWriteUlong(pCommon->IOPortGuest, data);
    161 }
    162 
    163 DECLINLINE(uint32_t) VBoxHGSMIGuestRead(PVBOXVIDEO_COMMON pCommon)
    164 {
    165     return VBoxVideoCmnPortReadUlong(pCommon->IOPortGuest);
    166 }
    167132
    168133bool VBoxHGSMIIsSupported (void);
     
    196161        uint8_t u8Channel);
    197162
    198 void hgsmiProcessHostCommandQueue(PVBOXVIDEO_COMMON pCommon);
     163void hgsmiProcessHostCommandQueue(PHGSMIHOSTCOMMANDCONTEXT pCtx);
    199164
    200 void HGSMIClearIrq (PVBOXVIDEO_COMMON pCommon);
     165void HGSMIClearIrq(PHGSMIHOSTCOMMANDCONTEXT pCtx);
    201166
    202167} /* extern "C" */
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp

    r34090 r34346  
    3232// #include "vboxioctl.h"
    3333
    34 void HGSMINotifyHostCmdComplete (PVBOXVIDEO_COMMON pCommon, HGSMIOFFSET offt)
    35 {
    36     VBoxHGSMIHostWrite(pCommon, offt);
    37 }
    38 
    39 void HGSMIClearIrq (PVBOXVIDEO_COMMON pCommon)
    40 {
    41     VBoxHGSMIHostWrite(pCommon, HGSMIOFFSET_VOID);
    42 }
    43 
    44 static void HGSMIHostCmdComplete (PVBOXVIDEO_COMMON pCommon, void * pvMem)
    45 {
    46     HGSMIOFFSET offMem = HGSMIPointerToOffset (&pCommon->areaHostHeap, HGSMIBufferHeaderFromData (pvMem));
     34/** Send completion notification to the host for the command located at offset
     35 * @a offt into the host command buffer. */
     36void HGSMINotifyHostCmdComplete(PHGSMIHOSTCOMMANDCONTEXT pCtx, HGSMIOFFSET offt)
     37{
     38    VBoxVideoCmnPortWriteUlong(pCtx->port, offt);
     39}
     40
     41/** Acknowlege an IRQ. */
     42void HGSMIClearIrq(PHGSMIHOSTCOMMANDCONTEXT pCtx)
     43{
     44    VBoxVideoCmnPortWriteUlong(pCtx->port, HGSMIOFFSET_VOID);
     45}
     46
     47/** Inform the host that a command has been handled. */
     48static void HGSMIHostCmdComplete(PHGSMIHOSTCOMMANDCONTEXT pCtx, void * pvMem)
     49{
     50    HGSMIBUFFERHEADER *pHdr = HGSMIBufferHeaderFromData(pvMem);
     51    HGSMIOFFSET offMem = HGSMIPointerToOffset(&pCtx->areaCtx, pHdr);
    4752    Assert(offMem != HGSMIOFFSET_VOID);
    4853    if(offMem != HGSMIOFFSET_VOID)
    4954    {
    50         HGSMINotifyHostCmdComplete (pCommon, offMem);
    51     }
    52 }
    53 
    54 static void hgsmiHostCmdProcess(PVBOXVIDEO_COMMON pCommon, HGSMIOFFSET offBuffer)
    55 {
    56     int rc = HGSMIBufferProcess (&pCommon->areaHostHeap,
    57                                 &pCommon->channels,
    58                                 offBuffer);
     55        HGSMINotifyHostCmdComplete(pCtx, offMem);
     56    }
     57}
     58
     59/** Submit an incoming host command to the appropriate handler. */
     60static void hgsmiHostCmdProcess(PHGSMIHOSTCOMMANDCONTEXT pCtx,
     61                                HGSMIOFFSET offBuffer)
     62{
     63    int rc = HGSMIBufferProcess(&pCtx->areaCtx, &pCtx->channels, offBuffer);
    5964    Assert(!RT_FAILURE(rc));
    6065    if(RT_FAILURE(rc))
     
    6267        /* failure means the command was not submitted to the handler for some reason
    6368         * it's our responsibility to notify its completion in this case */
    64         HGSMINotifyHostCmdComplete(pCommon, offBuffer);
     69        HGSMINotifyHostCmdComplete(pCtx, offBuffer);
    6570    }
    6671    /* if the cmd succeeded it's responsibility of the callback to complete it */
    6772}
    6873
    69 static HGSMIOFFSET hgsmiGetHostBuffer (PVBOXVIDEO_COMMON pCommon)
    70 {
    71     return VBoxHGSMIHostRead(pCommon);
    72 }
    73 
    74 static void hgsmiHostCommandQueryProcess (PVBOXVIDEO_COMMON pCommon)
    75 {
    76     HGSMIOFFSET offset = hgsmiGetHostBuffer (pCommon);
    77     Assert(offset != HGSMIOFFSET_VOID);
    78     if(offset != HGSMIOFFSET_VOID)
    79     {
    80         hgsmiHostCmdProcess(pCommon, offset);
    81     }
    82 }
    83 
    84 void hgsmiProcessHostCommandQueue(PVBOXVIDEO_COMMON pCommon)
    85 {
    86     while (pCommon->pHostFlags->u32HostFlags & HGSMIHOSTFLAGS_COMMANDS_PENDING)
    87     {
    88         if (!ASMAtomicCmpXchgBool(&pCommon->bHostCmdProcessing, true, false))
     74/** Get the next command from the host. */
     75static HGSMIOFFSET hgsmiGetHostBuffer(PHGSMIHOSTCOMMANDCONTEXT pCtx)
     76{
     77    return VBoxVideoCmnPortReadUlong(pCtx->port);
     78}
     79
     80/** Get and handle the next command from the host. */
     81static void hgsmiHostCommandQueryProcess(PHGSMIHOSTCOMMANDCONTEXT pCtx)
     82{
     83    HGSMIOFFSET offset = hgsmiGetHostBuffer(pCtx);
     84    AssertReturnVoid(offset != HGSMIOFFSET_VOID);
     85    hgsmiHostCmdProcess(pCtx, offset);
     86}
     87
     88/** Drain the host command queue. */
     89void hgsmiProcessHostCommandQueue(PHGSMIHOSTCOMMANDCONTEXT pCtx)
     90{
     91    while (pCtx->pfHostFlags->u32HostFlags & HGSMIHOSTFLAGS_COMMANDS_PENDING)
     92    {
     93        if (!ASMAtomicCmpXchgBool(&pCtx->fHostCmdProcessing, true, false))
    8994            return;
    90         hgsmiHostCommandQueryProcess(pCommon);
    91         ASMAtomicWriteBool(&pCommon->bHostCmdProcessing, false);
    92     }
    93 }
    94 
    95 /* Detect whether HGSMI is supported by the host. */
     95        hgsmiHostCommandQueryProcess(pCtx);
     96        ASMAtomicWriteBool(&pCtx->fHostCmdProcessing, false);
     97    }
     98}
     99
     100/** Detect whether HGSMI is supported by the host. */
    96101bool VBoxHGSMIIsSupported (void)
    97102{
     
    112117typedef FNHGSMICALLFINALIZE *PFNHGSMICALLFINALIZE;
    113118
    114 void* vboxHGSMIBufferAlloc(PVBOXVIDEO_COMMON pCommon,
     119void* vboxHGSMIBufferAlloc(PHGSMIGUESTCOMMANDCONTEXT pCtx,
    115120                         HGSMISIZE cbData,
    116121                         uint8_t u8Ch,
     
    120125    /* @todo: add synchronization */
    121126#endif
    122     return HGSMIHeapAlloc (&pCommon->hgsmiAdapterHeap, cbData, u8Ch, u16Op);
    123 }
    124 
    125 void vboxHGSMIBufferFree (PVBOXVIDEO_COMMON pCommon, void *pvBuffer)
     127    return HGSMIHeapAlloc (&pCtx->heapCtx, cbData, u8Ch, u16Op);
     128}
     129
     130void vboxHGSMIBufferFree(PHGSMIGUESTCOMMANDCONTEXT pCtx, void *pvBuffer)
    126131{
    127132#ifdef VBOX_WITH_WDDM
    128133    /* @todo: add synchronization */
    129134#endif
    130     HGSMIHeapFree (&pCommon->hgsmiAdapterHeap, pvBuffer);
    131 }
    132 
    133 int vboxHGSMIBufferSubmit (PVBOXVIDEO_COMMON pCommon, void *pvBuffer)
     135    HGSMIHeapFree (&pCtx->heapCtx, pvBuffer);
     136}
     137
     138int vboxHGSMIBufferSubmit(PHGSMIGUESTCOMMANDCONTEXT pCtx, void *pvBuffer)
    134139{
    135140    /* Initialize the buffer and get the offset for port IO. */
    136     HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&pCommon->hgsmiAdapterHeap, pvBuffer);
     141    HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&pCtx->heapCtx, pvBuffer);
    137142
    138143    Assert(offBuffer != HGSMIOFFSET_VOID);
     
    140145    {
    141146        /* Submit the buffer to the host. */
    142         VBoxHGSMIGuestWrite(pCommon, offBuffer);
     147        VBoxVideoCmnPortWriteUlong(pCtx->port, offBuffer);
    143148        return VINF_SUCCESS;
    144149    }
     
    158163
    159164    /* Allocate the IO buffer. */
    160     void *p = HGSMIHeapAlloc (&pCommon->hgsmiAdapterHeap, cbData, u8Ch, u16Op);
     165    void *p = HGSMIHeapAlloc (&pCommon->guestCtx.heapCtx, cbData, u8Ch, u16Op);
    161166
    162167    if (!p)
     
    174179        if (RT_SUCCESS (rc))
    175180        {
    176             /* Initialize the buffer and get the offset for port IO. */
    177             HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&pCommon->hgsmiAdapterHeap,
    178                                                            p);
    179 
    180             /* Submit the buffer to the host. */
    181             VBoxHGSMIGuestWrite(pCommon, offBuffer);
    182 
    183             if (pfnFinalize)
     181            rc = vboxHGSMIBufferSubmit(&pCommon->guestCtx, p);
     182
     183            if (RT_SUCCESS(rc) && pfnFinalize)
    184184            {
    185185                rc = pfnFinalize (pCommon, pvContext, p);
     
    193193
    194194        /* Free the IO buffer. */
    195         HGSMIHeapFree (&pCommon->hgsmiAdapterHeap, p);
     195        HGSMIHeapFree (&pCommon->guestCtx.heapCtx, p);
    196196    }
    197197
     
    271271    int rc;
    272272    /* Issue the screen info command. */
    273     void *p = vboxHGSMIBufferAlloc (pCommon, sizeof(VBVAINFOVIEW) * u32Count,
     273    void *p = vboxHGSMIBufferAlloc(&pCommon->guestCtx, sizeof(VBVAINFOVIEW) * u32Count,
    274274                                    HGSMI_CH_VBVA, VBVA_INFO_VIEW);
    275275    Assert(p);
     
    279279        rc = pfnFill(pvData, pInfo);
    280280        if (RT_SUCCESS(rc))
    281             vboxHGSMIBufferSubmit (pCommon, p);
    282         vboxHGSMIBufferFree (pCommon, p);
     281            vboxHGSMIBufferSubmit (&pCommon->guestCtx, p);
     282        vboxHGSMIBufferFree (&pCommon->guestCtx, p);
    283283    }
    284284    else
     
    403403        /** @note (michael) moved this here as it is done unconditionally in both
    404404         * driver branches.  Feel free to fix if that is ever changed. */
    405         pCommon->IOPortHost = (RTIOPORT)VGA_PORT_HGSMI_HOST;
    406         pCommon->IOPortGuest = (RTIOPORT)VGA_PORT_HGSMI_GUEST;
     405        pCommon->hostCtx.port = (RTIOPORT)VGA_PORT_HGSMI_HOST;
     406        pCommon->guestCtx.port = (RTIOPORT)VGA_PORT_HGSMI_GUEST;
    407407
    408408        /* Map the adapter information. It will be needed for HGSMI IO. */
     
    423423        {
    424424            /* Setup a HGSMI heap within the adapter information area. */
    425             rc = HGSMIHeapSetup (&pCommon->hgsmiAdapterHeap,
     425            rc = HGSMIHeapSetup (&pCommon->guestCtx.heapCtx,
    426426                                 pCommon->pvAdapterInformation,
    427427                                 VBVA_ADAPTER_INFORMATION_SIZE - sizeof(HGSMIHOSTFLAGS),
     
    438438            else
    439439            {
    440                 pCommon->pHostFlags = (HGSMIHOSTFLAGS*)(((uint8_t*)pCommon->pvAdapterInformation)
     440                pCommon->hostCtx.pfHostFlags = (HGSMIHOSTFLAGS*)(((uint8_t*)pCommon->pvAdapterInformation)
    441441                                                            + VBVA_ADAPTER_INFORMATION_SIZE - sizeof(HGSMIHOSTFLAGS));
    442442            }
     
    497497
    498498                /* Init the host hap area. Buffers from the host will be placed there. */
    499                 HGSMIAreaInitialize (&pCommon->areaHostHeap,
     499                HGSMIAreaInitialize (&pCommon->hostCtx.areaCtx,
    500500                                     pCommon->pvMiniportHeap,
    501501                                     pCommon->cbMiniportHeap,
     
    550550    PVBOXVIDEO_COMMON pCommon = (PVBOXVIDEO_COMMON)pvCommon;
    551551
    552     pCommon->pHostFlags = NULL;
     552    pCommon->hostCtx.pfHostFlags = NULL;
    553553    return true;
    554554}
     
    557557{
    558558    VBoxUnmapAdapterMemory(pCommon, &pCommon->pvMiniportHeap);
    559     HGSMIHeapDestroy(&pCommon->hgsmiAdapterHeap);
     559    HGSMIHeapDestroy(&pCommon->guestCtx.heapCtx);
    560560
    561561    /* Unmap the adapter information needed for HGSMI IO. */
     
    734734DECLCALLBACK(void) hgsmiHostCmdComplete (HVBOXVIDEOHGSMI hHGSMI, struct _VBVAHOSTCMD * pCmd)
    735735{
    736     PVBOXVIDEO_COMMON pCommon = (PVBOXVIDEO_COMMON)hHGSMI;
    737     HGSMIHostCmdComplete (pCommon, pCmd);
     736    PHGSMIHOSTCOMMANDCONTEXT pCtx = &((PVBOXVIDEO_COMMON)hHGSMI)->hostCtx;
     737    HGSMIHostCmdComplete(pCtx, pCmd);
    738738}
    739739
     
    759759        return VERR_INVALID_PARAMETER;
    760760
    761     PVBOXVIDEO_COMMON pCommon = (PVBOXVIDEO_COMMON)hHGSMI;
     761    PHGSMIHOSTCOMMANDCONTEXT pCtx = &((PVBOXVIDEO_COMMON)hHGSMI)->hostCtx;
    762762
    763763    /* pick up the host commands */
    764     hgsmiProcessHostCommandQueue(pCommon);
    765 
    766     HGSMICHANNEL * pChannel = HGSMIChannelFindById (&pCommon->channels, u8Channel);
     764    hgsmiProcessHostCommandQueue(pCtx);
     765
     766    HGSMICHANNEL *pChannel = HGSMIChannelFindById (&pCtx->channels, u8Channel);
    767767    if(pChannel)
    768768    {
     
    855855                            Assert(!pCur->u.pNext);
    856856#endif
    857                             HGSMIHostCmdComplete(pCallbacks->pCommon, pCur);
     857                            HGSMIHostCmdComplete(&pCallbacks->pCommon->hostCtx, pCur);
    858858#if 0  /* pNext is NULL, and the other things have already been asserted */
    859859                            pCur = pNext;
     
    907907    }
    908908    /* no handlers were found, need to complete the command here */
    909     HGSMIHostCmdComplete(pCallbacks->pCommon, pvBuffer);
     909    HGSMIHostCmdComplete(&pCallbacks->pCommon->hostCtx, pvBuffer);
    910910    return VINF_SUCCESS;
    911911}
     
    918918{
    919919    VBVA_CHANNELCONTEXTS * pContexts;
    920     HGSMICHANNEL * pChannel = HGSMIChannelFindById (&pCommon->channels, u8Channel);
     920    HGSMICHANNEL * pChannel = HGSMIChannelFindById (&pCommon->hostCtx.channels, u8Channel);
    921921    if(!pChannel)
    922922    {
     
    948948            if(!pChannel)
    949949            {
    950                 rc = HGSMIChannelRegister (&pCommon->channels,
     950                rc = HGSMIChannelRegister (&pCommon->hostCtx.channels,
    951951                                           u8Channel,
    952952                                           "VGA Miniport HGSMI channel",
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVbva.cpp

    r34079 r34346  
    2222{
    2323    int rc = VERR_NO_MEMORY;
    24     void *p = vboxHGSMIBufferAlloc (commonFromDeviceExt(pDevExt),
     24    void *p = vboxHGSMIBufferAlloc (&commonFromDeviceExt(pDevExt)->guestCtx,
    2525                                  sizeof (VBVAENABLE_EX),
    2626                                  HGSMI_CH_VBVA,
     
    4343        pEnable->i32Result = VERR_NOT_SUPPORTED;
    4444
    45         vboxHGSMIBufferSubmit (commonFromDeviceExt(pDevExt), p);
     45        vboxHGSMIBufferSubmit (&commonFromDeviceExt(pDevExt)->guestCtx, p);
    4646
    4747        if (bEnable)
     
    5353            rc = VINF_SUCCESS;
    5454
    55         vboxHGSMIBufferFree (commonFromDeviceExt(pDevExt), p);
     55        vboxHGSMIBufferFree (&commonFromDeviceExt(pDevExt)->guestCtx, p);
    5656    }
    5757    return rc;
     
    143143{
    144144    /* Issue the flush command. */
    145     void *p = vboxHGSMIBufferAlloc (commonFromDeviceExt(pDevExt),
     145    void *p = vboxHGSMIBufferAlloc (&commonFromDeviceExt(pDevExt)->guestCtx,
    146146                              sizeof (VBVAFLUSH),
    147147                              HGSMI_CH_VBVA,
     
    158158        pFlush->u32Reserved = 0;
    159159
    160         vboxHGSMIBufferSubmit (commonFromDeviceExt(pDevExt), p);
    161 
    162         vboxHGSMIBufferFree (commonFromDeviceExt(pDevExt), p);
     160        vboxHGSMIBufferSubmit (&commonFromDeviceExt(pDevExt)->guestCtx, p);
     161
     162        vboxHGSMIBufferFree (&commonFromDeviceExt(pDevExt)->guestCtx, p);
    163163    }
    164164
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.cpp

    r34345 r34346  
    10301030static int vboxWddmVdmaSubmitHgsmi(struct _DEVICE_EXTENSION* pDevExt, PVBOXVDMAINFO pInfo, HGSMIOFFSET offDr)
    10311031{
    1032     VBoxHGSMIGuestWrite(commonFromDeviceExt(pDevExt), offDr);
     1032    VBoxVideoCmnPortWriteUlong(commonFromDeviceExt(pDevExt)->guestCtx.port, offDr);
    10331033    return VINF_SUCCESS;
    10341034}
     
    10401040    int rc = VINF_SUCCESS;
    10411041
    1042     PVBOXVDMA_CTL pCmd = (PVBOXVDMA_CTL)VBoxSHGSMICommandAlloc(&commonFromDeviceExt(pDevExt)->hgsmiAdapterHeap, sizeof (VBOXVDMA_CTL), HGSMI_CH_VBVA, VBVA_VDMA_CTL);
     1042    PVBOXVDMA_CTL pCmd = (PVBOXVDMA_CTL)VBoxSHGSMICommandAlloc(&commonFromDeviceExt(pDevExt)->guestCtx.heapCtx, sizeof (VBOXVDMA_CTL), HGSMI_CH_VBVA, VBVA_VDMA_CTL);
    10431043    if (pCmd)
    10441044    {
     
    10471047        pCmd->i32Result = VERR_NOT_SUPPORTED;
    10481048
    1049         const VBOXSHGSMIHEADER* pHdr = VBoxSHGSMICommandPrepSynch(&commonFromDeviceExt(pDevExt)->hgsmiAdapterHeap, pCmd);
     1049        const VBOXSHGSMIHEADER* pHdr = VBoxSHGSMICommandPrepSynch(&commonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pCmd);
    10501050        Assert(pHdr);
    10511051        if (pHdr)
     
    10531053            do
    10541054            {
    1055                 HGSMIOFFSET offCmd = VBoxSHGSMICommandOffset(&commonFromDeviceExt(pDevExt)->hgsmiAdapterHeap, pHdr);
     1055                HGSMIOFFSET offCmd = VBoxSHGSMICommandOffset(&commonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pHdr);
    10561056                Assert(offCmd != HGSMIOFFSET_VOID);
    10571057                if (offCmd != HGSMIOFFSET_VOID)
     
    10611061                    if (RT_SUCCESS(rc))
    10621062                    {
    1063                         rc = VBoxSHGSMICommandDoneSynch(&commonFromDeviceExt(pDevExt)->hgsmiAdapterHeap, pHdr);
     1063                        rc = VBoxSHGSMICommandDoneSynch(&commonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pHdr);
    10641064                        AssertRC(rc);
    10651065                        if (RT_SUCCESS(rc))
     
    10741074                    rc = VERR_INVALID_PARAMETER;
    10751075                /* fail to submit, cancel it */
    1076                 VBoxSHGSMICommandCancelSynch(&commonFromDeviceExt(pDevExt)->hgsmiAdapterHeap, pHdr);
     1076                VBoxSHGSMICommandCancelSynch(&commonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pHdr);
    10771077            } while (0);
    10781078        }
    10791079
    1080         VBoxSHGSMICommandFree (&commonFromDeviceExt(pDevExt)->hgsmiAdapterHeap, pCmd);
     1080        VBoxSHGSMICommandFree (&commonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pCmd);
    10811081    }
    10821082    else
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVhwa.cpp

    r34129 r34346  
    4545    if(!cRefs)
    4646    {
    47         vboxHGSMIBufferFree(commonFromDeviceExt(pDevExt), pCmd);
     47        vboxHGSMIBufferFree(&commonFromDeviceExt(pDevExt)->guestCtx, pCmd);
    4848    }
    4949}
     
    6161    vbvaVhwaCommandRetain(pDevExt, pCmd);
    6262
    63     vboxHGSMIBufferSubmit(commonFromDeviceExt(pDevExt), pCmd);
     63    vboxHGSMIBufferSubmit(&commonFromDeviceExt(pDevExt)->guestCtx, pCmd);
    6464
    6565    if(!(pCmd->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH)
     
    100100                              VBVA_VHWA_CMD);
    101101#else
    102     VBOXVHWACMD* pHdr = (VBOXVHWACMD*)vboxHGSMIBufferAlloc(commonFromDeviceExt(pDevExt),
     102    VBOXVHWACMD* pHdr = (VBOXVHWACMD*)vboxHGSMIBufferAlloc(&commonFromDeviceExt(pDevExt)->guestCtx,
    103103                              cbCmd + VBOXVHWACMD_HEADSIZE(),
    104104                              HGSMI_CH_VBVA,
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp

    r34130 r34346  
    120120NTSTATUS vboxWddmGhDisplayPostInfoScreenBySDesc (PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SURFACE_DESC pDesc, POINT * pVScreenPos, uint16_t fFlags)
    121121{
    122     void *p = vboxHGSMIBufferAlloc (commonFromDeviceExt(pDevExt),
     122    void *p = vboxHGSMIBufferAlloc (&commonFromDeviceExt(pDevExt)->guestCtx,
    123123                                      sizeof (VBVAINFOSCREEN),
    124124                                      HGSMI_CH_VBVA,
     
    139139        pScreen->u16Flags        = fFlags;
    140140
    141         vboxHGSMIBufferSubmit (commonFromDeviceExt(pDevExt), p);
    142 
    143         vboxHGSMIBufferFree (commonFromDeviceExt(pDevExt), p);
     141        vboxHGSMIBufferSubmit (&commonFromDeviceExt(pDevExt)->guestCtx, p);
     142
     143        vboxHGSMIBufferFree (&commonFromDeviceExt(pDevExt)->guestCtx, p);
    144144    }
    145145
     
    163163
    164164    /* Issue the screen info command. */
    165     void *p = vboxHGSMIBufferAlloc (commonFromDeviceExt(pDevExt),
     165    void *p = vboxHGSMIBufferAlloc (&commonFromDeviceExt(pDevExt)->guestCtx,
    166166                                      sizeof (VBVAINFOVIEW),
    167167                                      HGSMI_CH_VBVA,
     
    178178        pView->u32MaxScreenSize = pView->u32ViewSize;
    179179
    180         vboxHGSMIBufferSubmit (commonFromDeviceExt(pDevExt), p);
    181 
    182         vboxHGSMIBufferFree (commonFromDeviceExt(pDevExt), p);
     180        vboxHGSMIBufferSubmit (&commonFromDeviceExt(pDevExt)->guestCtx, p);
     181
     182        vboxHGSMIBufferFree (&commonFromDeviceExt(pDevExt)->guestCtx, p);
    183183    }
    184184
     
    281281        return &pDevExt->u.primary.Vdma.CmdHeap;
    282282#endif
    283     if (HGSMIAreaContainsOffset(&commonFromDeviceExt(pDevExt)->hgsmiAdapterHeap.area, offCmd))
    284         return &commonFromDeviceExt(pDevExt)->hgsmiAdapterHeap;
     283    if (HGSMIAreaContainsOffset(&commonFromDeviceExt(pDevExt)->guestCtx.heapCtx.area, offCmd))
     284        return &commonFromDeviceExt(pDevExt)->guestCtx.heapCtx;
    285285    return NULL;
    286286}
     
    301301        return VBOXWDDM_HGSMICMD_TYPE_DMACMD;
    302302#endif
    303     if (HGSMIAreaContainsOffset(&commonFromDeviceExt(pDevExt)->hgsmiAdapterHeap.area, offCmd))
     303    if (HGSMIAreaContainsOffset(&commonFromDeviceExt(pDevExt)->guestCtx.heapCtx.area, offCmd))
    304304        return VBOXWDDM_HGSMICMD_TYPE_CTL;
    305305    return VBOXWDDM_HGSMICMD_TYPE_UNDEFINED;
     
    834834    BOOLEAN bOur = FALSE;
    835835    BOOLEAN bNeedDpc = FALSE;
    836     if (commonFromDeviceExt(pDevExt)->pHostFlags) /* If HGSMI is enabled at all. */
     836    if (commonFromDeviceExt(pDevExt)->hostCtx.pfHostFlags) /* If HGSMI is enabled at all. */
    837837    {
    838838        VBOXSHGSMILIST CtlList;
     
    850850#endif
    851851
    852         uint32_t flags = commonFromDeviceExt(pDevExt)->pHostFlags->u32HostFlags;
     852        uint32_t flags = commonFromDeviceExt(pDevExt)->hostCtx.pfHostFlags->u32HostFlags;
    853853        bOur = (flags & HGSMIHOSTFLAGS_IRQ);
    854854        do
     
    857857            {
    858858                /* read the command offset */
    859                 HGSMIOFFSET offCmd = VBoxHGSMIGuestRead(commonFromDeviceExt(pDevExt));
     859                HGSMIOFFSET offCmd = VBoxVideoCmnPortReadUlong(commonFromDeviceExt(pDevExt)->guestCtx.port);
    860860                Assert(offCmd != HGSMIOFFSET_VOID);
    861861                if (offCmd != HGSMIOFFSET_VOID)
     
    874874                        case VBOXWDDM_HGSMICMD_TYPE_CTL:
    875875                            pList = &CtlList;
    876                             pHeap = &commonFromDeviceExt(pDevExt)->hgsmiAdapterHeap;
     876                            pHeap = &commonFromDeviceExt(pDevExt)->guestCtx.heapCtx;
    877877                            break;
    878878                        default:
     
    920920                break;
    921921
    922             flags = commonFromDeviceExt(pDevExt)->pHostFlags->u32HostFlags;
     922            flags = commonFromDeviceExt(pDevExt)->hostCtx.pfHostFlags->u32HostFlags;
    923923        } while (1);
    924924
     
    953953        if (bOur)
    954954        {
    955             HGSMIClearIrq (commonFromDeviceExt(pDevExt));
     955            HGSMIClearIrq(&commonFromDeviceExt(pDevExt)->hostCtx);
    956956#ifdef DEBUG_misha
    957957            /* this is not entirely correct since host may concurrently complete some commands and raise a new IRQ while we are here,
    958958             * still this allows to check that the host flags are correctly cleared after the ISR */
    959             Assert(commonFromDeviceExt(pDevExt)->pHostFlags);
    960             uint32_t flags = commonFromDeviceExt(pDevExt)->pHostFlags->u32HostFlags;
     959            Assert(commonFromDeviceExt(pDevExt)->HostCtx.pfHostFlags);
     960            uint32_t flags = commonFromDeviceExt(pDevExt)->HostCtx.pfHostFlags->u32HostFlags;
    961961            Assert(flags == 0);
    962962#endif
     
    10411041    if (!vboxSHGSMIListIsEmpty(&context.data.CtlList))
    10421042    {
    1043         int rc = VBoxSHGSMICommandPostprocessCompletion (&commonFromDeviceExt(pDevExt)->hgsmiAdapterHeap, &context.data.CtlList);
     1043        int rc = VBoxSHGSMICommandPostprocessCompletion (&commonFromDeviceExt(pDevExt)->guestCtx.heapCtx, &context.data.CtlList);
    10441044        AssertRC(rc);
    10451045    }
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