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 authored and ahadas committed Jul 13, 2022
1 parent cfe7f48 commit aff9d17
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -445,4 +445,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 supportedInConfig(ConfigValues.VirtioVgaSupported, version);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1612,6 +1612,9 @@ public enum ConfigValues {
@TypeConverterAttribute(Boolean.class)
EnableBochsDisplay,

@TypeConverterAttribute(Boolean.class)
VirtioVgaSupported,

@TypeConverterAttribute(Integer.class)
HostMonitoringWatchdogIntervalInSeconds,

Expand Down
Original file line number Diff line number Diff line change
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
2 changes: 2 additions & 0 deletions packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,8 @@ select fn_db_add_config_value_for_versions_up_to('NvramPersistenceSupported', 'f
select fn_db_add_config_value_for_versions_up_to('NvramPersistenceSupported', 'true', '4.7');
select fn_db_add_config_value_for_versions_up_to('EnableBochsDisplay','false','4.5');
select fn_db_add_config_value_for_versions_up_to('EnableBochsDisplay','true','4.7');
select fn_db_add_config_value_for_versions_up_to('VirtioVgaSupported','false','4.6');
select fn_db_add_config_value_for_versions_up_to('VirtioVgaSupported','true','4.7');
select fn_db_add_config_value_for_versions_up_to('ParallelMigrationsSupported', 'false', '4.6');
select fn_db_add_config_value_for_versions_up_to('ParallelMigrationsSupported', 'true', '4.7');
select fn_db_add_config_value_for_versions_up_to('IsDedicatedSupported', 'false', '4.6');
Expand Down
2 changes: 2 additions & 0 deletions packaging/etc/engine-config/engine-config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,8 @@ NvramPersistenceSupported.description=Enable/Disable NVRAM data persistence.
NvramPersistenceSupported.type=Boolean
EnableBochsDisplay.type=Boolean
EnableBochsDisplay.description=Enable bochs display type support
VirtioVgaSupported.type=Boolean
VirtioVgaSupported.description=Enable virtio-vga driver usage for VGA displays.
# Host monitoring watchdog
HostMonitoringWatchdogIntervalInSeconds.type=Integer
HostMonitoringWatchdogIntervalInSeconds.description="Host monitoring watchdog service interval to check if host monitoring is running."
Expand Down

0 comments on commit aff9d17

Please sign in to comment.