virtio-win / kvm-guest-drivers-windows

Windows paravirtualized drivers for QEMU\KVM
https://www.linux-kvm.org/page/WindowsGuestDrivers
BSD 3-Clause "New" or "Revised" License
1.99k stars 382 forks source link

viogpu: can't set resolution higher than 1024x768 #560

Open amezin opened 3 years ago

amezin commented 3 years ago

In Windows display settings I see 3 resolution options:

When I select 3840x1912, I immediately see "Guest disabled display." message and then guest reboots. No memory dump is created.

With https://gitlab.freedesktop.org/spice/win32/virtio-gpu-wddm-dod I see more resolution options, and 1920x1080 is working.

The same (almost) issue reported there: https://gitlab.freedesktop.org/spice/win32/virtio-gpu-wddm-dod/-/issues/5 (before I found that the driver is now included here)

vrozenfe commented 3 years ago

@amezin

currently 3840x1912x32bit is too big https://github.com/virtio-win/kvm-guest-drivers-windows/blob/master/viogpu/viogpudo/viogpudo.cpp#L2263 I'm going to fix this problem along with https://bugzilla.redhat.com/show_bug.cgi?id=1923886

btw, I wouldn't suggest using this repository https://gitlab.freedesktop.org/spice/win32/virtio-gpu-wddm-dod/ anymore. Windows virtio-gpu driver has been fully merged under virtio-win umbrella.

Cheers, Vadim.

jwatt commented 3 years ago

I'm going to fix this problem along with https://bugzilla.redhat.com/show_bug.cgi?id=1923886

@vrozenfe It looks like you fixed that bug a month ago. It's not clear to me whether that fix made it into the recently updated public builds, but presumably this issue can be closed?

vrozenfe commented 3 years ago

@jwatt

Win10 currently (latest-build 204) works with up to 16MB (2KB x 2KB x 32bpp) surface. I still have a plan to make it bigger (up to 256 MB) but it might take some time. There is also a new feature introduced in build 204 that allows to change the Windows VM screen resolution dynamically https://bugzilla.redhat.com/show_bug.cgi?id=1923886.

Vadim.

amezin commented 3 years ago

Yes, 2560x1600 works for me now.

@vrozenfe

There is also a new feature introduced in build 204 that allows to change the Windows VM screen resolution dynamically

Windows allows me to select 3840x1848 (which is, I guess, the size of virt-manager window), but it results in a black screen. I think the driver shouldn't report the resolution if it's too big. virtio-win-0.1.204

vrozenfe commented 3 years ago

@amezin

I will try too support the bigger resolutions soon.

Lilith2208 commented 2 years ago

I think it's sometimes too big. My Screen supports 2560 x 1440 and in the Windows guest 2560 x 1600, so 160px too much, it doesn't crash but the pixels at the bottom aren't visible.

vrozenfe commented 2 years ago

@Lilith2208 currently we pre-allocate 16MB buffer on Win10 and 8MB on Win8/8.1 https://github.com/virtio-win/kvm-guest-drivers-windows/blob/master/viogpu/viogpudo/viogpudo.cpp#L2368 16MB should be enough to handle 2048x2048 resolution in 32bit per pixel mode. 2560x1600x4 requires even a bit less than 16MB. What kind of viewer do use?

In any case 16MB is a temporary limit that planed to be fixed in the future versions.

Vadim.

BentHaase commented 2 years ago

@Lilith2208 currently we pre-allocate 16MB buffer on Win10 and 8MB on Win8/8.1 https://github.com/virtio-win/kvm-guest-drivers-windows/blob/master/viogpu/viogpudo/viogpudo.cpp#L2368 16MB should be enough to handle 2048x2048 resolution in 32bit per pixel mode. 2560x1600x4 requires even a bit less than 16MB. What kind of viewer do use?

In any case 16MB is a temporary limit that planed to be fixed in the future versions.

Vadim.

Any update on this? I would really like to set 2560x1440 as a resolution because the maximum 2048x2048 is square on looks odd on most common 16:9 / 16:10 monitors.

Is there any way to set 2560x1440 while using the viogpud driver on Windows 10?

vrozenfe commented 2 years ago

@BentHaase Technically, it should be possible on Win10. 2560x1600x4 a git more than 14 MB while the memory, allocated to backup the frame buffer is 16MB.

BentHaase commented 2 years ago

@BentHaase Technically, it should be possible on Win10. 2560x1600x4 a git more than 14 MB while the memory, allocated to backup the frame buffer is 16MB.

Sadly there is now way to way to set 2560x1440 or am I missing something?

image

vrozenfe commented 2 years ago

@BentHaase you need to pass the following parameters to qemu "-device virtio-vga,edid=on,xres=2560,yres=1600" to make the new resolution to be recognisable by the guest/viogpudo driver Screenshot from 2022-07-24 15-50-53

Alternatively, you can try using the dynamic resolutions https://bugzilla.redhat.com/show_bug.cgi?id=1923886 by installing and running vgpusrv.exe service together with viogpuap.exe application

Best, Vadim.

vrozenfe commented 2 years ago

@BentHaase It has to be "-device virtio-vga,edid=on,xres=2560,yres=1440" of course, but let me check if it works fine with the recent drivers.

BentHaase commented 2 years ago

Using dynamic resolution seems to only work for me using QXL. Even though all guest tools have been installed on this Windows 10 VM dynamic resolution does not work when using virtio gpudo.

@BentHaase It has to be "-device virtio-vga,edid=on,xres=2560,yres=1440" of course, but let me check if it works fine with the recent drivers.

Is there a way to set this directly via virsh xml definition?

This is my current video device (virtio-vga-gl)

<video>
  <model type="virtio" heads="1" primary="yes">
    <acceleration accel3d="yes"/>
  </model>
  <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/>
</video>

Which translates to these qemu parameters:

[...] spice port=0,disable-ticketing=on,image-compression=auto_lz,streaming-video=filter,gl=on,rendernode=/dev/dri/by-path/pci-0000:07:00.0-render,seamless-migration=on -device virtio-vga-gl,id=video0,max_outputs=1,bus=pcie.0,addr=0x1 [...]
vrozenfe commented 2 years ago

@BentHaase, What kind of viewer do you use? The Windows virtio-gpu driver is not integrated with spice and vnc. And honestly, we don't have any technical requirements to address this issue yet.

Unfortunately, I have no idea how to set resolutions from libvirt/virsh side.

vrozenfe commented 2 years ago

Just for the record. Tested it again on QEMU with relatively recent driver. It works fine on my setup. We even don't need to enable EDID, just specify resolutions "-device virtio-vga,xres=2560,yres=1440" Screenshot from 2022-07-24 21-41-34

dacarey commented 2 years ago

This is a really helpful thread, as I also wanted to set a resolution of 2560 x 1440. Thank you so much @vrozenfe!

Just an FYI follow-up on the additional query @BentHaase raised, which i will paraphrase as to how to set this via the XML definition?.

I was able to achieve this by configuring the resolution element as shown below. This is documented as being a supported element in the libvirt XML docs so hopefully also answers that additional query

<video>
  <model type="virtio" heads="1" primary="yes">
    <resolution x="2560" y="1440"/>
  </model>
  <alias name="video0"/>
  <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/>
</video>

  ....

With this in place, i was then able to see the correct parameters being passed to qemu in the libvirt log for the VM. FYI they were as follows:-

-device virtio-vga,id=video0,max_outputs=1,xres=2560,yres=1440,bus=pcie.0,addr=0x1
marioroy commented 2 years ago

In any case 16MB is a temporary limit that planed to be fixed in the future versions.

Thank you for this thread. I was hoping for xres=3200,yres=1800 and not yet at this time using the Red Hat VirIO GPU DOD controller. The resolution works for Linux VMs and fits nicely within a 4k display.

Wish list: Please allow this resolution in a future release.

I tried spice using the Red Hat QXL controller, but the UI is laggy. So I export a variable for SDL and run QEMU with the following options. Be sure to update the display adapter driver and point to the virtio-win CD drive.

export SDL_MOUSE_FOCUS_CLICKTHROUGH=1

-vga none -device virtio-vga-gl,max_outputs=1,xres=2560,yres=1600 -display sdl,gl=on \
-audiodev sdl,id=audio0 -device intel-hda -device hda-output,audiodev=audio0

This works too.

-vga none -device virtio-vga-gl -display sdl,gl=on \
-audiodev sdl,id=audio0 -device intel-hda -device hda-output,audiodev=audio0
vrozenfe commented 2 years ago

@marioroy I will try to add more resolutions/memory allocation support in the next release.

sbleschke commented 1 year ago

Could you also add 3:2 aspect ratio 3240x2560? It would be great for my Huwai Mateview 28

major-mayer commented 12 months ago

Hi, I could need some help here as well. I tried setting my resultion to 3840x1880 using this XML configuration:

<video>
  <model type="virtio" heads="1" primary="yes">
    <acceleration accel3d="yes"/>
    <resolution x="3840" y="1880"/>
  </model>
  <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/>
</video>

But still, Windows only allows me setting the resolution up until 2560x1600, which leaves some black edges on my screen (using 4K). So is it not possible to set the resolution to any arbitrary value using the XML file or did I do something wrong?

vrozenfe commented 11 months ago

Currently viogpudo driver allocates 16MB memory buffer, which is too small for resolutions like 3840x1880 .

I will try to increase this size in the next release. Vadim.

vrozenfe commented 8 months ago

4K resolutions should work with the following fix https://github.com/virtio-win/kvm-guest-drivers-windows/pull/1019

major-mayer commented 8 months ago

Great news thanks for your work 😊

vrozenfe commented 7 months ago

the latest virtio-gpu-dod 64-bit drivers for Win10 and Win11 platforms can be found here https://people.redhat.com/vrozenfe/viogpu247.zip.

Not officially tested yet. Use it on your own rick. Best, Vadim.

mrhyperbit commented 7 months ago

@vrozenfe, When will this be officially released?

vrozenfe commented 7 months ago

@mrhyperbit Last decade of February. Maybe a bit earlier. Vadim.

Toetje585 commented 6 months ago

the latest virtio-gpu-dod 64-bit drivers for Win10 and Win11 platforms can be found here https://people.redhat.com/vrozenfe/viogpu247.zip.

Not officially tested yet. Use it on your own rick. Best, Vadim.

Those are for ARM?

vrozenfe commented 6 months ago

@Toetje585 That one was for x64 platforms only. But a new stable virtio-win package with the latest ARM64 drivers will be released soon. Vadim.

Toetje585 commented 6 months ago

@vrozenfe

If i inspect the INF file (viogpu247.zip.) they seem to be for ARM perhaps this happend by accident.

%VENDOR%=VioGpu,NTARM64.10.0

vrozenfe commented 6 months ago

My bad. Drivers in Win11 folder are actually Win11 arm64. Just messed up with attestation signing submission. Thank you spotting it out. Vadim.