VirtualBox

Changeset 98670 in vbox


Ignore:
Timestamp:
Feb 21, 2023 11:47:35 AM (2 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: Reworking CMachine wrapper usage step-by-step; Rest of graphics adapter stuff.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r98669 r98670  
    386386    /* Remember 'desired' visibility status: */
    387387    // See note in UIMachineView::sltHandleNotifyChange() regarding the graphics controller check. */
    388     if (uisession()->machine().GetGraphicsAdapter().GetGraphicsControllerType() != KGraphicsControllerType_VMSVGA)
     388    KGraphicsControllerType enmType = KGraphicsControllerType_Null;
     389    acquireGraphicsControllerType(enmType);
     390    if (enmType != KGraphicsControllerType_VMSVGA)
    389391        gEDataManager->setLastGuestScreenVisibilityStatus(uScreenId, fIsMonitorVisible, uiCommon().managedVMUuid());
    390392
     
    432434    /* Remember last full-screen size: */
    433435    m_monitorLastFullScreenSizeVector[(int)uScreenId] = size;
     436}
     437
     438bool UIMachine::acquireGraphicsControllerType(KGraphicsControllerType &enmType)
     439{
     440    return uisession()->acquireGraphicsControllerType(enmType);
     441}
     442
     443bool UIMachine::acquireVRAMSize(ulong &uSize)
     444{
     445    return uisession()->acquireVRAMSize(uSize);
     446}
     447
     448bool UIMachine::acquireWhetherAccelerate3DEnabled(bool &fEnabled)
     449{
     450    return uisession()->acquireWhetherAccelerate3DEnabled(fEnabled);
    434451}
    435452
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98669 r98670  
    279279        void setGuestResizeIgnored(bool fIgnored) { m_fIsGuestResizeIgnored = fIgnored; }
    280280
     281        /** Acquires graphics controller type. */
     282        bool acquireGraphicsControllerType(KGraphicsControllerType &enmType);
     283        /** Acquires VRAM size. */
     284        bool acquireVRAMSize(ulong &uSize);
     285        /** Acquires whether accelerate 3D is enabled. */
     286        bool acquireWhetherAccelerate3DEnabled(bool &fEnabled);
    281287        /** Acquires monitor count. */
    282288        bool acquireMonitorCount(ulong &uCount);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r98560 r98670  
    237237
    238238    /* Propagate the scale-factor related attributes to 3D service if necessary: */
    239     if (machine().GetGraphicsAdapter().GetAccelerate3DEnabled())
     239    bool fAccelerate3DEnabled = false;
     240    uimachine()->acquireWhetherAccelerate3DEnabled(fAccelerate3DEnabled);
     241    if (fAccelerate3DEnabled)
    240242    {
    241243        double dScaleFactorFor3D = dScaleFactor;
     
    672674    uimachine()->invalidateAndUpdateScreen(m_uScreenId);
    673675
     676    /* Acquire graphics controller type: */
     677    KGraphicsControllerType enmType = KGraphicsControllerType_Null;
     678    uimachine()->acquireGraphicsControllerType(enmType);
     679
    674680    /* If we are in normal or scaled mode and if GA are active,
    675681     * remember the guest-screen size to be able to restore it when necessary: */
     
    680686    if (   !isFullscreenOrSeamless()
    681687        && uimachine()->isGuestSupportsGraphics()
    682         && (machine().GetGraphicsAdapter().GetGraphicsControllerType() != KGraphicsControllerType_VMSVGA))
     688        && (enmType != KGraphicsControllerType_VMSVGA))
    683689        setStoredGuestScreenSizeHint(frameBufferSizeNew);
    684690
     
    990996
    991997    /* Propagate the scale-factor related attributes to 3D service if necessary: */
    992     if (machine().GetGraphicsAdapter().GetAccelerate3DEnabled())
     998    bool fAccelerate3DEnabled = false;
     999    uimachine()->acquireWhetherAccelerate3DEnabled(fAccelerate3DEnabled);
     1000    if (fAccelerate3DEnabled)
    9931001    {
    9941002        double dScaleFactorFor3D = dScaleFactor;
     
    12221230
    12231231        /* Propagate the scale-factor related attributes to 3D service if necessary: */
    1224         if (machine().GetGraphicsAdapter().GetAccelerate3DEnabled())
     1232        bool fAccelerate3DEnabled = false;
     1233        uimachine()->acquireWhetherAccelerate3DEnabled(fAccelerate3DEnabled);
     1234        if (fAccelerate3DEnabled)
    12251235        {
    12261236            double dScaleFactorFor3D = dScaleFactor;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp

    r98669 r98670  
    3535#include "UIMessageCenter.h"
    3636#include "UIMultiScreenLayout.h"
    37 
    38 /* COM includes: */
    39 #include "COMEnums.h"
    40 #include "CMachine.h"
    41 #include "CGraphicsAdapter.h"
    4237
    4338
     
    225220    if (uimachine()->isGuestSupportsGraphics())
    226221    {
    227         quint64 uAvailBits = machineLogic()->machine().GetGraphicsAdapter().GetVRAMSize() * _1M * 8;
    228         quint64 uUsedBits = memoryRequirements(tmpMap);
     222        ulong uVRAMSize = 0;
     223        uimachine()->acquireVRAMSize(uVRAMSize);
     224        const quint64 uAvailBits = uVRAMSize * _1M * 8;
     225        const quint64 uUsedBits = memoryRequirements(tmpMap);
    229226        fSuccess = uAvailBits >= uUsedBits;
    230227        if (!fSuccess)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98669 r98670  
    625625}
    626626
     627bool UISession::acquireGraphicsControllerType(KGraphicsControllerType &enmType)
     628{
     629    CMachine comMachine = machine();
     630    CGraphicsAdapter comAdapter = comMachine.GetGraphicsAdapter();
     631    bool fSuccess = comMachine.isOk();
     632    if (!fSuccess)
     633        UINotificationMessage::cannotAcquireMachineParameter(comMachine);
     634    else
     635    {
     636        const KGraphicsControllerType enmControllerType = comAdapter.GetGraphicsControllerType();
     637        fSuccess = comAdapter.isOk();
     638        if (!fSuccess)
     639            UINotificationMessage::cannotAcquireGraphicsAdapterParameter(comAdapter);
     640        else
     641            enmType = enmControllerType;
     642    }
     643    return fSuccess;
     644}
     645
     646bool UISession::acquireVRAMSize(ulong &uSize)
     647{
     648    CMachine comMachine = machine();
     649    CGraphicsAdapter comAdapter = comMachine.GetGraphicsAdapter();
     650    bool fSuccess = comMachine.isOk();
     651    if (!fSuccess)
     652        UINotificationMessage::cannotAcquireMachineParameter(comMachine);
     653    else
     654    {
     655        const ULONG uVRAMSize = comAdapter.GetVRAMSize();
     656        fSuccess = comAdapter.isOk();
     657        if (!fSuccess)
     658            UINotificationMessage::cannotAcquireGraphicsAdapterParameter(comAdapter);
     659        else
     660            uSize = uVRAMSize;
     661    }
     662    return fSuccess;
     663}
     664
     665bool UISession::acquireWhetherAccelerate3DEnabled(bool &fEnabled)
     666{
     667    CMachine comMachine = machine();
     668    CGraphicsAdapter comAdapter = comMachine.GetGraphicsAdapter();
     669    bool fSuccess = comMachine.isOk();
     670    if (!fSuccess)
     671        UINotificationMessage::cannotAcquireMachineParameter(comMachine);
     672    else
     673    {
     674        const BOOL fAccelerate3DEnabeld = comAdapter.GetAccelerate3DEnabled();
     675        fSuccess = comAdapter.isOk();
     676        if (!fSuccess)
     677            UINotificationMessage::cannotAcquireGraphicsAdapterParameter(comAdapter);
     678        else
     679            fEnabled = fAccelerate3DEnabeld;
     680    }
     681    return fSuccess;
     682}
     683
    627684bool UISession::acquireMonitorCount(ulong &uCount)
    628685{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98669 r98670  
    326326        QSize frameBufferSize(ulong uScreenId) const;
    327327
     328        /** Acquires graphics controller type. */
     329        bool acquireGraphicsControllerType(KGraphicsControllerType &enmType);
     330        /** Acquires VRAM size. */
     331        bool acquireVRAMSize(ulong &uSize);
     332        /** Acquires whether accelerate 3D is enabled. */
     333        bool acquireWhetherAccelerate3DEnabled(bool &fEnabled);
    328334        /** Acquires monitor count. */
    329335        bool acquireMonitorCount(ulong &uCount);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r98669 r98670  
    8484    if (uimachine()->isGuestSupportsGraphics())
    8585    {
    86         quint64 availBits = machine().GetGraphicsAdapter().GetVRAMSize() /* VRAM */ * _1M /* MiB to bytes */ * 8 /* to bits */;
    87         quint64 usedBits = m_pScreenLayout->memoryRequirements();
    88         if (availBits < usedBits)
    89         {
    90             if (!msgCenter().cannotEnterFullscreenMode(0, 0, 0, (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M))
     86        ulong uVRAMSize = 0;
     87        uimachine()->acquireVRAMSize(uVRAMSize);
     88        quint64 uAvailBits = uVRAMSize * _1M /* MiB to bytes */ * 8 /* to bits */;
     89        quint64 uUsedBits = m_pScreenLayout->memoryRequirements();
     90        if (uAvailBits < uUsedBits)
     91        {
     92            if (!msgCenter().cannotEnterFullscreenMode(0, 0, 0, (((uUsedBits + 7) / 8 + _1M - 1) / _1M) * _1M))
    9193                return false;
    9294        }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp

    r98556 r98670  
    7070    {
    7171        /* Propagate scale-factor to 3D service if necessary: */
    72         if (machine().GetGraphicsAdapter().GetAccelerate3DEnabled())
     72        bool fAccelerate3DEnabled = false;
     73        uimachine()->acquireWhetherAccelerate3DEnabled(fAccelerate3DEnabled);
     74        if (fAccelerate3DEnabled)
    7375        {
    7476            double xScaleFactor = (double)scaledSize.width()  / frameBuffer()->width();
     
    129131    {
    130132        /* Propagate scale-factor to 3D service if necessary: */
    131         if (machine().GetGraphicsAdapter().GetAccelerate3DEnabled())
     133        bool fAccelerate3DEnabled = false;
     134        uimachine()->acquireWhetherAccelerate3DEnabled(fAccelerate3DEnabled);
     135        if (fAccelerate3DEnabled)
    132136        {
    133137            double xScaleFactor = (double)scaledSize.width()  / frameBuffer()->width();
     
    152156    frameBuffer()->setUseUnscaledHiDPIOutput(fUseUnscaledHiDPIOutput);
    153157    /* Propagate unscaled-hidpi-output feature to 3D service if necessary: */
    154     if (machine().GetGraphicsAdapter().GetAccelerate3DEnabled())
     158    bool fAccelerate3DEnabled = false;
     159    uimachine()->acquireWhetherAccelerate3DEnabled(fAccelerate3DEnabled);
     160    if (fAccelerate3DEnabled)
    155161        uimachine()->notifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
    156162
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r98669 r98670  
    8181    if (uimachine()->isGuestSupportsSeamless())
    8282    {
    83         quint64 availBits = machine().GetGraphicsAdapter().GetVRAMSize() /* VRAM */ * _1M /* MiB to bytes */ * 8 /* to bits */;
    84         quint64 usedBits = m_pScreenLayout->memoryRequirements();
    85         if (availBits < usedBits)
     83        ulong uVRAMSize = 0;
     84        uimachine()->acquireVRAMSize(uVRAMSize);
     85        quint64 uAvailBits = uVRAMSize * _1M /* MiB to bytes */ * 8 /* to bits */;
     86        quint64 uUsedBits = m_pScreenLayout->memoryRequirements();
     87        if (uAvailBits < uUsedBits)
    8688        {
    8789            msgCenter().cannotEnterSeamlessMode(0, 0, 0,
    88                                                 (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M);
     90                                                (((uUsedBits + 7) / 8 + _1M - 1) / _1M) * _1M);
    8991            return false;
    9092        }
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