[gnome-boxes/wip/dont-crash-gl] spice-display: Take client-side screenshots when GL is ON
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/dont-crash-gl] spice-display: Take client-side screenshots when GL is ON
- Date: Thu, 30 May 2019 10:43:04 +0000 (UTC)
commit 26939ec91d2b68bd264ab0721935bb84fc1a74dd
Author: Felipe Borges <felipeborges gnome org>
Date: Fri May 24 15:36:33 2019 +0200
spice-display: Take client-side screenshots when GL is ON
Boxes crashes when taking screenshots (calling spice_display_get_pixbuf ()
when GL (virgl) is enabled. This is a known Mesa issue, reported
at https://bugs.freedesktop.org/106811
This solution is a workaround and could be reverted once the mesa
issue above is fixed. It is not ideal because it is dependend on the
widget size-allocation, i.e. a screenshot taken when Boxes isn't
fullscreen would result in an image with the same dimensions as the
Boxes display.
Fixes #311
src/spice-display.vala | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
---
diff --git a/src/spice-display.vala b/src/spice-display.vala
index f5d6e7bd..5eff2043 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -193,9 +193,28 @@ public override void set_enable_audio (bool enable) {
if (!display.ready)
return null;
+ /* FIXME: This is a temporary workaround for a mesa issue that causes
+ * Boxes to crash when calling spice_display_get_pixbuf ();
+ * See https://bugs.freedesktop.org/106811 */
+ if ((machine as LibvirtMachine).acceleration_3d) {
+ return draw_pixbuf_client_side (display);
+ }
+
return display.get_pixbuf ();
}
+ private Gdk.Pixbuf draw_pixbuf_client_side (Spice.Display display) {
+ Gtk.Allocation alloc;
+ var widget = display as Gtk.Widget;
+ widget.get_allocation (out alloc);
+
+ var surface = new Cairo.ImageSurface (ARGB32, alloc.width, alloc.height);
+ var context = new Cairo.Context (surface);
+ widget.draw (context);
+
+ return Gdk.pixbuf_get_from_surface (surface, 0, 0, alloc.width, alloc.height);
+ }
+
public override void collect_logs (StringBuilder builder) {
builder.append_printf ("URL: %s\n", uri);
if (gtk_session != null) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]