[Mesa-dev] [PATCH 04/24] intel: Use MapRenderbuffer in spans setup.

Chad Versace chad at chad-versace.us
Fri Oct 28 17:33:53 PDT 2011


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

On 10/28/2011 04:58 PM, Chad Versace wrote:
> This patch will break depthstencil renderbuffers on gen7. Comments below.
> 
> On 10/28/2011 12:49 PM, Eric Anholt wrote:
>> ---
>>  src/mesa/drivers/dri/intel/intel_span.c |   33
>>  +++++++++---------------------
>>  1 files changed, 10 insertions(+), 23 deletions(-)
> 
>> diff --git a/src/mesa/drivers/dri/intel/intel_span.c
>> b/src/mesa/drivers/dri/intel/intel_span.c
>> index bdc4a0e..ecccd30 100644
>> --- a/src/mesa/drivers/dri/intel/intel_span.c
>> +++ b/src/mesa/drivers/dri/intel/intel_span.c
>> @@ -221,7 +221,10 @@ intel_offset_S8(uint32_t stride, uint32_t x, uint32_t
>> y)
>>  void
>>  intel_renderbuffer_map(struct intel_context *intel, struct gl_renderbuffer
>>  *rb)
>>  {
>> +   struct gl_context *ctx = &intel->ctx;
>>     struct intel_renderbuffer *irb = intel_renderbuffer(rb);
>> +   GLubyte *map;
>> +   int stride;
> 
>>     if (!irb)
>>        return;
>> @@ -231,25 +234,11 @@ intel_renderbuffer_map(struct intel_context *intel,
>> struct gl_renderbuffer *rb)
>>     if (irb->wrapped_depth)
>>        intel_renderbuffer_map(intel, irb->wrapped_depth);
>>     if (irb->wrapped_stencil)
>>        intel_renderbuffer_map(intel, irb->wrapped_stencil);
> 
> Here we map the real depth and stencil renderbuffers individually.
> 
> [snip]
>> +   ctx->Driver.MapRenderbuffer(ctx, rb, 0, 0, rb->Width, rb->Height,
>> +                           GL_MAP_READ_BIT | GL_MAP_WRITE_BIT,
>> +                           &map, &stride);
>> +   rb->Data = map;
> 
> And here, the mappings done above are ignored and we set rb->Data = NULL.
> 
> To avoid regressing gen7, we need to copy the s8 bits in
> irb->wrapped_stencil->Data into irb->wrapped_depth->Data, then unmap
> irb->wrapped_stencil and set rb->Data = irb->wrapped_depth->Data.

Oops. I commented before I read the patch for
fast_read_depth_stencil_pixels_separate. I assume that function voids
my comments above.

Still, stencil buffer mapping is broken. See the crazy stencil values printed
by hiz-stencil-read-fbo-d24-s8 on gen7. 

I'm sure you're aware of what I'm about to say... For stencil buffers,
intel_map_renderbuffer will need to malloc a temporary buffer at rb->Data into
which the stencil pixels get detiled and copied. And, just in case
GL_MAP_WRITE_BIT was set, intel_unmap_renderbuffer will need to tile and write
back the pixels. So intel_renderbuffer will need to track the mapping mode for
this case.

- -- 
Chad Versace
chad at chad-versace.us

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOq0nvAAoJEAIvNt057x8iKVQQAKaqEOH1nA83BgTFFvWCdY00
HzoUKiSw2lCjf6ishe/aeMLvIIOpXmIYV5Cx9T5nwg6ZZKgdw1Sqt/gy3r8ytdHR
cabMcaPBLjhtZCeX9Sx4JpoSLOz53OYQxHIk1uB7ONT4P9Y4S5hsjjKaErNOhKHn
h52qL4tC+KgA3797r4w3e8bfNwLAf7ee4wvVnaQiTk8X2E0se2xNaDP1mz2Li0we
XcAH7K0HCYRQo9ZRR8OFHVeoWq0DqfAy3p9wPeQjt9KbPiJyOHD1OoozvQ/XVxGM
jupHCSRaHctRq3GyoVNQDLFiOl0dNStl1NQOIafgjYr4YzaFgZvVsB1lRKmlmqrg
QLnhwN+mo9AsoQPf6FCP1k6zVdXfiXNXKEoPzeXpEMgeZVSVhrb1x/cPJ0OvyaTm
elrYFJw4ROwNEHG7+VMAp2sHT8kZEv2eJbN9BCwjNjryR50O/z1ytr5gAZ8caUXt
gH4C8Duq/IKnUNWCRZKh1cDWinKb+J1DxWU/0wjjy4U/zTA3oAgaFqdN4BXnuW8B
6Wu85NjsoogANVWbzPwadm9fUmuncTVGk9Mzn78HWId8NBFDyFiDH3/OL//eKn6Z
Ed5H7pPF0p6gpWwcIcWHXZK8tQew2ccp8AYdj5oK0YR8yxEQXdXV139C4E/mYIuW
+hR7QAyK1sqtfHhKWOma
=JXfp
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list