On Sun, 13 Nov 2011 22:32:13 -0800, Chad Versace <chad.vers...@linux.intel.com> 
wrote:
> For a depthstencil buffer with separate stencil,
> intel_renderbuffer::region is null. (The regions are kept in hidden depth
> and stencil buffers). Since the region is null, intel_map_renderbuffer()
> assumed there was no data and returned a null map pointer, which in turn
> was dereferenced (!) by MapRenderbuffer's caller.
> 
> This patch fixes intel_map_renderbuffer() to map the hidden depth buffer
> through the GTT and return that as the mapped pointer. Also, the stencil
> bits are scattered and gathered when needed.
> 
> Fixes the following Piglit tests on gen7:
>     fbo/fbo-readpixels-depth-formats
>     hiz/hiz-depth-read-fbo-d24s8
>     hiz/hiz-stencil-read-fbo-d24s8
>     EXT_packed_depth_stencil/fbo-clear-formats
>     EXT_packed_depth_stencil/fbo-depth-GL_DEPTH24_STENCIL8-blit
>     EXT_packed_depth_stencil/fbo-depth-GL_DEPTH24_STENCIL8-drawpixels
>     EXT_packed_depth_stencil/fbo-depth-GL_DEPTH24_STENCIL8-readpixels
>     
> EXT_packed_depth_stencil/fbo-depthstencil-GL_DEPTH24_STENCIL8-readpixels-24_8
>     
> EXT_packed_depth_stencil/fbo-depthstencil-GL_DEPTH24_STENCIL8-readpixels-FLOAT-and-USHORT
>     EXT_packed_depth_stencil/fbo-stencil-GL_DEPTH24_STENCIL8-readpixels
> 
> CC: Eric Anholt <e...@anholt.net>
> Signed-off-by: Chad Versace <chad.vers...@linux.intel.com>
> ---
>  src/mesa/drivers/dri/intel/intel_fbo.c |  150 
> +++++++++++++++++++++++++++++++-
>  1 files changed, 149 insertions(+), 1 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
> b/src/mesa/drivers/dri/intel/intel_fbo.c
> index 2a78edf..dbd5163 100644
> --- a/src/mesa/drivers/dri/intel/intel_fbo.c
> +++ b/src/mesa/drivers/dri/intel/intel_fbo.c

> +static void
> +intel_map_renderbuffer_separate_s8z24(struct gl_context *ctx,
> +                                   struct gl_renderbuffer *rb,
> +                                   GLuint x, GLuint y, GLuint w, GLuint h,
> +                                   GLbitfield mode,
> +                                   GLubyte **out_map,
> +                                   GLint *out_stride)
> +{
> +   struct intel_context *intel = intel_context(ctx);
> +   struct intel_renderbuffer *irb = intel_renderbuffer(rb);
> +
> +   GLbitfield adjusted_mode;
> +
> +   uint8_t *s8z24_map;
> +   int32_t s8z24_stride;
> +

      /* The window system separate depth/stencil buffers are treated
       * as actual separate renderbuffers, not S8_Z24.
       */
> +   assert(rb->Name != 0);

Attachment: pgp8NQj5t0YNY.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to