* based in part on anv driver which is:
* Copyright © 2015 Intel Corporation
*
- * based in part on radv driver which is:
+ * based in part on libresoc driver which is:
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*
#include <vulkan/vulkan.h>
#include <vulkan/vk_icd.h>
-//#include "common/libresoc_device_info.h"
-
+#include "vk_alloc.h"
#include "vk_debug_report.h"
#include "util/xmlconfig.h"
+#include "compiler/shader_enums.h"
+#include "vk_object.h"
#include "libresoc_entrypoints.h"
#include "libresoc_extensions.h"
+#include "libresoc_constants.h"
+#include "libresoc_debug.h"
+#define LIBRESOC_MAX_QUEUE_FAMILIES 1
struct libresoc_instance;
+struct libresoc_device;
+struct cache_entry;
+
+struct libresoc_pipeline_cache {
+ struct vk_object_base base;
+ struct libresoc_device * device;
+ pthread_mutex_t mutex;
+ VkPipelineCacheCreateFlags flags;
+
+ uint32_t total_size;
+ uint32_t table_size;
+ uint32_t kernel_count;
+ struct cache_entry ** hash_table;
+ bool modified;
+
+ VkAllocationCallbacks alloc;
+};
+
+
+struct libresoc_shader_binary;
+struct libresoc_shader_variant;
+void
+libresoc_pipeline_cache_init(struct libresoc_pipeline_cache *cache,
+ struct libresoc_device *device);
+void
+libresoc_pipeline_cache_finish(struct libresoc_pipeline_cache *cache);
+bool
+libresoc_pipeline_cache_load(struct libresoc_pipeline_cache *cache,
+ const void *data, size_t size);
+
+bool
+libresoc_create_shader_variants_from_pipeline_cache(struct libresoc_device *device,
+ struct libresoc_pipeline_cache *cache,
+ const unsigned char *sha1,
+ struct libresoc_shader_variant **variants,
+ bool *found_in_application_cache);
+
+void
+libresoc_pipeline_cache_insert_shaders(struct libresoc_device *device,
+ struct libresoc_pipeline_cache *cache,
+ const unsigned char *sha1,
+ struct libresoc_shader_variant **variants,
+ struct libresoc_shader_binary *const *binaries);
struct libresoc_device {
- VK_LOADER_DATA _loader_data;
+ struct vk_device vk;
VkAllocationCallbacks alloc;
struct libresoc_instance *instance;
struct libresoc_device_extension_table enabled_extensions;
struct libresoc_device_dispatch_table dispatch;
+ struct libresoc_queue *queues[LIBRESOC_MAX_QUEUE_FAMILIES];
+ int queue_count[LIBRESOC_MAX_QUEUE_FAMILIES];
+ struct radeon_cmdbuf *empty_cs[LIBRESOC_MAX_QUEUE_FAMILIES];
+ struct libresoc_physical_device *physical_device;
+
+ /* Backup in-memory cache to be used if the app doesn't provide one */
+ struct libresoc_pipeline_cache * mem_cache;
/* FIXME: stub */
};
struct libresoc_physical_device {
VK_LOADER_DATA _loader_data;
+ struct list_head link;
struct libresoc_instance *instance;
struct libresoc_device_extension_table supported_extensions;
struct libresoc_physical_device_dispatch_table dispatch;
+ char name[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
+ uint8_t driver_uuid[VK_UUID_SIZE];
+ uint8_t device_uuid[VK_UUID_SIZE];
+ uint8_t cache_uuid[VK_UUID_SIZE];
/* FIXME: stub */
};
};
struct libresoc_instance {
- VK_LOADER_DATA _loader_data;
+ struct vk_object_base base;
VkAllocationCallbacks alloc;
+ uint32_t apiVersion;
+
+ uint64_t debug_flags;
+ char * engineName;
+ uint32_t engineVersion;
struct libresoc_app_info app_info;
+ bool physical_devices_enumerated;
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 libresoc_physical_device_dispatch_table physical_device_dispatch;
+ int physical_device_count;
+ struct list_head physical_devices;
struct vk_debug_report_instance debug_report_callbacks;
};
struct libresoc_device *device;
+ uint32_t queue_family_index;
+ int queue_idx;
VkDeviceQueueCreateFlags flags;
/* FIXME: stub */
};
struct libresoc_cmd_buffer {
- VK_LOADER_DATA _loader_data;
struct libresoc_device *device;
void *libresoc_lookup_entrypoint(const char *name);
+const char *
+libresoc_get_debug_option_name(int id);
+
#define libresoc_printflike(a, b) __attribute__((__format__(__printf__, a, b)))
VkResult __vk_errorf(struct libresoc_instance *instance, VkResult error,
return (__VkType) _obj; \
}
+#define LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(__libresoc_type, __VkType) \
+ \
+ static inline struct __libresoc_type * \
+ __libresoc_type ## _from_handle(__VkType _handle) \
+ { \
+ return (struct __libresoc_type *)(uintptr_t) _handle; \
+ } \
+ \
+ static inline __VkType \
+ __libresoc_type ## _to_handle(struct __libresoc_type *_obj) \
+ { \
+ return (__VkType)(uintptr_t) _obj; \
+ }
+
#define LIBRESOC_FROM_HANDLE(__libresoc_type, __name, __handle) \
struct __libresoc_type *__name = __libresoc_type ## _from_handle(__handle)
LIBRESOC_DEFINE_HANDLE_CASTS(libresoc_physical_device, VkPhysicalDevice)
LIBRESOC_DEFINE_HANDLE_CASTS(libresoc_queue, VkQueue)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_cmd_pool, VkCommandPool)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_buffer, VkBuffer)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_buffer_view, VkBufferView)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_descriptor_pool, VkDescriptorPool)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_descriptor_set, VkDescriptorSet)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_descriptor_set_layout, VkDescriptorSetLayout)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_descriptor_update_template, VkDescriptorUpdateTemplate)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_device_memory, VkDeviceMemory)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_fence, VkFence)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_event, VkEvent)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_framebuffer, VkFramebuffer)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_image, VkImage)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_image_view, VkImageView);
+LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_pipeline_cache, VkPipelineCache)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_pipeline, VkPipeline)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_pipeline_layout, VkPipelineLayout)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_query_pool, VkQueryPool)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_render_pass, VkRenderPass)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_sampler, VkSampler)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_sampler_ycbcr_conversion, VkSamplerYcbcrConversion)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_shader_module, VkShaderModule)
+//LIBRESOC_DEFINE_NONDISP_HANDLE_CASTS(libresoc_semaphore, VkSemaphore)
#endif /* LIBRESOC_PRIVATE_H */