mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: Add gl property to graphics of type sdl in domain config
Support OpenGL accelerated rendering when using SDL graphics in the domain config. Add associated test and documentation. Signed-off-by: Maciej Wolny <maciej.wolny@codethink.co.uk> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
9ac74d44a5
commit
fff9e25a2b
@ -6211,6 +6211,12 @@ qemu-kvm -net nic,model=? /dev/null
|
|||||||
and an optional <code>fullscreen</code> attribute accepting values
|
and an optional <code>fullscreen</code> attribute accepting values
|
||||||
<code>yes</code> or <code>no</code>.
|
<code>yes</code> or <code>no</code>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
You can use a <code>gl</code> with the <code>enable="yes"</code>
|
||||||
|
property to enable OpenGL support in SDL. Likewise you can
|
||||||
|
explicitly disable OpenGL support with <code>enable="no"</code>.
|
||||||
|
</p>
|
||||||
</dd>
|
</dd>
|
||||||
<dt><code>vnc</code></dt>
|
<dt><code>vnc</code></dt>
|
||||||
<dd>
|
<dd>
|
||||||
|
@ -3010,6 +3010,14 @@
|
|||||||
<ref name="virYesNo"/>
|
<ref name="virYesNo"/>
|
||||||
</attribute>
|
</attribute>
|
||||||
</optional>
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<element name="gl">
|
||||||
|
<attribute name="enable">
|
||||||
|
<ref name="virYesNo"/>
|
||||||
|
</attribute>
|
||||||
|
<empty/>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<attribute name="type">
|
<attribute name="type">
|
||||||
|
@ -13511,11 +13511,18 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDefPtr def,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainGraphicsDefParseXMLSDL(virDomainGraphicsDefPtr def,
|
virDomainGraphicsDefParseXMLSDL(virDomainGraphicsDefPtr def,
|
||||||
xmlNodePtr node)
|
xmlNodePtr node,
|
||||||
|
xmlXPathContextPtr ctxt)
|
||||||
{
|
{
|
||||||
|
xmlNodePtr save = ctxt->node;
|
||||||
|
char *enable = NULL;
|
||||||
|
int enableVal;
|
||||||
|
xmlNodePtr glNode;
|
||||||
char *fullscreen = virXMLPropString(node, "fullscreen");
|
char *fullscreen = virXMLPropString(node, "fullscreen");
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
ctxt->node = node;
|
||||||
|
|
||||||
if (fullscreen != NULL) {
|
if (fullscreen != NULL) {
|
||||||
if (STREQ(fullscreen, "yes")) {
|
if (STREQ(fullscreen, "yes")) {
|
||||||
def->data.sdl.fullscreen = true;
|
def->data.sdl.fullscreen = true;
|
||||||
@ -13533,9 +13540,29 @@ virDomainGraphicsDefParseXMLSDL(virDomainGraphicsDefPtr def,
|
|||||||
def->data.sdl.xauth = virXMLPropString(node, "xauth");
|
def->data.sdl.xauth = virXMLPropString(node, "xauth");
|
||||||
def->data.sdl.display = virXMLPropString(node, "display");
|
def->data.sdl.display = virXMLPropString(node, "display");
|
||||||
|
|
||||||
|
glNode = virXPathNode("./gl", ctxt);
|
||||||
|
if (glNode) {
|
||||||
|
enable = virXMLPropString(glNode, "enable");
|
||||||
|
if (!enable) {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
|
_("sdl gl element missing enable"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
enableVal = virTristateBoolTypeFromString(enable);
|
||||||
|
if (enableVal < 0) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("unknown enable value '%s'"), enable);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
def->data.sdl.gl = enableVal;
|
||||||
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(fullscreen);
|
VIR_FREE(fullscreen);
|
||||||
|
VIR_FREE(enable);
|
||||||
|
ctxt->node = save;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13964,7 +13991,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
|
|||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
|
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
|
||||||
if (virDomainGraphicsDefParseXMLSDL(def, node) < 0)
|
if (virDomainGraphicsDefParseXMLSDL(def, node, ctxt) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
|
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
|
||||||
@ -25736,6 +25763,18 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
|
|||||||
if (def->data.sdl.fullscreen)
|
if (def->data.sdl.fullscreen)
|
||||||
virBufferAddLit(buf, " fullscreen='yes'");
|
virBufferAddLit(buf, " fullscreen='yes'");
|
||||||
|
|
||||||
|
if (!children && def->data.sdl.gl != VIR_TRISTATE_BOOL_ABSENT) {
|
||||||
|
virBufferAddLit(buf, ">\n");
|
||||||
|
virBufferAdjustIndent(buf, 2);
|
||||||
|
children = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (def->data.sdl.gl != VIR_TRISTATE_BOOL_ABSENT) {
|
||||||
|
virBufferAsprintf(buf, "<gl enable='%s'",
|
||||||
|
virTristateBoolTypeToString(def->data.sdl.gl));
|
||||||
|
virBufferAddLit(buf, "/>\n");
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
|
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
|
||||||
|
@ -1599,6 +1599,7 @@ struct _virDomainGraphicsDef {
|
|||||||
char *display;
|
char *display;
|
||||||
char *xauth;
|
char *xauth;
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
|
virTristateBool gl;
|
||||||
} sdl;
|
} sdl;
|
||||||
struct {
|
struct {
|
||||||
int port;
|
int port;
|
||||||
|
38
tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.xml
Normal file
38
tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.xml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<domain type='qemu'>
|
||||||
|
<name>QEMUGuest1</name>
|
||||||
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<currentMemory unit='KiB'>1048576</currentMemory>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
|
<boot dev='hd'/>
|
||||||
|
</os>
|
||||||
|
<clock offset='utc'/>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-i686</emulator>
|
||||||
|
<disk type='file' device='disk'>
|
||||||
|
<driver name='qemu' type='qcow2' cache='none'/>
|
||||||
|
<source file='/var/lib/libvirt/images/QEMUGuest1'/>
|
||||||
|
<target dev='hda' bus='ide'/>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||||
|
</disk>
|
||||||
|
<controller type='ide' index='0'/>
|
||||||
|
<controller type='usb' index='0'/>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
|
<input type='mouse' bus='ps2'/>
|
||||||
|
<input type='keyboard' bus='ps2'/>
|
||||||
|
<graphics type='sdl'>
|
||||||
|
<gl enable='yes'/>
|
||||||
|
</graphics>
|
||||||
|
<video>
|
||||||
|
<model type='virtio' heads='1'>
|
||||||
|
<acceleration accel3d='yes'/>
|
||||||
|
</model>
|
||||||
|
</video>
|
||||||
|
<memballoon model='virtio'/>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
45
tests/qemuxml2xmloutdata/video-virtio-gpu-sdl-gl.xml
Normal file
45
tests/qemuxml2xmloutdata/video-virtio-gpu-sdl-gl.xml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<domain type='qemu'>
|
||||||
|
<name>QEMUGuest1</name>
|
||||||
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<currentMemory unit='KiB'>1048576</currentMemory>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
|
<boot dev='hd'/>
|
||||||
|
</os>
|
||||||
|
<clock offset='utc'/>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-i686</emulator>
|
||||||
|
<disk type='file' device='disk'>
|
||||||
|
<driver name='qemu' type='qcow2' cache='none'/>
|
||||||
|
<source file='/var/lib/libvirt/images/QEMUGuest1'/>
|
||||||
|
<target dev='hda' bus='ide'/>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||||
|
</disk>
|
||||||
|
<controller type='ide' index='0'>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='usb' index='0'>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
|
<input type='mouse' bus='ps2'/>
|
||||||
|
<input type='keyboard' bus='ps2'/>
|
||||||
|
<graphics type='sdl'>
|
||||||
|
<gl enable='yes'/>
|
||||||
|
</graphics>
|
||||||
|
<video>
|
||||||
|
<model type='virtio' heads='1' primary='yes'>
|
||||||
|
<acceleration accel3d='yes'/>
|
||||||
|
</model>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||||
|
</video>
|
||||||
|
<memballoon model='virtio'>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||||
|
</memballoon>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -1103,6 +1103,7 @@ mymain(void)
|
|||||||
DO_TEST("video-virtio-gpu-device", NONE);
|
DO_TEST("video-virtio-gpu-device", NONE);
|
||||||
DO_TEST("video-virtio-gpu-virgl", NONE);
|
DO_TEST("video-virtio-gpu-virgl", NONE);
|
||||||
DO_TEST("video-virtio-gpu-spice-gl", NONE);
|
DO_TEST("video-virtio-gpu-spice-gl", NONE);
|
||||||
|
DO_TEST("video-virtio-gpu-sdl-gl", NONE);
|
||||||
DO_TEST("virtio-input", NONE);
|
DO_TEST("virtio-input", NONE);
|
||||||
DO_TEST("virtio-input-passthrough", NONE);
|
DO_TEST("virtio-input-passthrough", NONE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user