Bug 1255108

Summary: Eclipse (GTK) on KDE/nouveau: Editor window not correctly refreshed when scrolling
Product: [Fedora] Fedora Reporter: Fredy Neeser <nfd>
Component: eclipseAssignee: Alexander Kurtakov <akurtako>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: airlied, ajax, akurtako, andjrobins, bskeggs, eclipse-sig, jerboaa, krzysztof.daniel, mat.booth, rgrunber
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: eclipse-4.5.0-5.fc22.x86_64 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-28 14:44:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Journal showing nouveau being loaded.
none
Xorg log file
none
Corrupted editor window (partially refreshed at bottom) after scroll down
none
Corrupted editor window (partially refreshed at top) after scroll up
none
~/.xsession-errors with info & errors from KDE Plasma's kwin_core none

Description Fredy Neeser 2015-08-19 16:23:10 UTC
Created attachment 1064926 [details]
Journal showing nouveau being loaded.

Description of problem
----------------------
Eclipse LUNA editor windows are refreshed only partially when scrolling, and this happens *only* with a dual monitor setup, where the i915 and nouveau graphics drivers (for the Intel and Nvidia GPUs, see below) are both active.

The problem is *not* present when I use Eclipse on the laptop screen, with no external monitor attached when logging on to KDE Plasma 5.

With the dual monitor setup, scrolling down with the mouse wheel updates only the bottom portion of the editor window, leaving behind a corrupted view.
Likewise, scrolling up with the mouse wheel updates only the top portion of the editor window. This makes code browsing unusable for me on Fedora 22.

(The editor window is correctly (fully) refreshed only by click-selecting
some other window or clicking in the background.)

This bug occurs *only* if the nouveau driver is active.

I started to debug the scrolling using xev -- the events
are slightly different when the nouveau driver is not involved
(more later).

I'm open to debug this further -- any suggestions?


My setup
--------
Lenovo W530 laptop with integrated Intel and discrete Nvidia graphics
("Optimus" technology, a.k.a. "Hybrid Graphics").
I have a working KDE Plasma 5 dual monitor setup (LVDS + DP), which uses the i915 driver (for the Intel GPU) as well as the nouveau driver (for the Nvidia GPU).

The nouveau driver for Nvidia is necessary with Fedora 22 to get an external monitor to work on the W530 -- I found no other way ...

This setup gives me a composite screen that extends over both the LVDS and
the external monitor and has a very smooth performance when moving around windows -- actually great news given that all drivers are open source !!!


Version-Release number of selected component (if applicable):
xorg-x11-drv-nouveau-1.0.11-2.fc22.x86_64


How reproducible
----------------
The window refresh problem can be reproduced easily by first minimizing and
then un-minimizing the Eclipse application.

The problem occurs under the following conditions:
1.  Hybrid graphics with dual monitor setup (external monitor enabled/working),
    using i915 and nouveau graphics drivers
2.  Scroll in an Eclipse LUNA editor window using the mouse wheel
    or the up/down arrows, or by moving the scrollbars.
    Both Eclipse LUNA SR1a (4.4.1) and Eclipse LUNA SR2 (4.4.2) are affected.
    
Scrolling works as usual with the Eclipse project explorer window.
Also, scrolling works fine in native KDE apps and in Firefox.

The problem is present regardless of whether I use Clearlooks or Adwaita
as my theme for GTK2 in
   KDE Desktop Settings > Application Style > GNOME Application Style

Steps to Reproduce
------------------
1.  On a laptop with "Hybrid Graphics", use a dual monitor setup
    as described, with i915 and nouveau graphics drivers.
    Configure /etc/eclipse.ini for GTK2 by changing the line after
    --launcher.GTK_version to contain 2 (rather than 3).
    (GTK3 does not work at all with Eclipse on Fedora 22.)
    
2.  Start Eclipse LUNA and open a long file in the Eclipse Editor.
    It doesn't matter whether Eclipse is on the laptop screen
    or on the external monitor.
    
3.  Minimize the Eclipse application.

4.  Un-minimize the Eclipse application and scroll down and/or up
    in the editor window  ==>  Editor window is partially refreshed
    
5.  Click somewhere else  ==>  Editor window is completely refreshed

6.  Repeat by going to 3.


Actual results:
Scrolling leaves editor window in a partially updated (corrupted) state.

Expected results:
Scrolling should fully update the editor window.


Additional info
---------------
# lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 VGA compatible controller: NVIDIA Corporation GK107GLM [Quadro K1000M] (rev a1)

# lsmod | egrep "i915|nouveau"
nouveau              1417216  1
mxm_wmi                16384  1 nouveau
ttm                    94208  1 nouveau
i915                 1097728  14
i2c_algo_bit           16384  2 i915,nouveau
drm_kms_helper        122880  2 i915,nouveau
drm                   327680  19 ttm,i915,drm_kms_helper,nouveau
wmi                    20480  2 mxm_wmi,nouveau
video                  24576  2 i915,nouveau

# uname -r
4.1.3-201.fc22.x86_64

# rpm -qa | egrep "kf5-kwindowsystem|kwin|gtk2|mesa|xorg|drm"
(sorted output)

kf5-kwindowsystem-5.12.0-1.fc22.x86_64
kwin-libs-5.3.2-1.fc22.x86_64
kwin-5.3.2-1.fc22.x86_64

gtk2-2.24.28-1.fc22.x86_64
gtk2-devel-2.24.28-1.fc22.x86_64
gtk2-2.24.28-1.fc22.i686
gtk2-engines-2.20.2-9.fc22.x86_64

ibus-gtk2-1.5.10-5.fc22.x86_64
adwaita-gtk2-theme-3.16.2-1.fc22.x86_64
oxygen-gtk2-1.4.6-2.fc22.x86_64
oxygen-gtk2-1.4.6-2.fc22.i686

mesa-dri-drivers-10.6.3-1.20150729.fc22.x86_64
mesa-libgbm-10.6.3-1.20150729.fc22.x86_64
mesa-libgbm-10.6.3-1.20150729.fc22.i686
mesa-libglapi-10.6.3-1.20150729.fc22.x86_64
mesa-libglapi-10.6.3-1.20150729.fc22.i686
mesa-libEGL-10.6.3-1.20150729.fc22.x86_64
mesa-libEGL-devel-10.6.3-1.20150729.fc22.x86_64
mesa-libEGL-10.6.3-1.20150729.fc22.i686
mesa-libGLU-9.0.0-7.fc22.x86_64
mesa-libGLU-devel-9.0.0-7.fc22.x86_64
mesa-libGLU-9.0.0-7.fc22.i686
mesa-libGL-10.6.3-1.20150729.fc22.x86_64
mesa-libGL-devel-10.6.3-1.20150729.fc22.x86_64
mesa-libGL-10.6.3-1.20150729.fc22.i686
mesa-libGLES-10.6.3-1.20150729.fc22.x86_64
mesa-libwayland-egl-10.6.3-1.20150729.fc22.x86_64

xorg-x11-utils-7.5-19.fc22.x86_64
xorg-x11-server-Xwayland-1.17.2-2.fc22.x86_64
xorg-x11-drv-libinput-0.11.0-3.fc22.x86_64
xorg-x11-xinit-1.3.4-8.fc22.x86_64
xorg-x11-drv-evdev-2.9.2-1.fc22.x86_64
xorg-x11-proto-devel-7.7-12.fc21.noarch
xorg-x11-drv-vesa-2.3.2-20.fc22.x86_64

xorg-x11-drv-nouveau-1.0.11-2.fc22.x86_64
xorg-x11-drv-intel-2.99.917-12.20150615.fc22.x86_64

xorg-x11-server-utils-7.7-15.fc22.x86_64
xorg-x11-xkb-utils-7.7-13.fc22.x86_64
xorg-x11-server-Xorg-1.17.2-2.fc22.x86_64
xorg-x11-drv-openchrome-0.3.3-14.fc22.x86_64
xorg-x11-drv-vmmouse-13.0.99-1.fc22.x86_64
xorg-x11-drv-fbdev-0.4.3-20.fc22.x86_64
xorg-x11-xbitmaps-1.1.1-7.fc21.noarch
xorg-x11-drv-qxl-0.1.3-2.fc22.x86_64
xorg-x11-server-common-1.17.2-2.fc22.x86_64

libdrm-2.4.61-3.fc22.x86_64
libdrm-devel-2.4.61-3.fc22.x86_64
libdrm-2.4.61-3.fc22.i686

# rpm -qa | egrep "eclipse" | egrep "platform|swt"
eclipse-swt-4.4.2-6.fc22.x86_64
eclipse-platform-4.4.2-6.fc22.x86_64


Attachment
----------
In the attached journal, I removed many repeated drm "Unsupported type value" errors.  These drm errors disappear when I change the KDE Display Configuration (Dual Monitor) for "No Primary Output" (changed after booting).
Hence, during the application tests of this bug report, no such errors
appeared in the journal.

Comment 1 Fredy Neeser 2015-08-19 17:06:45 UTC
Created attachment 1064930 [details]
Xorg log file

Comment 2 Fredy Neeser 2015-08-19 17:09:35 UTC
Created attachment 1064931 [details]
Corrupted editor window (partially refreshed at bottom) after scroll down

Comment 3 Fredy Neeser 2015-08-19 17:10:39 UTC
Created attachment 1064932 [details]
Corrupted editor window (partially refreshed at top) after scroll up

Comment 4 Fredy Neeser 2015-08-19 17:18:14 UTC
Created attachment 1064933 [details]
~/.xsession-errors  with info & errors from KDE Plasma's kwin_core

Comment 5 Fredy Neeser 2015-08-19 17:34:11 UTC
The X events below were captured with the help of 'xwininfo' and 'xev -id ...', first for scroll-down with the dual-monitor setup (causing window corruption), and then for scroll-down with a laptop-screen-only setup (no window corruption). 

X events for scroll-down in Eclipse editor window (dual-monitor setup)
----------------------------------------------------------------------
% Window does not refresh correctly.
%
% Scroll down: The following events are grouped together in time
%   state: 12288 = 0x3000
%
LeaveNotify event, serial 18, synthetic NO, window 0x5e001b4,
    root 0x13d, subw 0x0, time 5711250, (1027,656), root:(4011,685),
    mode NotifyGrab, detail NotifyAncestor, same_screen YES,
    focus NO, state 12288

EnterNotify event, serial 18, synthetic NO, window 0x5e001b4,
    root 0x13d, subw 0x0, time 5711251, (1027,656), root:(4011,685),
    mode NotifyUngrab, detail NotifyAncestor, same_screen YES,
    focus NO, state 12288

KeymapNotify event, serial 18, synthetic NO, window 0x0,
    keys:  61  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

PropertyNotify event, serial 18, synthetic NO, window 0x5e001b4,
    atom 0x15b (_NET_WM_USER_TIME), time 5711255, state PropertyNewValue


X events for scroll-down in Eclipse editor window (laptop-screen-only setup)
----------------------------------------------------------------------------
% Window refreshes correctly.
%
% Scroll down #1: The following events are grouped together in time
%   state: 4096 = 0x1000
%    
LeaveNotify event, serial 18, synthetic NO, window 0x68001b9,
    root 0x13d, subw 0x0, time 11267225, (766,291), root:(1547,334),
    mode NotifyGrab, detail NotifyAncestor, same_screen YES,
    focus NO, state 4096

EnterNotify event, serial 18, synthetic NO, window 0x68001b9,
    root 0x13d, subw 0x0, time 11267226, (766,291), root:(1547,334),
    mode NotifyUngrab, detail NotifyAncestor, same_screen YES,
    focus NO, state 4096

KeymapNotify event, serial 18, synthetic NO, window 0x0,
    keys:  4294967180 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

PropertyNotify event, serial 18, synthetic NO, window 0x68001b9,
    atom 0x15b (_NET_WM_USER_TIME), time 11267232, state PropertyNewValue


% Scroll down #2: Looked slightly different
%   (keys: 61, further diffs not shown here)

Comment 6 Fredy Neeser 2015-08-19 17:42:30 UTC
Regarding Comment 5, note that

- Scroll up/down events w/ dual-monitor setup have additional bit 0x2000 in state
- Scroll up/down events w/ laptop screen only do NOT have     bit 0x2000 in state

Not sure if that can make a difference to a GTK application?


Also special about the X events in Comment 5 (for a GTK application window) is the lack of ButtonPress / ButtonRelease events.

In a non GTK X window, scroll down produces

% Scroll down: The following events are grouped together in time
%
LeaveNotify event, serial 40, synthetic NO, window 0x7000001,
    root 0x13d, subw 0x0, time 7574352, (97,136), root:(2021,1398),
    mode NotifyGrab, detail NotifyAncestor, same_screen YES,
    focus NO, state 12288

EnterNotify event, serial 40, synthetic NO, window 0x7000001,
    root 0x13d, subw 0x0, time 7574354, (97,136), root:(2021,1398),
    mode NotifyUngrab, detail NotifyAncestor, same_screen YES,
    focus NO, state 12288

KeymapNotify event, serial 40, synthetic NO, window 0x0,
    keys:  61  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

ButtonPress event, serial 40, synthetic NO, window 0x7000001,
    root 0x13d, subw 0x0, time 7574352, (97,136), root:(2021,1398),
    state 0x0, button 5, same_screen YES

ButtonRelease event, serial 40, synthetic NO, window 0x7000001,
    root 0x13d, subw 0x0, time 7574352, (97,136), root:(2021,1398),
    state 0x3000, button 5, same_screen YES

Comment 7 Fredy Neeser 2015-08-20 13:36:47 UTC
Today's update to Eclipse MARS with these updates

  eclipse-equinox-osgi-4.5.0-5.fc22.x86_64
  eclipse-pde-4.5.0-5.fc22.x86_64
  eclipse-platform-4.5.0-5.fc22.x86_64
  eclipse-jdt-4.5.0-5.fc22.x86_64
  eclipse-swt-4.5.0-5.fc22.x86_64
  eclipse-ecf-core-3.10.0-5.fc22.x86_64

changed /etc/eclipse.ini to use GTK3.

With Eclipse JUNO, GTK3 did not work at all for me (corrupted editor window when scrolling).

Now with Eclipse MARS, GTK3 looks better and scrolling seems to work, except that I don't like the GTK3 "overlay scrollbars".  These are activated only when clicked (with content shining through ...), which I find rather disturbing when working on a large desktop monitor.

After googling for quite a while, I came across this discussion

  https://www.reddit.com/r/gnome/comments/37bp1r/how_do_i_disable_316s_overlay_scrollbars/

and by adding the line
GTK_OVERLAY_SCROLLING=0

to ~/.profile, I got rid of the overlay scrollbars in both gedit and eclipse.
(Don't try LIBOVERLAY_SCROLLBAR=0, that's Ubuntu and doesn't work in Fedora.)


I also tested Eclipse MARS with GTK2, but with that configuration, the editor window still does not correctly refresh when scrolling.

==> I guess the bug should be reassigned to Eclipse or GTK2.

Comment 8 Alexander Kurtakov 2015-08-20 13:39:27 UTC
GTK2 backend of SWT/Eclipse is something we don't have resources to deal with so people using it should be ready to provide patches for problems they may met.

Comment 9 Mat Booth 2015-10-28 14:44:51 UTC
Hi Fredy,

Fedora 22 and up now ship with Mars.1.

Since we no longer support running Eclipse on GTK2 in Fedora and given that you acknowledge that GTK3 now works for you in combination with Eclipse Mars, I am going to close this bug.

Thanks for your report.