VirtualBox

Ignore:
Timestamp:
May 25, 2009 6:36:52 PM (16 years ago)
Author:
vboxsync
Message:

Video HW Accel: guest->host command mechanism fixes

File:
1 edited

Legend:

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

    r19844 r20009  
    692692# ifdef VBOX_WITH_VIDEOHWACCEL
    693693
    694 VBOXVHWACMD* vboxVHWACreateCommand (PPDEV ppdev, VBOXVHWACMD_LENGTH cbCmd)
     694VBOXVHWACMD* vboxVHWACommandCreate (PPDEV ppdev, VBOXVHWACMD_LENGTH cbCmd)
    695695{
    696696    VBOXVHWACMD* pHdr = (VBOXVHWACMD*)HGSMIHeapAlloc (&ppdev->hgsmiDisplayHeap,
     
    700700    if (!pHdr)
    701701    {
    702         DISPDBG((0, "VBoxDISP::vboxVHWACreateCommand: HGSMIHeapAlloc failed\n"));
     702        DISPDBG((0, "VBoxDISP::vboxVHWACommandCreate: HGSMIHeapAlloc failed\n"));
    703703    }
    704704
     
    706706}
    707707
    708 void vboxVHWAFreeCommand (PPDEV ppdev, VBOXVHWACMD* pCmd)
     708void vboxVHWACommandFree (PPDEV ppdev, VBOXVHWACMD* pCmd)
    709709{
    710710    HGSMIHeapFree (&ppdev->hgsmiDisplayHeap, pCmd);
    711711}
    712712
    713 void vboxVHWASubmitCommand (PPDEV ppdev, VBOXVHWACMD* pCmd)
    714 {
     713static void vboxVHWACommandCompletionCallbackEvent(PPDEV ppdev, VBOXVHWACMD * pCmd, void * pContext)
     714{
     715    PEVENT pEvent = (PEVENT)pContext;
     716    LONG oldState = EngSetEvent(pEvent);
     717    Assert(!oldState);
     718}
     719
     720BOOL vboxVHWACommandSubmit (PPDEV ppdev, VBOXVHWACMD* pCmd)
     721{
     722    PEVENT pEvent;
     723    BOOL brc = EngCreateEvent(&pEvent);
     724    Assert(brc);
     725    if(brc)
     726    {
     727        vboxVHWACommandSubmitAssynch (ppdev, pCmd, vboxVHWACommandCompletionCallbackEvent, pEvent);
     728
     729        brc = EngWaitForSingleObject(pEvent,
     730                NULL /*IN PLARGE_INTEGER  pTimeOut*/
     731                );
     732        Assert(brc);
     733        if(brc)
     734        {
     735            EngDeleteEvent(pEvent);
     736        }
     737    }
     738    return brc;
     739}
     740
     741/* do not wait for completion */
     742void vboxVHWACommandSubmitAssynch (PPDEV ppdev, VBOXVHWACMD* pCmd, PFNVBOXVHWACMDCOMPLETION pfnCompletion, void * pContext)
     743{
     744    pCmd->GuestVBVAReserved1 = (uintptr_t)pfnCompletion;
     745    pCmd->GuestVBVAReserved2 = (uintptr_t)pContext;
     746
    715747    vboxHGSMIBufferSubmit (ppdev, pCmd);
    716     if(pCmd->rc == VINF_VHWA_CMD_PENDING)
    717     {
    718 
    719     }
    720 }
    721 
    722 /* do not wait for completion */
    723 void vboxVHWASubmitCommandAssynch (PPDEV ppdev, VBOXVHWACMD* pCmd)
    724 {
    725     vboxHGSMIBufferSubmit (ppdev, pCmd);
     748
     749    if(pCmd->rc != VINF_VHWA_CMD_PENDING)
     750    {
     751        /* the command is completed */
     752        pfnCompletion(ppdev, pCmd, pContext);
     753    }
     754
    726755}
    727756
    728757static int vboxVHWAHanldeVHWACmdCompletion(PPDEV ppdev, void *pvBuffer, HGSMISIZE cbBuffer)
    729758{
    730     Assert(0);
    731 
     759    VBOXVHWACMD* pCmd = (VBOXVHWACMD*)pvBuffer;
     760    PFNVBOXVHWACMDCOMPLETION pfnCompletion = (PFNVBOXVHWACMDCOMPLETION)pCmd->GuestVBVAReserved1;
     761    void * pContext = (void *)pCmd->GuestVBVAReserved2;
     762
     763    pfnCompletion(ppdev, pCmd, pContext);
     764    return 0;
     765}
     766
     767# endif
     768
     769void vboxVBVAHostCommandComplete(PPDEV ppdev, void *pvBuffer)
     770{
    732771    ppdev->pfnHGSMICommandComplete(ppdev->hMpHGSMI, pvBuffer);
    733     return 0;
    734 }
    735 
    736 # endif
    737 
    738 DECLCALLBACK(int) vboxVHWACommandHanlder(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer)
     772}
     773
     774DECLCALLBACK(int) vboxVBVAHostCommandHanlder(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer)
    739775{
    740776    int rc = VINF_SUCCESS;
     
    752788        default:
    753789        {
    754             ppdev->pfnHGSMICommandComplete(ppdev->hMpHGSMI, pvBuffer);
    755         }
    756 
     790            vboxVBVAHostCommandComplete(ppdev, pvBuffer);
     791        }
    757792    }
    758793    return 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