[Mesa-dev] [PATCH 10/15] intel: Support mapping multisample miptrees (v2)

Eric Anholt eric at anholt.net
Mon Aug 6 19:32:04 PDT 2012


Chad Versace <chad.versace at linux.intel.com> writes:

> Add two new functions: intel_miptree_{map,unmap}_multisample, to which
> intel_miptree_{map,unmap} dispatch. Only mapping flat, renderbuffer-like
> miptrees are supported.
>
> v2:
>     - Move the introduction of
>       intel_mipmap_tree::singlesample_{width0,height0} to this patch, per
>       Anholt.
>     - Replace relations `mt->num_samples == 0` and `mt->num_samples > 0`
>       with `<= 1` and `> 0`, per Anholt.
>     - Don't downsample unnecessarily, found by Anholt.
>
> CC: Eric Anholt <eric at anholt.net>
> CC: Paul Berry <stereotype441 at gmail.com>
> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> ---
>  src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 115 +++++++++++++++++++++++--
>  src/mesa/drivers/dri/intel/intel_mipmap_tree.h |  18 ++++
>  2 files changed, 127 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> index 23d84c0..6ecb48f 100644
> --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> +   if (!mt->singlesample_mt) {
> +      map->singlesample_mt_is_tmp = true;
> +      mt->need_downsample = true;

Move this mt->need_downsample flag setup to after you've successfully
alloced?

> +      mt->singlesample_mt =
> +         intel_miptree_create_for_renderbuffer(intel,
> +                                               mt->format,
> +                                               mt->singlesample_width0,
> +                                               mt->singlesample_height0,
> +                                               0 /*num_samples*/);
> +      if (!mt->singlesample_mt) {
> +         mt->need_downsample = false;
> +         goto fail;
> +      }
> +   }
> +
> +   if (mode & GL_MAP_INVALIDATE_RANGE_BIT)
> +      mt->need_downsample = false;
> +
> +   intel_miptree_downsample(intel, mt);

I don't think you can clear need_downsample for
GL_MAP_INVALIDATE_RANGE_BIT, because the GL_MAP_WRITE_BIT case in the
unmap (implied by INVALIDATE_RANGE) will upsample the whole singlesample
buffer back, not just the mapped subset.  Dropping the INVALIDATE_RANGE
gets the series up to this patch my r-b.

> +static void
> +intel_miptree_unmap_multisample(struct intel_context *intel,
> +                                struct intel_mipmap_tree *mt,
> +                                unsigned int level,
> +                                unsigned int slice)
> +{
> +   struct intel_miptree_map *map = mt->level[level].slice[slice].map;
> +
> +   assert(mt->num_samples > 1);
> +
> +   if (!map)
> +      return;
> +
> +   intel_miptree_unmap_singlesample(intel, mt->singlesample_mt, level, slice);
> +
> +   mt->need_downsample = false;
> +   if (map->mode & GL_MAP_WRITE_BIT)
> +      intel_miptree_upsample(intel, mt);
> +
> +   if (map->singlesample_mt_is_tmp)
> +      intel_miptree_release(&mt->singlesample_mt);
> +
> +   intel_miptree_release_map(mt, level, slice);
> +}
-------------- 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/20120806/155e088f/attachment.pgp>


More information about the mesa-dev mailing list