$(MESA_TOP)/src/gallium/include \
$(MESA_TOP)/src/gallium/auxiliary \
$(MESA_TOP)/src/mapi \
- $(MESA_TOP)/src/mesa
+ $(MESA_TOP)/src/mesa \
+ $(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_git_sha1,,)
LOCAL_SHARED_LIBRARIES := libz liblog
common/gen_l3_config.c \
common/gen_l3_config.h \
common/gen_urb_config.c \
- common/gen_sample_positions.h
+ common/gen_sample_positions.h \
+ common/gen_uuid.c \
+ common/gen_uuid.h
COMPILER_FILES = \
compiler/brw_cfg.cpp \
--- /dev/null
+/*
+ * Copyright © 2020 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "gen_uuid.h"
+#include "util/build_id.h"
+#include "util/mesa-sha1.h"
+
+void
+gen_uuid_compute_device_id(uint8_t *uuid,
+ const struct gen_device_info *devinfo,
+ const struct isl_device *isldev,
+ size_t size)
+{
+ struct mesa_sha1 sha1_ctx;
+ uint8_t sha1[20];
+
+ assert(size <= sizeof(sha1));
+
+ /* The device UUID uniquely identifies the given device within the machine.
+ * Since we never have more than one device, this doesn't need to be a real
+ * UUID. However, on the off-chance that someone tries to use this to
+ * cache pre-tiled images or something of the like, we use the PCI ID and
+ * some bits of ISL info to ensure that this is safe.
+ */
+ _mesa_sha1_init(&sha1_ctx);
+ _mesa_sha1_update(&sha1_ctx, &devinfo->chipset_id,
+ sizeof(devinfo->chipset_id));
+ _mesa_sha1_update(&sha1_ctx, &isldev->has_bit6_swizzling,
+ sizeof(isldev->has_bit6_swizzling));
+ _mesa_sha1_final(&sha1_ctx, sha1);
+ memcpy(uuid, sha1, size);
+}
+
+void
+gen_uuid_compute_driver_id(uint8_t *uuid,
+ const struct gen_device_info *devinfo,
+ size_t size)
+{
+ const struct build_id_note *note =
+ build_id_find_nhdr_for_addr(gen_uuid_compute_driver_id);
+ assert(note && "Failed to find build-id");
+
+ unsigned build_id_len = build_id_length(note);
+ assert(build_id_len >= size && "build-id too short");
+
+ /* The driver UUID is used for determining sharability of images and memory
+ * between two Vulkan instances in separate processes, or for
+ * interoperability between Vulkan and OpenGL. People who want to * share
+ * memory need to also check the device UUID so all this * needs to be is
+ * the build-id.
+ */
+ memcpy(uuid, build_id_data(note), size);
+}
--- /dev/null
+ /*
+ * Copyright © 2020 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#ifndef GEN_UUID_H
+#define GEN_UUID_H
+
+#include "dev/gen_device_info.h"
+#include "isl/isl.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void gen_uuid_compute_device_id(uint8_t *uuid,
+ const struct gen_device_info *devinfo,
+ const struct isl_device *isldev,
+ size_t size);
+
+void gen_uuid_compute_driver_id(uint8_t *uuid,
+ const struct gen_device_info *devinfo,
+ size_t size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GEN_UUID_H */
'gen_l3_config.h',
'gen_urb_config.c',
'gen_sample_positions.h',
+ 'gen_uuid.c',
+ 'gen_uuid.h',
)
libintel_common = static_library(
#include "vk_util.h"
#include "common/gen_aux_map.h"
#include "common/gen_defines.h"
+#include "common/gen_uuid.h"
#include "compiler/glsl_types.h"
#include "genxml/gen7_pack.h"
_mesa_sha1_final(&sha1_ctx, sha1);
memcpy(device->pipeline_cache_uuid, sha1, VK_UUID_SIZE);
- /* The driver UUID is used for determining sharability of images and memory
- * between two Vulkan instances in separate processes. People who want to
- * share memory need to also check the device UUID (below) so all this
- * needs to be is the build-id.
- */
- memcpy(device->driver_uuid, build_id_data(note), VK_UUID_SIZE);
-
- /* The device UUID uniquely identifies the given device within the machine.
- * Since we never have more than one device, this doesn't need to be a real
- * UUID. However, on the off-chance that someone tries to use this to
- * cache pre-tiled images or something of the like, we use the PCI ID and
- * some bits of ISL info to ensure that this is safe.
- */
- _mesa_sha1_init(&sha1_ctx);
- _mesa_sha1_update(&sha1_ctx, &device->info.chipset_id,
- sizeof(device->info.chipset_id));
- _mesa_sha1_update(&sha1_ctx, &device->isl_dev.has_bit6_swizzling,
- sizeof(device->isl_dev.has_bit6_swizzling));
- _mesa_sha1_final(&sha1_ctx, sha1);
- memcpy(device->device_uuid, sha1, VK_UUID_SIZE);
+ gen_uuid_compute_driver_id(device->driver_uuid, &device->info, VK_UUID_SIZE);
+ gen_uuid_compute_device_id(device->device_uuid, &device->info,
+ &device->isl_dev, VK_UUID_SIZE);
return VK_SUCCESS;
}