Multiple Resolutions in one Virtual Machine

Hi team,

I was trying to launch Virtual machine on MacOS 14 using native framework with different Resolutions.

        let graphicsConfiguration = VZMacGraphicsDeviceConfiguration()
        graphicsConfiguration.displays = [

            VZMacGraphicsDisplayConfiguration(widthInPixels: 2700, heightInPixels: 2200, pixelsPerInch: 100),
            VZMacGraphicsDisplayConfiguration(widthInPixels: 1920, heightInPixels: 1200, pixelsPerInch: 80)
        ]

        return graphicsConfiguration
    }

But I'm getting below error:

Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=VZErrorDomain Code=2 "More than one display is configured." UserInfo={NSLocalizedFailure=Invalid virtual machine configuration., NSLocalizedFailureReason=More than one display is configured.}

Please let me know it is possible to have multiple resolutions in single VM or not. My use case is to get support of multiple resolutions like 1920x1080, 2048x1536, 1024x728 etc.

Thanks.

Answered by DTS Engineer in 800102022

But I'm getting below error: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=VZErrorDomain Code=2 "More than one display is configured." UserInfo={NSLocalizedFailure=Invalid virtual machine configuration., NSLocalizedFailureReason=More than one display is configured.}

Yes. Currently, you can only have a single VZGraphicsDeviceConfiguration in VZMacGraphicsDeviceConfiguration.displays. In concrete terms, this means you can only have a single monitor attached to the VM.

Please let me know it is possible to have multiple resolutions in single VM or not. My use case is to get support of multiple resolutions like 1920x1080, 2048x1536, 1024x728 etc.

It is, but you're looking at the wrong API. VZMacGraphicsDeviceConfiguration is what establishes the initial starting configuration. You change the resolution on the live machine through by going through VZVirtualMachine.graphicsDevices -> VZGraphicsDevice.displays -> VZGraphicsDisplay.reconfigure(sizeInPixels:) or VZGraphicsDisplay.reconfigure(configuration:). Note that you can also use VZVirtualMachineView.automaticallyReconfiguresDisplay to have these display changes occur automatically as the user resizes the view.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Can someone please give some light on it?

But I'm getting below error: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=VZErrorDomain Code=2 "More than one display is configured." UserInfo={NSLocalizedFailure=Invalid virtual machine configuration., NSLocalizedFailureReason=More than one display is configured.}

Yes. Currently, you can only have a single VZGraphicsDeviceConfiguration in VZMacGraphicsDeviceConfiguration.displays. In concrete terms, this means you can only have a single monitor attached to the VM.

Please let me know it is possible to have multiple resolutions in single VM or not. My use case is to get support of multiple resolutions like 1920x1080, 2048x1536, 1024x728 etc.

It is, but you're looking at the wrong API. VZMacGraphicsDeviceConfiguration is what establishes the initial starting configuration. You change the resolution on the live machine through by going through VZVirtualMachine.graphicsDevices -> VZGraphicsDevice.displays -> VZGraphicsDisplay.reconfigure(sizeInPixels:) or VZGraphicsDisplay.reconfigure(configuration:). Note that you can also use VZVirtualMachineView.automaticallyReconfiguresDisplay to have these display changes occur automatically as the user resizes the view.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Hi, Thanks for the response.

I was looking for something that Code itself can change resize the screen while launch the VM. Is it possible if I pass **2048x1536 ** resolution while launching and, machine gets resized automatically?

Hope, you get my point. In concrete terms I want to control is using the automation as this Virtual machine will be used by some other hosts not manually.

Waiting for the reply.

I was looking for something that Code itself can change resize the screen while launch the VM. Is it possible if I pass **2048x1536 ** resolution while launching and, machine gets resized automatically?

Hope, you get my point. In concrete terms I want to control is using the automation as this Virtual machine will be used by some other hosts not manually.

If I understand you correctly, what you're trying to do is have the VM system present the system you're hosting with 2 different screen resolutions, which the hosted operating system would then switch between.

Assuming that's the case, then the answer is basically, no, not really. From the VM frameworks perspective, the size configure is the resolution of the display it presents to the hosted operating system. Having the hosted operating "resize" doesn't make sense in that architecture.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Multiple Resolutions in one Virtual Machine
 
 
Q