Module: Mesa
Branch: master
Commit: 76f79db3f5d8492370c92080b5bbea7e31827b75
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=76f79db3f5d8492370c92080b5bbea7e31827b75

Author: Marek Olšák <[email protected]>
Date:   Wed Mar 25 21:26:24 2020 -0400

util: stop including files from mesa/main

Reviewed-by: Timothy Arceri <[email protected]
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>

---

 src/util/blob.c              |  8 ++++----
 src/util/debug.c             |  1 -
 src/util/disk_cache.c        |  1 -
 src/util/hash_table.c        | 21 ++++++++++++++++++++-
 src/util/register_allocate.c |  5 +++--
 5 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/src/util/blob.c b/src/util/blob.c
index f830eb48076..db192146ac1 100644
--- a/src/util/blob.c
+++ b/src/util/blob.c
@@ -23,8 +23,8 @@
 
 #include <string.h>
 
-#include "main/macros.h"
 #include "blob.h"
+#include "u_math.h"
 
 #ifdef HAVE_VALGRIND
 #include <valgrind.h>
@@ -85,7 +85,7 @@ grow_to_fit(struct blob *blob, size_t additional)
 static bool
 align_blob(struct blob *blob, size_t alignment)
 {
-   const size_t new_size = ALIGN(blob->size, alignment);
+   const size_t new_size = align64(blob->size, alignment);
 
    if (blob->size < new_size) {
       if (!grow_to_fit(blob, new_size - blob->size))
@@ -102,7 +102,7 @@ align_blob(struct blob *blob, size_t alignment)
 static void
 align_blob_reader(struct blob_reader *blob, size_t alignment)
 {
-   blob->current = blob->data + ALIGN(blob->current - blob->data, alignment);
+   blob->current = blob->data + align64(blob->current - blob->data, alignment);
 }
 
 void
@@ -212,7 +212,7 @@ BLOB_WRITE_TYPE(blob_write_uint64, uint64_t)
 BLOB_WRITE_TYPE(blob_write_intptr, intptr_t)
 
 #define ASSERT_ALIGNED(_offset, _align) \
-   assert(ALIGN((_offset), (_align)) == (_offset))
+   assert(align64((_offset), (_align)) == (_offset))
 
 bool
 blob_overwrite_uint8 (struct blob *blob,
diff --git a/src/util/debug.c b/src/util/debug.c
index 7079c61b7f4..89ae6131074 100644
--- a/src/util/debug.c
+++ b/src/util/debug.c
@@ -23,7 +23,6 @@
 
 #include <errno.h>
 #include <string.h>
-#include "main/macros.h"
 #include "debug.h"
 #include "u_string.h"
 
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index 04320568537..a92d621927a 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -52,7 +52,6 @@
 #include "util/mesa-sha1.h"
 #include "util/ralloc.h"
 #include "util/compiler.h"
-#include "main/errors.h"
 
 #include "disk_cache.h"
 
diff --git a/src/util/hash_table.c b/src/util/hash_table.c
index 3d5de59a040..939c03c19ee 100644
--- a/src/util/hash_table.c
+++ b/src/util/hash_table.c
@@ -47,12 +47,31 @@
 #include "hash_table.h"
 #include "ralloc.h"
 #include "macros.h"
-#include "main/hash.h"
+#include "u_memory.h"
 #include "fast_urem_by_const.h"
 
 #define XXH_INLINE_ALL
 #include "xxhash.h"
 
+/**
+ * Magic number that gets stored outside of the struct hash_table.
+ *
+ * The hash table needs a particular pointer to be the marker for a key that
+ * was deleted from the table, along with NULL for the "never allocated in the
+ * table" marker.  Legacy GL allows any GLuint to be used as a GL object name,
+ * and we use a 1:1 mapping from GLuints to key pointers, so we need to be
+ * able to track a GLuint that happens to match the deleted key outside of
+ * struct hash_table.  We tell the hash table to use "1" as the deleted key
+ * value, so that we test the deleted-key-in-the-table path as best we can.
+ */
+#define DELETED_KEY_VALUE 1
+
+static inline void *
+uint_key(unsigned id)
+{
+   return (void *)(uintptr_t) id;
+}
+
 static const uint32_t deleted_key_value;
 
 /**
diff --git a/src/util/register_allocate.c b/src/util/register_allocate.c
index 9c654080a09..af43c2fbb43 100644
--- a/src/util/register_allocate.c
+++ b/src/util/register_allocate.c
@@ -71,11 +71,12 @@
  */
 
 #include <stdbool.h>
+#include <limits.h>
 
 #include "ralloc.h"
 #include "util/imports.h"
-#include "main/macros.h"
 #include "util/bitset.h"
+#include "u_math.h"
 #include "register_allocate.h"
 
 struct ra_reg {
@@ -496,7 +497,7 @@ ra_realloc_interference_graph(struct ra_graph *g, unsigned 
int alloc)
     * easier to memset the top of the growing bitsets.
     */
    assert(g->alloc % BITSET_WORDBITS == 0);
-   alloc = ALIGN(alloc, BITSET_WORDBITS);
+   alloc = align64(alloc, BITSET_WORDBITS);
 
    g->nodes = reralloc(g, g->nodes, struct ra_node, alloc);
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to