[Mesa-dev] [PATCH 7/8] i965/msaa: Adjust MCS buffer allocation for 8x MSAA.
Paul Berry
stereotype441 at gmail.com
Tue Jul 24 12:20:35 PDT 2012
On 24 July 2012 12:10, Kenneth Graunke <kenneth at whitecape.org> wrote:
> On 07/18/2012 09:21 AM, Paul Berry wrote:
> > MCS buffers use 32 bits per pixel in 8x MSAA, and 8 bits per pixel in
> > 4x MSAA. This patch adjusts the format we use to allocate the buffer
> > so that enough memory is set aside for 8x MSAA.
> > ---
> > src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 27
> ++++++++++++++++++++++-
> > 1 files changed, 25 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> > index d6572cd..f30f92b 100644
> > --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> > +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> > @@ -672,7 +672,30 @@ intel_miptree_alloc_mcs(struct intel_context *intel,
> > {
> > assert(mt->mcs_mt == NULL);
> > assert(intel->gen >= 7); /* MCS only used on Gen7+ */
> > - assert(num_samples == 4); /* TODO: support 8x MSAA */
> > +
> > + /* Choose the correct format for the MCS buffer. All that really
> matters
> > + * is that we allocate the right buffer size, since we'll always be
> > + * accessing this miptree using MCS-specific hardware mechanisms,
> which
> > + * infer the correct format based on num_samples.
> > + */
> > + gl_format format;
> > + switch (num_samples) {
> > + case 4:
> > + /* 8 bits/pixel are required for MCS data when using 4x MSAA (2
> bits for
> > + * each sample).
> > + */
> > + format = MESA_FORMAT_A8;
>
> I'm surprised to see A8 here...it would be nicer, I think, to use R8. I
> guess all that matters here is that you get an 8-bit, 1-component
> format...but the luminance/alpha formats are pretty awful and require
> special cases in a lot of places, so I'd rather avoid using them
> wherever possible.
>
> That said, I would change it in a separate patch.
>
Ok, will do. Thanks for the review.
>
> > + break;
> > + case 8:
> > + /* 32 bits/pixel are required for MCS data when using 8x MSAA (3
> bits
> > + * for each sample, plus 8 padding bits).
> > + */
> > + format = MESA_FORMAT_R_UINT32;
> > + break;
> > + default:
> > + assert(!"Unrecognized sample count in intel_miptree_alloc_mcs");
> > + break;
> > + };
> >
> > /* From the Ivy Bridge PRM, Vol4 Part1 p76, "MCS Base Address":
> > *
> > @@ -684,7 +707,7 @@ intel_miptree_alloc_mcs(struct intel_context *intel,
> > */
> > mt->mcs_mt = intel_miptree_create(intel,
> > mt->target,
> > - MESA_FORMAT_A8,
> > + format,
> > mt->first_level,
> > mt->last_level,
> > mt->width0,
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120724/8740ff07/attachment.html>
More information about the mesa-dev
mailing list