Bug 1266025

Summary: [PATCH] Sigsegv in i965 driver (get_stencil_miptree), plasma crashes after login
Product: [Fedora] Fedora Reporter: Giulio Bernardi <ugilio>
Component: mesaAssignee: Adam Jackson <ajax>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: ajax, fschwarz, ignatenko, ugilio
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-07 09:03:35 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
Stack trace
none
The patch none

Description Giulio Bernardi 2015-09-24 10:45:58 UTC
Created attachment 1076457 [details]
Stack trace

Description of problem:
On the machine I use at work sometimes plasma crashes after the login, before showing the KDE desktop. Investigation with gdb might have shown the cause of the problem.

Version-Release number of selected component (if applicable):
mesa-dri-drivers-10.6.3-3.20150729.fc22.x86_64

How reproducible:
Sometimes


Steps to Reproduce:
1. In KDM, perform the login

Actual results:
Sometimes plasma crashes before showing the desktop

Expected results:
Plasma should start and show the desktop

Additional info:
I Launched gdb from the KDE crash handler (drkonqi?), see attached stack trace. The crash happened at brw_misc_state.c:215, that is:

(gdb) list
210     static struct intel_mipmap_tree *
211     get_stencil_miptree(struct intel_renderbuffer *irb)
212     {
213        if (!irb)
214           return NULL;
215        if (irb->mt->stencil_mt)
216           return irb->mt->stencil_mt;
217        return irb->mt;
218     }
219

It turns out that irb->mt was null:

(gdb) print irb->mt
$3 = (struct intel_mipmap_tree *) 0x0

I modified the line to read

if (irb->mt && irb->mt->stencil_mt)

(see the patch at the end of this report, it looks like I cannot add more than one attachment) and so far (a couple of restarts, a shutdown, and a tenth of logouts/logins) no crash happened.

However, since the crash is not always reproducible, I cannot be 100% sure.


The video card is

00:02.0 VGA compatible controller: Intel Corporation 4 Series Chipset Integrated Graphics Controller (rev 03)

I am using the intel driver with UXA acceleration method (not SNA).
Glxinfo says:

server glx vendor string: SGI
server glx version string: 1.4
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) G45/G43 
OpenGL version string: 2.1 Mesa 10.6.3 (git-ccef890)
OpenGL shading language version string: 1.20
OpenGL ES profile version string: OpenGL ES 2.0 Mesa 10.6.3 (git-ccef890)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16

I think this is not a duplicate of bugs like this:
https://bugs.freedesktop.org/show_bug.cgi?id=77402
because it was fixed long ago.

It might be related to EOLed bugs 1220985, 1163587, 1146582, 1124035, 1123691, 1117453, 1070417, 1141358 though. 

This is the patch:
diff -r -N -u mesa-20150729.orig/src/mesa/drivers/dri/i965/brw_misc_state.c mesa-20150729/src/mesa/drivers/dri/i965/brw_misc_state.c
--- mesa-20150729.orig/src/mesa/drivers/dri/i965/brw_misc_state.c       2015-07-29 01:58:03.000000000 +0200
+++ mesa-20150729/src/mesa/drivers/dri/i965/brw_misc_state.c    2015-09-24 10:41:37.922718969 +0200
@@ -212,7 +212,7 @@
 {
    if (!irb)
       return NULL;
-   if (irb->mt->stencil_mt)
+   if (irb->mt && irb->mt->stencil_mt)
       return irb->mt->stencil_mt;
    return irb->mt;
 }

Comment 1 Giulio Bernardi 2015-09-24 10:47:32 UTC
Created attachment 1076459 [details]
The patch

Comment 2 Igor Gnatenko 2015-09-24 10:52:01 UTC
Can you send it to upstream?

Comment 3 Giulio Bernardi 2015-09-24 12:37:21 UTC
Reported upstream at https://bugs.freedesktop.org/show_bug.cgi?id=92103

Comment 4 Igor Gnatenko 2016-07-07 09:03:35 UTC
Fixed in upstream.