virtManager/ui: add 3d acceleration checkbox to virtio video

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2017-02-21 17:01:02 +04:00 committed by Cole Robinson
parent 53d09bc28c
commit b484d15258
3 changed files with 134 additions and 104 deletions

View File

@ -4667,114 +4667,121 @@ if you know what you are doing.&lt;/small&gt;</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment30">
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">3</property>
<property name="left_padding">12</property>
<property name="margin_left">12</property>
<property name="margin_top">3</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkTable" id="table4">
<object class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_columns">2</property>
<property name="column_spacing">8</property>
<property name="row_spacing">4</property>
<child>
<object class="GtkLabel" id="video-heads">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">M_odel:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">combobox-entry13</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="video-model">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_entry">True</property>
<signal name="changed" handler="on_video_model_combo_changed" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry13">
<property name="can_focus">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="video-ram">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="label17">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">RAM:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">M_odel:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">combobox-entry13</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="label25">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Heads:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="video-model">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_entry">True</property>
<signal name="changed" handler="on_video_model_combo_changed" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry13">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label17">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">RAM:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="video-ram">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label25">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Heads:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="video-heads">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">3D acceleration:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="video-3d">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_video_3d_toggled" swapped="no"/>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
</object>
</child>

View File

@ -95,6 +95,7 @@ EDIT_GFX_OPENGL,
EDIT_GFX_RENDERNODE,
EDIT_VIDEO_MODEL,
EDIT_VIDEO_3D,
EDIT_WATCHDOG_MODEL,
EDIT_WATCHDOG_ACTION,
@ -107,7 +108,7 @@ EDIT_FS,
EDIT_HOSTDEV_ROMBAR,
) = range(1, 48)
) = range(1, 49)
# Columns in hw list model
@ -543,8 +544,8 @@ class vmmDetails(vmmGObjectUI):
"on_sound_model_combo_changed": lambda *x: self.enable_apply(x,
EDIT_SOUND_MODEL),
"on_video_model_combo_changed": lambda *x: self.enable_apply(x,
EDIT_VIDEO_MODEL),
"on_video_model_combo_changed": self.video_model_changed,
"on_video_3d_toggled": self.video_3d_toggled,
"on_watchdog_model_combo_changed": lambda *x: self.enable_apply(x,
EDIT_WATCHDOG_MODEL),
@ -1740,6 +1741,16 @@ class vmmDetails(vmmGObjectUI):
self.widget("cpu-topology-table").set_sensitive(do_enable)
self.config_cpu_topology_changed()
def video_model_changed(self, ignore):
model = uiutil.get_list_selection(self.widget("video-model"))
uiutil.set_grid_row_visible(
self.widget("video-3d"), model == "virtio")
self.enable_apply(EDIT_VIDEO_MODEL)
def video_3d_toggled(self, ignore):
self.widget("video-3d").set_inconsistent(False)
self.enable_apply(EDIT_VIDEO_3D)
# Boot device / Autostart
def config_bootdev_selected(self, ignore=None):
boot_row = self.get_boot_selection()
@ -2202,6 +2213,9 @@ class vmmDetails(vmmGObjectUI):
if model:
kwargs["model"] = model
if self.edited(EDIT_VIDEO_3D):
kwargs["accel3d"] = self.widget("video-3d").get_active()
return vmmAddHardware.change_config_helper(self.vm.define_video,
kwargs, self.vm, self.err,
devobj=devobj)
@ -2968,6 +2982,11 @@ class vmmDetails(vmmGObjectUI):
uiutil.set_list_selection(self.widget("video-model"), model)
if vid.accel3d is None:
self.widget("video-3d").set_inconsistent(True)
else:
self.widget("video-3d").set_active(vid.accel3d)
def refresh_watchdog_page(self):
watch = self.get_hw_selection(HW_LIST_COL_DEVICE)
if not watch:

View File

@ -876,7 +876,7 @@ class vmmDomain(vmmLibvirtObject):
else:
self._redefine_xmlobj(xmlobj)
def define_video(self, devobj, do_hotplug, model=_SENTINEL):
def define_video(self, devobj, do_hotplug, model=_SENTINEL, accel3d=_SENTINEL):
xmlobj = self._make_xmlobj_to_define()
editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug)
if not editdev:
@ -893,6 +893,10 @@ class vmmDomain(vmmLibvirtObject):
editdev.heads = None
editdev.ram = None
editdev.vgamem = None
editdev.accel3d = None
if accel3d != _SENTINEL:
editdev.accel3d = accel3d
if do_hotplug:
self.hotplug(device=editdev)