Bug 27199

Summary: Division by Zero error with glDrawRangeElementsEXT()
Product: Mesa Reporter: Chris Rankin <rankincj>
Component: Drivers/DRI/r300Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Full WoW output, including backtrace.
WoW screenshot, showing lots of artifacts

Description Chris Rankin 2010-03-19 07:41:10 UTC
Created attachment 34243 [details]
Full WoW output, including backtrace.

This error kills World of Warcraft almost immediately on entering Azeroth. (Login screens seem OK). Full stack trace is attached, but the part relevant to R300 reads:

=Backtrace:
>0 0x7de37b40 emit_zb_offset+0x50() in r300_dri.so (0x0039f1fc)
  1 0x7de4b872 radeonEmitState+0x4b2() in r300_dri.so (0x0039f26c)
  2 0x7de32f20 r300DrawPrims+0xc30() in r300_dri.so (0x0039f31c)
  3 0x7dee657b vbo_validated_drawrangeelements+0x10b() in r300_dri.so (0x0039f38c)
  4 0x7dee69a4 vbo_exec_DrawRangeElements+0x54() in r300_dri.so (0x0039f3bc)
  5 0x7dedafcb neutral_DrawRangeElements+0xab() in r300_dri.so (0x0039f3ec)
  6 0x7ed78291 wine_glDrawRangeElementsEXT+0xb1() in opengl32 (0x0039f44c)

This is with Mesa-git, xf86-drv-ati from git, libdrm-2.4.18 from F13, vanilla kernel 2.6.33.1.
Comment 1 Chris Rankin 2010-03-19 07:47:07 UTC
This bus is also present in F12's Mesa 7.7-4 packages.
Comment 2 Chris Rankin 2010-03-19 08:25:16 UTC
This crash stopped happening after I added the following hack:

--- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c
+++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
@@ -424,7 +424,7 @@ static void emit_zb_offset(GLcontext *ctx, struct radeon_sta
        uint32_t dw = atom->check(ctx, atom);
 
        rrb = radeon_get_depthbuffer(&r300->radeon);
-       if (!rrb)
+       if (!rrb || (rrb->cpp == 0))
                return;
 
        zbpitch = (rrb->pitch / rrb->cpp);

However, this did result in a couple of "no rrb" messages in my output log. There were also a lot of artifacts present (see attachment), although that may be a separate bug.
Comment 3 Chris Rankin 2010-03-19 08:48:58 UTC
Created attachment 34245 [details]
WoW screenshot, showing lots of artifacts

These artifacts may be a completely different bug, not just because I hacked away at emit_zb_offset().
Comment 4 Chris Rankin 2010-12-24 06:38:43 UTC
No longer relevant now that r300g is the default driver. And was probably fixed anyway.

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.