VirtualBox

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


Ignore:
Timestamp:
Jun 7, 2024 8:45:19 AM (6 months ago)
Author:
vboxsync
Message:

Main: Use VBOX_SVGA_VRAM_MIN_SIZE / VBOX_SVGA_VRAM_MIN_SIZE_3D for both, VBoxSVGA + VMSVGA, in PlatformProperties::s_getSupportedVRAMRange() + make the maximum value for GraphicsControllerType_QemuRamFB a power of two. bugref:​10693

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-all/PlatformPropertiesImpl.cpp

    r104851 r104864  
    836836                                                    ULONG *aMinMB, ULONG *aMaxMB, ULONG *aStrideSizeMB)
    837837{
    838 #if !defined(VBOX_WITH_VMSVGA) || !defined(VBOX_WITH_VMSVGA3D)
    839     RT_NOREF(fAccelerate3DEnabled);
    840 #endif
    841 
    842838    size_t cbMin;
    843839    size_t cbMax;
     
    847843    {
    848844        case GraphicsControllerType_VBoxVGA:
     845        {
    849846            cbMin = VGA_VRAM_MIN;
    850847            cbMax = VGA_VRAM_MAX;
    851848            break;
     849        }
    852850
    853851        case GraphicsControllerType_VMSVGA:
    854             cbMin = VGA_VRAM_MIN;
    855             cbMax = VGA_VRAM_MAX;
    856             break;
    857 
     852            RT_FALL_THROUGH();
    858853        case GraphicsControllerType_VBoxSVGA:
    859 #ifdef VBOX_WITH_VMSVGA
    860 # ifdef VBOX_WITH_VMSVGA3D
     854        {
    861855            if (fAccelerate3DEnabled)
    862856                cbMin = VBOX_SVGA_VRAM_MIN_SIZE_3D;
    863857            else
    864 # endif
    865858                cbMin = VBOX_SVGA_VRAM_MIN_SIZE;
    866859            /* We don't want to limit ourselves to VBOX_SVGA_VRAM_MAX_SIZE,
    867              * so we use VGA_VRAM_MAX (as we do for VBoxVGA + VMSVGA) here as well. */
     860             * so we use VGA_VRAM_MAX for all controllers. */
    868861            cbMax = VGA_VRAM_MAX;
    869862            break;
    870 #else
    871             return VBOX_E_NOT_SUPPORTED;
    872 #endif
     863        }
    873864
    874865        case GraphicsControllerType_QemuRamFB:
     866        {
    875867            /* We seem to hardcode 32-bit (4 bytes) as BPP, see RAMFB_BPP in QemuRamfb.c. */
    876868            cbMin = 4 /* BPP in bytes */ * 16    * 16;    /* Values taken from qemu/hw/display/ramfb.c */
    877869            cbMax = 4 /* BPP in bytes */ * 16000 * 12000; /* Values taken from bochs-vbe.h. */
    878             break;
     870            /* Make the maximum value a power of two. */
     871            cbMax = RT_BIT_64(ASMBitLastSetU64(cbMax));
     872            break;
     873        }
    879874
    880875        default:
    881876            return E_INVALIDARG;
    882877    }
     878
     879    /* Sanity. We want all max values to be a power of two. */
     880    AssertMsg(RT_IS_POWER_OF_TWO(cbMax), ("Maximum VRAM value is not a power of two!\n"));
    883881
    884882    /* Convert bytes -> MB, align to stride. */
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