[Mesa-dev] [PATCH v2 07/32] i965/miptree: Make aux_state work in terms of logical layers
Pohjolainen, Topi
topi.pohjolainen at gmail.com
Sat Jul 22 08:29:48 UTC 2017
On Fri, Jul 21, 2017 at 09:47:52AM -0700, Jason Ekstrand wrote:
> This commit changes layer_range_length to return locical layers and also
> changes the way we allocate the aux_state field to not allocate extra
> layers for MCS. This will be important as we're about to start doing
> significantly more detailed tracking of MCS state.
> ---
> src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 42 +++++++++++++--------------
> 1 file changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index a5e71a1..cd36f5b 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -637,6 +637,22 @@ intel_lower_compressed_format(struct brw_context *brw, mesa_format format)
> }
>
> static unsigned
> +get_num_logical_layers(const struct intel_mipmap_tree *mt, unsigned level)
> +{
> + if (mt->surf.size > 0) {
> + if (mt->surf.dim == ISL_SURF_DIM_3D)
> + return minify(mt->surf.logical_level0_px.depth, level);
> + else
> + return mt->surf.logical_level0_px.array_len;
> + } else if (mt->surf.samples > 1) {
> + assert(level == 0);
> + return mt->logical_depth0;
> + } else {
> + return mt->level[level].depth;
You can drop this now :)
> + }
> +}
> +
> +static unsigned
> get_num_phys_layers(const struct isl_surf *surf, unsigned level)
> {
> /* In case of physical dimensions one needs to consider also the layout.
> @@ -677,12 +693,8 @@ create_aux_state_map(struct intel_mipmap_tree *mt,
> const uint32_t levels = mt->last_level + 1;
>
> uint32_t total_slices = 0;
> - for (uint32_t level = 0; level < levels; level++) {
> - if (mt->surf.size > 0)
> - total_slices += get_num_phys_layers(&mt->surf, level);
> - else
> - total_slices += mt->level[level].depth;
> - }
> + for (uint32_t level = 0; level < levels; level++)
> + total_slices += get_num_logical_layers(mt, level);
>
> const size_t per_level_array_size = levels * sizeof(enum isl_aux_state *);
>
> @@ -700,14 +712,8 @@ create_aux_state_map(struct intel_mipmap_tree *mt,
> enum isl_aux_state *s = data + per_level_array_size;
> for (uint32_t level = 0; level < levels; level++) {
> per_level_arr[level] = s;
> -
> - unsigned level_depth;
> - if (mt->surf.size > 0)
> - level_depth = get_num_phys_layers(&mt->surf, level);
> - else
> - level_depth = mt->level[level].depth;
> -
> - for (uint32_t a = 0; a < level_depth; a++)
> + const unsigned level_layers = get_num_logical_layers(mt, level);
> + for (uint32_t a = 0; a < level_layers; a++)
> *(s++) = initial;
> }
> assert((void *)s == data + total_size);
> @@ -2533,13 +2539,7 @@ miptree_layer_range_length(const struct intel_mipmap_tree *mt, uint32_t level,
> uint32_t start_layer, uint32_t num_layers)
> {
> assert(level <= mt->last_level);
> - uint32_t total_num_layers;
> -
> - if (mt->surf.size > 0)
> - total_num_layers = get_num_phys_layers(&mt->surf, level);
> - else
> - total_num_layers = mt->level[level].depth;
> -
> + uint32_t total_num_layers = get_num_logical_layers(mt, level);
> assert(start_layer < total_num_layers);
> if (num_layers == INTEL_REMAINING_LAYERS)
> num_layers = total_num_layers - start_layer;
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list