[Mesa-dev] [PATCH 05/30] i965/miptree: Clean up the depth resolve helpers a little
Kenneth Graunke
kenneth at whitecape.org
Wed May 31 21:33:24 UTC 2017
On Friday, May 26, 2017 4:30:09 PM PDT Jason Ekstrand wrote:
> ---
> src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 70 ++++++++++++---------------
> 1 file changed, 30 insertions(+), 40 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index 2701201..3a4fd89 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -1978,23 +1978,30 @@ intel_miptree_set_all_slices_need_depth_resolve(struct intel_mipmap_tree *mt,
> }
>
> static bool
> -intel_miptree_slice_resolve(struct brw_context *brw,
> - struct intel_mipmap_tree *mt,
> - uint32_t level,
> - uint32_t layer,
> - enum blorp_hiz_op need)
> +intel_miptree_depth_hiz_resolve(struct brw_context *brw,
> + struct intel_mipmap_tree *mt,
> + uint32_t start_level, uint32_t num_levels,
> + uint32_t start_layer, uint32_t num_layers,
> + enum blorp_hiz_op need)
> {
> - intel_miptree_check_level_layer(mt, level, layer);
> + bool did_resolve = false;
>
> - struct intel_resolve_map *item =
> - intel_resolve_map_get(&mt->hiz_map, level, layer);
> + foreach_list_typed_safe(struct intel_resolve_map, map, link, &mt->hiz_map) {
> + if (map->level < start_level ||
> + map->level >= (start_level + num_levels) ||
> + map->layer < start_layer ||
> + map->layer >= (start_layer + num_layers))
> + continue;
>
> - if (!item || item->need != need)
> - return false;
> + if (map->need != need)
> + continue;
>
> - intel_hiz_exec(brw, mt, level, layer, need);
> - intel_resolve_map_remove(item);
> - return true;
> + intel_hiz_exec(brw, mt, map->level, map->layer, need);
> + intel_resolve_map_remove(map);
> + did_resolve = true;
> + }
> +
> + return did_resolve;
> }
>
> bool
> @@ -2003,8 +2010,8 @@ intel_miptree_slice_resolve_hiz(struct brw_context *brw,
> uint32_t level,
> uint32_t layer)
> {
> - return intel_miptree_slice_resolve(brw, mt, level, layer,
> - BLORP_HIZ_OP_HIZ_RESOLVE);
> + return intel_miptree_depth_hiz_resolve(brw, mt, level, 1, layer, 1,
> + BLORP_HIZ_OP_HIZ_RESOLVE);
> }
>
> bool
> @@ -2013,43 +2020,26 @@ intel_miptree_slice_resolve_depth(struct brw_context *brw,
> uint32_t level,
> uint32_t layer)
> {
> - return intel_miptree_slice_resolve(brw, mt, level, layer,
> - BLORP_HIZ_OP_DEPTH_RESOLVE);
> -}
> -
> -static bool
> -intel_miptree_all_slices_resolve(struct brw_context *brw,
> - struct intel_mipmap_tree *mt,
> - enum blorp_hiz_op need)
> -{
> - bool did_resolve = false;
> -
> - foreach_list_typed_safe(struct intel_resolve_map, map, link, &mt->hiz_map) {
> - if (map->need != need)
> - continue;
> -
> - intel_hiz_exec(brw, mt, map->level, map->layer, need);
> - intel_resolve_map_remove(map);
> - did_resolve = true;
> - }
> -
> - return did_resolve;
> + return intel_miptree_depth_hiz_resolve(brw, mt, level, 1, layer, 1,
> + BLORP_HIZ_OP_DEPTH_RESOLVE);
> }
>
> bool
> intel_miptree_all_slices_resolve_hiz(struct brw_context *brw,
> struct intel_mipmap_tree *mt)
> {
> - return intel_miptree_all_slices_resolve(brw, mt,
> - BLORP_HIZ_OP_HIZ_RESOLVE);
> + return intel_miptree_depth_hiz_resolve(brw, mt,
> + 0, UINT32_MAX, 0, UINT32_MAX,
> + BLORP_HIZ_OP_HIZ_RESOLVE);
> }
>
> bool
> intel_miptree_all_slices_resolve_depth(struct brw_context *brw,
> struct intel_mipmap_tree *mt)
> {
> - return intel_miptree_all_slices_resolve(brw, mt,
> - BLORP_HIZ_OP_DEPTH_RESOLVE);
> + return intel_miptree_depth_hiz_resolve(brw, mt,
> + 0, UINT32_MAX, 0, UINT32_MAX,
> + BLORP_HIZ_OP_DEPTH_RESOLVE);
> }
>
> enum intel_fast_clear_state
>
I suppose this works...I was worried about integer overflow since you
do start_level + num_levels, both of which are uint32_t, and you pass
in UINT32_MAX to mean "all the levels". But you also pass in 0, so
it's not actually a problem...
Patches 1-5 are:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170531/85ed50e4/attachment.sig>
More information about the mesa-dev
mailing list