[Mesa-dev] [PATCH] i830_state:i830Enable(): Fix crash for GL_STENCIL_TEST

Kurt Roeckx kurt at roeckx.be
Tue May 29 09:22:44 PDT 2012


On Tue, May 29, 2012 at 08:53:12AM -0600, Brian Paul wrote:
> On Fri, May 25, 2012 at 5:26 PM, Kurt Roeckx <kurt at roeckx.be> wrote:
> > Can someone please review and commit this?  A lot of the piglit
> > tests fail because of this.
> >
> >
> > Kurt
> >
> > On Fri, May 11, 2012 at 12:19:42AM +0200, Kurt Roeckx wrote:
> >> commit 87f12bb2d95236c7b025d1a8be56b5ab1683d702 tried to fix rb->mt
> >> being NULL, but change this case wrong.
> >>
> >> Note: this is a candidate for the 8.0 branch
> >>
> >> Signed-off-by: Kurt Roeckx <kurt at roeckx.be>
> >> ---
> >>  src/mesa/drivers/dri/i915/i830_state.c |    2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c
> >> index 6f8bd69..647ba62 100644
> >> --- a/src/mesa/drivers/dri/i915/i830_state.c
> >> +++ b/src/mesa/drivers/dri/i915/i830_state.c
> >> @@ -862,7 +862,7 @@ i830Enable(struct gl_context * ctx, GLenum cap, GLboolean state)
> >>           if (ctx->DrawBuffer) {
> >>              struct intel_renderbuffer *irbStencil
> >>                 = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL);
> >> -            hw_stencil = (irbStencil && irbStencil->mt->region);
> >> +            hw_stencil = (irbStencil && irbStencil->mt);
> 
> I would think that you should test all three pointers to be safe:
> 
> hw_stencil = irbStencil && irbStencil->mt && irbStencil->mt->region;
> 
> I can commit that change later if there's no objections.

I did this based on other changes in
87f12bb2d95236c7b025d1a8be56b5ab1683d702, and I see no problems
with the patch as is.  But checking irbStencil->mt->region
probably doesn't hurt.


Kurt



More information about the mesa-dev mailing list