VirtualBox

Changeset 22136 in vbox


Ignore:
Timestamp:
Aug 10, 2009 2:05:23 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
50904
Message:

video hw accel: fix cmd loss

Location:
trunk/src/VBox
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c

    r22099 r22136  
    15851585        ASMAtomicIncU32(&pCurrDesc->cPendingFlipsCurr);
    15861586        ASMAtomicIncU32(&pTargDesc->cPendingFlipsTarg);
     1587#ifdef DEBUG
     1588        ASMAtomicIncU32(&pCurrDesc->cFlipsCurr);
     1589        ASMAtomicIncU32(&pTargDesc->cFlipsTarg);
     1590#endif
    15871591
    15881592        if(pTargDesc->UpdatedMemRegion.bValid)
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h

    r22028 r22136  
    108108    volatile uint32_t cPendingFlipsCurr;
    109109    volatile uint32_t cPendingFlipsTarg;
     110#ifdef DEBUG
     111    volatile uint64_t cFlipsCurr;
     112    volatile uint64_t cFlipsTarg;
     113#endif
    110114//    uint32_t cBitsPerPixel;
    111115    bool bHidden;
     
    200204
    201205    HVBOXVIDEOHGSMI hMpHGSMI; /* context handler passed to miniport HGSMI callbacks */
     206    PFNVBOXVIDEOHGSMIPOSTCOMMAND pfnHGSMIGHCommandPost; /* called to post the guest command (offset) to the host */
    202207    PFNVBOXVIDEOHGSMICOMPLETION pfnHGSMICommandComplete; /* called to complete the command we receive from the miniport */
    203208    PFNVBOXVIDEOHGSMICOMMANDS   pfnHGSMIRequestCommands; /* called to requests the commands posted to us from the host */
     
    225230
    226231#ifdef VBOX_WITH_HGSMI
    227 #define VBE_DISPI_IOPORT_INDEX          0x01CE
    228 #define VBE_DISPI_IOPORT_DATA           0x01CF
    229 #define VBE_DISPI_INDEX_VBVA_GUEST      0xc
     232//#define VBE_DISPI_IOPORT_INDEX          0x01CE
     233//#define VBE_DISPI_IOPORT_DATA           0x01CF
     234//#define VBE_DISPI_INDEX_VBVA_GUEST      0xc
    230235#endif /* VBOX_WITH_HGSMI */
    231236
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/screen.c

    r20961 r22136  
    123123
    124124            ppdev->hMpHGSMI = Callbacks.hContext;
     125            ppdev->pfnHGSMIGHCommandPost = Callbacks.pfnHGSMIGHCommandPost;
    125126            ppdev->pfnHGSMICommandComplete = Callbacks.pfnCompletionHandler;
    126127            ppdev->pfnHGSMIRequestCommands = Callbacks.pfnRequestCommandsHandler;
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/vbox.c

    r21939 r22136  
    345345    HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&ppdev->hgsmiDisplayHeap, p);
    346346
    347     ASMOutU16 (VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VBVA_GUEST);
    348     ASMOutU32 (VBE_DISPI_IOPORT_DATA, offBuffer);
     347    ppdev->pfnHGSMIGHCommandPost(ppdev->hMpHGSMI, offBuffer);
     348//    ASMOutU16 (VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VBVA_GUEST);
     349//    ASMOutU32 (VBE_DISPI_IOPORT_DATA, offBuffer);
    349350}
    350351
     
    757758        default:
    758759        {
     760                Assert(0);
    759761            vboxVBVAHostCommandComplete(ppdev, pCmd);
    760762        }
     
    764766void vboxVHWACommandCheckHostCmds(PPDEV ppdev)
    765767{
    766     VBVAHOSTCMD * pCmd;
     768    VBVAHOSTCMD * pCmd, * pNextCmd;
    767769    int rc = ppdev->pfnHGSMIRequestCommands(ppdev->hMpHGSMI, HGSMI_CH_VBVA, &pCmd);
     770    Assert(RT_SUCCESS(rc));
    768771    if(RT_SUCCESS(rc))
    769772    {
    770         for(; pCmd; pCmd = pCmd->u.pNext)
    771         {
     773        for(;pCmd; pCmd = pNextCmd)
     774        {
     775                pNextCmd = pCmd->u.pNext;
    772776            vboxVBVAHostCommandHanlder(ppdev, pCmd);
    773777        }
     
    784788    pCmd->Flags |= VBOXVHWACMD_FLAG_GH_ASYNCH_EVENT;
    785789    vboxHGSMIBufferSubmit (ppdev, pCmd);
    786 
     790    //TODO: dbg
     791#if 0
    787792    if(!(ASMAtomicReadU32((volatile uint32_t *)&pCmd->Flags)  & VBOXVHWACMD_FLAG_HG_ASYNCH))
    788793    {
     
    790795        EngSetEvent(pEvent);
    791796    }
     797#endif
    792798}
    793799
     
    823829
    824830    vboxHGSMIBufferSubmit (ppdev, pCmd);
    825 
     831    //TODO: dbg
     832#if 0
    826833    if(!(pCmd->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH))
    827834    {
     
    829836        pfnCompletion(ppdev, pCmd, pContext);
    830837    }
     838#endif
    831839}
    832840
     
    844852
    845853    vboxHGSMIBufferSubmit (ppdev, pCmd);
    846 
     854    //TODO: dbg
     855#if 0
    847856    if(!(pCmd->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH)
    848857            || pCmd->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED)
     
    851860        vboxVHWAFreeCmdCompletion(ppdev, pCmd, NULL);
    852861    }
     862#endif
    853863}
    854864
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp

    r21939 r22136  
    11571157   dprintf(("VBoxVideo::VBoxVideoFindAdapter\n"));
    11581158
     1159   VideoPortCreateSpinLock(HwDeviceExtension, &((PDEVICE_EXTENSION)HwDeviceExtension)->u.primary.pGHRWLock);
     1160
    11591161   VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID);
    11601162   VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, VBE_DISPI_ID2);
     
    12491251       * with old guest additions.
    12501252       */
    1251       if (VBoxHGSMIIsSupported ())
     1253      if (VBoxHGSMIIsSupported ((PDEVICE_EXTENSION)HwDeviceExtension))
    12521254      {
    12531255          LogRel(("VBoxVideo: using HGSMI\n"));
     
    17691771            {
    17701772                /* The display driver must have prepared the monitor information. */
     1773#ifndef VBOX_WITH_HGSMI
    17711774                VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VBOX_VIDEO);
    17721775                VideoPortWritePortUlong((PULONG)VBE_DISPI_IOPORT_DATA, VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE + pDevExt->iDevice);
     1776#else
     1777                VBoxVideoHostWriteUlong(((PDEVICE_EXTENSION)HwDeviceExtension)->pPrimary, VBE_DISPI_INDEX_VBOX_VIDEO, VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE + pDevExt->iDevice);
     1778#endif
    17731779            }
    17741780            else
     
    19451951
    19461952            pInfo->hContext = pDevExt;
     1953            pInfo->pfnHGSMIGHCommandPost = hgsmiGHCommandPost;
    19471954            pInfo->pfnCompletionHandler = hgsmiHostCmdComplete;
    19481955            pInfo->pfnRequestCommandsHandler = hgsmiHostCmdRequest;
     
    20312038    }
    20322039
     2040#ifndef VBOX_WITH_HGSMI
    20332041    VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ENABLE);
    20342042    VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, VBE_DISPI_DISABLED);
     2043#else
     2044    VBoxVideoHostWriteUshort(((PDEVICE_EXTENSION)HwDeviceExtension)->pPrimary, VBE_DISPI_INDEX_ENABLE, VBE_DISPI_DISABLED);
     2045#endif
    20352046
    20362047    if (pDevExt->u.primary.pvReqFlush != NULL)
     
    21342145
    21352146    /* set the mode characteristics */
     2147#ifndef VBOX_WITH_HGSMI
    21362148    VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_XRES);
    21372149    VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, (USHORT)ModeInfo->VisScreenWidth);
     
    21442156    VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED);
    21452157    /** @todo read from the port to see if the mode switch was successful */
     2158#else
     2159    VBoxVideoHostWriteUshort(DeviceExtension->pPrimary, VBE_DISPI_INDEX_XRES, (USHORT)ModeInfo->VisScreenWidth);
     2160    VBoxVideoHostWriteUshort(DeviceExtension->pPrimary, VBE_DISPI_INDEX_YRES, (USHORT)ModeInfo->VisScreenHeight);
     2161    VBoxVideoHostWriteUshort(DeviceExtension->pPrimary, VBE_DISPI_INDEX_BPP, (USHORT)ModeInfo->BitsPerPlane);
     2162    VBoxVideoHostWriteUshort(DeviceExtension->pPrimary, VBE_DISPI_INDEX_ENABLE, VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED);
     2163#endif
    21462164
    21472165    /* Tell the host that we now support graphics in the additions.
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h

    r21609 r22136  
    116116#ifdef VBOX_WITH_HGSMI
    117117           volatile HGSMIHOSTFLAGS * pHostFlags; /* HGSMI host flags */
    118            bool bHostCmdProcessing;
     118           volatile bool bHostCmdProcessing;
    119119           PSPIN_LOCK pSynchLock;
    120120#endif
     
    140140
    141141           HGSMIHEAP hgsmiAdapterHeap;
     142
     143           PSPIN_LOCK pGHRWLock; /* lock for making guest->host read/writes atomic */
    142144#endif /* VBOX_WITH_HGSMI */
    143145       } primary;
     
    253255
    254256#ifdef VBOX_WITH_HGSMI
    255 BOOLEAN VBoxHGSMIIsSupported (void);
     257
     258DECLINLINE(void) VBoxVideoHostWriteUlongLocked(USHORT dataType, ULONG data)
     259{
     260    VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, dataType);
     261    VideoPortWritePortUlong((PULONG)VBE_DISPI_IOPORT_DATA, data);
     262}
     263
     264DECLINLINE(void) VBoxVideoHostWriteUshortLocked(USHORT dataType, USHORT data)
     265{
     266    VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, dataType);
     267    VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, data);
     268}
     269
     270DECLINLINE(ULONG) VBoxVideoHostReadUlongLocked (USHORT dataType)
     271{
     272    VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, dataType);
     273    return VideoPortReadPortUlong((PULONG)VBE_DISPI_IOPORT_DATA);
     274}
     275
     276DECLINLINE(void) VBoxVideoHostWriteUlong(PDEVICE_EXTENSION PrimaryExtension, USHORT dataType, ULONG data)
     277{
     278    UCHAR oldIrql;
     279    VideoPortAcquireSpinLock(PrimaryExtension,
     280                PrimaryExtension->u.primary.pGHRWLock,
     281            &oldIrql);
     282    VBoxVideoHostWriteUlongLocked(dataType, data);
     283    VideoPortReleaseSpinLock(PrimaryExtension,
     284                PrimaryExtension->u.primary.pGHRWLock,
     285            oldIrql);
     286}
     287
     288DECLINLINE(void) VBoxVideoHostWriteUshort(PDEVICE_EXTENSION PrimaryExtension, USHORT dataType, USHORT data)
     289{
     290    UCHAR oldIrql;
     291    VideoPortAcquireSpinLock(PrimaryExtension,
     292                PrimaryExtension->u.primary.pGHRWLock,
     293            &oldIrql);
     294    VBoxVideoHostWriteUshortLocked(dataType, data);
     295    VideoPortReleaseSpinLock(PrimaryExtension,
     296                PrimaryExtension->u.primary.pGHRWLock,
     297            oldIrql);
     298}
     299
     300DECLINLINE(ULONG) VBoxVideoHostReadUlong(PDEVICE_EXTENSION PrimaryExtension, USHORT dataType)
     301{
     302        ULONG data;
     303    UCHAR oldIrql;
     304    VideoPortAcquireSpinLock(PrimaryExtension,
     305                PrimaryExtension->u.primary.pGHRWLock,
     306            &oldIrql);
     307        data = VBoxVideoHostReadUlongLocked(dataType);
     308    VideoPortReleaseSpinLock(PrimaryExtension,
     309                PrimaryExtension->u.primary.pGHRWLock,
     310            oldIrql);
     311    return data;
     312}
     313
     314BOOLEAN VBoxHGSMIIsSupported (PDEVICE_EXTENSION PrimaryExtension);
    256315
    257316VOID VBoxSetupDisplaysHGSMI (PDEVICE_EXTENSION PrimaryExtension,
     
    261320                                PVIDEO_POINTER_ATTRIBUTES pointerAttr,
    262321                                uint32_t cbLength);
    263 
     322DECLCALLBACK(void) hgsmiGHCommandPost(HVBOXVIDEOHGSMI hHGSMI, HGSMIOFFSET offCmd);
    264323DECLCALLBACK(void) hgsmiHostCmdComplete (HVBOXVIDEOHGSMI hHGSMI, struct _VBVAHOSTCMD * pCmd);
    265324DECLCALLBACK(int) hgsmiHostCmdRequest (HVBOXVIDEOHGSMI hHGSMI, uint8_t u8Channel, struct _VBVAHOSTCMD ** ppCmd);
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/vboxioctl.h

    r21227 r22136  
    130130{
    131131    HVBOXVIDEOHGSMI hContext;
     132    PFNVBOXVIDEOHGSMIPOSTCOMMAND pfnHGSMIGHCommandPost;
    132133    PFNVBOXVIDEOHGSMICOMPLETION pfnCompletionHandler;
    133134    PFNVBOXVIDEOHGSMICOMMANDS   pfnRequestCommandsHandler;
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h

    r22107 r22136  
    10621062
    10631063    class VBoxGLWidget *mWidget;
     1064
    10641065protected:
    10651066#if 0
     
    10691070
    10701071    friend class VBoxVHWASurfList;
    1071 
     1072#ifdef DEBUG
     1073public:
     1074    uint64_t cFlipsCurr;
     1075    uint64_t cFlipsTarg;
     1076#endif
    10721077};
    10731078
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette