guest: Set default rendernode= if spice gl requested

Since this is required to work out of the box with qemu:///system
This commit is contained in:
Cole Robinson 2017-11-25 17:23:59 -05:00
parent bd1c6e55ad
commit 5ac933e98a
3 changed files with 18 additions and 6 deletions

View File

@ -235,12 +235,12 @@
<filetransfer enable="yes"/>
</graphics>
<graphics type="spice">
<gl enable="yes"/>
<gl enable="yes" rendernode="/dev/dri/by-path/pci-0000:00:02.0-render"/>
<image compression="off"/>
<listen type="socket"/>
</graphics>
<graphics type="spice">
<gl enable="yes"/>
<gl enable="yes" rendernode="/dev/dri/by-path/pci-0000:00:02.0-render"/>
<image compression="off"/>
<listen type="none"/>
</graphics>

View File

@ -44,7 +44,7 @@
</interface>
<input type="tablet" bus="usb"/>
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
<gl enable="yes"/>
<gl enable="yes" rendernode="/dev/dri/by-path/pci-0000:00:02.0-render"/>
<image compression="off"/>
</graphics>
<console type="pty"/>

View File

@ -1174,9 +1174,21 @@ class Guest(XMLBuilder):
if dev.image_compression is None:
dev.image_compression = "off"
if (dev.type == "spice" and dev.gl and
not self.conn.check_support(self.conn.SUPPORT_CONN_SPICE_GL)):
raise ValueError(_("Host does not support spice GL"))
if dev.type == "spice" and dev.gl:
if not self.conn.check_support(
self.conn.SUPPORT_CONN_SPICE_GL):
raise ValueError(_("Host does not support spice GL"))
# If spice GL but rendernode wasn't specified, hardcode
# the first one
if not dev.rendernode and self.conn.check_support(
self.conn.SUPPORT_CONN_SPICE_RENDERNODE):
for nodedev in self.conn.fetch_all_nodedevs():
if (nodedev.device_type != 'drm' or
nodedev.drm_type != 'render'):
continue
dev.rendernode = nodedev.get_devnode().path
break
def _add_spice_channels(self):
if self.skip_default_channel: