VirtualBox

Changeset 53528 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Dec 12, 2014 8:22:39 PM (10 years ago)
Author:
vboxsync
Message:

Devices/Graphics, Devices/PC/DevACPI, Main: add support for sending video mode hints through the VGA device.

Location:
trunk/src/VBox/Main/src-client
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r53442 r53528  
    51845184
    51855185    fireVRDEServerInfoChangedEvent(mEventSource);
     5186}
     5187
     5188HRESULT Console::i_sendACPIMonitorHotPlugEvent()
     5189{
     5190    LogFlowThisFuncEnter();
     5191
     5192    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     5193
     5194    if (   mMachineState != MachineState_Running
     5195        && mMachineState != MachineState_Teleporting
     5196        && mMachineState != MachineState_LiveSnapshotting)
     5197        return i_setInvalidMachineStateError();
     5198
     5199    /* get the VM handle. */
     5200    SafeVMPtr ptrVM(this);
     5201    if (!ptrVM.isOk())
     5202        return ptrVM.rc();
     5203
     5204    // no need to release lock, as there are no cross-thread callbacks
     5205
     5206    /* get the acpi device interface and press the sleep button. */
     5207    PPDMIBASE pBase;
     5208    int vrc = PDMR3QueryDeviceLun(ptrVM.rawUVM(), "acpi", 0, 0, &pBase);
     5209    if (RT_SUCCESS(vrc))
     5210    {
     5211        Assert(pBase);
     5212        PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT);
     5213        if (pPort)
     5214            vrc = pPort->pfnMonitorHotPlugEvent(pPort);
     5215        else
     5216            vrc = VERR_PDM_MISSING_INTERFACE;
     5217    }
     5218
     5219    HRESULT rc = RT_SUCCESS(vrc) ? S_OK :
     5220        setError(VBOX_E_PDM_ERROR,
     5221            tr("Sending monitor hot-plug event failed (%Rrc)"),
     5222            vrc);
     5223
     5224    LogFlowThisFunc(("rc=%Rhrc\n", rc));
     5225    LogFlowThisFuncLeave();
     5226    return rc;
    51865227}
    51875228
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r53201 r53528  
    2020#include "ConsoleImpl.h"
    2121#include "ConsoleVRDPServer.h"
     22#include "GuestImpl.h"
    2223#include "VMMDev.h"
    2324
     
    122123#ifdef VBOX_WITH_HGSMI
    123124    mu32UpdateVBVAFlags = 0;
     125    mfVMMDevSupportsGraphics = false;
     126    mfGuestVBVACapabilities = 0;
    124127#endif
    125128#ifdef VBOX_WITH_VPX
     
    10321035        mParent->i_consoleVRDPServer()->SendUpdateBitmap(uScreenId, x, y, w, h);
    10331036    }
     1037}
     1038
     1039void Display::i_updateGuestGraphicsFacility(void)
     1040{
     1041    Guest* pGuest = mParent->i_getGuest();
     1042    AssertPtrReturnVoid(pGuest);
     1043    /* The following is from GuestImpl.cpp. */
     1044    /** @todo A nit: The timestamp is wrong on saved state restore. Would be better
     1045     *  to move the graphics and seamless capability -> facility translation to
     1046     *  VMMDev so this could be saved.  */
     1047    RTTIMESPEC TimeSpecTS;
     1048    RTTimeNow(&TimeSpecTS);
     1049
     1050    if (   mfVMMDevSupportsGraphics
     1051        || (mfGuestVBVACapabilities & VBVACAPS_VIDEO_MODE_HINTS) != 0)
     1052        pGuest->i_setAdditionsStatus(VBoxGuestFacilityType_Graphics,
     1053                                     VBoxGuestFacilityStatus_Active,
     1054                                     0 /*fFlags*/, &TimeSpecTS);
     1055    else
     1056        pGuest->i_setAdditionsStatus(VBoxGuestFacilityType_Graphics,
     1057                                     VBoxGuestFacilityStatus_Inactive,
     1058                                     0 /*fFlags*/, &TimeSpecTS);
     1059}
     1060
     1061void Display::i_handleUpdateVMMDevSupportsGraphics(bool fSupportsGraphics)
     1062{
     1063    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     1064    if (mfVMMDevSupportsGraphics == fSupportsGraphics)
     1065        return;
     1066    mfVMMDevSupportsGraphics = fSupportsGraphics;
     1067    i_updateGuestGraphicsFacility();
     1068    /* The VMMDev interface notifies the console. */
     1069}
     1070
     1071void Display::i_handleUpdateGuestVBVACapabilities(uint32_t fNewCapabilities)
     1072{
     1073    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     1074    bool fNotify = (fNewCapabilities & VBVACAPS_VIDEO_MODE_HINTS) != 0;
     1075
     1076    mfGuestVBVACapabilities = fNewCapabilities;
     1077    if (!fNotify)
     1078        return;
     1079    i_updateGuestGraphicsFacility();
     1080    /* Tell the console about it */
     1081    mParent->i_onAdditionsStateChange();
    10341082}
    10351083
     
    16371685    alock.release();
    16381686
     1687    /* We always send the hint to the graphics card in case the guest enables
     1688     * support later.  For now we notify exactly when support is enabled. */
     1689    mpDrv->pUpPort->pfnSendModeHint(mpDrv->pUpPort, aWidth, aHeight,
     1690                                    aBitsPerPixel, aDisplay,
     1691                                    aChangeOrigin ? aOriginX : ~0,
     1692                                    aChangeOrigin ? aOriginY : ~0,
     1693                                    RT_BOOL(aEnabled),
     1694                                      mfGuestVBVACapabilities
     1695                                    & VBVACAPS_VIDEO_MODE_HINTS);
     1696    if (   mfGuestVBVACapabilities & VBVACAPS_VIDEO_MODE_HINTS
     1697        && !(mfGuestVBVACapabilities & VBVACAPS_IRQ))
     1698    {
     1699        HRESULT hrc = mParent->i_sendACPIMonitorHotPlugEvent();
     1700        if (FAILED(hrc))
     1701            return hrc;
     1702    }
     1703
     1704    /* We currently never suppress the VMMDev hint if the guest has requested
     1705     * it.  Specifically the video graphics driver may not be responsible for
     1706     * screen positioning in the guest virtual desktop, and the component
     1707     * responsible may want to get the hint from VMMDev. */
    16391708    VMMDev *pVMMDev = mParent->i_getVMMDev();
    16401709    if (pVMMDev)
     
    37813850    return VINF_SUCCESS;
    37823851}
     3852
     3853DECLCALLBACK(void) Display::i_displayVBVAGuestCapabilityUpdate(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fCapabilities)
     3854{
     3855    LogFlowFunc(("\n"));
     3856
     3857    PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
     3858    Display *pThis = pDrv->pDisplay;
     3859
     3860    pThis->i_handleUpdateGuestVBVACapabilities(fCapabilities);
     3861}
    37833862#endif /* VBOX_WITH_HGSMI */
    37843863
     
    38813960    pThis->IConnector.pfnVBVAResize            = Display::i_displayVBVAResize;
    38823961    pThis->IConnector.pfnVBVAMousePointerShape = Display::i_displayVBVAMousePointerShape;
     3962    pThis->IConnector.pfnVBVAGuestCapabilityUpdate = Display::i_displayVBVAGuestCapabilityUpdate;
    38833963#endif
    38843964
  • trunk/src/VBox/Main/src-client/GuestImpl.cpp

    r52085 r53528  
    10831083                     0 /*fFlags*/, &TimeSpecTS);
    10841084    /** @todo Add VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING */
    1085     i_facilityUpdate(VBoxGuestFacilityType_Graphics,
    1086                      aCaps & VMMDEV_GUEST_SUPPORTS_GRAPHICS ? VBoxGuestFacilityStatus_Active : VBoxGuestFacilityStatus_Inactive,
    1087                      0 /*fFlags*/, &TimeSpecTS);
    1088 }
    1089 
     1085}
     1086
  • trunk/src/VBox/Main/src-client/VMMDevInterface.cpp

    r52934 r53528  
    290290     */
    291291    pGuest->i_setSupportedFeatures(newCapabilities);
     292
     293    /*
     294     * Tell the Display, so that it can update the "supports graphics"
     295     * capability if the graphics card has not asserted it.
     296     */
     297    Display* pDisplay = pConsole->i_getDisplay();
     298    AssertPtrReturnVoid(pDisplay);
     299    pDisplay->i_handleUpdateVMMDevSupportsGraphics(newCapabilities
     300                                             & VMMDEV_GUEST_SUPPORTS_GRAPHICS);
    292301
    293302    /*
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