Bug 1266484 - spice + fedora wayland VM + spice-vdagent + resize-guest == flickering display
spice + fedora wayland VM + spice-vdagent + resize-guest == flickering display
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: qemu (Show other bugs)
25
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Fedora Virtualization Maintainers
Fedora Extras Quality Assurance
AcceptedBlocker https://fedoraproject...
: CommonBugs, Reopened
: 1330824 1372434 1377566 1381040 1384036 (view as bug list)
Depends On:
Blocks: WaylandRelated F25FinalBlocker
  Show dependency treegraph
 
Reported: 2015-09-25 08:03 EDT by J. Haas
Modified: 2016-11-16 06:27 EST (History)
43 users (show)

See Also:
Fixed In Version: qemu-2.7.0-6.fc25
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-10-22 00:00:18 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch for spice-gtk-0.31-1.fc24 in order to avoid wayland guest flickering (5.12 KB, patch)
2016-03-22 16:42 EDT, Joachim Frieben
no flags Details | Diff
Patch for the QXL kernel driver (5.20 KB, patch)
2016-10-14 11:39 EDT, Christophe Fergeau
no flags Details | Diff
QEMU patch (3.24 KB, patch)
2016-10-14 11:40 EDT, Christophe Fergeau
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
FreeDesktop.org 94950 None None None 2016-04-15 09:53 EDT

  None (edit)
Description J. Haas 2015-09-25 08:03:01 EDT
Description of problem:

Situation: Fedora 22 host with Fedora 23 Beta guest system using Boxes as virtualization software.

When spice-vdagent is installed on the guest and you start a wayland session on the guest (or just use gdm which uses wayland by default) the screen flickers every second or so, because apparently spice-vdagent wants to resize the screen but the guest screen shize already has the desired size of the host window.

Version-Release number of selected component (if applicable):
0.16.0-1-fc23

How reproducible:
Always

Steps to Reproduce:
1. Install Fedora 22
2. use Boxes to create a Fedora 23 Beta Workstation Guest using live iso
3. Launch wayland session on guest

Actual results:

Screen flickers and it's unusable until you remove spice-vdagent

Expected results:

Guest working fine
Comment 1 Giulio 'juliuxpigface' 2015-10-04 09:04:53 EDT
I've encountered this with virt-manager too.
Comment 2 Pavel Grunt 2015-10-04 12:36:47 EDT
it is ok with virt-viewer / remote-viewer
Comment 3 Pavel Grunt 2015-10-05 10:30:03 EDT
The issue is related to the 'resize-guest' property of the spice display widget. Attempts to resize only happen when the spice-vdagent is running, that's why the issue disappears.
Comment 5 Joachim Frieben 2016-02-13 05:44:28 EST
Heavy flickering for (current) Fedora 23 Wayland guest in a (current) Fedora 23 host making the desktop completely unusable.
Comment 6 Cole Robinson 2016-03-16 19:12:09 EDT
Pavel, did this patch ever make it upstream? I don't see it in git
Comment 7 Pavel Grunt 2016-03-21 05:11:57 EDT
It didn't. I will look into it again..

scratch build containing the patch:
http://koji.fedoraproject.org/koji/taskinfo?taskID=13408204
Comment 8 Joachim Frieben 2016-03-21 11:59:30 EDT
(In reply to Pavel Grunt from comment #7)
The patched package works as extended, thanks! Please ship a build for Fedora 24, too.
Comment 9 Joachim Frieben 2016-03-21 12:01:12 EDT
(In reply to Pavel Grunt from comment #7)
The patched package works as intended, thanks! Please ship a build for Fedora 24, too.
Comment 10 Joachim Frieben 2016-03-22 16:42 EDT
Created attachment 1139230 [details]
Patch for spice-gtk-0.31-1.fc24 in order to avoid wayland guest flickering

Wayland guest flickering likewise affects current Fedora 24 with package spice-gtk3-0.31-1.fc24. The attached patch applies the changes from comment 4 to the latter.
Comment 11 Mike McCune 2016-03-28 19:16:15 EDT
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune@redhat.com with any questions
Comment 12 Fedora Update System 2016-04-18 03:46:54 EDT
spice-gtk-0.30-2.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-88264ad5cc
Comment 13 Fedora Update System 2016-04-18 03:57:02 EDT
spice-gtk-0.31-2.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-c7ad5f2566
Comment 14 Fedora Update System 2016-04-18 14:51:21 EDT
spice-gtk-0.31-2.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-c7ad5f2566
Comment 15 J. Haas 2016-04-18 15:24:15 EDT
Are we supposed to update the guest or the host (or both)? Updating the host to spice-gtk-0.30-2.fc23 didn't cause any improvements. Guest is currently using latest rawhide.
Comment 16 Joachim Frieben 2016-04-18 16:13:55 EDT
The patch added in spice-gtk-0.31-2.fc24 differs from that applied in the koji sratch build with task ID 13408204 introduced in comment 7, and unlike the former, it has -no- effect.
Comment 17 Joachim Frieben 2016-04-18 16:20:12 EDT
(In reply to J. Haas from comment #15)
Updating the host system is both necessary and sufficient. Alas, the working scratch build from comment 7 has been removed from koji in the meantime.
Comment 18 Fedora Update System 2016-04-18 22:23:31 EDT
spice-gtk-0.30-2.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-88264ad5cc
Comment 19 Fedora Update System 2016-04-26 16:53:41 EDT
spice-gtk-0.30-2.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
Comment 20 J. Haas 2016-04-27 00:58:40 EDT
Bug is not fixed in spice-gtk-0.30-2.fc23.
Comment 21 Joachim Frieben 2016-04-27 01:13:02 EDT
Issue has reported anew as bug 1330824 for Fedora 24 (should also cover Fedora 23).
Comment 22 Christophe Fergeau 2016-04-27 02:39:51 EDT
Yeah, sorry about that, I pushed the update to stable by mistake, I thought I cancelled, but apparently this failed ;)
Comment 23 Joachim Frieben 2016-04-27 05:13:16 EDT
Unless I am wrong, it is not correct to reopen a bug report closed with resolution ERRATA. Therefore, I have filed bug 1330824, albeit for Fedora 24.
Comment 24 Joachim Frieben 2016-05-02 17:19:05 EDT
(In reply to Pavel Grunt from comment #4)

Please keep in mind that the -successful- scratch build

  http://koji.fedoraproject.org/koji/taskinfo?taskID=13408204

did -not- include the faulty patch committed upstream at

  https://cgit.freedesktop.org/spice/spice-gtk/commit/?id=ec6bfc00f81afddbdcc0fac86d7039385d89c6b6

but rather the modification suggested in message http://lists.freedesktop.org/archives/spice-devel/2015-October/022730.html.
Comment 25 Fedora Update System 2016-05-07 08:07:07 EDT
spice-gtk-0.31-2.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.
Comment 26 J. Haas 2016-05-07 09:10:54 EDT
Reopened again, as spice-gtk-0.31-2.fc24 is still affected. If you want to use the other bug feel free to close this again.
Comment 27 Cole Robinson 2016-06-01 10:09:20 EDT

*** This bug has been marked as a duplicate of bug 1330824 ***
Comment 28 Cole Robinson 2016-06-01 10:10:17 EDT
*** Bug 1330824 has been marked as a duplicate of this bug. ***
Comment 29 Cole Robinson 2016-06-01 10:11:56 EDT
FWIW I can still reproduce with virt-manager and spice-gtk3-0.31-2.fc24.x86_64, so like Joachim said there must be something wrong with the backport
Comment 30 Gilles Dubreuil 2016-06-07 05:12:22 EDT
FYI, I cannot reproduce the issue, using Fedora 22 (spice-gtk3-0.30-1.fc22.x86_64) or either RHEL7.2 (spice-gtk3-0.26-5.el7.x86_64) hosts with Fedora 24 guest (spice-vdagent-0.16.0-3.fc24.x86_64).
Comment 31 Martin Stefany 2016-06-21 14:59:15 EDT
I can report it's still happening on Fedora 24 (just-released) guest on CentOS/RHEL7.2 host.
Comment 32 Joachim Frieben 2016-06-23 12:34:25 EDT
Issue still present for the latest rawhide update spice-gtk-0.32-1.fc25.
Comment 33 David Strauss 2016-07-18 17:17:53 EDT
Still seeing this with a Fedora 24 guest.
Comment 34 Pavel Grunt 2016-08-04 03:12:13 EDT
Hi, I took a look into DRM_QXL help:
 QXL virtual GPU for Spice virtualization desktop integration.
 Do not enable this driver unless your distro ships a corresponding 
 X.org QXL driver that can handle kernel modesetting.

So has Fedora running GNOME on Wayland X.org QXL driver that can handle kernel modesetting ?

workaround (solution?):
I also found out that virtio graphic doesn't have this flickering problem and support features like automatic resizing. Please switch from Video QXL to Video virtio. You can use `virsh edit` or virt-manager for it.
Comment 35 Joachim Frieben 2016-08-04 06:02:23 EDT
Component xorg-x11-drv-qxl is clearly not the right one, because it is used by Xorg alone and -never- by Xwayland. Kernel modesetting in both cases is provided by the kernel DRM modules, here

  /usr/lib/modules/`uname -r`/kernel/drivers/gpu/drm/qxl/qxl.ko.xz .

I would rather think that the default graphics device in QEMU needs to be set to virtio-gpu.
Comment 36 Joachim Frieben 2016-08-04 09:06:07 EDT
(In reply to Pavel Grunt from comment #34)
Using virgl instead of QXL indeed suppresses screen flicker. Instructions can be found at http://www.spice-space.org/spice-user-manual.html. To summarize:

"You need to add a virtio-gpu video device to your virtual machine instead of QXL.

<video>
  <model type='virtio' heads='1'>
    <acceleration accel3d='yes'/>
  </model>
</video>

Then you need to enable OpenGL on your SPICE graphics node:

<graphics type='spice' autoport='no'>
  <gl enable='yes'/>
</graphics>".

Running a Fedora 24 guest on a Fedora 25 host, the machine fails to start up in enforcing mode because of bug 1364075. After switching to permissive mode, the virtual machine starts up as expected, and virgl direct rendering is enabled:

"..
 Extended renderer info (GLX_MESA_query_renderer):
     Vendor: Red Hat (0x1af4)
     Device: virgl (0x1010)
     Version: 12.0.1
     Accelerated: yes
 .."

However, as long as QXL is configured as the default device, comment 34 provides nothing more than a workaround. I do recall that the flicker issue -was- successfully settled as per comment 7, but the patch was not applied correctly upstream. 
With a private patched build of spice-gtk-0.31, I have been able to run flicker-free GNOME on Wayland guest sessions with QXL on Fedora 24 and Fedora 25 host systems ever since.
Comment 37 Joachim Frieben 2016-08-04 09:38:33 EDT
(In reply to Pavel Grunt from comment #34)
Using virgl with direct rendering seems to be fairly unstable and resizing also does not seem to work. The results reported in comment 34 may rather refer to virgl w/o direct rendering. This mode can be obtained by setting <gl enable=no'/>.
Comment 38 Pavel Grunt 2016-08-04 09:44:49 EDT
(In reply to Joachim Frieben from comment #37)
> (In reply to Pavel Grunt from comment #34)
> Using virgl with direct rendering seems to be fairly unstable and resizing
> also does not seem to work. 
Works fine in my system
> The results reported in comment 34 may rather
> refer to virgl w/o direct rendering. This mode can be obtained by setting
> <gl enable=no'/>.

I didn't mention virgl in my comment.

Changing video node (using `virsh edit`) to:

    <video>
      <model type='virtio' heads='1' primary='yes'/>
    </video>

is enough
Comment 39 Fedora Blocker Bugs Application 2016-09-05 03:49:06 EDT
Proposed as a Blocker for 25-final by Fedora user jonha using the blocker tracking app because:

 Violates the following criterion for the Gnome Boxes app:

"All applications that can be launched using the standard graphical mechanism of a release-blocking desktop after a default installation of that desktop must start successfully and withstand a basic functionality test. "

I'd consider creating and using a Fedora 25 guest the most basic functionality test and if the screen is flickering every second or so, it's clearly not usable at all.

Alternatively could block on the " Guest on current stable release " beta criterion.
Comment 40 Michael Catanzaro 2016-09-10 11:34:53 EDT
FWIW I agree with the blocker status: this bug makes it extremely difficult to use Fedora in Boxes VMs. Good luck so much as launching an app, because the shell overview gets dismissed every second when the flicker occurs, so you need to be very fast with the mouse in order to launch anything from favorites with the mouse. I haven't been able to start any app not in favorites, because it's too far to go with the mouse and I can't type a search quickly enough.
Comment 41 Joachim Frieben 2016-09-10 14:23:04 EDT
(In reply to Michael Catanzaro from comment #40)
I have resorted to either switching to virtio-gpu or simply launching the virtual machine in "basic graphics mode" which amounts to adding "nomodeset" to the kernel boot options.
Comment 42 Pavel Grunt 2016-09-10 16:40:15 EDT
Boxes can/should create vms with the virtio graphics which works fine with wayland and (compared to qxl) it supports 3D.

There are patches upstream for that, see https://bugzilla.gnome.org/show_bug.cgi?id=762727
Comment 43 Joachim Frieben 2016-09-10 17:09:39 EDT
(In reply to Pavel Grunt from comment #42)
Video device QXL is a valid choice which needs to be supported even in the hypothetic case where virtio-gpu became the default virtual video device. Currently, using video device virtio-gpu requires manual editing of some XML file which can only be considered a workaround for advanced users.

In current Fedora 24, VirGL 3D is inhibited by gnome-boxes which has been reported in bug 1367660; because of bug 1337333, VirGL 3D can only be used in permissive SELinux mode in both of Fedora 24 and Fedora 25 which is definitely a showstopper.
Comment 44 psmis 2016-09-12 16:18:45 EDT
*** Bug 1372434 has been marked as a duplicate of this bug. ***
Comment 45 Geoffrey Marr 2016-09-12 22:57:13 EDT
Discussed during the 2016-09-12 blocker review meeting: [1]

The decision to delay the classification of this as a bug was made as we're not entirely clear on the circumstances in which this bug happens or the difficulty of the workaround(s); more information is required before any classification can be made.

[1] https://meetbot.fedoraproject.org/fedora-blocker-review/2016-09-12/f25-blocker-review.2016-09-12-16.01.txt
Comment 46 J. Haas 2016-09-13 03:56:54 EDT
To clarify a few points from the blocker meeting:

- It doesn't matter if the host uses Wayland or X11, what's important is that the guest uses Wayland.

- Still reproducible using a F25 Alpha 2 Workstation (Wayland) guest on a standard up-to-date F24 Workstation (X11) host.

- Still reproducible using a live F25 Alpha 2 Workstation (Wayland) guest on a live F25 Alpha 2 Workstation host (Wayland)

Tried on multiple systems, not sure why you couldn't reproduce this.

Bad screencast: http://webm.land/w/cZJP/

The flickering isn't really visible and it's subtle anyway, but it will "defocus" all applications and close the application launcher (if it's open) every second or so.
Comment 47 Joachim Frieben 2016-09-13 04:31:24 EDT
(In reply to J. Haas from comment #46)
This issue is easily reproducible as outlined in muliple comments to this bug report. Now that Fedora 25 is launching a "GNOME" (on Wayland) session by default, it has essentially become inescapable. It is sufficient to boot from a Fedora 25 live image prior or equal to Fedora-Workstation-Live-x86_64-25-20160909.n.0.
Because of bug 1374028 which causes a failure of Xwayland and Xorg to be used forcibly instead in a virtual machine using the QXL video device, live images equal or later than Fedora-Workstation-Live-x86_64-25-20160910.n.0 do -not- exhibit any flicker. This may currently mislead a thoughtless observer.
Comment 48 Kamil Páral 2016-09-13 06:01:38 EDT
(In reply to Joachim Frieben from comment #47)
> Because of bug 1374028 which causes a failure of Xwayland and Xorg to be
> used forcibly instead in a virtual machine using the QXL video device, live
> images equal or later than Fedora-Workstation-Live-x86_64-25-20160910.n.0 do
> -not- exhibit any flicker. This may currently mislead a thoughtless observer.

This was the critical piece of information. I tried with Fedora-Workstation-Live-x86_64-25-20160907.n.0.iso, and yes, the flicker is there and gnome overview is unusable (can be reproduced just booting the livecd).
Comment 49 Joachim Frieben 2016-09-13 08:34:04 EDT
Assignee: this appears to be a QXL/KMS issue showing up in a Wayland session, and the Xorg driver package xorg-x11-drv-qxl has simply nothing to do with it.
What about eventually setting the component to package kernel then?
Comment 50 Christophe Fergeau 2016-09-14 11:22:33 EDT
(In reply to Kamil Páral from comment #48)
> This was the critical piece of information. I tried with
> Fedora-Workstation-Live-x86_64-25-20160907.n.0.iso, and yes, the flicker is
> there and gnome overview is unusable (can be reproduced just booting the
> livecd).

Where would I get this image? I tried installing the latest one, and then downgrading mutter/gnome-shell to avoid bug #1374028, I think my session is a wayland one (gnome-shell is running as a child of /usr/libexec/gdm-wayland-session gnome-session) but I'm not seeing flickering (f24 host).
Comment 51 Joachim Frieben 2016-09-14 12:23:26 EDT
(In reply to Christophe Fergeau from comment #50)
You can grab the latest working image at https://kojipkgs.fedoraproject.org/packages/Fedora-Workstation-Live/25/20160909.n.0/images/Fedora-Workstation-Live-x86_64-25-20160909.n.0.iso unless you prefer to use the live media of Fedora Workstation 25 Alpha which should also do the job.
Once the live session is running, check whether a process Xwayland or a process Xorg is running - that is all you need to know ..
Comment 52 Kamil Páral 2016-09-15 04:46:09 EDT
(In reply to Christophe Fergeau from comment #50)
> Where would I get this image? 

https://kojipkgs.fedoraproject.org/compose/branched/Fedora-25-20160907.n.0/compose/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-25-20160907.n.0.iso

> I tried installing the latest one, and then
> downgrading mutter/gnome-shell to avoid bug #1374028, I think my session is
> a wayland one (gnome-shell is running as a child of
> /usr/libexec/gdm-wayland-session gnome-session) but I'm not seeing
> flickering (f24 host).

You can identify the type of session like this:
https://fedoraproject.org/wiki/How_to_debug_Wayland_problems#Identifying_the_session_type_in_runtime
Comment 53 Petr Schindler 2016-09-19 13:35:59 EDT
Discussed at 2016-09-19 blocker review meeting: [1]. 

We decided to punt the decision: Currently F25 uses X11 in Boxes, but should the switch to Wayland be made in the future, this will inhibit the user from launching applications. If Wayland is confirmed, we will classify this bug as an AcceptedBlocker, but until then we will wait on any decision.

[1] https://meetbot-raw.fedoraproject.org/fedora-blocker-review/2016-09-19/
Comment 54 Michael Catanzaro 2016-09-19 14:19:42 EDT
(In reply to Petr Schindler from comment #53)
> If Wayland is confirmed, we will classify this bug
> as an AcceptedBlocker, but until then we will wait on any decision.

We haven't announced this anywhere besides the Workstation meeting notes yet, but the final vote was made last Wednesday and it was unanimous to stick with Wayland. So: confirmed.
Comment 55 Kamil Páral 2016-09-20 04:02:20 EDT
(In reply to Michael Catanzaro from comment #54)
> We haven't announced this anywhere besides the Workstation meeting notes
> yet, but the final vote was made last Wednesday and it was unanimous to
> stick with Wayland. So: confirmed.

This was not about the default display stack overall, but the display stack used *in Boxes*. Currently Boxes default to X11 probably due to 1374028. If that gets resolved and Boxes start booting F25 under wayland, this will be a blocker.

Changing component to something more appropriate per comment 49.
Comment 56 Joachim Frieben 2016-09-20 04:21:03 EDT
(In reply to Kamil Páral from comment #55)
With the latest bunch of GNOME updates from a few days ago including mutter-3.21.92-1.fc25, Fedora 25 defaults again correctly to session type "GNOME" (on Wayland) when launched in "Boxes" (gnome-boxes). I had added a corresponding comment in bug 1374028.
Comment 57 Laura Abbott 2016-09-23 15:28:35 EDT
*********** MASS BUG UPDATE **************
 
We apologize for the inconvenience.  There is a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 23 kernel bugs.
 
Fedora 23 has now been rebased to 4.7.4-100.fc23.  Please test this kernel update (or newer) and let us know if you issue has been resolved or if it is still present with the newer kernel.
 
If you have moved on to Fedora 24 or 25, and are still experiencing this issue, please change the version to Fedora 24 or 25.
 
If you experience different issues, please open a new bug report for those.
Comment 58 Michael Catanzaro 2016-09-23 15:36:44 EDT
Reassigning to F25 since this is a proposed F25 blocker.
Comment 59 Vít Ondruch 2016-09-26 04:45:12 EDT
*** Bug 1377566 has been marked as a duplicate of this bug. ***
Comment 60 Kamil Páral 2016-09-26 10:36:52 EDT
Since bug 1374028 got resolved, this is now the default behavior in Boxes (tested with Fedora-Workstation-Live-x86_64-25-20160925.n.0.iso). Setting as AcceptedBlocker per comment 53.
Comment 61 Christian Stadelmann 2016-09-26 19:01:10 EDT
Can somebody confirm or deny that this bug is not only causing flicker, but also a blurness? I'm seeing one on a F24→F25 upgraded physical machine (no virtual machine).
Comment 62 Kamil Páral 2016-09-27 03:14:49 EDT
(In reply to Christian Stadelmann from comment #61)
That will likely be a different bug, please file a new one and attach screenshots and logs. Thanks.
Comment 63 Justin M. Forbes 2016-09-27 13:20:22 EDT
From reading the comments here, I am confused as to how this is kernel, comment #24 this was working with the scratch build to spice, but the patch in that build is not the patch that got into the release. Reassigning to spice-gtk.
Comment 64 Joachim Frieben 2016-09-27 14:59:11 EDT
(In reply to Justin M. Forbes from comment #63)
This issue can be attacked from either side: it is correct that there was a patch for an older version of spice-gtk which solved the issue; on the other hand, the virtio-gpu device appears to be completely unhampered and resizing works like a charm. This indicates that the root issue is actually related to the KMS properties of the video kernel module. For that reason it seems more appropriate to look at the QXL kernel module and how kernel mode setting is implemented. Tinkering with spice-gtk is possibly rather a workaround than a true solution.
Comment 65 Christian Stadelmann 2016-09-28 04:56:30 EDT
(In reply to Kamil Páral from comment #62)
> (In reply to Christian Stadelmann from comment #61)
> That will likely be a different bug, please file a new one and attach
> screenshots and logs. Thanks.

Ok, see bug #1379959.
Comment 66 Cole Robinson 2016-10-11 09:48:03 EDT
Pavel sent patches to upstream spice list, but they are still under discussion: https://lists.freedesktop.org/archives/spice-devel/2016-October/032555.html
Comment 67 Joachim Frieben 2016-10-11 12:48:21 EDT
(In reply to Cole Robinson from comment #66)
Can anybody push a koji build of package spice-gtk applying said patch? This does not need approval by upstream, thanks.
Comment 68 Pavel Grunt 2016-10-12 16:58:30 EDT
*** Bug 1381040 has been marked as a duplicate of this bug. ***
Comment 69 Zdenek Chmelar 2016-10-13 08:03:40 EDT
*** Bug 1384036 has been marked as a duplicate of this bug. ***
Comment 70 Christophe Fergeau 2016-10-14 11:38:35 EDT
I finally have a good grasp of what's going on, and have a QEMU patch
and a kernel patch, each of these fixing (or avoiding) this bug.

The short version of it is that nothing host/guest-side is checking
whether a monitors config message received from the client is specifying
a new configuration, and resolution changes done by mutter trigger the
blinking and the sending of a monitors config message, so we get in a
monitors config message -> resolution change -> monitors config message
-> ... loop


Long version:
- a monitors config message is received from the client
- spice-server tells QEMU about it witout looking at its content
- QEMU raises an interrupt to let the guest know about the new config,
  and once again, does not make sure it's different from the current
  one
- the kernel QXL driver gets the new monitors configuration from QEMU
  and notifies userspace about it (as usual, no check whether there were
  actual changes)
- mutter (part of gnome-shell) gets this notification, and reconfigures
  its resolution/monitors (and you already know I'm going to mention
  that it does not check if it's the same as the existing one ;)

This could be all fine and not cause any problems at all, except that
the way mutter/clutter/cogl handle the resolution change does not play
nice with the above.

The resolution change in mutter will be done with calls to drmModeRmFB,
drmModeAddFB, and drmModeSetCrtc.
The drmModeRmFB call will cause the drmModeSetCrtc call to
notify the client about a destroy/create of the primary surface, which
will schedule the sending of a monitors config message one second
later, which will cause the infinite loop with flickering.

I've written a kernel patch for the qxl driver, and a qemu patch, each
of these patches fixes the bug on its own. They only make sure not to
notify userspace or the guest about changes in the monitor configuration
if nothing changed. This avoids this annoying loop.

Now, I don't know whether the way mutter uses the drm API is correct, or
if a fix belongs there too. I also don't know whether there is another
bug to fix in the QXL driver which would avoid this destruction/creation
of the primary surface in qxl_crtc_mode_set(). Any input there would be
welcome :)


I'm planning to send these patches upstream unless there is strong disagreement
against them. In the mean time, they can probably be added to the f25
packages to avoid this annoying regression (I'd go with the kernel
patch).
Comment 71 Christophe Fergeau 2016-10-14 11:39 EDT
Created attachment 1210590 [details]
Patch for the QXL kernel driver
Comment 72 Christophe Fergeau 2016-10-14 11:40 EDT
Created attachment 1210592 [details]
QEMU patch
Comment 73 Joachim Frieben 2016-10-15 03:52:07 EDT
(In reply to Christophe Fergeau from comment #71)
Thanks a lot for your great work!

1. The patch from comment 71 applies cleanly and solves the issue successfully.
2. This seems to confirm my comment 64 that the root cause was in the QXL kernel driver (remember that the virtio-gpu video device was not hampered by this issue at all), and that tinkering with spice-gtk etc. was rather a workaround than a proper solution. I therefore strongly recommend dropping the QEMU patch altogether and retaining the kernel patch from comment 71 alone.
Comment 74 Cole Robinson 2016-10-17 19:36:03 EDT
I'll do a qemu build tomorrow to pull in Christophe's qemu patch. I've filed a separate bug to track pulling in the kernel fix:

https://bugzilla.redhat.com/show_bug.cgi?id=1385956
Comment 75 Fedora Update System 2016-10-20 18:56:28 EDT
qemu-2.7.0-6.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-190e517826
Comment 76 Anass Ahmed 2016-10-21 15:23:50 EDT
After the last update, I've booted F25 Alpha to GNOME Boxes and it finally works without flickering.
Comment 77 Fedora Update System 2016-10-22 00:00:18 EDT
qemu-2.7.0-6.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.
Comment 78 jibecfed 2016-10-22 12:03:28 EDT
hi, thank for your work, but the issue isn't fixed for me. Host and guest are up to date. Here is a short video:
https://jibecfed.fedorapeople.org/partage/Capture%20d'%c3%a9cran%20vid%c3%a9o%20de%2022-10-2016%2017:57:54.webm
Comment 79 Anass Ahmed 2016-10-22 12:06:48 EDT
(In reply to jibecfed from comment #78)
> hi, thank for your work, but the issue isn't fixed for me. Host and guest
> are up to date. Here is a short video:
> https://jibecfed.fedorapeople.org/partage/
> Capture%20d'%c3%a9cran%20vid%c3%a9o%20de%2022-10-2016%2017:57:54.webm

The problem is not in qemu which is inside the guest, it's in the qemu of the host.
Comment 80 Jean-François Fortin Tam 2016-10-26 22:12:51 EDT
> The problem is not in qemu which is inside the guest,
> it's in the qemu of the host.

I have a fully updated fedora 24 host with a fully updated fedora 25 guest in gnome-boxes, and the problem still occurs. Why was it closed if there was only an update to the qemu package in "fc25" (from what it seems in comment 77)?
Comment 81 J. Haas 2016-10-27 02:05:28 EDT
I also want to ask if this fix can be included in Fedora 24. Launching F25 on a F24 host seems to be a common use case for testing the new release for example.
Comment 82 Kamil Páral 2016-10-27 03:29:59 EDT
There seems to be an update for F24 claiming to fix this in updates-testing repo:
https://bodhi.fedoraproject.org/updates/FEDORA-2016-9f5fc14b30

Can you try, and add karma if it fixes the problem for you? Thanks.
Comment 83 Christophe Fergeau 2016-11-02 11:11:39 EDT
(In reply to Cole Robinson from comment #74)
> I'll do a qemu build tomorrow to pull in Christophe's qemu patch. I've filed
> a separate bug to track pulling in the kernel fix:
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1385956

For the record, the QEMU patched is on its way upstream https://lists.nongnu.org/archive/html/qemu-devel/2016-11/msg00018.html
It's a revised version of the patch which was attached to this bug/added to the package though https://lists.nongnu.org/archive/html/qemu-devel/2016-10/msg07483.html
Comment 84 Cole Robinson 2016-11-06 11:54:50 EST
(In reply to Christophe Fergeau from comment #83)
> (In reply to Cole Robinson from comment #74)
> > I'll do a qemu build tomorrow to pull in Christophe's qemu patch. I've filed
> > a separate bug to track pulling in the kernel fix:
> > 
> > https://bugzilla.redhat.com/show_bug.cgi?id=1385956
> 
> For the record, the QEMU patched is on its way upstream
> https://lists.nongnu.org/archive/html/qemu-devel/2016-11/msg00018.html
> It's a revised version of the patch which was attached to this bug/added to
> the package though
> https://lists.nongnu.org/archive/html/qemu-devel/2016-10/msg07483.html

I filed https://bugzilla.redhat.com/show_bug.cgi?id=1392239 to track backporting/replacing the patch when it lands upstream
Comment 85 Christian Stadelmann 2016-11-15 17:44:32 EST
Since this bug is fixed, how about removing the CommonBugs and Wiki entry https://fedoraproject.org/wiki/Common_F25_bugs#boxes-flickering ?
Comment 86 Paul W. Frields 2016-11-15 18:00:08 EST
@Christian: Done.
Comment 87 Kamil Páral 2016-11-16 06:27:27 EST
(In reply to Christian Stadelmann from comment #85)
> Since this bug is fixed, how about removing the CommonBugs and Wiki entry

We always go through the wiki and update it between Go/No-Go and official release. Of course feel free to update it any time, no problem, just make sure the update has been pushed stable.

Note You need to log in before you can comment on or make changes to this bug.