Bug 308369 - KWIN crashing (OpenGL) randomly when enter displaysettings
Summary: KWIN crashing (OpenGL) randomly when enter displaysettings
Status: RESOLVED DUPLICATE of bug 308385
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 4.9.2
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 308398 316702 318010 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-10-14 11:52 UTC by Mikael Hermansson
Modified: 2013-04-08 07:13 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:
mgraesslin: Intel+
thomas.luebking: Mesa+


Attachments
glxinfo (16.02 KB, text/plain)
2012-10-14 20:34 UTC, Stefan Derkits
Details
qdbus org.kde.kwin /KWin supportInformation (2.02 KB, text/plain)
2012-10-14 20:34 UTC, Stefan Derkits
Details
glxinfo from my lenovo X230 (19.00 KB, text/plain)
2012-10-15 18:23 UTC, Mikael Hermansson
Details
kwin supportinfo from my leovo X230 (4.18 KB, text/plain)
2012-10-15 18:26 UTC, Mikael Hermansson
Details
New crash information added by DrKonqi (5.48 KB, text/plain)
2012-10-18 15:29 UTC, Unknown
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Hermansson 2012-10-14 11:52:30 UTC
Application: kwin (4.9.2)
KDE Platform Version: 4.9.2
Qt Version: 4.8.3
Operating System: Linux 3.5.0-17-generic x86_64
Distribution: Ubuntu 12.10

-- Information about the crash:
- What I was doing when the application crashed:

If turning on external DP1 screen 2560x1440, in DisplaySettings, 
KWin often crashing if Desktop effects is enabled. 

This also happens if I try reenable Effects after crash.  If I do "Reenable OpenGL effects" it says desktop effects could not be loaded and kwin crashes. 

Dont sure how it really works but to me it seems kwin trying to enable the OpenGL modules BEFORE OpenGL has been fully initialized? Just I wild guess. So is there any way I can enable desktop effects from console and the spawn kwin manually, to see if that actually is the case? 


Btw. if i logout from KDE and login again desktop effects works as expected. So to me it seems only happen if I turn on screen after login via displaysettings.


HW is:

Lenovo X230 with latest Intel GFX: GMA4000 

External screen is: 2560x1440 and internal LVDS screen (if enabled) is 1360x780

Actually I am not 100% sure it is related to KWIN or the GFX kernel driver so if someone knows better please move this to correct place.

Dist: kubuntu 12.10 beta
Kernel: Linux version 3.5.0-17-generic

The crash can be reproduced some of the time.

-- Backtrace:
Application: KWin (kwin), signal: Bus error
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[KCrash Handler]
#6  __memset_sse2 () at ../sysdeps/x86_64/multiarch/../memset.S:908
#7  0x00007f7ae0bdade6 in memset (__len=<optimized out>, __ch=255, __dest=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/string3.h:85
#8  intel_miptree_alloc_mcs (intel=intel@entry=0x1644a50, mt=0x1820a20, num_samples=num_samples@entry=8) at intel_mipmap_tree.c:823
#9  0x00007f7ae0bdb0cd in intel_miptree_create_for_renderbuffer (intel=intel@entry=0x1644a50, format=format@entry=MESA_FORMAT_ARGB8888, width=<optimized out>, height=<optimized out>, num_samples=num_samples@entry=8) at intel_mipmap_tree.c:480
#10 0x00007f7ae0bdbdf7 in intel_miptree_create_for_dri2_buffer (intel=intel@entry=0x1644a50, dri_attachment=1, format=MESA_FORMAT_ARGB8888, num_samples=num_samples@entry=8, region=0x1633cb0) at intel_mipmap_tree.c:372
#11 0x00007f7ae0bd70ab in intel_process_dri2_buffer (buffer_name=0x7f7ae0c58f29 "dri2 back buffer", rb=0x16da840, buffer=<optimized out>, intel=0x1644a50, drawable=<optimized out>) at intel_context.c:1024
#12 intel_update_renderbuffers (context=context@entry=0x125be50, drawable=drawable@entry=0x12552a0) at intel_context.c:389
#13 0x00007f7ae0bd7202 in intel_prepare_render (intel=intel@entry=0x1644a50) at intel_context.c:408
#14 0x00007f7ae0bd7ec7 in intelMakeCurrent (driContextPriv=0x125be50, driDrawPriv=0x12552a0, driReadPriv=0x12552a0) at intel_context.c:886
#15 0x00007f7ae0c55876 in driBindContext (pcp=<optimized out>, pdp=<optimized out>, prp=<optimized out>) at dri_util.c:381
#16 0x00007f7afa336dcf in dri2_bind_context (context=0x1258810, old=<optimized out>, draw=<optimized out>, read=<optimized out>) at dri2_glx.c:154
#17 0x00007f7afa30f0b4 in MakeContextCurrent (dpy=0x1106350, draw=81793490, read=81793490, gc_user=0x1258810) at glxcurrent.c:269
#18 0x00007f7afdf663a0 in KWin::SceneOpenGL::initRenderingContext (this=this@entry=0x14a8580) at ../../kwin/scene_opengl_glx.cpp:193
#19 0x00007f7afdf6835c in KWin::SceneOpenGL::SceneOpenGL (this=0x14a8580, ws=<optimized out>) at ../../kwin/scene_opengl_glx.cpp:55
#20 0x00007f7afdf56df8 in KWin::Workspace::slotCompositingOptionsInitialized (this=this@entry=0x1228410) at ../../kwin/composite.cpp:143
#21 0x00007f7afdf571b1 in setupCompositing (this=0x1228410) at ../../kwin/composite.cpp:110
#22 KWin::Workspace::setupCompositing (this=0x1228410) at ../../kwin/composite.cpp:83
#23 0x00007f7afdeea524 in KWin::Workspace::slotReconfigure (this=0x1228410) at ../../kwin/workspace.cpp:1020
#24 0x00007f7afdef014a in qt_static_metacall (_a=<optimized out>, _id=<optimized out>, _o=<optimized out>, _c=<optimized out>) at ./workspace.moc:354
#25 KWin::Workspace::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at ./workspace.moc:269
#26 0x00007f7af9873f5f in QMetaObject::activate (sender=0x1228778, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3547
#27 0x00007f7af987326c in QObject::event (this=0x1228778, e=<optimized out>) at kernel/qobject.cpp:1157
#28 0x00007f7af8c05e9c in QApplicationPrivate::notify_helper (this=this@entry=0x10e1db0, receiver=receiver@entry=0x1228778, e=e@entry=0x7ffffd974140) at kernel/qapplication.cpp:4562
#29 0x00007f7af8c0a30a in QApplication::notify (this=0x7ffffd974780, receiver=0x1228778, e=0x7ffffd974140) at kernel/qapplication.cpp:4423
#30 0x00007f7afd6d01d6 in KApplication::notify (this=0x7ffffd974780, receiver=0x1228778, event=0x7ffffd974140) at ../../kdeui/kernel/kapplication.cpp:311
#31 0x00007f7af985e56e in QCoreApplication::notifyInternal (this=0x7ffffd974780, receiver=0x1228778, event=0x7ffffd974140) at kernel/qcoreapplication.cpp:915
#32 0x00007f7af988f462 in sendEvent (event=0x7ffffd974140, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#33 QTimerInfoList::activateTimers (this=0x10e28f8) at kernel/qeventdispatcher_unix.cpp:611
#34 0x00007f7af988f4c0 in QEventDispatcherUNIX::activateTimers (this=this@entry=0x108cad0) at kernel/qeventdispatcher_unix.cpp:868
#35 0x00007f7af988f618 in QEventDispatcherUNIX::processEvents (this=0x108cad0, flags=...) at kernel/qeventdispatcher_unix.cpp:930
#36 0x00007f7af8caba3f in QEventDispatcherX11::processEvents (this=0x108cad0, flags=...) at kernel/qeventdispatcher_x11.cpp:152
#37 0x00007f7af985d2bf in QEventLoop::processEvents (this=this@entry=0x7ffffd974490, flags=...) at kernel/qeventloop.cpp:149
#38 0x00007f7af985d548 in QEventLoop::exec (this=0x7ffffd974490, flags=...) at kernel/qeventloop.cpp:204
#39 0x00007f7af9862708 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1187
#40 0x00007f7afdf0fe34 in kdemain (argc=3, argv=0x7ffffd9748c8) at ../../kwin/main.cpp:545
#41 0x00007f7afdb0f76d in __libc_start_main (main=0x4006a0 <main(int, char**)>, argc=3, ubp_av=0x7ffffd9748c8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffffd9748b8) at libc-start.c:226
#42 0x00000000004006d1 in _start ()

Reported using DrKonqi
Comment 1 Martin Flöser 2012-10-14 12:01:35 UTC
Looks quite likely like a driver bug. You could try to restart kwin from a command line after that crash occurred:
kwin --replace &

Anyway, could you please upload the output of:
qdbus org.kde.kwin /KWin supportInformation

and
glxinfo -l
Comment 2 Thomas Lübking 2012-10-14 20:31:53 UTC
*** Bug 308398 has been marked as a duplicate of this bug. ***
Comment 3 Stefan Derkits 2012-10-14 20:34:14 UTC
Created attachment 74547 [details]
glxinfo
Comment 4 Stefan Derkits 2012-10-14 20:34:37 UTC
Created attachment 74548 [details]
qdbus org.kde.kwin /KWin supportInformation
Comment 5 Stefan Derkits 2012-10-14 20:35:20 UTC
Attached my information. KWin smoothly restarts when it crashes and (in my case) it only crashes when enabling compositing.
Comment 6 Thomas Lübking 2012-10-14 20:46:58 UTC
What's your (combined?) screen resolution?
Comment 7 Stefan Derkits 2012-10-14 20:48:47 UTC
Laptop Display: 1920x1080, LCD connected via VGA: 1920x1200
Comment 8 Thomas Lübking 2012-10-14 20:53:58 UTC
Do you get the same crash with the internal display only?
Comment 9 Stefan Derkits 2012-10-14 21:09:07 UTC
If only one of them is active, Desktop Effects can be enabled without any problem. Also if the second display is activated afterwards, the Desktop Effects still work. If they are deactivated, they can't be activated again without crashing KWin.
Comment 10 Thomas Lübking 2012-10-14 21:40:10 UTC
Do you have a smaller external screen so that if you arrange the displays vertically you stay below 2048px in either direction (ie. the external height should be < 969px) or can you try to arrange the displays overlapping to stay in that bounds?
Comment 11 Mikael Hermansson 2012-10-15 18:23:13 UTC
Created attachment 74566 [details]
glxinfo from my lenovo X230
Comment 12 Mikael Hermansson 2012-10-15 18:26:37 UTC
Created attachment 74567 [details]
kwin supportinfo from my leovo X230
Comment 13 Mikael Hermansson 2012-10-15 18:57:35 UTC
(In reply to comment #10)
> Do you have a smaller external screen so that if you arrange the displays
> vertically you stay below 2048px in either direction (ie. the external
> height should be < 969px) or can you  oo arrange the displays overlapping
> to stay in that bounds?

It turns out if I first turn off Laptopo screen and then turn on extmonitor in lower resolution(1920x1440) kwin does not crash then I switch to highest res (2560x1440) afterwards.

like this litle script:

if [ "$1" == "--lpoff" ]
  then
    xrandr --output LVDS1 --off

    xrandr --output DP1 --mode 1920x1440
    xrandr --output DP1 --mode 2560x1440
    exit 0
fi
Comment 14 Mikael Hermansson 2012-10-15 19:03:14 UTC
(In reply to comment #10)
> Do you have a smaller external screen so that if you arrange the displays
> vertically you stay below 2048px in either direction (ie. the external
> height should be < 969px) or can you  oo arrange the displays overlapping
> to stay in that bounds?

It turns out if I first turn off Laptopo screen and then turn on extmonitor in lower resolution(1920x1440) kwin does not crash then I switch to highest res (2560x1440) afterwards and it works.

like this little script:

if [ "$1" == "--lpoff" ]
  then
    xrandr --output LVDS1 --off
    #if I remove this line kwin crash when call this script with --lpoff
    xrandr --output DP1 --mode 1920x1440
    # the res I want
    xrandr --output DP1 --mode 2560x1440
    exit 0
fi

#However turning on both screen does not work with Compositor it seems...
if [ "$1" == "--both" ]
then
  xrandr --output LVDS1 --mode 1366x768
  xrandr --output DP1 --mode 1920x1440
  xrandr --output DP1 --mode 2560x1440 --left-of LVDS1 --primary
  exit 0
fi
Comment 15 Thomas Lübking 2012-10-15 19:49:42 UTC
> #However turning on both screen does not work with Compositor it seems...
Does it work with 1920x1440 on the ext screen or does this

xrandr --output DP1 --mode 2560x1440 --pos 0x0 --primary
xrandr --output LVDS1 --mode 1366x768 --pos 683x0

work? (makes LVDS1 extend DP1 by 1px to the right)

It will likely be size driven (and in that case also a driver bug, since the GPU or at least MESA propagates:

GL_MAX_TEXTURE_SIZE = 8192
GL_MAX_VIEWPORT_DIMS = 16384, 16384
GL_MAX_RECTANGLE_TEXTURE_SIZE_NV = 4096

and you're not near any of those limitations.)
Comment 16 Martin Flöser 2012-10-15 20:46:49 UTC
random maybe unrelated note: we currently have quite a lot of various reported issues around the combination of Kubuntu 12.10, Mesa 9 and Intel. It seems to be all Ivybridge. Somehow I'd say they are all related and I'd love to figure that one out before the Kubuntu release

As a reference for example Bug #308245
Comment 17 Mikael Hermansson 2012-10-16 18:30:00 UTC
(In reply to comment #15)
> > #However turning on both screen does not work with Compositor it seems...
> Does it work with 1920x1440 on the ext screen or does this
> 
> xrandr --output DP1 --mode 2560x1440 --pos 0x0 --primary
> xrandr --output LVDS1 --mode 1366x768 --pos 683x0
> 
> work? (makes LVDS1 extend DP1 by 1px to the right)
> 
> It will likely be size driven (and in that case also a driver bug, since the
> GPU or at least MESA propagates:
> 
> GL_MAX_TEXTURE_SIZE = 8192
> GL_MAX_VIEWPORT_DIMS = 16384, 16384
> GL_MAX_RECTANGLE_TEXTURE_SIZE_NV = 4096
> 
> and you're not near any of those limitations.)

(In reply to comment #15)
> > #However turning on both screen does not work with Compositor it seems...
> Does it work with 1920x1440 on the ext screen or does this
> 
> xrandr --output DP1 --mode 2560x1440 --pos 0x0 --primary
> xrandr --output LVDS1 --mode 1366x768 --pos 683x0
> 
> work? (makes LVDS1 extend DP1 by 1px to the right)
> 
> It will likely be size driven (and in that case also a driver bug, since the
> GPU or at least MESA propagates:
> 
> GL_MAX_TEXTURE_SIZE = 8192
> GL_MAX_VIEWPORT_DIMS = 16384, 16384
> GL_MAX_RECTANGLE_TEXTURE_SIZE_NV = 4096
> 
> and you're not near any of those limitations.)

Buserror:

DP1 1920x1440
LVDS1 1380x768 

Below works (except the position of LVDS is confusing...) 

xrandr --output DP1 --mode 2560x1440 --pos 0x0 --primary
xrandr --output LVDS1 --mode 1366x768 --pos 683x0
Comment 18 Thomas Lübking 2012-10-16 18:53:06 UTC
What about this:
xrandr --output DP1 --mode 2560x1440 --pos 0x0 --primary
xrandr --output LVDS1 --mode 1366x768 --pos 1706x0

and in copmarism this:
xrandr --output DP1 --mode 2560x1440 --pos 0x0 --primary
xrandr --output LVDS1 --mode 1366x768 --pos 1707x0
Comment 19 Mikael Hermansson 2012-10-17 19:55:22 UTC
About Commen 18:

The first crashed kwin BUT this time effect was still active after restart of kwin.... (No need to go to the effects setting to enable composite)

Second worked also and didn't crash kwin.

Also tried some more tweeking by start around --pos 2000x0 increment pos with step around 100 but when reach around >2400 I step increment only by 10 pix until I reached 2550 when a then changed to 2560 it crashed....

then I changed res back to 2550 and tried to enable desktop effects and do kwin --replace but then kwin crashed hmm...
Comment 20 Thomas Lübking 2012-10-17 20:31:47 UTC
Means it was likely some different, unrelated patch (Ubuntu had a bad libxrandr version)

However, there seems no "magic hidden border" like 2048+1024 which causes this. There's just some memory corruption error on the higher areas.

If you move the screens on top of each other, can you offset the y of the smaller one to 3328 (so you'll get 3328+768=4096)?
Comment 21 Unknown 2012-10-18 15:29:34 UTC
Created attachment 74628 [details]
New crash information added by DrKonqi

kwin (4.9.2) on KDE Platform 4.9.2 using Qt 4.8.3

- What I was doing when the application crashed:
I was connecting an external 27" monitor to my 14" laptop via VGA.  
- Unusual behavior I noticed:
The first time I connected the monitor, kwin didn't crash, the second time did. 
Both times the computer became slow. When disconnecting the external monitor the laptop was thinking to be larger than it actualy is, so I have a good part of my application windows outside the visible area (I've taken a screenshot if needed)
As already stated logging out and in again reenable effects and the normal size of the screen.
I'm also on Intel Ivy Bridge with integrated graphics.

-- Backtrace (Reduced):
#6  __memset_sse2 () at ../sysdeps/x86_64/multiarch/../memset.S:908
#7  0x00007f51ea70cde6 in memset (__len=<optimized out>, __ch=255, __dest=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/string3.h:85
#8  intel_miptree_alloc_mcs (intel=intel@entry=0x20663e0, mt=0x22648f0, num_samples=num_samples@entry=8) at intel_mipmap_tree.c:823
#9  0x00007f51ea70d0cd in intel_miptree_create_for_renderbuffer (intel=intel@entry=0x20663e0, format=format@entry=MESA_FORMAT_ARGB8888, width=<optimized out>, height=<optimized out>, num_samples=num_samples@entry=8) at intel_mipmap_tree.c:480
#10 0x00007f51ea70ddf7 in intel_miptree_create_for_dri2_buffer (intel=intel@entry=0x20663e0, dri_attachment=1, format=MESA_FORMAT_ARGB8888, num_samples=num_samples@entry=8, region=0x20f0f70) at intel_mipmap_tree.c:372
Comment 22 Thomas Lübking 2012-10-18 17:00:51 UTC
correlates with apparent memory curruption of bug #308245
same system, same OS, same MESA 9.0

can anyone reproduce this bug on (downgraded) MESA 8.x?
Comment 23 Mikael Hermansson 2012-10-19 19:24:41 UTC
Finally got some time over to downgrade libmesa to 8.0.4 and the problem with crashing kwin is gone!

also  bug #308245 so yes those bugs in combination of mesa 9 seems related atleast onb GMA4000.
Comment 24 Thomas Lübking 2012-10-19 20:11:50 UTC
There's somewhere a memory corruption and given bug #308245 and other bugs we get around mesa 9.0, it's there - or at least in the 64bit version shipped by ubuntu.
Comment 25 Thomas Lübking 2012-11-04 17:36:25 UTC
THIS is likely the multisample issue, see bug #308385

*** This bug has been marked as a duplicate of bug 308385 ***
Comment 26 Martin Flöser 2013-03-14 09:08:23 UTC
*** Bug 316702 has been marked as a duplicate of this bug. ***
Comment 27 Martin Flöser 2013-04-08 07:13:05 UTC
*** Bug 318010 has been marked as a duplicate of this bug. ***