gfxstream: mesa: import Mesa

Mesa has Linux WSI implementations that can be used for
gfxstream.  We have to first import the parts of Mesa that
we find useful.

Just modified

- guest/src/mesa/meson.build

to remove extra project args.

- guest/src/mesa/src/meson.build

to not automatically call subdir in all directories.

This also requires the VK_NO_NIR and Android build patches, which
are fairly upstreamable.  The strategy would be to merge all changes
required in the source code.

Generally, if you want to modify the Mesa subdir, you generally
will want to have a plan for upstreaming the change.
For example, here's the Mesa VK_NIR patches.

https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26574

[not upstreamed yet; but do have a plan ;-)]

BUG=313466265
TEST=compile

Change-Id: Ib5a7546e3f8832ddba4de8e62afc80c669692444
diff --git a/guest/mesa/src/util/blake3/blake3.h b/guest/mesa/src/util/blake3/blake3.h
new file mode 100644
index 0000000..ff09151
--- /dev/null
+++ b/guest/mesa/src/util/blake3/blake3.h
@@ -0,0 +1,60 @@
+#ifndef BLAKE3_H
+#define BLAKE3_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define BLAKE3_VERSION_STRING "1.3.3"
+#define BLAKE3_KEY_LEN 32
+#define BLAKE3_OUT_LEN 32
+#define BLAKE3_BLOCK_LEN 64
+#define BLAKE3_CHUNK_LEN 1024
+#define BLAKE3_MAX_DEPTH 54
+
+// This struct is a private implementation detail. It has to be here because
+// it's part of blake3_hasher below.
+typedef struct {
+  uint32_t cv[8];
+  uint64_t chunk_counter;
+  uint8_t buf[BLAKE3_BLOCK_LEN];
+  uint8_t buf_len;
+  uint8_t blocks_compressed;
+  uint8_t flags;
+} blake3_chunk_state;
+
+typedef struct blake3_hasher {
+  uint32_t key[8];
+  blake3_chunk_state chunk;
+  uint8_t cv_stack_len;
+  // The stack size is MAX_DEPTH + 1 because we do lazy merging. For example,
+  // with 7 chunks, we have 3 entries in the stack. Adding an 8th chunk
+  // requires a 4th entry, rather than merging everything down to 1, because we
+  // don't know whether more input is coming. This is different from how the
+  // reference implementation does things.
+  uint8_t cv_stack[(BLAKE3_MAX_DEPTH + 1) * BLAKE3_OUT_LEN];
+} blake3_hasher;
+
+const char *blake3_version(void);
+void blake3_hasher_init(blake3_hasher *self);
+void blake3_hasher_init_keyed(blake3_hasher *self,
+                              const uint8_t key[BLAKE3_KEY_LEN]);
+void blake3_hasher_init_derive_key(blake3_hasher *self, const char *context);
+void blake3_hasher_init_derive_key_raw(blake3_hasher *self, const void *context,
+                                       size_t context_len);
+void blake3_hasher_update(blake3_hasher *self, const void *input,
+                          size_t input_len);
+void blake3_hasher_finalize(const blake3_hasher *self, uint8_t *out,
+                            size_t out_len);
+void blake3_hasher_finalize_seek(const blake3_hasher *self, uint64_t seek,
+                                 uint8_t *out, size_t out_len);
+void blake3_hasher_reset(blake3_hasher *self);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BLAKE3_H */