Mesa (main): venus: break up vn_device.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 2 22:54:44 UTC 2021


Module: Mesa
Branch: main
Commit: 22cb100ea0a26ca8083c3e30bab4268750ffba4d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=22cb100ea0a26ca8083c3e30bab4268750ffba4d

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Fri Jul 30 11:07:55 2021 -0700

venus: break up vn_device.h

Break it up into vn_{device,instance,physical_device}.h.  Suggested by
Ryan Neph.

Signed-off-by: Chia-I Wu <olvaffe at gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei at chromium.org>
Reviewed-by: Ryan Neph <ryanneph at google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12144>

---

 src/virtio/venus-protocol/vn_protocol_driver.h     |   2 +-
 .../venus-protocol/vn_protocol_driver_buffer.h     |   2 +-
 .../vn_protocol_driver_buffer_view.h               |   2 +-
 .../vn_protocol_driver_command_buffer.h            |   2 +-
 .../vn_protocol_driver_command_pool.h              |   2 +-
 .../vn_protocol_driver_descriptor_pool.h           |   2 +-
 .../vn_protocol_driver_descriptor_set.h            |   2 +-
 .../vn_protocol_driver_descriptor_set_layout.h     |   2 +-
 ...vn_protocol_driver_descriptor_update_template.h |   2 +-
 .../venus-protocol/vn_protocol_driver_device.h     |   2 +-
 .../vn_protocol_driver_device_memory.h             |   2 +-
 .../venus-protocol/vn_protocol_driver_event.h      |   2 +-
 .../venus-protocol/vn_protocol_driver_fence.h      |   2 +-
 .../vn_protocol_driver_framebuffer.h               |   2 +-
 .../venus-protocol/vn_protocol_driver_image.h      |   2 +-
 .../venus-protocol/vn_protocol_driver_image_view.h |   2 +-
 .../venus-protocol/vn_protocol_driver_instance.h   |   2 +-
 .../venus-protocol/vn_protocol_driver_pipeline.h   |   2 +-
 .../vn_protocol_driver_pipeline_cache.h            |   2 +-
 .../vn_protocol_driver_pipeline_layout.h           |   2 +-
 .../venus-protocol/vn_protocol_driver_query_pool.h |   2 +-
 .../venus-protocol/vn_protocol_driver_queue.h      |   2 +-
 .../vn_protocol_driver_render_pass.h               |   2 +-
 .../venus-protocol/vn_protocol_driver_sampler.h    |   2 +-
 .../vn_protocol_driver_sampler_ycbcr_conversion.h  |   2 +-
 .../venus-protocol/vn_protocol_driver_semaphore.h  |   2 +-
 .../vn_protocol_driver_shader_module.h             |   2 +-
 .../venus-protocol/vn_protocol_driver_transport.h  |   2 +-
 src/virtio/vulkan/vn_android.c                     |   6 +-
 src/virtio/vulkan/vn_cs.c                          |   2 +-
 src/virtio/vulkan/vn_device.c                      |   2 +
 src/virtio/vulkan/vn_device.h                      | 182 ---------------------
 src/virtio/vulkan/vn_device_memory.c               |   1 +
 src/virtio/vulkan/vn_icd.c                         |   2 +-
 src/virtio/vulkan/vn_image.c                       |   1 +
 src/virtio/vulkan/vn_instance.h                    | 144 ++++++++++++++++
 src/virtio/vulkan/vn_physical_device.h             |  72 ++++++++
 src/virtio/vulkan/vn_pipeline.c                    |   1 +
 src/virtio/vulkan/vn_queue.c                       |   1 +
 src/virtio/vulkan/vn_wsi.c                         |   2 +
 src/virtio/vulkan/vn_wsi_wayland.c                 |   3 +-
 src/virtio/vulkan/vn_wsi_x11.c                     |   3 +-
 42 files changed, 262 insertions(+), 216 deletions(-)

diff --git a/src/virtio/venus-protocol/vn_protocol_driver.h b/src/virtio/venus-protocol/vn_protocol_driver.h
index 0ee2996cd7b..535f067c1a8 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver.h
@@ -1,4 +1,4 @@
-/* This file is generated by venus-protocol git-f59e7aad. */
+/* This file is generated by venus-protocol git-0d51970a. */
 
 /*
  * Copyright 2020 Google LLC
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_buffer.h b/src/virtio/venus-protocol/vn_protocol_driver_buffer.h
index 7b9b7ef3cfb..7f80b40da09 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_buffer.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_buffer.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_BUFFER_H
 #define VN_PROTOCOL_DRIVER_BUFFER_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkExternalMemoryBufferCreateInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_buffer_view.h b/src/virtio/venus-protocol/vn_protocol_driver_buffer_view.h
index 952bb6237f7..a5d649d32b9 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_buffer_view.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_buffer_view.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_BUFFER_VIEW_H
 #define VN_PROTOCOL_DRIVER_BUFFER_VIEW_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkBufferViewCreateInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_command_buffer.h b/src/virtio/venus-protocol/vn_protocol_driver_command_buffer.h
index 18d155f9101..7aeaf7343a9 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_command_buffer.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_command_buffer.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_COMMAND_BUFFER_H
 #define VN_PROTOCOL_DRIVER_COMMAND_BUFFER_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkCommandBufferAllocateInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_command_pool.h b/src/virtio/venus-protocol/vn_protocol_driver_command_pool.h
index c71701079b4..a2a5bf864ff 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_command_pool.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_command_pool.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_COMMAND_POOL_H
 #define VN_PROTOCOL_DRIVER_COMMAND_POOL_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkCommandPoolCreateInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_descriptor_pool.h b/src/virtio/venus-protocol/vn_protocol_driver_descriptor_pool.h
index a80f9aa3a1f..b01cef37a14 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_descriptor_pool.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_descriptor_pool.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_DESCRIPTOR_POOL_H
 #define VN_PROTOCOL_DRIVER_DESCRIPTOR_POOL_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkDescriptorPoolSize */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_descriptor_set.h b/src/virtio/venus-protocol/vn_protocol_driver_descriptor_set.h
index ded739f38f1..9c55d8f1362 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_descriptor_set.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_descriptor_set.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_DESCRIPTOR_SET_H
 #define VN_PROTOCOL_DRIVER_DESCRIPTOR_SET_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /*
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_descriptor_set_layout.h b/src/virtio/venus-protocol/vn_protocol_driver_descriptor_set_layout.h
index e02186752cb..cde1126feb0 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_descriptor_set_layout.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_descriptor_set_layout.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_DESCRIPTOR_SET_LAYOUT_H
 #define VN_PROTOCOL_DRIVER_DESCRIPTOR_SET_LAYOUT_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkDescriptorSetLayoutBinding */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_descriptor_update_template.h b/src/virtio/venus-protocol/vn_protocol_driver_descriptor_update_template.h
index 82c4da9b76b..a62db72882c 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_descriptor_update_template.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_descriptor_update_template.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_DESCRIPTOR_UPDATE_TEMPLATE_H
 #define VN_PROTOCOL_DRIVER_DESCRIPTOR_UPDATE_TEMPLATE_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkDescriptorUpdateTemplateEntry */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_device.h b/src/virtio/venus-protocol/vn_protocol_driver_device.h
index 96e72003764..1ee0ac273ea 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_device.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_device.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_DEVICE_H
 #define VN_PROTOCOL_DRIVER_DEVICE_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /*
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_device_memory.h b/src/virtio/venus-protocol/vn_protocol_driver_device_memory.h
index ecbcff59799..47cd33f7ee0 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_device_memory.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_device_memory.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_DEVICE_MEMORY_H
 #define VN_PROTOCOL_DRIVER_DEVICE_MEMORY_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /*
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_event.h b/src/virtio/venus-protocol/vn_protocol_driver_event.h
index ac69e3ce439..b2027e9b0f0 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_event.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_event.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_EVENT_H
 #define VN_PROTOCOL_DRIVER_EVENT_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkEventCreateInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_fence.h b/src/virtio/venus-protocol/vn_protocol_driver_fence.h
index e7cf67524a6..31cc83a0121 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_fence.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_fence.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_FENCE_H
 #define VN_PROTOCOL_DRIVER_FENCE_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkExportFenceCreateInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_framebuffer.h b/src/virtio/venus-protocol/vn_protocol_driver_framebuffer.h
index 7262c6251cd..434c3d98b0f 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_framebuffer.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_framebuffer.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_FRAMEBUFFER_H
 #define VN_PROTOCOL_DRIVER_FRAMEBUFFER_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkFramebufferAttachmentImageInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_image.h b/src/virtio/venus-protocol/vn_protocol_driver_image.h
index cdb4659dc89..5f324fa99a4 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_image.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_image.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_IMAGE_H
 #define VN_PROTOCOL_DRIVER_IMAGE_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkSparseImageMemoryRequirements */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_image_view.h b/src/virtio/venus-protocol/vn_protocol_driver_image_view.h
index 150a473583d..7dd322b4807 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_image_view.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_image_view.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_IMAGE_VIEW_H
 #define VN_PROTOCOL_DRIVER_IMAGE_VIEW_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkImageViewUsageCreateInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_instance.h b/src/virtio/venus-protocol/vn_protocol_driver_instance.h
index a6c910be790..fa52e810cd4 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_instance.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_instance.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_INSTANCE_H
 #define VN_PROTOCOL_DRIVER_INSTANCE_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /*
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_pipeline.h b/src/virtio/venus-protocol/vn_protocol_driver_pipeline.h
index ab299bc5e17..8df0f569770 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_pipeline.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_pipeline.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_PIPELINE_H
 #define VN_PROTOCOL_DRIVER_PIPELINE_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkSpecializationMapEntry */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_pipeline_cache.h b/src/virtio/venus-protocol/vn_protocol_driver_pipeline_cache.h
index ce08acce13c..c68b49eb6c5 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_pipeline_cache.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_pipeline_cache.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_PIPELINE_CACHE_H
 #define VN_PROTOCOL_DRIVER_PIPELINE_CACHE_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkPipelineCacheCreateInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_pipeline_layout.h b/src/virtio/venus-protocol/vn_protocol_driver_pipeline_layout.h
index 4e123125f90..0c33d7225e6 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_pipeline_layout.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_pipeline_layout.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_PIPELINE_LAYOUT_H
 #define VN_PROTOCOL_DRIVER_PIPELINE_LAYOUT_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkPushConstantRange */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_query_pool.h b/src/virtio/venus-protocol/vn_protocol_driver_query_pool.h
index f08f938013a..416cb395234 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_query_pool.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_query_pool.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_QUERY_POOL_H
 #define VN_PROTOCOL_DRIVER_QUERY_POOL_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkQueryPoolCreateInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_queue.h b/src/virtio/venus-protocol/vn_protocol_driver_queue.h
index 2a0fd3d0c27..9c723996b1f 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_queue.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_queue.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_QUEUE_H
 #define VN_PROTOCOL_DRIVER_QUEUE_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkDeviceGroupSubmitInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_render_pass.h b/src/virtio/venus-protocol/vn_protocol_driver_render_pass.h
index 22e4df43e3d..bc5ba424822 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_render_pass.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_render_pass.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_RENDER_PASS_H
 #define VN_PROTOCOL_DRIVER_RENDER_PASS_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkAttachmentDescription */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_sampler.h b/src/virtio/venus-protocol/vn_protocol_driver_sampler.h
index 72aa53573cd..5c96997c948 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_sampler.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_sampler.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_SAMPLER_H
 #define VN_PROTOCOL_DRIVER_SAMPLER_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkSamplerReductionModeCreateInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_sampler_ycbcr_conversion.h b/src/virtio/venus-protocol/vn_protocol_driver_sampler_ycbcr_conversion.h
index 564b30a87cc..3640b8e9834 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_sampler_ycbcr_conversion.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_sampler_ycbcr_conversion.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_SAMPLER_YCBCR_CONVERSION_H
 #define VN_PROTOCOL_DRIVER_SAMPLER_YCBCR_CONVERSION_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkSamplerYcbcrConversionCreateInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_semaphore.h b/src/virtio/venus-protocol/vn_protocol_driver_semaphore.h
index a459356d451..d8007587124 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_semaphore.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_semaphore.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_SEMAPHORE_H
 #define VN_PROTOCOL_DRIVER_SEMAPHORE_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkExportSemaphoreCreateInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_shader_module.h b/src/virtio/venus-protocol/vn_protocol_driver_shader_module.h
index 1ad368019d2..e8de716f6a4 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_shader_module.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_shader_module.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_SHADER_MODULE_H
 #define VN_PROTOCOL_DRIVER_SHADER_MODULE_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /* struct VkShaderModuleCreateInfo chain */
diff --git a/src/virtio/venus-protocol/vn_protocol_driver_transport.h b/src/virtio/venus-protocol/vn_protocol_driver_transport.h
index 0a3f05e59df..c9c12fc1666 100644
--- a/src/virtio/venus-protocol/vn_protocol_driver_transport.h
+++ b/src/virtio/venus-protocol/vn_protocol_driver_transport.h
@@ -8,7 +8,7 @@
 #ifndef VN_PROTOCOL_DRIVER_TRANSPORT_H
 #define VN_PROTOCOL_DRIVER_TRANSPORT_H
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_protocol_driver_structs.h"
 
 /*
diff --git a/src/virtio/vulkan/vn_android.c b/src/virtio/vulkan/vn_android.c
index 0dbcbc5f036..121f124853f 100644
--- a/src/virtio/vulkan/vn_android.c
+++ b/src/virtio/vulkan/vn_android.c
@@ -24,6 +24,8 @@
 #include "vn_device.h"
 #include "vn_device_memory.h"
 #include "vn_image.h"
+#include "vn_instance.h"
+#include "vn_physical_device.h"
 #include "vn_queue.h"
 
 static int
@@ -208,8 +210,8 @@ vn_GetSwapchainGrallocUsage2ANDROID(
 
 struct cros_gralloc0_buffer_info {
    uint32_t drm_fourcc;
-   int num_fds;         /* ignored */
-   int fds[4];          /* ignored */
+   int num_fds; /* ignored */
+   int fds[4];  /* ignored */
    uint64_t modifier;
    uint32_t offset[4];
    uint32_t stride[4];
diff --git a/src/virtio/vulkan/vn_cs.c b/src/virtio/vulkan/vn_cs.c
index 0a07e86d7fe..abb3517aa1a 100644
--- a/src/virtio/vulkan/vn_cs.c
+++ b/src/virtio/vulkan/vn_cs.c
@@ -5,7 +5,7 @@
 
 #include "vn_cs.h"
 
-#include "vn_device.h"
+#include "vn_instance.h"
 #include "vn_renderer.h"
 
 static void
diff --git a/src/virtio/vulkan/vn_device.c b/src/virtio/vulkan/vn_device.c
index 7e890b42323..cabe79f1dd9 100644
--- a/src/virtio/vulkan/vn_device.c
+++ b/src/virtio/vulkan/vn_device.c
@@ -23,6 +23,8 @@
 #include "vn_android.h"
 #include "vn_device_memory.h"
 #include "vn_icd.h"
+#include "vn_instance.h"
+#include "vn_physical_device.h"
 #include "vn_queue.h"
 #include "vn_renderer.h"
 
diff --git a/src/virtio/vulkan/vn_device.h b/src/virtio/vulkan/vn_device.h
index b0fc465814a..0efd0b26023 100644
--- a/src/virtio/vulkan/vn_device.h
+++ b/src/virtio/vulkan/vn_device.h
@@ -13,120 +13,7 @@
 
 #include "vn_common.h"
 
-#include "venus-protocol/vn_protocol_driver_defines.h"
-
-#include "vn_cs.h"
 #include "vn_device_memory.h"
-#include "vn_renderer.h"
-#include "vn_ring.h"
-#include "vn_wsi.h"
-
-struct vn_instance {
-   struct vn_instance_base base;
-
-   struct driOptionCache dri_options;
-   struct driOptionCache available_dri_options;
-
-   struct vn_renderer *renderer;
-   struct vn_renderer_info renderer_info;
-
-   /* Between the driver and the app, VN_MAX_API_VERSION is what we advertise
-    * and base.base.app_info.api_version is what the app requests.
-    *
-    * Between the driver and the renderer, renderer_api_version is the api
-    * version we request internally, which can be higher than
-    * base.base.app_info.api_version.  renderer_version is the instance
-    * version we can use internally.
-    */
-   uint32_t renderer_api_version;
-   uint32_t renderer_version;
-
-   /* to synchronize renderer/ring */
-   mtx_t roundtrip_mutex;
-   uint32_t roundtrip_next;
-
-   struct {
-      mtx_t mutex;
-      struct vn_renderer_shmem *shmem;
-      struct vn_ring ring;
-      uint64_t id;
-
-      struct vn_cs_encoder upload;
-      uint32_t command_dropped;
-   } ring;
-
-   struct {
-      struct vn_renderer_shmem *shmem;
-      size_t size;
-      size_t used;
-      void *ptr;
-   } reply;
-
-   mtx_t physical_device_mutex;
-   struct vn_physical_device *physical_devices;
-   uint32_t physical_device_count;
-
-   /* XXX staged features to be merged to core venus protocol */
-   VkVenusExperimentalFeatures100000MESA experimental;
-};
-VK_DEFINE_HANDLE_CASTS(vn_instance,
-                       base.base.base,
-                       VkInstance,
-                       VK_OBJECT_TYPE_INSTANCE)
-
-struct vn_physical_device {
-   struct vn_physical_device_base base;
-
-   struct vn_instance *instance;
-
-   /* Between the driver and the app, properties.properties.apiVersion is what
-    * we advertise and is capped by VN_MAX_API_VERSION and others.
-    *
-    * Between the driver and the renderer, renderer_version is the device
-    * version we can use internally.
-    */
-   uint32_t renderer_version;
-
-   /* Between the driver and the app, base.base.supported_extensions is what
-    * we advertise.
-    *
-    * Between the driver and the renderer, renderer_extensions is what we can
-    * use internally (after enabling).
-    */
-   struct vk_device_extension_table renderer_extensions;
-   uint32_t *extension_spec_versions;
-
-   VkPhysicalDeviceFeatures2 features;
-   VkPhysicalDeviceVulkan11Features vulkan_1_1_features;
-   VkPhysicalDeviceVulkan12Features vulkan_1_2_features;
-   VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback_features;
-
-   VkPhysicalDeviceProperties2 properties;
-   VkPhysicalDeviceVulkan11Properties vulkan_1_1_properties;
-   VkPhysicalDeviceVulkan12Properties vulkan_1_2_properties;
-   VkPhysicalDeviceTransformFeedbackPropertiesEXT
-      transform_feedback_properties;
-
-   VkQueueFamilyProperties2 *queue_family_properties;
-   uint32_t queue_family_count;
-
-   VkPhysicalDeviceMemoryProperties2 memory_properties;
-
-   struct {
-      VkExternalMemoryHandleTypeFlagBits renderer_handle_type;
-      VkExternalMemoryHandleTypeFlags supported_handle_types;
-   } external_memory;
-
-   VkExternalFenceHandleTypeFlags external_fence_handles;
-   VkExternalSemaphoreHandleTypeFlags external_binary_semaphore_handles;
-   VkExternalSemaphoreHandleTypeFlags external_timeline_semaphore_handles;
-
-   struct wsi_device wsi_device;
-};
-VK_DEFINE_HANDLE_CASTS(vn_physical_device,
-                       base.base.base,
-                       VkPhysicalDevice,
-                       VK_OBJECT_TYPE_PHYSICAL_DEVICE)
 
 struct vn_device {
    struct vn_device_base base;
@@ -148,73 +35,4 @@ VK_DEFINE_HANDLE_CASTS(vn_device,
                        VkDevice,
                        VK_OBJECT_TYPE_DEVICE)
 
-VkResult
-vn_instance_submit_roundtrip(struct vn_instance *instance,
-                             uint32_t *roundtrip_seqno);
-
-void
-vn_instance_wait_roundtrip(struct vn_instance *instance,
-                           uint32_t roundtrip_seqno);
-
-static inline void
-vn_instance_roundtrip(struct vn_instance *instance)
-{
-   uint32_t roundtrip_seqno;
-   if (vn_instance_submit_roundtrip(instance, &roundtrip_seqno) == VK_SUCCESS)
-      vn_instance_wait_roundtrip(instance, roundtrip_seqno);
-}
-
-VkResult
-vn_instance_ring_submit(struct vn_instance *instance,
-                        const struct vn_cs_encoder *cs);
-
-struct vn_instance_submit_command {
-   /* empty command implies errors */
-   struct vn_cs_encoder command;
-   struct vn_cs_encoder_buffer buffer;
-   /* non-zero implies waiting */
-   size_t reply_size;
-
-   /* when reply_size is non-zero, NULL can be returned on errors */
-   struct vn_renderer_shmem *reply_shmem;
-   struct vn_cs_decoder reply;
-};
-
-static inline struct vn_cs_encoder *
-vn_instance_submit_command_init(struct vn_instance *instance,
-                                struct vn_instance_submit_command *submit,
-                                void *cmd_data,
-                                size_t cmd_size,
-                                size_t reply_size)
-{
-   submit->command = VN_CS_ENCODER_INITIALIZER_LOCAL(cmd_data, cmd_size);
-   /* fix submit->command.buffers to not point to a local variable */
-   submit->buffer = submit->command.buffers[0];
-   submit->command.buffers = &submit->buffer;
-
-   submit->reply_size = reply_size;
-   submit->reply_shmem = NULL;
-
-   return &submit->command;
-}
-
-void
-vn_instance_submit_command(struct vn_instance *instance,
-                           struct vn_instance_submit_command *submit);
-
-static inline struct vn_cs_decoder *
-vn_instance_get_command_reply(struct vn_instance *instance,
-                              struct vn_instance_submit_command *submit)
-{
-   return submit->reply_shmem ? &submit->reply : NULL;
-}
-
-static inline void
-vn_instance_free_command_reply(struct vn_instance *instance,
-                               struct vn_instance_submit_command *submit)
-{
-   assert(submit->reply_shmem);
-   vn_renderer_shmem_unref(instance->renderer, submit->reply_shmem);
-}
-
 #endif /* VN_DEVICE_H */
diff --git a/src/virtio/vulkan/vn_device_memory.c b/src/virtio/vulkan/vn_device_memory.c
index 27e758ad515..d244f109e39 100644
--- a/src/virtio/vulkan/vn_device_memory.c
+++ b/src/virtio/vulkan/vn_device_memory.c
@@ -17,6 +17,7 @@
 #include "vn_buffer.h"
 #include "vn_device.h"
 #include "vn_image.h"
+#include "vn_physical_device.h"
 
 /* device memory commands */
 
diff --git a/src/virtio/vulkan/vn_icd.c b/src/virtio/vulkan/vn_icd.c
index 2cbc1337e23..a4784250d3e 100644
--- a/src/virtio/vulkan/vn_icd.c
+++ b/src/virtio/vulkan/vn_icd.c
@@ -10,7 +10,7 @@
 
 #include "vn_icd.h"
 
-#include "vn_device.h"
+#include "vn_instance.h"
 
 /* we support all versions from version 1 up to version 5 */
 static uint32_t vn_icd_version = 5;
diff --git a/src/virtio/vulkan/vn_image.c b/src/virtio/vulkan/vn_image.c
index 8665f3f18a9..76fbd3fb05b 100644
--- a/src/virtio/vulkan/vn_image.c
+++ b/src/virtio/vulkan/vn_image.c
@@ -18,6 +18,7 @@
 #include "vn_android.h"
 #include "vn_device.h"
 #include "vn_device_memory.h"
+#include "vn_wsi.h"
 
 static void
 vn_image_init_memory_requirements(struct vn_image *img,
diff --git a/src/virtio/vulkan/vn_instance.h b/src/virtio/vulkan/vn_instance.h
new file mode 100644
index 00000000000..8312f49ad85
--- /dev/null
+++ b/src/virtio/vulkan/vn_instance.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2019 Google LLC
+ * SPDX-License-Identifier: MIT
+ *
+ * based in part on anv and radv which are:
+ * Copyright © 2015 Intel Corporation
+ * Copyright © 2016 Red Hat.
+ * Copyright © 2016 Bas Nieuwenhuizen
+ */
+
+#ifndef VN_INSTANCE_H
+#define VN_INSTANCE_H
+
+#include "vn_common.h"
+
+#include "venus-protocol/vn_protocol_driver_defines.h"
+
+#include "vn_cs.h"
+#include "vn_renderer.h"
+#include "vn_ring.h"
+
+struct vn_instance {
+   struct vn_instance_base base;
+
+   struct driOptionCache dri_options;
+   struct driOptionCache available_dri_options;
+
+   struct vn_renderer *renderer;
+   struct vn_renderer_info renderer_info;
+
+   /* Between the driver and the app, VN_MAX_API_VERSION is what we advertise
+    * and base.base.app_info.api_version is what the app requests.
+    *
+    * Between the driver and the renderer, renderer_api_version is the api
+    * version we request internally, which can be higher than
+    * base.base.app_info.api_version.  renderer_version is the instance
+    * version we can use internally.
+    */
+   uint32_t renderer_api_version;
+   uint32_t renderer_version;
+
+   /* to synchronize renderer/ring */
+   mtx_t roundtrip_mutex;
+   uint32_t roundtrip_next;
+
+   struct {
+      mtx_t mutex;
+      struct vn_renderer_shmem *shmem;
+      struct vn_ring ring;
+      uint64_t id;
+
+      struct vn_cs_encoder upload;
+      uint32_t command_dropped;
+   } ring;
+
+   struct {
+      struct vn_renderer_shmem *shmem;
+      size_t size;
+      size_t used;
+      void *ptr;
+   } reply;
+
+   mtx_t physical_device_mutex;
+   struct vn_physical_device *physical_devices;
+   uint32_t physical_device_count;
+
+   /* XXX staged features to be merged to core venus protocol */
+   VkVenusExperimentalFeatures100000MESA experimental;
+};
+VK_DEFINE_HANDLE_CASTS(vn_instance,
+                       base.base.base,
+                       VkInstance,
+                       VK_OBJECT_TYPE_INSTANCE)
+
+VkResult
+vn_instance_submit_roundtrip(struct vn_instance *instance,
+                             uint32_t *roundtrip_seqno);
+
+void
+vn_instance_wait_roundtrip(struct vn_instance *instance,
+                           uint32_t roundtrip_seqno);
+
+static inline void
+vn_instance_roundtrip(struct vn_instance *instance)
+{
+   uint32_t roundtrip_seqno;
+   if (vn_instance_submit_roundtrip(instance, &roundtrip_seqno) == VK_SUCCESS)
+      vn_instance_wait_roundtrip(instance, roundtrip_seqno);
+}
+
+VkResult
+vn_instance_ring_submit(struct vn_instance *instance,
+                        const struct vn_cs_encoder *cs);
+
+struct vn_instance_submit_command {
+   /* empty command implies errors */
+   struct vn_cs_encoder command;
+   struct vn_cs_encoder_buffer buffer;
+   /* non-zero implies waiting */
+   size_t reply_size;
+
+   /* when reply_size is non-zero, NULL can be returned on errors */
+   struct vn_renderer_shmem *reply_shmem;
+   struct vn_cs_decoder reply;
+};
+
+static inline struct vn_cs_encoder *
+vn_instance_submit_command_init(struct vn_instance *instance,
+                                struct vn_instance_submit_command *submit,
+                                void *cmd_data,
+                                size_t cmd_size,
+                                size_t reply_size)
+{
+   submit->command = VN_CS_ENCODER_INITIALIZER_LOCAL(cmd_data, cmd_size);
+   /* fix submit->command.buffers to not point to a local variable */
+   submit->buffer = submit->command.buffers[0];
+   submit->command.buffers = &submit->buffer;
+
+   submit->reply_size = reply_size;
+   submit->reply_shmem = NULL;
+
+   return &submit->command;
+}
+
+void
+vn_instance_submit_command(struct vn_instance *instance,
+                           struct vn_instance_submit_command *submit);
+
+static inline struct vn_cs_decoder *
+vn_instance_get_command_reply(struct vn_instance *instance,
+                              struct vn_instance_submit_command *submit)
+{
+   return submit->reply_shmem ? &submit->reply : NULL;
+}
+
+static inline void
+vn_instance_free_command_reply(struct vn_instance *instance,
+                               struct vn_instance_submit_command *submit)
+{
+   assert(submit->reply_shmem);
+   vn_renderer_shmem_unref(instance->renderer, submit->reply_shmem);
+}
+
+#endif /* VN_INSTANCE_H */
diff --git a/src/virtio/vulkan/vn_physical_device.h b/src/virtio/vulkan/vn_physical_device.h
new file mode 100644
index 00000000000..d282d534b1a
--- /dev/null
+++ b/src/virtio/vulkan/vn_physical_device.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2019 Google LLC
+ * SPDX-License-Identifier: MIT
+ *
+ * based in part on anv and radv which are:
+ * Copyright © 2015 Intel Corporation
+ * Copyright © 2016 Red Hat.
+ * Copyright © 2016 Bas Nieuwenhuizen
+ */
+
+#ifndef VN_PHYSICAL_DEVICE_H
+#define VN_PHYSICAL_DEVICE_H
+
+#include "vn_common.h"
+
+#include "vn_wsi.h"
+
+struct vn_physical_device {
+   struct vn_physical_device_base base;
+
+   struct vn_instance *instance;
+
+   /* Between the driver and the app, properties.properties.apiVersion is what
+    * we advertise and is capped by VN_MAX_API_VERSION and others.
+    *
+    * Between the driver and the renderer, renderer_version is the device
+    * version we can use internally.
+    */
+   uint32_t renderer_version;
+
+   /* Between the driver and the app, base.base.supported_extensions is what
+    * we advertise.
+    *
+    * Between the driver and the renderer, renderer_extensions is what we can
+    * use internally (after enabling).
+    */
+   struct vk_device_extension_table renderer_extensions;
+   uint32_t *extension_spec_versions;
+
+   VkPhysicalDeviceFeatures2 features;
+   VkPhysicalDeviceVulkan11Features vulkan_1_1_features;
+   VkPhysicalDeviceVulkan12Features vulkan_1_2_features;
+   VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback_features;
+
+   VkPhysicalDeviceProperties2 properties;
+   VkPhysicalDeviceVulkan11Properties vulkan_1_1_properties;
+   VkPhysicalDeviceVulkan12Properties vulkan_1_2_properties;
+   VkPhysicalDeviceTransformFeedbackPropertiesEXT
+      transform_feedback_properties;
+
+   VkQueueFamilyProperties2 *queue_family_properties;
+   uint32_t queue_family_count;
+
+   VkPhysicalDeviceMemoryProperties2 memory_properties;
+
+   struct {
+      VkExternalMemoryHandleTypeFlagBits renderer_handle_type;
+      VkExternalMemoryHandleTypeFlags supported_handle_types;
+   } external_memory;
+
+   VkExternalFenceHandleTypeFlags external_fence_handles;
+   VkExternalSemaphoreHandleTypeFlags external_binary_semaphore_handles;
+   VkExternalSemaphoreHandleTypeFlags external_timeline_semaphore_handles;
+
+   struct wsi_device wsi_device;
+};
+VK_DEFINE_HANDLE_CASTS(vn_physical_device,
+                       base.base.base,
+                       VkPhysicalDevice,
+                       VK_OBJECT_TYPE_PHYSICAL_DEVICE)
+
+#endif /* VN_PHYSICAL_DEVICE_H */
diff --git a/src/virtio/vulkan/vn_pipeline.c b/src/virtio/vulkan/vn_pipeline.c
index 8413975070f..c7c5a3cef6e 100644
--- a/src/virtio/vulkan/vn_pipeline.c
+++ b/src/virtio/vulkan/vn_pipeline.c
@@ -16,6 +16,7 @@
 #include "venus-protocol/vn_protocol_driver_shader_module.h"
 
 #include "vn_device.h"
+#include "vn_physical_device.h"
 
 /* shader module commands */
 
diff --git a/src/virtio/vulkan/vn_queue.c b/src/virtio/vulkan/vn_queue.c
index 26ccc9be09c..2f067f1f581 100644
--- a/src/virtio/vulkan/vn_queue.c
+++ b/src/virtio/vulkan/vn_queue.c
@@ -19,6 +19,7 @@
 #include "vn_device.h"
 #include "vn_device_memory.h"
 #include "vn_renderer.h"
+#include "vn_wsi.h"
 
 /* queue commands */
 
diff --git a/src/virtio/vulkan/vn_wsi.c b/src/virtio/vulkan/vn_wsi.c
index a4ac5018004..9dd28f356a2 100644
--- a/src/virtio/vulkan/vn_wsi.c
+++ b/src/virtio/vulkan/vn_wsi.c
@@ -14,6 +14,8 @@
 
 #include "vn_device.h"
 #include "vn_image.h"
+#include "vn_instance.h"
+#include "vn_physical_device.h"
 #include "vn_queue.h"
 
 /* The common WSI support makes some assumptions about the driver.
diff --git a/src/virtio/vulkan/vn_wsi_wayland.c b/src/virtio/vulkan/vn_wsi_wayland.c
index 84d0a1800a8..74cec7fb20c 100644
--- a/src/virtio/vulkan/vn_wsi_wayland.c
+++ b/src/virtio/vulkan/vn_wsi_wayland.c
@@ -10,7 +10,8 @@
 
 #include "wsi_common_wayland.h"
 
-#include "vn_device.h"
+#include "vn_instance.h"
+#include "vn_physical_device.h"
 #include "vn_wsi.h"
 
 VkResult
diff --git a/src/virtio/vulkan/vn_wsi_x11.c b/src/virtio/vulkan/vn_wsi_x11.c
index e169d193464..df79e46cfdb 100644
--- a/src/virtio/vulkan/vn_wsi_x11.c
+++ b/src/virtio/vulkan/vn_wsi_x11.c
@@ -12,7 +12,8 @@
 
 #include "wsi_common_x11.h"
 
-#include "vn_device.h"
+#include "vn_instance.h"
+#include "vn_physical_device.h"
 #include "vn_wsi.h"
 
 /* XCB surface commands */



More information about the mesa-commit mailing list