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

Chad Versace chad.versace at linux.intel.com
Mon Nov 14 14:13:36 PST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/14/2011 01:55 PM, Eric Anholt wrote:
> 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);

Ok. I'll add that comment.

- ----
Chad Versace
chad.versace at linux.intel.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOwZKPAAoJEAIvNt057x8iAmYQAIF58yP1EwjWd+Z2i3CUwtx+
rZRhDwUai+SNOI19m0AG6mSRSY3LINoV5koIzIRLFY6dogexs+Qtp61PNkKKcd7x
AD66AukvCO40fB1WOrpSsXAyep16ome38moD+r9Go1W2aW20rtcybhc+Ii7/s1FJ
WBiduKO6GUobDcPcrripY4FKGy0JFIyj0kMlQlDH3raekip5kPTvScWTVoJBXm8D
1C03xFVbmgx3AGOTvSO8V9GizwLapBABpihftl/8T9tj6yEvNhziKcjfVtke90he
uUQq0IjgD2S4xucHcIyJFPyjjPxKz7KRBhDlgB/5LaMUHtZZmDjAdp/g/OrOIc+J
XJOK8H1q5cMSrzY0rKUmckbMnYLsNmlemeN8xrJEisXTgguUUrK3LXgJXjf1OXjR
FgdWL1EBvqLA+PeVtEtPqDNdwSkPJIcdon1SoLFt5kelxJPv8mHq1YoZH2f6C40j
eR7uJxJGtX8V/F3MN1XWwVE9IJ+Dh7bkfhZmyB3kHXiIYM7Jf06eHOqi1LyaVekK
YdhT6Wpq0+J3xbOfLw/FCju9jN0f9yjnCkZRHHCHqSdqWydipf/NY3p2nl/1Hc+L
SWAOAvVba4SSD86sIS9hHe0jctcQfpJ2zZM2YYkZhHHSwrJHsQSLjpZ27LFPzur3
NXZVuoF4PY7Zd38jqh5l
=XWXN
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list