VirtualBox

Ticket #15511 (closed defect: invalid)

Opened 18 months ago

Last modified 16 months ago

Screen refresh only when loosing focus -> X server bug, fixed upstream, work-around in versions higher than 5.1.2

Reported by: reddipped Owned by:
Priority: major Component: guest additions/x11/graphics
Version: VirtualBox 5.0.20 Keywords: screen refresh focus
Cc: KennyDr Guest type: Linux
Host type: Mac OS X

Description

After installing a Oracle Virtual Box with Oracle Linux 6.8 and Oracle JDeveloper the screen in the VM is not refreshed after starting JDeveloper. The screen in the preview pane shows the output of the screen as it should be. After the VM looses focus it updates the screen again.

See youtube video for clarification;  https://www.youtube.com/watch?v=58Q-SEjGM9k&feature=youtu.be

Reproduced in VirtualBox 5.1.0_BETA2 r107840 also.

Machine is configured exactly as documented here;  http://www.reddipped.com/2016/01/virtualbox-with-soa-12cr2-and-streamexplorer-in-33-minutes/ Network configuration;  http://www.reddipped.com/2015/10/setting-up-a-nat-network-in-virtualbox-5/

Attachments

VBox.log Download (81.6 KB) - added by reddipped 18 months ago.
VBox.log
Xorg.0.log Download (142.8 KB) - added by reddipped 18 months ago.
VBox.2.log Download (76.9 KB) - added by ChadACrawford 17 months ago.
Lubuntu VM log
modesetting_drv.so.unpatched Download (294.6 KB) - added by michael 17 months ago.
Unpatched modesetting driver
modesetting_drv.so.patched Download (294.8 KB) - added by michael 17 months ago.
Patched modesetting driver. Note: only compatible with X.Org Server 1.17.x
Xorg.0.2.log Download (43.1 KB) - added by reddipped 17 months ago.
modesetting_drv.so.2.unpatched Download (282.8 KB) - added by michael 17 months ago.
Unpatched test modesetting driver
modesetting_drv.so.2.patched Download (283.0 KB) - added by michael 17 months ago.
Patched test modesetting driver

Change History

Changed 18 months ago by reddipped

VBox.log

comment:1 Changed 18 months ago by reddipped

Could be duplicate of Ticket #2985. Found in Xorg.0.log the entry "[ 267.961] (II) modeset(0): Disabling kernel dirty updates, not required." at the exact time when JDeveloper is started.

Changed 18 months ago by reddipped

comment:2 Changed 18 months ago by reddipped

Probably found a workaround by pressing fn+ctrl+alt+f7 followed by fn+ctrl+alt+f1 to refresh the screen.

comment:3 Changed 17 months ago by ChadACrawford

Having this same issue on a Windows host with a Lubuntu guest in 5.0.20 and 5.0.22. It's usually happening when emacs is printing a lot of text to a buffer at once. However, mine reports "Lagging too far behind, not trying to catch up anymore. Expect glitches with USB devices" at the time that the screen freezes.

Changed 17 months ago by ChadACrawford

Lubuntu VM log

comment:4 Changed 17 months ago by michael

The message in the X.Org log file - "Disabling kernel dirty updates, not required" - definitely looks related to the issue. However, when I look at the X server sources (checked in Ubuntu 16.04), that message can only trigger when the kernel driver dirty update handler returns ENOSYS or EINVAL, which our one never does, so this clearly needs investigation.

comment:5 Changed 17 months ago by michael

I took a look at the Linux kernel code between the X server and the driver. That code path could be triggered if there is a bug in the X server causing it to call the kernel wrong.

comment:6 Changed 17 months ago by michael

Or if the X server submits too many updates at one time. I suspect that is what is happening from looking at the X server code. This is somewhat annoying, because if the X server does that it misinterprets the result as meaning that the driver does not need update information, and stops providing it altogether. This is a bug in the X server of course, and will affect other virtual graphics drivers, but that does not help us much.

comment:7 Changed 17 months ago by michael

  • Keywords screen added; scree removed
  • Component changed from GUI to guest additions/x11/graphics

comment:8 Changed 17 months ago by michael

Is anyone watching this bug up to playing with the guest X server a bit? For example,

  • getting the X server source code
  • editing the file hw/xfree86/drivers/modesetting/driver.c
  • finding the block containing the text "Disabling kernel dirty updates, not required.\n"
  • removing the code snippet a few lines above reading "ret == -EINVAL || " (on Ubuntu, that would leave the whole line looking like: "if (ret == -ENOSYS) {")
  • and finally rebuilding and reinstalling the X server package, or at least the modesetting driver in it?

I think that should fix it. I am tending towards submitting a patch to the X server doing this.

comment:9 Changed 17 months ago by OveE

Recompiled X server on Oracle Linux 72 (OL72) guest and can confirm that the trigger I have for this issue no longer triggers.

My environment is OL72 host running VBOX 5.0.22 and OL72 guest. Host graphics card is Nvidia GeForce 960 and the Nvidia driver.

My trigger is to do any "drag-and-drop" of a firefox menu entry when using the KDE desktop.

Below is a cut-n-paste of the method used to recompile, might help some if you want to do it yourself. Warning, it removes ~/rpmbuild directory.

I've just tested by installing recompiled RPMs and could not reproduce doing 30+ drags, and then;

yum reinstall 'xorg-x11-server*'

reboot and the issue triggers on the first menu entry drag. Will need to work with a fixed desktop for a day trying to trigger the issue a couple of times to "feel" sure about this.

Thanks for the detective work on this ticket.

/Ove


[root@ol7-obi-hv-a xorg]# diff driver.c.orig driver.c.changed
495c495
<     if (ret == -EINVAL || ret == -ENOSYS) {
---
>     if (ret == -ENOSYS) {
[root@ol7-obi-hv-a xorg]# cat doit.sh
#!/bin/bash

yumdownloader --source xorg-x11-server

# install all deps
# yum install '*devel' --exclude='mariadb*' --skip-broken # install too much
#yum install 'xorg*devel' '*GL*devel'

# needed to reinstall libGL (old libs present, compiled did not find libGL-1.2.0)
#yum reinstall -y mesa-libGL-10.6.5-3.20150824.el7.x86_64
# this must be a fluke on the OL72 I'm using


cat > /tmp/0001-driver-remove-einval.patch <<EOF
From: Ove Ewerlid <ove.ewerlid@oracle.com>
Date: Mon Jun 27 16:18:59 CEST 2016
Subject: [PATCH] remove EINVAL check from status of returned kernel call

EOF

diff -c driver.c.orig driver.c

rm -rf ~/rpmbuild/
rpm -i src/xorg-x11-server-1.17.2-10.el7.src.rpm

# Do this  hack rather then "git init; ..." to get the git diff from within a git tree
mkdir -p ~/rpmbuild/BUILD
( cd ~/rpmbuild/BUILD; tar -xjf ../SOURCES/xorg-server-1.17.2.tar.bz2 )
cp -p driver.c.orig  ~/rpmbuild/BUILD/xorg-server-1.17.2/hw/xfree86/drivers/modesetting/driver.c.orig
cp -p driver.c.changed  ~/rpmbuild/BUILD/xorg-server-1.17.2/hw/xfree86/drivers/modesetting/driver.c
( cd ~/rpmbuild/BUILD/xorg-server-1.17.2; git diff hw/xfree86/drivers/modesetting/driver.c.orig hw/xfree86/drivers/modesetting/driver.c >> /tmp/0001-driver-remove-einval.patch )
sed -i 's/.orig//' /tmp/0001-driver-remove-einval.patch
cp -p ~/rpmbuild/SPECS/xorg-x11-server.spec .
cp -p /tmp/0001-driver-remove-einval.patch ~/rpmbuild/SOURCES/

# add new diff to spec
sed -i 's/Patch9305: 0001-modesetting-Claim-PCI-devices-as-PCI-not-platform.patch/Patch9305: 0001-modesetting-Claim-PCI-devices-as-PCI-not-platform.patch\nPatch9990: 0001-driver-remove-einval.patch/' xorg-x11-server.spec
cp -p xorg-x11-server.spec ~/rpmbuild/SPECS/
rpmbuild -bs ~/rpmbuild/SPECS/xorg-x11-server.spec

# Remove to be  sure we use the newly build modified SRC rpm
rm -rf ~/rpmbuild/SOURCES
rm -rf ~/rpmbuild/BUILD

time rpmbuild --rebuild  ~/rpmbuild/SRPMS/xorg-x11-server-1.17.2-10.el7.src.rpm
rm -rf RPMS
mkdir -p RPMS
cp -a ~/rpmbuild/RPMS/* RPMS/
[root@ol7-obi-hv-a xorg]# 

comment:10 Changed 17 months ago by michael

Thanks for investigating too. Then I will submit a patch to the X server and add an ugly work-around to our kernel driver to make them work with broken X servers.

comment:12 Changed 17 months ago by michael

Ove, would you be able to test a slightly less crude patch?

 https://lists.x.org/archives/xorg-devel/2016-July/050324.html

Thanks.

comment:13 Changed 17 months ago by reddipped

Michael, i have an OL 6U8 machine an can test it. I have no experience with applying patches this way. Tried Ove's script but that one does not seem to work without adaption.

comment:14 Changed 17 months ago by michael

reddipped, sadly I do not have much Fedora experience. You could try executing the script as individual commands, line-by-line and paste the results here and we can see if we can work it out.

comment:15 Changed 17 months ago by reddipped

I already tried to fix it, but i do not understand the line 'diff -c driver.c.orig driver.c' because there is no driver.c or driver.c.orig yet. Yumdownlaoder just downloads the package. I could use one of the two suggested diff's and add this in to the tmp/0001-driver-remove-einval.patch fie, but this also does not create the missing files.

comment:16 Changed 17 months ago by michael

I will see if I can reproduce this myself. Can anyone tell me what the quickest way is if I am creating a virtual machine from scratch?

comment:17 Changed 17 months ago by reddipped

You can follow these steps.  http://www.reddipped.com/2016/01/virtualbox-with-soa-12cr2-and-streamexplorer-in-33-minutes/ You could skip almost all steps except the installation of Oracle Linux and JDeveloper. I can reproduce it when using a high resolution (2560x1440) and starting/stopping JDeveloper a few times.

comment:18 Changed 17 months ago by michael

Don't have time just now, so what I have done is to rebuild the modesetting driver from the upstream xorg-server-1.17.4 source, once without once with the patch applied. Please try both of them in the guest (replace the guest's modesetting driver with the file, without the ".patched" or ".unpatched" suffix). You should be able to reproduce the problem with the "unpatched" one but not with the "patched" one.

Changed 17 months ago by michael

Unpatched modesetting driver

Changed 17 months ago by michael

Patched modesetting driver. Note: only compatible with X.Org Server 1.17.x

comment:19 Changed 17 months ago by michael

Just to be clear, those files should only work with X.Org Server 1.17.x ("xorg -version"). I believe that this is the version shipped with Enterprise Linux 6u8.

comment:20 Changed 17 months ago by reddipped

@michael i have 1.17.4 on Oracle Linux 6U8

comment:21 Changed 17 months ago by reddipped

After replacing the modesetting_drv.so the resolution immediately changed to 800x600 (0Hz). Reinstalling Guest Additions and reboot did not resolve this. After restoring file and rebooting the resolution was normal again.

Cheers, Peter

comment:22 Changed 17 months ago by michael

Could you please post an Xorg.0.log file so I can see what went wrong? And I will have another go.

Changed 17 months ago by reddipped

Changed 17 months ago by michael

Unpatched test modesetting driver

Changed 17 months ago by michael

Patched test modesetting driver

comment:23 Changed 17 months ago by michael

Rebuilt the files, but on 64-bit CentOS 6.8. Hopefully they will work better this time.

comment:24 Changed 17 months ago by reddipped

Hi Michael,

Great!

Installed the new driver version en restarted the VM. Working fine now, and have not been able to reproduce this issue till now.

Thanks, Peter

comment:25 Changed 16 months ago by michael

  • Status changed from new to closed
  • Resolution set to invalid
  • Summary changed from Screen refresh only when loosing focus to Screen refresh only when loosing focus -> X server bug, fixed upstream

This has now been fixed in the upstream X server and should be in any future 1.18 and later releases. Unfortunately it could not be back-ported to 1.17, but the Redhat X server maintainer was the person who helped me get this fixed, so if you ask nicely it might be possible to get the RHEL 6 X server fixed.

comment:26 Changed 16 months ago by michael

  • Cc KennyDr added

Adding KennyDr to CC list.

comment:27 Changed 16 months ago by michael

  • Summary changed from Screen refresh only when loosing focus -> X server bug, fixed upstream to Screen refresh only when loosing focus -> X server bug, fixed upstream, work-around in versions higher than 5.1.2
Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use