From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 50B1B1FF38C for <inbox@lore.proxmox.com>; Fri, 31 May 2024 17:13:12 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 32A8837E3A; Fri, 31 May 2024 17:13:37 +0200 (CEST) From: Fiona Ebner <f.ebner@proxmox.com> To: pve-devel@lists.proxmox.com Date: Fri, 31 May 2024 17:13:30 +0200 Message-Id: <20240531151330.106977-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240531151330.106977-1-f.ebner@proxmox.com> References: <20240531151330.106977-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.059 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemuserver.pm] Subject: [pve-devel] [PATCH qemu-server 2/2] cfg2cmd: split out helper for vga properties X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> To remove some line bloat from the config_to_command() function. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> --- Original motivation was to prepare for a deprectation warning for display type 'cirrus'. However, it might not get deprecated after all: https://lore.kernel.org/qemu-devel/usd6hvncbao47zklcb5qlpvjcuk7odryu57f45imxienyltlec@2ujm6g2gr2od/ Still, adding the helper doesn't hurt IMHO. PVE/QemuServer.pm | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index cf593383..a1f8adea 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -3493,6 +3493,27 @@ my sub print_ovmf_drive_commandlines { return ("if=pflash,unit=0,format=raw,readonly=on,file=$ovmf_code", $var_drive_str); } +my sub get_vga_properties { + my ($conf, $arch, $machine_version, $winversion) = @_; + + my $vga = parse_vga($conf->{vga}); + + my $qxlnum = vga_conf_has_spice($conf->{vga}); + $vga->{type} = 'qxl' if $qxlnum; + + if (!$vga->{type}) { + if ($arch eq 'aarch64') { + $vga->{type} = 'virtio'; + } elsif (min_version($machine_version, 2, 9)) { + $vga->{type} = (!$winversion || $winversion >= 6) ? 'std' : 'cirrus'; + } else { + $vga->{type} = ($winversion >= 6) ? 'std' : 'cirrus'; + } + } + + return ($vga, $qxlnum); +} + sub config_to_command { my ($storecfg, $vmid, $conf, $defaults, $forcemachine, $forcecpu, $live_restore_backing) = @_; @@ -3644,20 +3665,8 @@ sub config_to_command { my @usbcontrollers = PVE::QemuServer::USB::get_usb_controllers( $conf, $bridges, $arch, $machine_type, $machine_version); push @$devices, @usbcontrollers if @usbcontrollers; - my $vga = parse_vga($conf->{vga}); - my $qxlnum = vga_conf_has_spice($conf->{vga}); - $vga->{type} = 'qxl' if $qxlnum; - - if (!$vga->{type}) { - if ($arch eq 'aarch64') { - $vga->{type} = 'virtio'; - } elsif (min_version($machine_version, 2, 9)) { - $vga->{type} = (!$winversion || $winversion >= 6) ? 'std' : 'cirrus'; - } else { - $vga->{type} = ($winversion >= 6) ? 'std' : 'cirrus'; - } - } + my ($vga, $qxlnum) = get_vga_properties($conf, $arch, $machine_version, $winversion); # enable absolute mouse coordinates (needed by vnc) my $tablet = $conf->{tablet}; -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel