Mesa (main): intel: Minimal calculation of pixel hash table for arbitrary number of pixel pipes.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 11 02:45:22 UTC 2022


Module: Mesa
Branch: main
Commit: 170468b4fee457770bcb8db8fec58dd7d657fce4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=170468b4fee457770bcb8db8fec58dd7d657fce4

Author: Francisco Jerez <currojerez at riseup.net>
Date:   Wed Oct  6 14:42:18 2021 -0700

intel: Minimal calculation of pixel hash table for arbitrary number of pixel pipes.

This starts off with the simplest possible pixel hashing table
calculation that just assigns consecutive indices (modulo N) to
adjacent entries of the table, along the lines of the existing
intel_compute_pixel_hash_table().  The same function will be improved
in a future commit with a more optimal calculation.

Reviewed-by: Caio Oliveira <caio.oliveira at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13569>

---

 src/intel/common/intel_pixel_hash.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/src/intel/common/intel_pixel_hash.h b/src/intel/common/intel_pixel_hash.h
index d1c3049156f..306880879a6 100644
--- a/src/intel/common/intel_pixel_hash.h
+++ b/src/intel/common/intel_pixel_hash.h
@@ -62,4 +62,36 @@ intel_compute_pixel_hash_table(unsigned n, unsigned m,
    }
 }
 
+/**
+ * Compute an \p n x \p m pixel hashing table usable as slice,
+ * subslice or pixel pipe hashing table.  This generalizes the
+ * previous 3-way hash table function to an arbitrary number of ways
+ * given by the number of bits set in the \p mask argument, but
+ * doesn't allow the specification of different frequencies for
+ * different table indices.
+ */
+UNUSED static void
+intel_compute_pixel_hash_table_nway(unsigned n, unsigned m, uint32_t mask,
+                                    uint32_t *p)
+{
+   /* Construct a table mapping consecutive indices to the physical
+    * indices given by the bits set on the mask argument.
+    */
+   unsigned phys_ids[sizeof(mask) * CHAR_BIT];
+   unsigned num_ids = 0;
+
+   u_foreach_bit(i, mask)
+      phys_ids[num_ids++] = i;
+
+   assert(num_ids > 0);
+
+   /* Initialize the table with the cyclic repetition of a
+    * num_ids-periodic pattern.
+    */
+   for (unsigned i = 0; i < n; i++) {
+      for (unsigned j = 0; j < m; j++)
+         p[j + m * i] = phys_ids[(j + i) % num_ids];
+   }
+}
+
 #endif



More information about the mesa-commit mailing list