VirtualBox

Changeset 15732 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Dec 23, 2008 3:12:45 PM (16 years ago)
Author:
vboxsync
Message:

#3285: Improve error handling API to include unique error numbers
Document

  • IDisplay::lockFramebuffer
  • IDisplay::unlockFramebuffer
  • IDisplay::setVideoModeHint
  • IDisplay::takeScreenShot
  • IDisplay::drawToScreen
  • IDisplay::invalidateAndUpdate
  • IDisplay::resizeCompleted
  • IDisplay::updateCompleted
Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/DisplayImpl.cpp

    r15256 r15732  
    12501250STDMETHODIMP Display::COMGETTER(Width) (ULONG *width)
    12511251{
    1252     if (!width)
    1253         return E_POINTER;
     1252    CheckComArgSafeArrayNotNull(width);
    12541253
    12551254    AutoCaller autoCaller (this);
     
    12731272STDMETHODIMP Display::COMGETTER(Height) (ULONG *height)
    12741273{
    1275     if (!height)
    1276         return E_POINTER;
     1274    CheckComArgNotNull(height);
    12771275
    12781276    AutoCaller autoCaller (this);
     
    13721370STDMETHODIMP Display::LockFramebuffer (BYTE **address)
    13731371{
    1374     if (!address)
    1375         return E_POINTER;
     1372    CheckComArgOutPointerValid(address);
    13761373
    13771374    AutoCaller autoCaller (this);
     
    13811378
    13821379    /* only allowed for internal framebuffers */
    1383     if (mInternalFramebuffer && !mFramebufferOpened && !maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer.isNull())
     1380    if (mInternalFramebuffer && !mFramebufferOpened
     1381        && !maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer.isNull())
    13841382    {
    13851383        CHECK_CONSOLE_DRV (mpDrv);
     
    13911389    }
    13921390
    1393     return setError (E_FAIL,
    1394                      tr ("Framebuffer locking is allowed only for the internal framebuffer"));
     1391    return setError (VBOX_E_NOT_SUPPORTED,
     1392        tr ("Framebuffer locking is allowed only for the internal framebuffer"));
    13951393}
    13961394
     
    14111409    }
    14121410
    1413     return setError (E_FAIL,
    1414                      tr ("Framebuffer locking is allowed only for the internal framebuffer"));
     1411    return setError (VBOX_E_NOT_SUPPORTED,
     1412        tr ("Framebuffer locking is allowed only for the internal framebuffer"));
    14151413}
    14161414
     
    14191417    LogFlowFunc (("\n"));
    14201418
    1421     if (!frameBuf)
    1422         return E_POINTER;
     1419    CheckComArgNotNull(frameBuf);
    14231420
    14241421    AutoCaller autoCaller (this);
     
    14301427    if (pVM.isOk())
    14311428    {
    1432         /* Must leave the lock here because the changeFramebuffer will also obtain it. */
     1429        /* Must leave the lock here because the changeFramebuffer will
     1430         * also obtain it. */
    14331431        alock.leave ();
    14341432
     
    14361434        PVMREQ pReq = NULL;
    14371435        int vrc = VMR3ReqCall (pVM, VMREQDEST_ANY, &pReq, RT_INDEFINITE_WAIT,
    1438                                (PFNRT) changeFramebuffer, 4,
    1439                                this, frameBuf, false /* aInternal */, VBOX_VIDEO_PRIMARY_SCREEN);
     1436            (PFNRT) changeFramebuffer, 4, this, frameBuf, false /* aInternal */,
     1437            VBOX_VIDEO_PRIMARY_SCREEN);
    14401438        if (RT_SUCCESS (vrc))
    14411439            vrc = pReq->iStatus;
     
    14491447    {
    14501448        /* No VM is created (VM is powered off), do a direct call */
    1451         int vrc = changeFramebuffer (this, frameBuf, false /* aInternal */, VBOX_VIDEO_PRIMARY_SCREEN);
     1449        int vrc = changeFramebuffer (this, frameBuf, false /* aInternal */,
     1450            VBOX_VIDEO_PRIMARY_SCREEN);
    14521451        ComAssertRCRet (vrc, E_FAIL);
    14531452    }
     
    14561455}
    14571456
    1458 STDMETHODIMP Display::SetFramebuffer (ULONG aScreenId, IFramebuffer *aFramebuffer)
     1457STDMETHODIMP Display::SetFramebuffer (ULONG aScreenId,
     1458    IFramebuffer *aFramebuffer)
    14591459{
    14601460    LogFlowFunc (("\n"));
     
    14701470    if (pVM.isOk())
    14711471    {
    1472         /* Must leave the lock here because the changeFramebuffer will also obtain it. */
     1472        /* Must leave the lock here because the changeFramebuffer will
     1473         * also obtain it. */
    14731474        alock.leave ();
    14741475
     
    14761477        PVMREQ pReq = NULL;
    14771478        int vrc = VMR3ReqCall (pVM, VMREQDEST_ANY, &pReq, RT_INDEFINITE_WAIT,
    1478                                (PFNRT) changeFramebuffer, 4,
    1479                                this, aFramebuffer, false /* aInternal */, aScreenId);
     1479            (PFNRT) changeFramebuffer, 4, this, aFramebuffer, false /* aInternal */,
     1480            aScreenId);
    14801481        if (RT_SUCCESS (vrc))
    14811482            vrc = pReq->iStatus;
     
    14891490    {
    14901491        /* No VM is created (VM is powered off), do a direct call */
    1491         int vrc = changeFramebuffer (this, aFramebuffer, false /* aInternal */, aScreenId);
     1492        int vrc = changeFramebuffer (this, aFramebuffer, false /* aInternal */,
     1493            aScreenId);
    14921494        ComAssertRCRet (vrc, E_FAIL);
    14931495    }
     
    14961498}
    14971499
    1498 STDMETHODIMP Display::GetFramebuffer (ULONG aScreenId, IFramebuffer **aFramebuffer, LONG *aXOrigin, LONG *aYOrigin)
     1500STDMETHODIMP Display::GetFramebuffer (ULONG aScreenId,
     1501    IFramebuffer **aFramebuffer, LONG *aXOrigin, LONG *aYOrigin)
    14991502{
    15001503    LogFlowFunc (("aScreenId = %d\n", aScreenId));
     
    15211524}
    15221525
    1523 STDMETHODIMP Display::SetVideoModeHint(ULONG aWidth, ULONG aHeight, ULONG aBitsPerPixel, ULONG aDisplay)
     1526STDMETHODIMP Display::SetVideoModeHint(ULONG aWidth, ULONG aHeight,
     1527    ULONG aBitsPerPixel, ULONG aDisplay)
    15241528{
    15251529    AutoCaller autoCaller (this);
     
    15611565//        return setError(E_FAIL, tr("Not enough VRAM for the selected video mode"));
    15621566
    1563     /* Have to leave the lock because the pfnRequestDisplayChange will call EMT.  */
     1567    /* Have to leave the lock because the pfnRequestDisplayChange
     1568     * will call EMT.  */
    15641569    alock.leave ();
    15651570    if (mParent->getVMMDev())
     
    15981603                  address, width, height));
    15991604
    1600     if (!address)
    1601         return E_POINTER;
    1602     if (!width || !height)
    1603         return E_INVALIDARG;
     1605    CheckComArgNotNull(address);
     1606    CheckComArgExpr(width, width != 0);
     1607    CheckComArgExpr(height, height != 0);
    16041608
    16051609    AutoCaller autoCaller (this);
     
    16191623    /*
    16201624     * First try use the graphics device features for making a snapshot.
    1621      * This does not support stretching, is an optional feature (returns not supported).
     1625     * This does not support stretching, is an optional feature (returns
     1626     * not supported).
    16221627     *
    16231628     * Note: It may cause a display resize. Watch out for deadlocks.
     
    16301635        size_t cbData = RT_ALIGN_Z(width, 4) * 4 * height;
    16311636        rcVBox = VMR3ReqCall(pVM, VMREQDEST_ANY, &pReq, RT_INDEFINITE_WAIT,
    1632                              (PFNRT)mpDrv->pUpPort->pfnSnapshot, 6, mpDrv->pUpPort,
    1633                              address, cbData, (uintptr_t)NULL, (uintptr_t)NULL, (uintptr_t)NULL);
     1637            (PFNRT)mpDrv->pUpPort->pfnSnapshot, 6, mpDrv->pUpPort,
     1638            address, cbData, (uintptr_t)NULL, (uintptr_t)NULL, (uintptr_t)NULL);
    16341639        if (RT_SUCCESS(rcVBox))
    16351640        {
     
    16451650    if (rcVBox == VERR_NOT_SUPPORTED || rcVBox == VERR_NOT_IMPLEMENTED)
    16461651    {
    1647         /** @todo implement snapshot stretching and generic snapshot fallback. */
     1652        /** @todo implement snapshot stretching & generic snapshot fallback. */
    16481653        rc = setError (E_NOTIMPL, tr ("This feature is not implemented"));
    16491654    }
    16501655    else if (RT_FAILURE(rcVBox))
    1651         rc = setError (E_FAIL,
     1656        rc = setError (VBOX_E_IPRT_ERROR,
    16521657            tr ("Could not take a screenshot (%Rrc)"), rcVBox);
    16531658
     
    16681673    LogFlowFuncEnter();
    16691674    LogFlowFunc (("address=%p, x=%d, y=%d, width=%d, height=%d\n",
    1670                   address, x, y, width, height));
    1671 
    1672     if (!address)
    1673         return E_POINTER;
    1674     if (!width || !height)
    1675         return E_INVALIDARG;
     1675                  (void *)address, x, y, width, height));
     1676
     1677    CheckComArgNotNull(address);
     1678    CheckComArgExpr(width, width != 0);
     1679    CheckComArgExpr(height, height != 0);
    16761680
    16771681    AutoCaller autoCaller (this);
     
    16911695    PVMREQ pReq;
    16921696    int rcVBox = VMR3ReqCall(pVM, VMREQDEST_ANY, &pReq, RT_INDEFINITE_WAIT,
    1693                              (PFNRT)mpDrv->pUpPort->pfnDisplayBlt, 6, mpDrv->pUpPort,
    1694                              address, x, y, width, height);
     1697        (PFNRT)mpDrv->pUpPort->pfnDisplayBlt, 6, mpDrv->pUpPort,
     1698        address, x, y, width, height);
    16951699    if (RT_SUCCESS(rcVBox))
    16961700    {
     
    17101714    }
    17111715    else if (RT_FAILURE(rcVBox))
    1712         rc = setError (E_FAIL,
     1716        rc = setError (VBOX_E_IPRT_ERROR,
    17131717            tr ("Could not draw to the screen (%Rrc)"), rcVBox);
    17141718//@todo
     
    17511755    PVMREQ pReq;
    17521756    int rcVBox = VMR3ReqCallVoid(pVM, VMREQDEST_ANY, &pReq, RT_INDEFINITE_WAIT,
    1753                                  (PFNRT)mpDrv->pUpPort->pfnUpdateDisplayAll, 1, mpDrv->pUpPort);
     1757        (PFNRT)mpDrv->pUpPort->pfnUpdateDisplayAll, 1, mpDrv->pUpPort);
    17541758    if (RT_SUCCESS(rcVBox))
    17551759        VMR3ReqFree(pReq);
    17561760
    17571761    if (RT_FAILURE(rcVBox))
    1758         rc = setError (E_FAIL,
     1762        rc = setError (VBOX_E_IPRT_ERROR,
    17591763            tr ("Could not invalidate and update the screen (%Rrc)"), rcVBox);
    17601764
     
    17871791    /* this is only valid for external framebuffers */
    17881792    if (mInternalFramebuffer)
    1789         return setError (E_FAIL,
     1793        return setError (VBOX_E_NOT_SUPPORTED,
    17901794            tr ("Resize completed notification is valid only "
    17911795                "for external framebuffers"));
    17921796
    1793     /* Set the flag indicating that the resize has completed and display data need to be updated. */
    1794     bool f = ASMAtomicCmpXchgU32 (&maFramebuffers[aScreenId].u32ResizeStatus, ResizeStatus_UpdateDisplayData, ResizeStatus_InProgress);
     1797    /* Set the flag indicating that the resize has completed and display
     1798     * data need to be updated. */
     1799    bool f = ASMAtomicCmpXchgU32 (&maFramebuffers[aScreenId].u32ResizeStatus,
     1800        ResizeStatus_UpdateDisplayData, ResizeStatus_InProgress);
    17951801    AssertRelease(f);NOREF(f);
    17961802
     
    18211827    /* this is only valid for external framebuffers */
    18221828    if (mInternalFramebuffer)
    1823         return setError (E_FAIL,
     1829        return setError (VBOX_E_NOT_SUPPORTED,
    18241830            tr ("Resize completed notification is valid only "
    18251831                "for external framebuffers"));
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r15727 r15732  
    95649564      <desc>
    95659565        Requests access to the internal frame buffer.
     9566
     9567        <result name="VBOX_E_NOT_SUPPORTED">
     9568          Attempt to lock a non-internal frame buffer.
     9569        </result>
     9570
    95669571      </desc>
    95679572      <param name="address" type="octet" mod="ptr" dir="return"/>
     
    95719576      <desc>
    95729577        Releases access to the internal frame buffer.
     9578
     9579        <result name="VBOX_E_NOT_SUPPORTED">
     9580          Attempt to unlock a non-internal frame buffer.
     9581        </result>
     9582
    95739583      </desc>
    95749584    </method>
     
    96189628        must be <tt>0</tt>.
    96199629
     9630        <result name="E_INVALIDARG">
     9631          The @a display is not associated with any monitor.
     9632        </result>
     9633
    96209634      </desc>
    96219635      <param name="width" type="unsigned long" dir="in"/>
     
    96419655        Takes a screen shot of the requested size and copies it to the
    96429656        32-bpp buffer allocated by the caller.
     9657
     9658        <result name="E_NOTIMPL">
     9659          Feature not implemented.
     9660        </result>
     9661        <result name="VBOX_E_IPRT_ERROR">
     9662          Could not take a screenshot.
     9663        </result>
     9664
    96439665      </desc>
    96449666      <param name="address" type="octet" mod="ptr" dir="in"/>
     
    96519673        Draws a 32-bpp image of the specified size from the given buffer
    96529674        to the given point on the VM display.
     9675
     9676        <result name="E_NOTIMPL">
     9677          Feature not implemented.
     9678        </result>
     9679        <result name="VBOX_E_IPRT_ERROR">
     9680          Could not draw to screen.
     9681        </result>
     9682
    96539683      </desc>
    96549684      <param name="address" type="octet" mod="ptr" dir="in"/>
     
    96639693        Does a full invalidation of the VM display and instructs the VM
    96649694        to update it.
     9695
     9696        <result name="VBOX_E_IPRT_ERROR">
     9697          Could not invalidate and update screen.
     9698        </result>
     9699
    96659700      </desc>
    96669701    </method>
     
    96699704      <desc>
    96709705        Signals that a framebuffer has completed the resize operation.
     9706
     9707        <result name="VBOX_E_NOT_SUPPORTED">
     9708          Operation only valid for external frame buffers.
     9709        </result>
     9710
    96719711      </desc>
    96729712      <param name="screenId" type="unsigned long" dir="in"/>
     
    96769716      <desc>
    96779717        Signals that a framebuffer has completed the update operation.
     9718
     9719        <result name="VBOX_E_NOT_SUPPORTED">
     9720          Operation only valid for external frame buffers.
     9721        </result>
     9722
    96789723      </desc>
    96799724    </method>
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