--- /dev/null
+/*
+ * Copyright © 2019 Raspberry Pi
+ *
+ * based in part on anv driver which is:
+ * Copyright © 2015 Intel Corporation
+ *
+ * based in part on radv driver which is:
+ * Copyright © 2016 Red Hat.
+ * Copyright © 2016 Bas Nieuwenhuizen
+ *
+ * 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 LIBRESOC_PRIVATE_H
+#define LIBRESOC_PRIVATE_H
+
+#include <stdio.h>
+#include <string.h>
+#include <vulkan/vulkan.h>
+#include <vulkan/vk_icd.h>
+
+//#include "common/libresoc_device_info.h"
+
+#include "vk_debug_report.h"
+#include "util/xmlconfig.h"
+
+#include "libresoc_entrypoints.h"
+#include "libresoc_extensions.h"
+
+struct libresoc_instance;
+
+struct libresoc_device {
+ VK_LOADER_DATA _loader_data;
+
+ VkAllocationCallbacks alloc;
+
+ struct libresoc_instance *instance;
+
+ struct libresoc_device_extension_table enabled_extensions;
+ struct libresoc_device_dispatch_table dispatch;
+
+ /* FIXME: stub */
+};
+
+
+struct libresoc_physical_device {
+ VK_LOADER_DATA _loader_data;
+
+ struct libresoc_instance *instance;
+
+ struct libresoc_device_extension_table supported_extensions;
+ struct libresoc_physical_device_dispatch_table dispatch;
+
+ /* FIXME: stub */
+};
+
+struct libresoc_app_info {
+ const char *app_name;
+ uint32_t app_version;
+ const char *engine_name;
+ uint32_t engine_version;
+ uint32_t api_version;
+};
+
+struct libresoc_instance {
+ VK_LOADER_DATA _loader_data;
+
+ VkAllocationCallbacks alloc;
+
+ struct libresoc_app_info app_info;
+
+ struct libresoc_instance_extension_table enabled_extensions;
+ struct libresoc_instance_dispatch_table dispatch;
+ struct libresoc_device_dispatch_table device_dispatch;
+
+ int physicalDeviceCount;
+ struct libresoc_physical_device physicalDevice;
+
+ struct vk_debug_report_instance debug_report_callbacks;
+};
+
+struct libresoc_queue {
+ VK_LOADER_DATA _loader_data;
+
+ struct libresoc_device *device;
+
+ VkDeviceQueueCreateFlags flags;
+
+ /* FIXME: stub */
+};
+
+struct libresoc_cmd_buffer {
+ VK_LOADER_DATA _loader_data;
+
+ struct libresoc_device *device;
+
+ /* FIXME: stub */
+};
+
+uint32_t libresoc_physical_device_api_version(struct libresoc_physical_device *dev);
+
+int libresoc_get_instance_entrypoint_index(const char *name);
+int libresoc_get_device_entrypoint_index(const char *name);
+int libresoc_get_physical_device_entrypoint_index(const char *name);
+
+const char *libresoc_get_instance_entry_name(int index);
+const char *libresoc_get_physical_device_entry_name(int index);
+const char *libresoc_get_device_entry_name(int index);
+
+bool
+libresoc_instance_entrypoint_is_enabled(int index, uint32_t core_version,
+ const struct libresoc_instance_extension_table *instance);
+bool
+libresoc_physical_device_entrypoint_is_enabled(int index, uint32_t core_version,
+ const struct libresoc_instance_extension_table *instance);
+bool
+libresoc_device_entrypoint_is_enabled(int index, uint32_t core_version,
+ const struct libresoc_instance_extension_table *instance,
+ const struct libresoc_device_extension_table *device);
+
+void *libresoc_lookup_entrypoint(const char *name);
+
+#define libresoc_printflike(a, b) __attribute__((__format__(__printf__, a, b)))
+
+VkResult __vk_errorf(struct libresoc_instance *instance, VkResult error,
+ const char *file, int line,
+ const char *format, ...);
+
+#define vk_error(instance, error) __vk_errorf(instance, error, __FILE__, __LINE__, NULL);
+#define vk_errorf(instance, error, format, ...) __vk_errorf(instance, error, __FILE__, __LINE__, format, ## __VA_ARGS__);
+
+void libresoc_loge(const char *format, ...) libresoc_printflike(1, 2);
+void libresoc_loge_v(const char *format, va_list va);
+
+#define LIBRESOC_DEFINE_HANDLE_CASTS(__libresoc_type, __VkType) \
+ \
+ static inline struct __libresoc_type * \
+ __libresoc_type ## _from_handle(__VkType _handle) \
+ { \
+ return (struct __libresoc_type *) _handle; \
+ } \
+ \
+ static inline __VkType \
+ __libresoc_type ## _to_handle(struct __libresoc_type *_obj) \
+ { \
+ return (__VkType) _obj; \
+ }
+
+#define LIBRESOC_FROM_HANDLE(__libresoc_type, __name, __handle) \
+ struct __libresoc_type *__name = __libresoc_type ## _from_handle(__handle)
+
+LIBRESOC_DEFINE_HANDLE_CASTS(libresoc_cmd_buffer, VkCommandBuffer)
+LIBRESOC_DEFINE_HANDLE_CASTS(libresoc_device, VkDevice)
+LIBRESOC_DEFINE_HANDLE_CASTS(libresoc_instance, VkInstance)
+LIBRESOC_DEFINE_HANDLE_CASTS(libresoc_physical_device, VkPhysicalDevice)
+LIBRESOC_DEFINE_HANDLE_CASTS(libresoc_queue, VkQueue)
+
+
+#endif /* LIBRESOC_PRIVATE_H */