Add Display Options

This commit is contained in:
SimonFair
2024-12-20 19:59:59 +00:00
parent 8591914a18
commit f4bda545c9
2 changed files with 76 additions and 1 deletions

View File

@@ -860,6 +860,12 @@
$strAccel3d ="<acceleration accel3d='yes'/>";
}}
$strDisplayOptions = "";
if ($strModelType == "qxl") {
if (empty($gpu['DisplayOptions'])) $gpu['DisplayOptions'] ="ram='65536' vram='16384' vgamem='16384' heads='1' primary='yes'";
$strDisplayOptions = $gpu['DisplayOptions'];
}
$vmrc = "<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
@@ -869,7 +875,7 @@
</graphics>
$strEGLHeadless
<video>
<model type='$strModelType'>
<model type='$strModelType' $strDisplayOptions>
$strAccel3d
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
@@ -2227,6 +2233,25 @@
return $var;
}
function domain_get_vnc_display_options($domain) {
$tmp = $this->get_xpath($domain, '//domain/devices/video/model/@heads', false);
if (!$tmp)
$heads=1;
$heads = $tmp[0];
unset($tmp);
$tmp = $this->get_xpath($domain, '//domain/devices/video/model/@vram', false);
if (!$tmp)
$vram=16384/1024;
$vram = $tmp[0]/1024;
unset($tmp);
$var = "H$heads.{$vram}M";
return $var;
}
function domain_get_vnc_keymap($domain) {
$tmp = $this->get_xpath($domain, '//domain/devices/graphics/@keymap', false);
if (!$tmp)

View File

@@ -708,6 +708,55 @@ private static $encoding = 'UTF-8';
] ;
#<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
$arrDisplayOptions = [
"H1.16M" => [
"text" => "1 Screen 16Mb Memory",
"qxlxml" => "ram='65536' vram='16384' vgamem='16384' heads='1' primary='yes'",
],
"H1.32M" => [
"text" => "1 Screen 32Mb Memory",
"qxlxml" => "ram='65536' vram='32768' vgamem='32768' heads='1' primary='yes'",
],
"H1.64M" => [
"text" => "1 Screen 64Mb Memory",
"qxlxml" => "ram='65536' vram='65536' vram64='65535' vgamem='65536' heads='1' primary='yes'",
],
"H1.128M" => [
"text" => "1 Screen 128Mb Memory",
"qxlxml"=> "ram='65536' vram='131072' vram64='131072' vgamem='65536' heads='1' primary='yes'",
],
"H1.256M" => [
"text" => "1 Screen 256Mb Memory",
"qxlxml" => "ram='65536' vram='262144' vram64='262144' vgamem='65536' heads='1' primary='yes'",
],
"H2.64M" => [
"text" => "2 Screens 64Mb Memory",
"qxlxml" => "ram='65536' vram='65536' vram64='65535' vgamem='65536' heads='2' primary='yes'",
],
"H2.128M" => [
"text" => "2 Screens 128Mb Memory",
"qxlxml" => "ram='65536' vram='131072'vram64='131072' vgamem='65536' heads='2' primary='yes'",
],
"H2.256M" => [
"text" => "2 Screens 256Mb Memory",
"qxlxml" => "ram='65536' vram='262144'vram64='262144' vgamem='65536' heads='2' primary='yes'",
],
"H4.64M" => [
"text" => "4 Screens 64Mb Memory",
"qxlxml" => "ram='65536' vram='65536' vram64='65535' vgamem='65536' heads='4' primary='yes'",
],
"H4.128M" => [
"text" => "4 Screens 128Mb Memory",
"qxlxml" => "ram='65536' vram='131072'vram64='131072' vgamem='65536' heads='4' primary='yes'",
],
"H4.256M" => [
"text" => "4 Screens 256Mb Memory",
"qxlxml"=> "ram='65536' vram='262144' vram64='262144' vgamem='65536' heads='4' primary='yes'",
],
];
// Read configuration file (guaranteed to exist)
$domain_cfgfile = "/boot/config/domain.cfg";
$domain_cfg = parse_ini_file($domain_cfgfile);
@@ -1281,6 +1330,7 @@ private static $encoding = 'UTF-8';
'copypaste' => $getcopypaste,
'guest' => ['multi' => 'off' ],
'render' => $lv->domain_get_vnc_render($res),
'DisplayOptions' => $lv->domain_get_vnc_display_options($res),
];
}