[Mesa-dev] [PATCH 01/12] i965: Move brw_dump_ir() out of brw_*_emit() functions

Iago Toral itoral at igalia.com
Thu Oct 8 22:53:39 PDT 2015


On Thu, 2015-10-08 at 11:19 -0700, Kristian Høgsberg wrote:
> On Thu, Oct 8, 2015 at 4:42 AM, Iago Toral <itoral at igalia.com> wrote:
> > On Thu, 2015-10-08 at 12:32 +0100, Chris Wilson wrote:
> >> On Thu, Oct 08, 2015 at 01:23:27PM +0200, Iago Toral wrote:
> >> > Well, this is weird.... this patch makes this crash:
> >> >
> >> > INTEL_DEBUG=vs glxgears
> >> >
> >> > because that uses a vertex program, so &vs->base is a NULL pointer
> >> > dereference in this call:
> >> >
> >> > brw_dump_ir("vertex", prog, &vs->base, &vp->program.Base);
> >> >
> >>
> >> No, the crash is:
> >>
> >> > +   if (unlikely(INTEL_DEBUG & DEBUG_VS) && vs->base.ir)
> >>
> >> and friends.
> >> -Chris
> >
> > Correct. We still need to patch calls to brw_dump_ir to fix this though.
> 
> No, what happened was I rebased this across Jasons recent cleanup and
> didn't remove the vs->base.ir checks. I've removed them and verified
> that glxgears works with INTEL_DEBUG=vs.

No, the problem is still there, vs can be NULL and are always derefering
it in the call to brw_dump_ir. See this gdb session with current master:

#1  0x00007ffff40454ea in brw_codegen_vs_prog (brw=0x7ffff7fd1040,
prog=0x0, vp=0x960f50, key=0x7fffffffc940) at brw_vs.c:174

Notice that prog is NULL, so vs is never set. Right when we call
brw_dump_ir we have:

(gdb) p vs
$7 = (struct brw_shader *) 0x0
(gdb) p vp
$8 = (struct brw_vertex_program *) 0x960f50

And we still do:
brw_dump_ir("vertex", prog, &vs->base, &vp->program.Base); 

it doesn't crash for some reason, but the problem is there. I'll send a
patch for this.

Iago



More information about the mesa-dev mailing list