Skip to content

Commit

Permalink
core: Use virtio-vga driver for VGA
Browse files Browse the repository at this point in the history
If VM is configured with VGA display type, use virtio-vga driver for it.
This behaviour is enabled for compatibility version 4.7 or higher.

Change-Id: I2476286e90cd84b51e35bd3170affeaee1924951
Bug-Url: https://bugzilla.redhat.com/2038694
Signed-off-by: Shmuel Melamud <smelamud@redhat.com>
  • Loading branch information
smelamud committed Jul 6, 2022
1 parent c9b4ead commit cde8a45
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Expand Up @@ -457,4 +457,14 @@ public static boolean isDedicatePolicySupported(Version version) {
public static boolean isReplicateExtendSupported(Version version) {
return Version.v4_7.lessOrEquals(version);
}

/**
* Check 'virtio' driver for 'vga' display type is supported.
*
* @param version Compatibility version to check for.
* @return true if 'virtio' driver is supported
*/
public static boolean isVirtioVgaSupported(Version version) {
return Version.v4_7.lessOrEquals(version);
}
}
Expand Up @@ -3014,7 +3014,7 @@ void writeVideo(VmDevice device) {
if (mdevDisplayOn) {
writer.writeAttributeString("type", "none");
} else {
writer.writeAttributeString("type", device.getDevice());
writer.writeAttributeString("type", getVideoType(device.getDevice()));
Object vram = device.getSpecParams().get(VdsProperties.VIDEO_VRAM);
writer.writeAttributeString("vram", vram != null ? vram.toString() : "32768");
Object heads = device.getSpecParams().get(VdsProperties.VIDEO_HEADS);
Expand All @@ -3033,6 +3033,13 @@ void writeVideo(VmDevice device) {
writer.writeEndElement();
}

private String getVideoType(String deviceType) {
if (!deviceType.equals("vga")) {
return deviceType;
}
return FeatureSupported.isVirtioVgaSupported(vm.getCompatibilityVersion()) && !legacyVirtio ? "virtio" : "vga";
}

private void writeDefaultVideo() {
writer.writeStartElement("video");
writer.writeStartElement("model");
Expand Down

0 comments on commit cde8a45

Please sign in to comment.