Bug 75723

Summary: (regression since Linux 3.14?) brw_get_graphics_reset_status: Assertion `brw->hw_ctx != ((void *)0)' failed
Product: Mesa Reporter: Peter Wu <peter>
Component: Drivers/DRI/i965Assignee: Ian Romanick <idr>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: major    
Priority: high CC: andreas.sturmlechner, arthur.titeica, bjoern, Magnus.Kessler, meiko, patrakov, peter, rsalvaterra, shawn.starr, tjaalton, vasyl.demin
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: gdb backtrace from kwin with symbols
proposed patch

Description Peter Wu 2014-03-03 16:59:00 UTC
Created attachment 95042 [details]
gdb backtrace from kwin with symbols

Since I upgraded some packages (including Linux 3.13.2 -> 3.14-rc5, but not Mesa nor xf86-video-intel), I am unable to run KWin with desktop effects enabled.

Daniel Vetter suggested in #intel-gfx that this may be buggy Mesa code that was triggered due to a change in 3.14, "enable[ment of] reset stat support".

Distribution: Arch Linux x86_64
Linux: v3.14-rc5
Mesa: 10.0.3-1
kde-workspace: 4.11.6-3
Comment 1 Timo Aaltonen 2014-04-01 04:45:21 UTC
we're now hitting this on Ubuntu since adding the separate i915_bdw module that needed some drm/i915 changes from 3.14 to build, namely

drm/i915: add i915_get_reset_stats_ioctl
drm/i915: add i915_reset_count

so mesa 10.1 needs some backports from master?
Comment 2 Mika Kuoppala 2014-04-01 07:30:38 UTC
(In reply to comment #1)
> we're now hitting this on Ubuntu since adding the separate i915_bdw module
> that needed some drm/i915 changes from 3.14 to build, namely
> 
> drm/i915: add i915_get_reset_stats_ioctl
> drm/i915: add i915_reset_count
> 
> so mesa 10.1 needs some backports from master?

I think it needs:

commit 0c3fd8708fc54b4b46f5db20d34eb29508537b08
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Wed Nov 20 08:32:14 2013 -0800

    intel: Use memset instead of VG_CLEAR

included in libdrm 2.4.49
Comment 3 Mika Kuoppala 2014-04-01 07:32:44 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > we're now hitting this on Ubuntu since adding the separate i915_bdw module
> > that needed some drm/i915 changes from 3.14 to build, namely
> > 
> > drm/i915: add i915_get_reset_stats_ioctl
> > drm/i915: add i915_reset_count
> > 
> > so mesa 10.1 needs some backports from master?
> 
> I think it needs:
> 
> commit 0c3fd8708fc54b4b46f5db20d34eb29508537b08
> Author: Ian Romanick <ian.d.romanick@intel.com>
> Date:   Wed Nov 20 08:32:14 2013 -0800
> 
>     intel: Use memset instead of VG_CLEAR
> 
> included in libdrm 2.4.49

Ah well it needs atleast that, but the assert is hit before the ioctl so it can't be that in this case
Comment 4 Timo Aaltonen 2014-04-01 12:45:47 UTC
so it's happening on 965GM, not sandybridge or broadwell at least
Comment 5 Timo Aaltonen 2014-04-01 12:57:55 UTC
downstream bug says xorg-edgers build from git master is affected as well
Comment 6 domagoj 2014-04-01 15:15:06 UTC
i have problem whith my texture after updating linux karnel 3.14 i m runing mint 16 

http://imgur.com/5pCfzOn
http://imgur.com/1si6T86
http://imgur.com/UrBpTfy
http://imgur.com/IQc2Txl

any help for me i think that is rendering mode problem ?

Graphics: Card: Intel 2nd Generation Core Processor Family Integrated Graphics Controller 
X.Org: 1.14.5 drivers: intel (unloaded: fbdev,vesa) Resolution: 1360x768@59.8hz 
GLX Renderer: Mesa DRI Intel Sandybridge Mobile GLX Version: 3.0 Mesa 10.2.0-devel


OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Sandybridge Mobile 
OpenGL core profile version string: 3.1 (Core Profile) Mesa 10.2.0-devel
OpenGL core profile shading language version string: 1.40
OpenGL core profile context flags: (none)
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 10.2.0-devel
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
Comment 7 Timo Aaltonen 2014-04-03 06:40:05 UTC
apparently happens on ironlake too, so gen4&5
Comment 8 Timo Aaltonen 2014-04-03 06:41:14 UTC
domagoj: this is not your bug
Comment 9 Peter Wu 2014-04-03 08:47:11 UTC
ILK is indeed affected. I (OP) forgot to mention my hardware. Some more details:

CPU: i5-460M (Ironlake GPU)
libdrm: 2.4.52-1

libdrm master contains only some fixes for Freedreno, a FreeBSD platform fix and a change in the test suite. I believe that updating libdrm in Ubuntu won't help in this matter.
Comment 10 Timo Aaltonen 2014-04-03 11:03:16 UTC
Created attachment 96838 [details] [review]
proposed patch

could you try the attached patch, based on what mkuoppal gave me on irc
Comment 11 Tasev 2014-04-06 09:11:46 UTC
Hi,

I also have this bug , my system is:

Kubuntu Trusty Thar

Intel(R) Pentium(R) CPU  P6000  @ 1.87GHz in HP G72 notebook

glxinfo | grep OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Ironlake Mobile 
OpenGL version string: 2.1 Mesa 10.1.0
OpenGL shading language version string: 1.20

I try the proposed patch with

sudo apt-get build-dep mesa
apt-get source mesa
cd mesa*/

Then a change the line proposed in the patch in /src/mesa/drivers/dri/i965/brw_context.c

dpkg-source --commit
dpkg-buildpackage

sudo dpkg -i libgl1-mesa-dri libgl1-mesa-glx

Then i reboot but the bug is still there , kwin crashes if i enable desktop effects, 
here is the krash log:

Thread 1 (Thread 0x7f6418790800 (LWP 2353)):
[KCrash Handler]
#5  0x00007f6417ea2f79 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#6  0x00007f6417ea6388 in __GI_abort () at abort.c:89
#7  0x00007f6417e9be36 in __assert_fail_base (fmt=0x7f641877e05f "%s%s%s\302\240:%u\302\240:\302\240%s%s 
l'assertion \302\253\302\240%s\302\240\302\273 a \303\251chou\303\251.\n%n", 
assertion=assertion@entry=0x7f63f3cf2a63 "brw->hw_ctx != ((void *)0)", file=file@entry=0x7f63f3cf2a28 "../../../../../../../src/mesa/drivers/dri/i965/brw_reset.c", line=line@entry=43, 
function=function@entry=0x7f63f3cf2a80 "brw_get_graphics_reset_status") at assert.c:92
#8  0x00007f6417e9bee2 in __GI___assert_fail (assertion=0x7f63f3cf2a63 "brw->hw_ctx != ((void *)0)", 
file=0x7f63f3cf2a28 "../../../../../../../src/mesa/drivers/dri/i965/brw_reset.c", line=43, 
function=0x7f63f3cf2a80 "brw_get_graphics_reset_status") at assert.c:101

I try also with the final 3.14 kernel from the mainline ppa and also with the latest mesa an libdrm from the oibaf ppa with the same result
Comment 12 Magnus Kessler 2014-04-06 12:13:55 UTC
the proposed patch works fine on

vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
model name      : Intel(R) Core(TM)2 Duo CPU     P8600  @ 2.40GHz
stepping        : 6
microcode       : 0x610

OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Mobile Intel® GM45 Express Chipset 
OpenGL version string: 2.1 Mesa 10.2.0-devel (git-5d0b3ec)

applied agains latest git.
Comment 13 Uwe L. Korn 2014-04-06 23:08:17 UTC
I have/had the same problem with chromium 34 on kernel 3.14 (Gentoo).

Backtraces with:
 * mesa 10.0.4: https://gist.github.com/xhochy/10010809
 * mesa 10.1.0: https://gist.github.com/xhochy/10012223

Proposed patch applied against mesa 10.1.0 fixes the problem.
Comment 14 Alexander E. Patrakov 2014-04-13 10:26:31 UTC
*** Bug 77391 has been marked as a duplicate of this bug. ***
Comment 15 Peter Wu 2014-04-19 13:38:39 UTC
The problem disappeared with:
KDE 4.13.0
Linux v3.15-rc1-356-gebfc45e
Mesa 10.1.1

Not sure which of the three is responsible though.
Comment 16 andreas.sturmlechner 2014-04-20 09:28:06 UTC
Problem still exists in mesa-10.1.1 when not using the proposed patch, and it looks like master isn't fixed as well yet.

Tested with:
gentoo-sources-3.14.1
mesa-10.1.1
kde-frameworks-4.11.8 and kde-workspaces-4.12.4
Comment 17 Peter Wu 2014-04-20 09:39:16 UTC
I think you got your versions reversed. On this laptop, kdebase-workspace 4.11.8 (includes KWin) and kdebase-runtime 4.13.0 are installed.

Perhaps you can try with a newer kernel?
Comment 18 andreas.sturmlechner 2014-04-20 10:51:38 UTC
Yeah, I got the KDE parts backwards...

Anyway, kwin with kernel 3.15_rc1+ is just the same crash fest as 3.14 with vanilla mesa-10.1.1. Restored the mesa binary package with the patch, and everything's fine again.

I guess Arch has you covered with the patch already?
Comment 19 andreas.sturmlechner 2014-04-20 11:22:46 UTC
yes, Arch has the patch, so no wonder it works for you: https://www.mail-archive.com/arch-commits@archlinux.org/msg169430.html
Comment 20 Peter Wu 2014-04-20 11:27:08 UTC
Indeed, I forgot to consider that possibility because Arch normally does not patch that much:
https://projects.archlinux.org/svntogit/packages.git/tree/trunk/workaround-for-robustness-and-reset-with-intel.patch?h=packages/mesa
Comment 21 Rui Salvaterra 2014-04-30 08:26:25 UTC
I'd love to see this one fixed, I also have an Arrandale/Ironlake (Core-i3 380M) laptop stuck at Linux 3.13 because of this bug... :/
Comment 22 Kenneth Graunke 2014-05-01 06:42:01 UTC
I gave up on waiting and just pushed my original fix.

commit 0380ec467d78f40b5c8134158ca48b4c5378b282
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Wed Mar 12 01:43:40 2014 -0700

    i965: Don't enable reset notification support on Gen4-5.
    
    arekm reported that using Chrome with GPU acceleration enabled on GM45
    triggered the hw_ctx != NULL assertion in brw_get_graphics_reset_status.
    
    We definitely do not want to advertise reset notification support on
    Gen4-5 systems, since it needs hardware contexts, and we never even
    request a hardware context on those systems.
    
    Cc: "10.1" <mesa-stable@lists.freedesktop.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75723
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>

Hopefully it'll get picked up for the next 10.1 release...
Comment 23 Alberto González 2014-06-19 11:01:18 UTC
I have a doubt regarding this bug:

I was one of the users who had this problem and with the first patch proposed (that got into Arch Linux fast) it got fixed. However, there's something strange:

I use KDE with desktop effects turned on. For maybe a year or more before this bug happened I was using them with OpenGL 3.1 (in the System Setting -> Desktop effects -> Advanced you can choose that). When I upgraded to kernel 3.14 the desktop effects stopped working. Downgrading to 3.13 fixed it (and 3.14 + patch the same), but only if I selected OpenGL 2.0 instead of 3.1. Which is strange, because before upgrading it worked with OpenGL 3.1 normally, but after downgrading it didn't.

Since then always the same, each time I try OpenGL 3.1 it breaks. And other users who suffered from this bug reported the same, OpenGL 3.1 didn't work for them either.

I know it is a DIFFERENT BUG from this one, but I still wanted to ask if after kernel 3.14 OpenGL 3.1 works for anyone. And is there any other way of testing if it actually works other than in kwin?

My graphics are Ironlake based (Gen 4?).

Thanks.
Comment 24 Peter Wu 2014-06-19 14:46:19 UTC
(In reply to comment #23)
[..]
> I know it is a DIFFERENT BUG from this one, but I still wanted to ask if
> after kernel 3.14 OpenGL 3.1 works for anyone. And is there any other way of
> testing if it actually works other than in kwin?

Please open a new bug, I can confirm that KWin (kdebase-workspace 4.11.10) + OpenGL 3.1 + Linux 3.15-rc8 + mesa 10.2.1 + xf86-video-intel 2.99.912 crashes.
Comment 25 Alexander E. Patrakov 2014-06-19 15:18:31 UTC
That new bug is probably https://bugs.gentoo.org/show_bug.cgi?id=513500
Comment 26 Ian Romanick 2014-06-19 15:54:00 UTC
(In reply to comment #23)
> I know it is a DIFFERENT BUG from this one, but I still wanted to ask if
> after kernel 3.14 OpenGL 3.1 works for anyone. And is there any other way of
> testing if it actually works other than in kwin?
> 
> My graphics are Ironlake based (Gen 4?).

FYI... OpenGL 3.1 is not supported on Ironlake, so you shouldn't have 3.1 at all.  The highest OpenGL version supported by Mesa on that chipset is 2.1.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.