Bug 31940

Summary: [r300g] Crash in dri2_invalidate_drawable
Product: Mesa Reporter: Stephen E. Baker <cycoone>
Component: Drivers/Gallium/r300Assignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: bugs.freedesktop, cycoone, kai, liquid.acid, nirbheek.chauhan, pedretti.fabio, rankincj
Version: 7.9Keywords: have-backtrace, patch
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Wine log showing backtrace
wine log showing backtrace for 28ee7561f9e9bac8a76d5f96fe55b890a61a7d04
st/dri: workaround weird null dereference
st/dri: workaround weird null dereference
Crash after applying "st/dri: workaround weird null dereference" patch
Solves another weird issue with regards to invalidate buffers might help.

Description Stephen E. Baker 2010-11-26 12:48:28 UTC
Created attachment 40590 [details]
Wine log showing backtrace

A game in wine crashes when the resolution changes.  The crashlog attached points to r300_dri.so

I am using Arch Linux with Mesa 7.9 and the r300g gallium drivers.

X1400 Radeon
Core 2 Duo T7400
2GB Ram
Comment 1 Stephen E. Baker 2010-11-26 18:38:49 UTC
I've done a number of tests with the latest git:28ee7561f9e9bac8a76d5f96fe55b890a61a7d04

With software rasterizer: Everything works as expected, game resolution changes
With r300c: No crash but graphical corruption after changing resolution
With r300g: Still crashes in dri2_invalidate_drawable
Comment 2 Stephen E. Baker 2010-11-26 18:39:42 UTC
Created attachment 40596 [details]
wine log showing backtrace for 28ee7561f9e9bac8a76d5f96fe55b890a61a7d04
Comment 3 nobled 2010-11-29 23:44:19 UTC
Created attachment 40656 [details] [review]
st/dri: workaround weird null dereference

(In reply to comment #2)
> Created an attachment (id=40596) [details]
> wine log showing backtrace for 28ee7561f9e9bac8a76d5f96fe55b890a61a7d04

Weird. It looks like it's because ctx->st is NULL on that line, but that shouldn't be possible--the code in dri_create_context should prevent that:

http://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/state_trackers/dri/common/dri_context.c?h=28ee7561f9e9bac8a76d5f96fe55b890a61a7d04#n92

Does this patch fix it?
Comment 4 nobled 2010-11-29 23:47:53 UTC
Created attachment 40657 [details] [review]
st/dri: workaround weird null dereference
Comment 5 Stephen E. Baker 2010-11-30 19:35:53 UTC
Created attachment 40688 [details]
Crash after applying "st/dri: workaround weird null dereference" patch

I think there is some improvement, I was able to change to from 600x800 to 640x480 without issue, but when going to 1024x768 I get the crash still, a couple lines later.

Now built with git revision: ff994eeff8fa9f8f889878d6b48015ca7683e22b
Comment 6 Stephen E. Baker 2010-11-30 19:50:08 UTC
Actually if you compensate for the patch it is the same line :s
Comment 7 Jakob Bornecrantz 2010-11-30 20:10:44 UTC
Created attachment 40689 [details] [review]
Solves another weird issue with regards to invalidate buffers might help.

There is a off chance that this patch fixes the problem can you please test?

Cheers Jakob.
Comment 8 Stephen E. Baker 2010-12-01 17:04:45 UTC
Yes, Jakob's patch fixes the issue!
Comment 9 Jakob Bornecrantz 2010-12-01 17:36:15 UTC
Does it fix it completely? Enabling you to change resolution? Or does the crash just go away?

Cheers Jakob.
Comment 10 Stephen E. Baker 2010-12-01 18:48:01 UTC
Fixes it completely
Comment 11 Stephen E. Baker 2010-12-05 13:52:58 UTC
Is there anything more I should be doing to close up this issue, or are we just waiting for the patch to be merged?
Comment 12 Jakob Bornecrantz 2010-12-05 13:57:48 UTC
No its fine. Thank you for your help.
Comment 13 Pavel Ondračka 2010-12-15 05:50:23 UTC
I also have this problem with latest mesa and some Wine games. Attached patch in Comment 7 fixes it, I'm reopening this until the fix is committed to master.
Comment 14 Pavel Ondračka 2011-01-06 08:49:45 UTC
Any chance the patch from comment 7 can make it into master or at least to mesa-dev for review? It fixes crash in Star Trek Armada 2 for me and I have not encountered any regressions so far.
Maybe also reassigning to Mesa core would be appropriate?
Comment 15 Chris Rankin 2011-01-09 11:13:16 UTC
*** Bug 32297 has been marked as a duplicate of this bug. ***
Comment 16 Kai 2011-02-01 10:11:06 UTC
I can confirm, that the patch presented in comment #7 (attachment 40689 [details] [review]) fixes the problem with Mesa 7.10. Please consider applying the patch and making it a candidate for the Mesa 7.10 branch.

My "test case": http://bugs.winehq.org/show_bug.cgi?id=25712
Comment 17 Marek Olšák 2011-02-10 18:04:51 UTC
Jakob, please could you possibly push the fix to master?
Comment 18 Marek Olšák 2011-02-21 22:55:46 UTC
I pushed the patch to master. Closing..

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.