i965: Add multi-slice getter for resolve maps
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Fri, 10 Jun 2016 15:18:57 +0000 (18:18 +0300)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Wed, 23 Nov 2016 09:06:53 +0000 (11:06 +0200)
This is useful when checking if any slice is in unresolved state.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/intel_resolve_map.c
src/mesa/drivers/dri/i965/intel_resolve_map.h

index 26eac8bc65e89609006d5f26b7ca87f418158d07..56fd9547788e33ec8d0098e4faacbb2452f22100 100644 (file)
@@ -57,13 +57,16 @@ intel_resolve_map_set(struct exec_list *resolve_map,
  * \brief Get an element from the map.
  * \return null if element is not contained in map.
  */
-struct intel_resolve_map *
-intel_resolve_map_get(struct exec_list *resolve_map,
-                     uint32_t level,
-                     uint32_t layer)
+const struct intel_resolve_map *
+intel_resolve_map_find_any(const struct exec_list *resolve_map,
+                           uint32_t start_level, uint32_t num_levels,
+                           uint32_t start_layer, uint32_t num_layers)
 {
    foreach_list_typed(struct intel_resolve_map, map, link, resolve_map) {
-      if (map->level == level && map->layer == layer)
+      if (map->level >= start_level &&
+          map->level < (start_level + num_levels) &&
+          map->layer >= start_layer &&
+          map->layer < (start_layer + num_layers))
          return map;
    }
 
index e998e97e6da019e0ee682b19aadb0279e182f178..29cad8f4b6de7f6e1e24180530e1668a0fbaa107 100644 (file)
@@ -71,10 +71,27 @@ intel_resolve_map_set(struct exec_list *resolve_map,
                      uint32_t layer,
                      enum blorp_hiz_op need);
 
-struct intel_resolve_map *
+const struct intel_resolve_map *
+intel_resolve_map_find_any(const struct exec_list *resolve_map,
+                           uint32_t start_level, uint32_t num_levels,
+                           uint32_t start_layer, uint32_t num_layers);
+
+static inline const struct intel_resolve_map *
+intel_resolve_map_const_get(const struct exec_list *resolve_map,
+                            uint32_t level,
+                            uint32_t layer)
+{
+   return intel_resolve_map_find_any(resolve_map, level, 1, layer, 1);
+}
+
+static inline struct intel_resolve_map *
 intel_resolve_map_get(struct exec_list *resolve_map,
                      uint32_t level,
-                     uint32_t layer);
+                     uint32_t layer)
+{
+   return (struct intel_resolve_map *)intel_resolve_map_find_any(
+                                         resolve_map, level, 1, layer, 1);
+}
 
 void
 intel_resolve_map_remove(struct intel_resolve_map *resolve_map);