VirtualBox

Ignore:
Timestamp:
Feb 15, 2010 10:10:11 PM (15 years ago)
Author:
vboxsync
Message:

wddm: more impl

File:
1 edited

Legend:

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

    r26505 r26556  
    186186typedef FNHGSMICALLFINALIZE *PFNHGSMICALLFINALIZE;
    187187
     188void* VBoxHGSMIBufferAlloc (PDEVICE_EXTENSION PrimaryExtension,
     189                         HGSMISIZE cbData,
     190                         uint8_t u8Ch,
     191                         uint16_t u16Op)
     192{
     193#ifdef VBOXWDDM
     194    /* @todo: add synchronization */
     195#endif
     196    return HGSMIHeapAlloc (&PrimaryExtension->u.primary.hgsmiAdapterHeap, cbData, u8Ch, u16Op);
     197}
     198
     199void* VBoxHGSMIBufferAlloc (PDEVICE_EXTENSION PrimaryExtension,
     200                         uint8_t u8Ch,
     201                         uint16_t u16Op,
     202                         HGSMISIZE cbData)
     203{
     204#ifdef VBOXWDDM
     205    /* @todo: add synchronization */
     206#endif
     207    return HGSMIHeapAlloc (&PrimaryExtension->u.primary.hgsmiAdapterHeap, cbData, u8Ch, u16Op);
     208}
     209
     210void VBoxHGSMIBufferFree (PDEVICE_EXTENSION PrimaryExtension, void *pvBuffer)
     211{
     212#ifdef VBOXWDDM
     213    /* @todo: add synchronization */
     214#endif
     215    HGSMIHeapFree (&PrimaryExtension->u.primary.hgsmiAdapterHeap, pvBuffer);
     216}
     217
     218int VBoxHGSMIBufferSubmit (PDEVICE_EXTENSION PrimaryExtension, void *pvBuffer)
     219{
     220    /* Initialize the buffer and get the offset for port IO. */
     221    HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&PrimaryExtension->u.primary.hgsmiAdapterHeap, pvBuffer);
     222
     223    Assert(offBuffer != HGSMIOFFSET_VOID);
     224    if (offBuffer != HGSMIOFFSET_VOID)
     225    {
     226        /* Submit the buffer to the host. */
     227        VBoxHGSMIGuestWrite(PrimaryExtension, offBuffer);
     228        return VINF_SUCCESS;
     229    }
     230
     231    return VERR_INVALID_PARAMETER;
     232}
     233
    188234static int vboxCallChannel (PDEVICE_EXTENSION PrimaryExtension,
    189235                         uint8_t u8Ch,
     
    197243
    198244    /* Allocate the IO buffer. */
     245#ifndef VBOXWDDM
    199246    if (PrimaryExtension->pPrimary != PrimaryExtension)
    200247    {
     
    202249        return VERR_INVALID_PARAMETER;
    203250    }
     251#endif
    204252
    205253    void *p = HGSMIHeapAlloc (&PrimaryExtension->u.primary.hgsmiAdapterHeap, cbData, u8Ch, u16Op);
     
    315363    return rc;
    316364}
    317 
     365#ifndef VBOXWDDM
    318366static int vbvaInitInfoDisplay (PDEVICE_EXTENSION PrimaryExtension, void *pvContext, void *pvData)
    319367{
     
    348396    return VERR_INTERNAL_ERROR;
    349397}
     398#endif
    350399
    351400static int vbvaInitInfoHeap (PDEVICE_EXTENSION PrimaryExtension, void *pvContext, void *pvData)
     
    389438    if(RT_SUCCESS (rc))
    390439    {
     440#ifndef VBOXWDDM
    391441        rc = vboxCallVBVA (PrimaryExtension,
    392442                               VBVA_INFO_VIEW,
     
    397447        AssertRC(rc);
    398448        if (RT_SUCCESS (rc))
     449#else
     450        /* in case of WDDM we do not control the framebuffer location,
     451         * i.e. it is assigned by Video Memory Manager,
     452         * The FB information should be passed to guest from our DxgkDdiSetVidPnSourceAddress callback */
     453#endif
    399454        {
    400455            /* Report the host heap location. */
     
    660715     */
    661716    PrimaryExtension->pNext                              = NULL;
     717#ifndef VBOXWDDM
    662718    PrimaryExtension->pPrimary                           = PrimaryExtension;
    663719    PrimaryExtension->iDevice                            = 0;
    664720    PrimaryExtension->ulFrameBufferOffset                = 0;
    665721    PrimaryExtension->ulFrameBufferSize                  = 0;
     722#endif
    666723    PrimaryExtension->u.primary.ulVbvaEnabled            = 0;
    667724    PrimaryExtension->u.primary.bVBoxVideoSupported      = FALSE;
     
    861918    }
    862919
     920#ifndef VBOXWDDM
    863921    /* Now when the number of monitors is known and extensions are created,
    864922     * calculate the layout of framebuffers.
    865923     */
    866924    VBoxComputeFrameBufferSizes (PrimaryExtension);
     925#endif
    867926
    868927    if (PrimaryExtension->u.primary.bHGSMI)
     
    876935        }
    877936    }
     937
     938#ifdef VBOXWDDM
     939    if (PrimaryExtension->u.primary.bHGSMI)
     940    {
     941        ULONG ulAvailable = PrimaryExtension->u.primary.cbVRAM
     942                            - PrimaryExtension->u.primary.cbMiniportHeap
     943                            - VBVA_ADAPTER_INFORMATION_SIZE;
     944
     945        /* use 25% od VRAM for DMA command buffer
     946         * @todo: ^^^? */
     947        ULONG ulSize = ulAvailable / 4;
     948
     949        /* Align down to 4096 bytes. */
     950        ulSize &= ~0xFFF;
     951        ULONG offset = ulAvailable - ulSize;
     952
     953        Assert(!(offset & 0xFFF));
     954
     955        rc = vboxVdmaCreate (PrimaryExtension, &PrimaryExtension->u.primary.Vdma, offset, ulSize);
     956        AssertRC(rc);
     957        if (RT_SUCCESS(rc))
     958        {
     959            /* can enable it right away since the host does not need any screen/FB info
     960             * for basic DMA functionality */
     961            rc = vboxVdmaEnable(PrimaryExtension, &PrimaryExtension->u.primary.Vdma);
     962            AssertRC(rc);
     963            if (RT_FAILURE(rc))
     964                vboxVdmaDestroy(PrimaryExtension, &PrimaryExtension->u.primary.Vdma);
     965        }
     966
     967        if (RT_FAILURE(rc))
     968            PrimaryExtension->u.primary.bHGSMI = FALSE;
     969    }
     970#endif
    878971
    879972    if (!PrimaryExtension->u.primary.bHGSMI)
     
    9531046                                uint32_t cbLength)
    9541047{
     1048#ifndef VBOXWDDM
    9551049    PDEVICE_EXTENSION PrimaryExtension = DeviceExtension->pPrimary;
    9561050
     
    9771071        return TRUE;
    9781072    }
     1073#else
     1074    PDEVICE_EXTENSION PrimaryExtension = DeviceExtension;
     1075#endif
    9791076
    9801077    uint32_t cbData = 0;
     
    11161213}
    11171214
     1215#ifndef VBOXWDDM
    11181216DECLCALLBACK(void) hgsmiHostCmdComplete (HVBOXVIDEOHGSMI hHGSMI, struct _VBVAHOSTCMD * pCmd)
    11191217{
     
    11641262    return VERR_INVALID_PARAMETER;
    11651263}
     1264#endif
    11661265
    11671266static DECLCALLBACK(int) vboxVBVAChannelGenericHandler(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer)
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