[Mesa-dev] [PATCH] intel: Fix accum buffer mapping since the swrast rework.

Daniel Vetter daniel at ffwll.ch
Wed Jan 25 05:28:03 PST 2012


On Tue, Jan 24, 2012 at 10:33:07PM -0800, Eric Anholt wrote:
> On Tue, 24 Jan 2012 23:52:57 -0500, nobled <nobled at dreamwidth.org> wrote:
> > On Tue, Jan 24, 2012 at 6:59 PM, Eric Anholt <eric at anholt.net> wrote:
> > > A pure swrast-allocated buffer gets an irb of NULL, so we segfaulted
> > > in the clear-accum test.  Just look at the swrast renderbuffer pointer
> > > for handling swrast rbs.
> > > ---
> > >  src/mesa/drivers/dri/intel/intel_fbo.c |   12 +++++++-----
> > >  1 files changed, 7 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
> > > index 3a35a01..27b0bfc 100644
> > > --- a/src/mesa/drivers/dri/intel/intel_fbo.c
> > > +++ b/src/mesa/drivers/dri/intel/intel_fbo.c
> > > @@ -128,15 +128,16 @@ intel_map_renderbuffer(struct gl_context *ctx,
> > >                       GLint *out_stride)
> > >  {
> > >    struct intel_context *intel = intel_context(ctx);
> > > +   struct swrast_renderbuffer *srb = (struct swrast_renderbuffer *)rb;
> > >    struct intel_renderbuffer *irb = intel_renderbuffer(rb);
> > >    void *map;
> > >    int stride;
> > >
> > > -   if (!irb && irb->Base.Buffer) {
> > Isn't the problem just that this (and the other condition) is && instead of ||?
> 
> No, because irb is NULL, so the following references would segfault.

The condition checks for !irb, so with the && we will deref irb only if
it is NULL. I haven't checked the code and generally got squat clue about
all this ...
-Daniel
-- 
Daniel Vetter
Mail: daniel at ffwll.ch
Mobile: +41 (0)79 365 57 48


More information about the mesa-dev mailing list