[Mesa-dev] [PATCH 4/6] intel: Fix intel_map_renderbuffer() for depthstencil buffers with separate stencil

Eric Anholt eric at anholt.net
Mon Nov 14 13:55:02 PST 2011


On Sun, 13 Nov 2011 22:32:13 -0800, Chad Versace <chad.versace at 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 <eric at anholt.net>
> Signed-off-by: Chad Versace <chad.versace at 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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111114/66d1a37d/attachment.pgp>


More information about the mesa-dev mailing list