<br><br><div class="gmail_quote">On 9 July 2012 13:36, Chad Versace <span dir="ltr"><<a href="mailto:chad.versace@linux.intel.com" target="_blank">chad.versace@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 07/06/2012 03:29 PM, Paul Berry wrote:<br>
> To implement Gen7's CMS MSAA layout, we need an extra buffer, the MCS<br>
> (Multisample Control Surface) buffer.  This patch introduces code for<br>
> allocating and deallocating the buffer, and storing a pointer to it in<br>
> the intel_mipmap_tree struct.<br>
><br>
> No functional change, since the CMS layout is not enabled yet.<br>
> ---<br>
>  src/mesa/drivers/dri/intel/intel_fbo.c         |    9 +++++<br>
>  src/mesa/drivers/dri/intel/intel_mipmap_tree.c |   45 ++++++++++++++++++++++++<br>
>  src/mesa/drivers/dri/intel/intel_mipmap_tree.h |   14 +++++++<br>
>  3 files changed, 68 insertions(+), 0 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c<br>
> index a801bb7..6530b99 100644<br>
> --- a/src/mesa/drivers/dri/intel/intel_fbo.c<br>
> +++ b/src/mesa/drivers/dri/intel/intel_fbo.c<br>
> @@ -282,6 +282,15 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer<br>
>        }<br>
>     }<br>
><br>
> +   if (irb->mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) {<br>
> +      bool ok = intel_miptree_alloc_mcs(intel, irb->mt, rb->NumSamples);<br>
> +      if (!ok) {<br>
> +         intel_miptree_release(&irb->mt->hiz_mt);<br>
> +         intel_miptree_release(&irb->mt);<br>
> +         return false;<br>
> +      }<br>
> +   }<br>
> +<br>
>     return true;<br>
>  }<br>
<br>
</div></div>FYI, though it causes no harm, there's no need to release the hiz miptree<br>
separately from its parent. The miptree's destructor takes care of that.<br></blockquote><div><br>Good point.  I'll remove it.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<div class="im"><br>
<br>
> +   /* From the Ivy Bridge PRM, Vol 2 Part 1 p326:<br>
> +    *<br>
> +    *     When MCS buffer is enabled and bound to MSRT, it is required that it<br>
> +    *     is cleared prior to any rendering.<br>
> +    *<br>
> +    * Since we don't use the MCS buffer for any purpose other than rendering,<br>
> +    * it makes sense to just clear it immediately upon allocation.<br>
> +    */<br>
> +   void *data = intel_region_map(intel, mt->mcs_mt->region, 0);<br>
> +   memset(data, 0, mt->mcs_mt->region->bo->size);<br>
> +   intel_region_unmap(intel, mt->mcs_mt->region);<br>
<br>
</div>But the clear value for a 4x MCS is 0xff. Am I missing something?<br></blockquote><div><br>Yes, you're right.  I had a convoluted reason for believing that initializing to 0 was better, but it's not standing up to scrutiny.  I'll change it to 0xff.  <br>
 </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
-Chad<br>
</font></span></blockquote></div>