VirtualBox

Changeset 52574 in vbox for trunk/src


Ignore:
Timestamp:
Sep 2, 2014 7:24:34 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
95843
Message:

IFramebuffer::capabilities

Location:
trunk/src/VBox
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp

    r52200 r52574  
    394394}
    395395
     396STDMETHODIMP VBoxSDLFB::COMGETTER(Capabilities)(ComSafeArrayOut(FramebufferCapabilities_T, aCapabilities))
     397{
     398    if (ComSafeArrayOutIsNull(aCapabilities))
     399        return E_POINTER;
     400
     401    com::SafeArray<FramebufferCapabilities_T> caps;
     402
     403    if (mfUpdateImage)
     404    {
     405        caps.resize(1);
     406        caps[0] = FramebufferCapabilities_UpdateImage;
     407    }
     408    else
     409    {
     410        /* No caps to return. */
     411    }
     412
     413    caps.detachTo(ComSafeArrayOutArg(aCapabilities));
     414    return S_OK;
     415}
     416
    396417/**
    397418 * Notify framebuffer of an update.
     
    666687
    667688    resizeGuest();
    668 
    669     if (mfUpdateImage)
    670     {
    671         gpDisplay->SetFramebufferUpdateMode(aScreenId, FramebufferUpdateMode_NotifyUpdateImage);
    672     }
    673689
    674690    gpDisplay->InvalidateAndUpdateScreen(aScreenId);
  • trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.h

    r51677 r52574  
    8080    STDMETHOD(COMGETTER(Overlay)) (IFramebufferOverlay **aOverlay);
    8181    STDMETHOD(COMGETTER(WinId)) (int64_t *winId);
     82    STDMETHOD(COMGETTER(Capabilities))(ComSafeArrayOut(FramebufferCapabilities_T, aCapabilities));
    8283
    8384    STDMETHOD(NotifyUpdate)(ULONG x, ULONG y, ULONG w, ULONG h);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp

    r52086 r52574  
    194194}
    195195
     196STDMETHODIMP UIFrameBuffer::COMGETTER(Capabilities)(ComSafeArrayOut(FramebufferCapabilities_T, aCapabilities))
     197{
     198    if (ComSafeArrayOutIsNull(aCapabilities))
     199        return E_POINTER;
     200
     201    com::SafeArray<FramebufferCapabilities_T> caps;
     202    caps.resize(2);
     203    caps[0] = FramebufferCapabilities_VHWA;
     204    caps[1] = FramebufferCapabilities_VisibleRegion;
     205
     206    caps.detachTo(ComSafeArrayOutArg(aCapabilities));
     207    return S_OK;
     208}
     209
    196210STDMETHODIMP UIFrameBuffer::NotifyChange(ULONG uScreenId, ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight)
    197211{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h

    r52200 r52574  
    105105    STDMETHOD(COMGETTER(Overlay))(IFramebufferOverlay **ppOverlay);
    106106    STDMETHOD(COMGETTER(WinId))(LONG64 *pWinId);
     107    STDMETHOD(COMGETTER(Capabilities))(ComSafeArrayOut(FramebufferCapabilities_T, aCapabilities));
    107108
    108109    /** EMT callback: Notifies frame-buffer about guest-screen size change.
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r52360 r52574  
    1529615296  -->
    1529715297
    15298   <enum
    15299     name="FramebufferUpdateMode"
    15300     uuid="1268d8ab-dd2f-443c-bc56-d93d3ced5cde"
    15301     >
    15302     <desc>
    15303       How a framebuffer is notified about screen updates.
    15304     </desc>
    15305 
    15306     <const name="NotifyUpdate"       value="0">
    15307       <desc>
    15308         IFramebuffer::NotifyUpdate is called.
    15309       </desc>
    15310     </const>
    15311     <const name="NotifyUpdateImage"  value="1">
    15312       <desc>
    15313         IFramebuffer::NotifyUpdateImage is called.
    15314       </desc>
    15315     </const>
    15316   </enum>
    15317 
    1531815298  <interface
    1531915299    name="IDisplaySourceBitmap" extends="$unknown" wsmap="suppress"
     
    1533315313  </interface>
    1533415314
     15315  <enum
     15316    name="FramebufferCapabilities"
     15317    uuid="cc395839-30fa-4ca5-ae65-e6360e3edd7a"
     15318    >
     15319    <desc>
     15320      Framebuffer capability flags.
     15321    </desc>
     15322
     15323    <const name="UpdateImage" value="0x01">
     15324      <desc>
     15325        Requires NotifyUpdateImage. NotifyUpdate must not be called.
     15326      </desc>
     15327    </const>
     15328
     15329    <const name="VHWA" value="0x02">
     15330      <desc>
     15331        Supports VHWA interface. If set, then IFramebuffer::processVHWACommand can be called.
     15332      </desc>
     15333    </const>
     15334
     15335    <const name="VisibleRegion" value="0x04">
     15336      <desc>
     15337        Supports visible region. If set, then IFramebuffer::setVisibleRegion can be called.
     15338      </desc>
     15339    </const>
     15340  </enum>
     15341
    1533515342  <interface
    1533615343    name="IFramebuffer" extends="$unknown"
    15337     uuid="16d73cd3-da84-4a11-a607-ebab57d050d0"
     15344    uuid="735365aa-544d-415c-a25b-a5ea913d63f3"
    1533815345    wsmap="managed"
    1533915346    >
     
    1556015567    </method>
    1556115568
     15569    <attribute name="capabilities" type="FramebufferCapabilities" safearray="yes" readonly="yes">
     15570      <desc>
     15571        Capabilities of the framebuffer instance.
     15572
     15573        For the meaning of individual capability flags see
     15574        <link to="FramebufferCapabilities"/>.
     15575      </desc>
     15576    </attribute>
     15577
    1556215578  </interface>
    1556315579
     
    1561015626  <interface
    1561115627    name="IDisplay" extends="$unknown"
    15612     uuid="1659de81-24f0-41a9-afd4-abd03dcfbcbc"
     15628    uuid="fb51010f-eefd-430d-8cd7-3c1bc14740eb"
    1561315629    wsmap="managed"
    1561415630    wrap-hint-server-addinterfaces="IEventListener"
     
    1590915925      <param name="screenId" type="unsigned long" dir="in"/>
    1591015926      <param name="displaySourceBitmap" type="IDisplaySourceBitmap" dir="out"/>
    15911     </method>
    15912 
    15913     <method name="setFramebufferUpdateMode">
    15914       <desc>Select how the framebuffer is informed about screen updates.</desc>
    15915       <param name="screenId" type="unsigned long" dir="in"/>
    15916       <param name="framebufferUpdateMode" type="FramebufferUpdateMode" dir="in"/>
    1591715927    </method>
    1591815928
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r52390 r52574  
    4747    bool fDisabled;
    4848
    49     FramebufferUpdateMode_T enmFramebufferUpdateMode;
     49    uint32_t u32Caps;
    5050
    5151    struct
     
    232232    virtual HRESULT querySourceBitmap(ULONG aScreenId,
    233233                                      ComPtr<IDisplaySourceBitmap> &aDisplaySourceBitmap);
    234     virtual HRESULT setFramebufferUpdateMode(ULONG aScreenId,
    235                                              FramebufferUpdateMode_T aFramebufferUpdateMode);
    236234
    237235    // Wrapped IEventListener properties
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r52427 r52574  
    595595        maFramebuffers[ul].fDisabled = ul > 0;
    596596
    597         maFramebuffers[ul].enmFramebufferUpdateMode = FramebufferUpdateMode_NotifyUpdate;
     597        maFramebuffers[ul].u32Caps = 0;
    598598
    599599        maFramebuffers[ul].updateImage.pu8Address = NULL;
     
    855855    }
    856856
    857     SetFramebufferUpdateMode(uScreenId, FramebufferUpdateMode_NotifyUpdate);
     857    DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId];
     858
     859    /* Reset the update mode. */
     860    pFBInfo->updateImage.pSourceBitmap.setNull();
     861    pFBInfo->updateImage.pu8Address = NULL;
     862    pFBInfo->updateImage.cbLine = 0;
    858863
    859864    if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
    860865    {
    861         DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId];
    862866        pFBInfo->w = w;
    863867        pFBInfo->h = h;
     
    892896
    893897    i_handleResizeCompletedEMT(uScreenId, TRUE);
     898
     899    bool fUpdateImage = RT_BOOL(pFBInfo->u32Caps & FramebufferCapabilities_UpdateImage);
     900    if (fUpdateImage && !pFBInfo->pFramebuffer.isNull())
     901    {
     902        ComPtr<IDisplaySourceBitmap> pSourceBitmap;
     903        HRESULT hr = QuerySourceBitmap(uScreenId, pSourceBitmap.asOutParam());
     904        if (SUCCEEDED(hr))
     905        {
     906            BYTE *pAddress = NULL;
     907            ULONG ulWidth = 0;
     908            ULONG ulHeight = 0;
     909            ULONG ulBitsPerPixel = 0;
     910            ULONG ulBytesPerLine = 0;
     911            ULONG ulPixelFormat = 0;
     912
     913            hr = pSourceBitmap->QueryBitmapInfo(&pAddress,
     914                                                &ulWidth,
     915                                                &ulHeight,
     916                                                &ulBitsPerPixel,
     917                                                &ulBytesPerLine,
     918                                                &ulPixelFormat);
     919            if (SUCCEEDED(hr))
     920            {
     921                pFBInfo->updateImage.pSourceBitmap = pSourceBitmap;
     922                pFBInfo->updateImage.pu8Address = pAddress;
     923                pFBInfo->updateImage.cbLine = ulBytesPerLine;
     924            }
     925        }
     926    }
    894927
    895928    return VINF_SUCCESS;
     
    10531086        if (w != 0 && h != 0)
    10541087        {
    1055             if (RT_LIKELY(maFramebuffers[uScreenId].enmFramebufferUpdateMode == FramebufferUpdateMode_NotifyUpdate))
     1088            bool fUpdateImage = RT_BOOL(maFramebuffers[uScreenId].u32Caps & FramebufferCapabilities_UpdateImage);
     1089            if (RT_LIKELY(!fUpdateImage))
    10561090            {
    10571091                pFramebuffer->NotifyUpdate(x, y, w, h);
    10581092            }
    1059             else if (maFramebuffers[uScreenId].enmFramebufferUpdateMode == FramebufferUpdateMode_NotifyUpdateImage)
     1093            else
    10601094            {
    10611095                AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    11951229        DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId];
    11961230
    1197         if (!pFBInfo->pFramebuffer.isNull())
     1231        if (  !pFBInfo->pFramebuffer.isNull()
     1232            & RT_BOOL(pFBInfo->u32Caps & FramebufferCapabilities_VisibleRegion))
    11981233        {
    11991234            /* Prepare a new array of rectangles which intersect with the framebuffer.
     
    22552290
    22562291    pFBInfo->pFramebuffer = aFramebuffer;
     2292
     2293    SafeArray<FramebufferCapabilities_T> caps;
     2294    pFBInfo->pFramebuffer->COMGETTER(Capabilities)(ComSafeArrayAsOutParam(caps));
     2295    pFBInfo->u32Caps = 0;
     2296    size_t i;
     2297    for (i = 0; i < caps.size(); ++i)
     2298        pFBInfo->u32Caps |= caps[i];
    22572299
    22582300    alock.release();
     
    34383480}
    34393481
    3440 HRESULT Display::setFramebufferUpdateMode(ULONG aScreenId, FramebufferUpdateMode_T aFramebufferUpdateMode)
    3441 {
    3442     LogRelFlowFunc(("aScreenId %d, aFramebufferUpdateMode %d\n", aScreenId, aFramebufferUpdateMode));
    3443 
    3444     HRESULT hr = S_OK;
    3445 
    3446     /* Prepare without taking a lock. API has it's own locking. */
    3447     ComPtr<IDisplaySourceBitmap> pSourceBitmap;
    3448     if (aFramebufferUpdateMode == FramebufferUpdateMode_NotifyUpdateImage)
    3449     {
    3450         /* A source bitmap will be needed. */
    3451         hr = QuerySourceBitmap(aScreenId, pSourceBitmap.asOutParam());
    3452     }
    3453 
    3454     if (FAILED(hr))
    3455         return hr;
    3456 
    3457     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    3458 
    3459     if (aScreenId >= mcMonitors)
    3460         return setError(E_INVALIDARG, tr("SetFramebufferUpdateMode: Invalid screen %d (total %d)"),
    3461                         aScreenId, mcMonitors);
    3462 
    3463     DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId];
    3464 
    3465     /* Reset the update mode. */
    3466     pFBInfo->updateImage.pSourceBitmap.setNull();
    3467     pFBInfo->updateImage.pu8Address = NULL;
    3468     pFBInfo->updateImage.cbLine = 0;
    3469 
    3470     if (aFramebufferUpdateMode == FramebufferUpdateMode_NotifyUpdateImage)
    3471     {
    3472         BYTE *pAddress = NULL;
    3473         ULONG ulWidth = 0;
    3474         ULONG ulHeight = 0;
    3475         ULONG ulBitsPerPixel = 0;
    3476         ULONG ulBytesPerLine = 0;
    3477         ULONG ulPixelFormat = 0;
    3478 
    3479         hr = pSourceBitmap->QueryBitmapInfo(&pAddress,
    3480                                             &ulWidth,
    3481                                             &ulHeight,
    3482                                             &ulBitsPerPixel,
    3483                                             &ulBytesPerLine,
    3484                                             &ulPixelFormat);
    3485         if (SUCCEEDED(hr))
    3486         {
    3487             pFBInfo->updateImage.pSourceBitmap = pSourceBitmap;
    3488             pFBInfo->updateImage.pu8Address = pAddress;
    3489             pFBInfo->updateImage.cbLine = ulBytesPerLine;
    3490         }
    3491     }
    3492 
    3493     pFBInfo->enmFramebufferUpdateMode = aFramebufferUpdateMode;
    3494 
    3495     return S_OK;
    3496 }
    3497 
    34983482// wrapped IEventListener method
    34993483HRESULT Display::handleEvent(const ComPtr<IEvent> &aEvent)
     
    41114095    AutoReadLock arlock(this COMMA_LOCKVAL_SRC_POS);
    41124096    pFramebuffer = maFramebuffers[id].pFramebuffer;
     4097    bool fVHWASupported = RT_BOOL(maFramebuffers[id].u32Caps & FramebufferCapabilities_VHWA);
    41134098    arlock.release();
    41144099
    4115     if (pFramebuffer == NULL)
     4100    if (pFramebuffer == NULL || !fVHWASupported)
    41164101        return VERR_NOT_IMPLEMENTED; /* Implementation is not available. */
    41174102
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