VirtualBox

Changeset 77370 in vbox for trunk/src


Ignore:
Timestamp:
Feb 20, 2019 8:04:38 AM (6 years ago)
Author:
vboxsync
Message:

Device/Graphics, pdm, Main, Front-ends: infrastructure for host software cursor.
bugref:9376: Complete hardware cursor implementation in VMSVGA.
This change provides the infrastructure for letting front-ends report to the
graphics device that they are able to render a pointer cursor at any location,
not just where the host cursor is, and for the device to ask them to do this.
It also provides mediation in Main/Display between multiple front-ends and the
device, and tells the guest that we can always render the cursor. In a
follow-up change the device is expected to add support for rendering the
cursor itself into the frame-buffer image it provides to the front-end if not
all attached front-ends are capable of rendering it.

Location:
trunk/src/VBox
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r76985 r77370  
    585585                                       uint32_t dy, uint32_t fEnabled,
    586586                                       uint32_t fNotifyGuest);
    587 DECLCALLBACK(void) vbvaPortReportHostCursorCapabilities(PPDMIDISPLAYPORT pInterface, uint32_t fCapabilitiesAdded,
    588                                                         uint32_t fCapabilitiesRemoved);
     587DECLCALLBACK(void) vbvaPortReportHostCursorCapabilities(PPDMIDISPLAYPORT pInterface, bool fSupportsRenderCursor, bool fSupportsMoveCursor);
    589588DECLCALLBACK(void) vbvaPortReportHostCursorPosition(PPDMIDISPLAYPORT pInterface, uint32_t x, uint32_t y);
    590589
  • trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp

    r77130 r77370  
    28342834}
    28352835
    2836 DECLCALLBACK(void) vbvaPortReportHostCursorCapabilities(PPDMIDISPLAYPORT pInterface, uint32_t fCapabilitiesAdded,
    2837                                                         uint32_t fCapabilitiesRemoved)
    2838 {
     2836DECLCALLBACK(void) vbvaPortReportHostCursorCapabilities(PPDMIDISPLAYPORT pInterface, bool fSupportsRenderCursor, bool fSupportsMoveCursor)
     2837{
     2838    LogRelFlowFunc(("fSupportsRenderCursor=%RTbool, fSupportsMoveCursor=%RTbool\n",
     2839                    fSupportsRenderCursor, fSupportsMoveCursor));
     2840#if 0
    28392841    PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface);
    28402842    int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
     2843    NOREF(fSupportsMoveCursor);
    28412844    AssertRC(rc);
    2842     pThis->fHostCursorCapabilities |= fCapabilitiesAdded;
    2843     pThis->fHostCursorCapabilities &= ~fCapabilitiesRemoved;
     2845    pThis->fHostCursorCapabilities = fSupportsRenderCursor ? VBOX_VBVA_CURSOR_CAPABILITY_HARDWARE : 0;
    28442846    if (pThis->fGuestCaps & VBVACAPS_IRQ && pThis->fGuestCaps & VBVACAPS_DISABLE_CURSOR_INTEGRATION)
    28452847        VBVARaiseIrq(pThis, HGSMIHOSTFLAGS_CURSOR_CAPABILITIES);
    28462848    PDMCritSectLeave(&pThis->CritSect);
     2849#else
     2850    RT_NOREF(pInterface, fSupportsRenderCursor, fSupportsMoveCursor);
     2851#endif
    28472852}
    28482853
     
    28852890             pCtx->fPaused = true;
    28862891             memset(pCtx->aModeHints, ~0, sizeof(pCtx->aModeHints));
    2887              pVGAState->fHostCursorCapabilities = 0;
     2892             pVGAState->fHostCursorCapabilities = VBOX_VBVA_CURSOR_CAPABILITY_HARDWARE;
    28882893         }
    28892894     }
  • trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp

    r76553 r77370  
    412412    if (mfUpdateImage)
    413413    {
     414        caps.resize(2);
     415        caps[0] = FramebufferCapabilities_UpdateImage;
     416        caps[1] = FramebufferCapabilities_RenderCursor;
     417    }
     418    else
     419    {
    414420        caps.resize(1);
    415         caps[0] = FramebufferCapabilities_UpdateImage;
    416     }
    417     else
    418     {
    419         /* No caps to return. */
     421        caps[0] = FramebufferCapabilities_RenderCursor;
    420422    }
    421423
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp

    r76606 r77370  
    711711    if (vboxGlobal().isSeparateProcess())
    712712    {
    713        caps.resize(1);
     713       caps.resize(2);
    714714       caps[0] = FramebufferCapabilities_UpdateImage;
     715       caps[1] = FramebufferCapabilities_RenderCursor;
    715716    }
    716717    else
    717718    {
    718        caps.resize(2);
     719       caps.resize(3);
    719720       caps[0] = FramebufferCapabilities_VHWA;
    720721       caps[1] = FramebufferCapabilities_VisibleRegion;
     722       caps[2] = FramebufferCapabilities_RenderCursor;
    721723    }
    722724
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r77065 r77370  
    1788217882      </desc>
    1788317883    </const>
     17884
     17885    <const name="RenderCursor" value="0x08">
     17886      <desc>
     17887        This framebuffer implementation can render a pointer cursor itself.  Unless the
     17888        MoveCursor capability is also set the cursor will always be rendered at the
     17889        location of (and usually using) the host pointer.
     17890      </desc>
     17891    </const>
     17892
     17893    <const name="MoveCursor" value="0x10">
     17894      <desc>
     17895        Supports rendering a pointer cursor anywhere within the guest screen.  Implies
     17896        RenderCursor.
     17897      </desc>
     17898    </const>
    1788417899  </enum>
    1788517900
     
    2544725462
    2544825463    <attribute name="hasData" readonly="yes" type="boolean">
    25449       <desc>Event contains valid data (alternative: notification of support)</desc>
     25464      <desc>Event contains valid data.  If not set, switch back to using the host cursor.</desc>
    2545025465    </attribute>
    2545125466    <attribute name="x" readonly="yes" type="unsigned long">
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r77130 r77370  
    193193    int  i_handleQueryVisibleRegion(uint32_t *pcRects, PRTRECT paRects);
    194194
    195     void i_VideoAccelVRDP(bool fEnable);
     195    void i_VRDPConnectionEvent(bool fConnect);
     196    void i_VideoAccelVRDP(bool fEnable, int c);
    196197
    197198    /* Legacy video acceleration requests coming from the VGA refresh timer. */
     
    201202    int  VideoAccelEnableVMMDev(bool fEnable, VBVAMEMORY *pVbvaMemory);
    202203    void VideoAccelFlushVMMDev(void);
     204
     205    void i_UpdateDeviceCursorCapabilities(void);
    203206
    204207#ifdef VBOX_WITH_RECORDING
     
    433436    bool        mfVideoAccelVRDP;
    434437    uint32_t    mfu32SupportedOrders;
    435     int32_t volatile mcVideoAccelVRDPRefs;
     438    /** Number of currently connected VRDP clients. */
     439    int32_t volatile mcVRDPRefs;
    436440
    437441    /** Accelerate3DEnabled = true && GraphicsControllerType == VBoxVGA. */
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r77100 r77370  
    14051405
    14061406    NOREF(u32ClientId);
    1407     mDisplay->i_VideoAccelVRDP(true);
     1407    mDisplay->i_VRDPConnectionEvent(true);
    14081408
    14091409#ifdef VBOX_WITH_GUEST_PROPS
     
    14391439    }
    14401440
    1441     mDisplay->i_VideoAccelVRDP(false);
     1441    mDisplay->i_VRDPConnectionEvent(false);
    14421442
    14431443    if (fu32Intercepted & VRDE_CLIENT_INTERCEPT_USB)
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r77152 r77370  
    125125    mfVideoAccelVRDP = false;
    126126    mfu32SupportedOrders = 0;
    127     mcVideoAccelVRDPRefs = 0;
     127    mcVRDPRefs = 0;
    128128
    129129    mfSeamlessEnabled = false;
     
    13511351}
    13521352
     1353/** Updates the device's view of the host cursor handling capabilities.
     1354 *  Calls into mpDrv->pUpPort. */
     1355void Display::i_UpdateDeviceCursorCapabilities(void)
     1356{
     1357    bool fRenderCursor = true;
     1358    bool fMoveCursor = mcVRDPRefs == 0;
     1359#ifdef VBOX_WITH_RECORDING
     1360    RecordingContext *pCtx = mParent->i_recordingGetContext();
     1361
     1362    if (   pCtx
     1363        && pCtx->IsStarted()
     1364        && pCtx->IsFeatureEnabled(RecordingFeature_Video))
     1365        fRenderCursor = fMoveCursor = false;
     1366    else
     1367#endif /* VBOX_WITH_RECORDING */
     1368    {
     1369        for (unsigned uScreenId = 0; uScreenId < mcMonitors; uScreenId++)
     1370        {
     1371            DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId];
     1372            if (!(pFBInfo->u32Caps & FramebufferCapabilities_RenderCursor))
     1373                fRenderCursor = false;
     1374            if (!(pFBInfo->u32Caps & FramebufferCapabilities_MoveCursor))
     1375                fMoveCursor = false;
     1376        }
     1377    }
     1378    mpDrv->pUpPort->pfnReportHostCursorCapabilities(mpDrv->pUpPort, fRenderCursor, fMoveCursor);
     1379}
     1380
    13531381HRESULT Display::i_reportHostCursorCapabilities(uint32_t fCapabilitiesAdded, uint32_t fCapabilitiesRemoved)
    13541382{
     
    13661394    CHECK_CONSOLE_DRV(mpDrv);
    13671395    alock.release();  /* Release before calling up for lock order reasons. */
    1368     mpDrv->pUpPort->pfnReportHostCursorCapabilities(mpDrv->pUpPort, fCapabilitiesAdded, fCapabilitiesRemoved);
    13691396    mfHostCursorCapabilities = fHostCursorCapabilities;
     1397    i_UpdateDeviceCursorCapabilities();
    13701398    return S_OK;
    13711399}
     
    16251653/* Called always by one VRDP server thread. Can be thread-unsafe.
    16261654 */
    1627 void Display::i_VideoAccelVRDP(bool fEnable)
    1628 {
    1629     LogRelFlowFunc(("fEnable = %d\n", fEnable));
    1630 
     1655void Display::i_VRDPConnectionEvent(bool fConnect)
     1656{
     1657    LogRelFlowFunc(("fConnect = %d\n", fConnect));
     1658
     1659    int c = fConnect?
     1660                ASMAtomicIncS32(&mcVRDPRefs):
     1661                ASMAtomicDecS32(&mcVRDPRefs);
     1662
     1663    i_VideoAccelVRDP(fConnect, c);
     1664    i_UpdateDeviceCursorCapabilities();
     1665}
     1666
     1667
     1668void Display::i_VideoAccelVRDP(bool fEnable, int c)
     1669{
    16311670    VIDEOACCEL *pVideoAccel = &mVideoAccelLegacy;
    1632 
    1633     int c = fEnable?
    1634                 ASMAtomicIncS32(&mcVideoAccelVRDPRefs):
    1635                 ASMAtomicDecS32(&mcVideoAccelVRDPRefs);
    16361671
    16371672    Assert (c >= 0);
     
    24412476    RecordingContext *pCtx = mParent->i_recordingGetContext();
    24422477
     2478    i_UpdateDeviceCursorCapabilities();
    24432479    if (   RT_LIKELY(!maRecordingEnabled[uScreenId])
    24442480        || !pCtx || !pCtx->IsStarted())
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