diff --git a/src/virtio/vulkan/.clang-format b/src/virtio/vulkan/.clang-format index f33c95de85d..bdc8a0dc3fc 100644 --- a/src/virtio/vulkan/.clang-format +++ b/src/virtio/vulkan/.clang-format @@ -16,6 +16,7 @@ ForEachMacros: - list_for_each_entry - list_for_each_entry_safe - vk_outarray_append + - vk_outarray_append_typed - vk_foreach_struct - vk_foreach_struct_const IncludeBlocks: Regroup diff --git a/src/virtio/vulkan/vn_buffer.c b/src/virtio/vulkan/vn_buffer.c index a57950a3167..125e2df84b6 100644 --- a/src/virtio/vulkan/vn_buffer.c +++ b/src/virtio/vulkan/vn_buffer.c @@ -15,8 +15,8 @@ #include "vn_android.h" #include "vn_device.h" -#include "vn_physical_device.h" #include "vn_device_memory.h" +#include "vn_physical_device.h" /* buffer commands */ diff --git a/src/virtio/vulkan/vn_command_buffer.c b/src/virtio/vulkan/vn_command_buffer.c index 38a23560b8a..a4a76dece9e 100644 --- a/src/virtio/vulkan/vn_command_buffer.c +++ b/src/virtio/vulkan/vn_command_buffer.c @@ -426,10 +426,8 @@ vn_cmd_end_render_pass(struct vn_command_buffer *cmd) if (pass->present_release_count) { vn_cmd_transfer_present_src_images( - cmd, false, - images + pass->present_acquire_count, - pass->present_release_attachments, - pass->present_release_count); + cmd, false, images + pass->present_acquire_count, + pass->present_release_attachments, pass->present_release_count); } vk_free(&cmd->allocator, images); diff --git a/src/virtio/vulkan/vn_common.c b/src/virtio/vulkan/vn_common.c index 6e0b11de37b..4c0e45f721b 100644 --- a/src/virtio/vulkan/vn_common.c +++ b/src/virtio/vulkan/vn_common.c @@ -22,21 +22,25 @@ #define VN_RELAX_MIN_BASE_SLEEP_US (160) static const struct debug_control vn_debug_options[] = { + /* clang-format off */ { "init", VN_DEBUG_INIT }, { "result", VN_DEBUG_RESULT }, { "vtest", VN_DEBUG_VTEST }, { "wsi", VN_DEBUG_WSI }, { "no_abort", VN_DEBUG_NO_ABORT }, { NULL, 0 }, + /* clang-format on */ }; static const struct debug_control vn_perf_options[] = { + /* clang-format off */ { "no_async_set_alloc", VN_PERF_NO_ASYNC_SET_ALLOC }, { "no_async_buffer_create", VN_PERF_NO_ASYNC_BUFFER_CREATE }, { "no_async_queue_submit", VN_PERF_NO_ASYNC_QUEUE_SUBMIT }, { "no_event_feedback", VN_PERF_NO_EVENT_FEEDBACK }, { "no_fence_feedback", VN_PERF_NO_FENCE_FEEDBACK }, { NULL, 0 }, + /* clang-format on */ }; struct vn_env vn_env; diff --git a/src/virtio/vulkan/vn_common.h b/src/virtio/vulkan/vn_common.h index 69a49f1ca7a..18dfb174d80 100644 --- a/src/virtio/vulkan/vn_common.h +++ b/src/virtio/vulkan/vn_common.h @@ -166,7 +166,10 @@ vn_log_result(struct vn_instance *instance, const char *where); #define VN_REFCOUNT_INIT(val) \ - (struct vn_refcount) { .count = (val) } + (struct vn_refcount) \ + { \ + .count = (val), \ + } static inline int vn_refcount_load_relaxed(const struct vn_refcount *ref) diff --git a/src/virtio/vulkan/vn_cs.h b/src/virtio/vulkan/vn_cs.h index a467a6dbf84..c01bf2d546c 100644 --- a/src/virtio/vulkan/vn_cs.h +++ b/src/virtio/vulkan/vn_cs.h @@ -11,7 +11,10 @@ #include "venus-protocol/vn_protocol_driver_info.h" #define VN_CS_ENCODER_BUFFER_INITIALIZER(storage) \ - (struct vn_cs_encoder_buffer) { .base = storage, } + (struct vn_cs_encoder_buffer) \ + { \ + .base = storage, \ + } /* note that buffers points to an unamed local variable */ #define VN_CS_ENCODER_INITIALIZER_LOCAL(storage, size) \ diff --git a/src/virtio/vulkan/vn_physical_device.c b/src/virtio/vulkan/vn_physical_device.c index 71aa4c86744..41fc30803bc 100644 --- a/src/virtio/vulkan/vn_physical_device.c +++ b/src/virtio/vulkan/vn_physical_device.c @@ -32,7 +32,10 @@ (head).pNext = &(elem); \ } while (0) #define VN_ADD_EXT_TO_PNEXT(ext, elem, s_type, head) \ - if (ext) VN_ADD_TO_PNEXT(elem, s_type, head) + do { \ + if (ext) \ + VN_ADD_TO_PNEXT(elem, s_type, head); \ + } while (0) static void vn_physical_device_init_features(struct vn_physical_device *physical_dev) @@ -168,7 +171,8 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev) CUSTOM_BORDER_COLOR_FEATURES_EXT, features2); VN_ADD_EXT_TO_PNEXT(exts->EXT_depth_clip_enable, feats->depth_clip_enable, DEPTH_CLIP_ENABLE_FEATURES_EXT, features2); - VN_ADD_EXT_TO_PNEXT(exts->EXT_image_view_min_lod, feats->image_view_min_lod, + VN_ADD_EXT_TO_PNEXT(exts->EXT_image_view_min_lod, + feats->image_view_min_lod, IMAGE_VIEW_MIN_LOD_FEATURES_EXT, features2); VN_ADD_EXT_TO_PNEXT(exts->EXT_index_type_uint8, feats->index_type_uint8, INDEX_TYPE_UINT8_FEATURES_EXT, features2); @@ -177,7 +181,8 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev) LINE_RASTERIZATION_FEATURES_EXT, features2); VN_ADD_EXT_TO_PNEXT(exts->EXT_primitive_topology_list_restart, feats->primitive_topology_list_restart, - PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT, features2); + PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT, + features2); VN_ADD_EXT_TO_PNEXT(exts->EXT_private_data, feats->private_data, PRIVATE_DATA_FEATURES, features2); VN_ADD_EXT_TO_PNEXT(exts->EXT_provoking_vertex, feats->provoking_vertex, @@ -1118,13 +1123,14 @@ vn_physical_device_get_passthrough_extensions( * VkPhysicalDevicePrivateDataFeaturesEXT, and (c) modify its bits in * VkPhysicalDeviceVulkan13Features. * - * For now, we implement the extension functions natively by using Mesa's - * commong implementation. We passthrough VkDevicePrivateDataCreateInfoEXT - * to the renderer, which is harmless. We passthrough the extension - * enablement and feature bits to the renderer because otherwise - * VkDevicePrivateDataCreateInfoEXT would cause invalid usage in the - * renderer. Therefore, even though we implement the extension natively, - * we expose the extension only if the renderer supports it too. + * For now, we implement the extension functions natively by using + * Mesa's commong implementation. We passthrough + * VkDevicePrivateDataCreateInfoEXT to the renderer, which is harmless. + * We passthrough the extension enablement and feature bits to the + * renderer because otherwise VkDevicePrivateDataCreateInfoEXT would + * cause invalid usage in the renderer. Therefore, even though we + * implement the extension natively, we expose the extension only if the + * renderer supports it too. */ .EXT_private_data = true, .EXT_provoking_vertex = true, @@ -1597,7 +1603,8 @@ vn_EnumeratePhysicalDevices(VkInstance _instance, if (result != VK_SUCCESS) return vn_error(instance, result); - VK_OUTARRAY_MAKE_TYPED(VkPhysicalDevice, out, pPhysicalDevices, pPhysicalDeviceCount); + VK_OUTARRAY_MAKE_TYPED(VkPhysicalDevice, out, pPhysicalDevices, + pPhysicalDeviceCount); for (uint32_t i = 0; i < instance->physical_device.device_count; i++) { vk_outarray_append_typed(VkPhysicalDevice, &out, physical_dev) { *physical_dev = vn_physical_device_to_handle( @@ -1645,7 +1652,8 @@ vn_EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, if (pLayerName) return vn_error(physical_dev->instance, VK_ERROR_LAYER_NOT_PRESENT); - VK_OUTARRAY_MAKE_TYPED(VkExtensionProperties, out, pProperties, pPropertyCount); + VK_OUTARRAY_MAKE_TYPED(VkExtensionProperties, out, pProperties, + pPropertyCount); for (uint32_t i = 0; i < VK_DEVICE_EXTENSION_COUNT; i++) { if (physical_dev->base.base.supported_extensions.extensions[i]) { vk_outarray_append_typed(VkExtensionProperties, &out, prop) { diff --git a/src/virtio/vulkan/vn_pipeline.c b/src/virtio/vulkan/vn_pipeline.c index 1902073bf2e..c4dd4f47b21 100644 --- a/src/virtio/vulkan/vn_pipeline.c +++ b/src/virtio/vulkan/vn_pipeline.c @@ -377,7 +377,8 @@ vn_fix_graphics_pipeline_create_info( } has_dynamic_state = { 0 }; if (info->pDynamicState) { - for (uint32_t j = 0; j < info->pDynamicState->dynamicStateCount; j++) { + for (uint32_t j = 0; j < info->pDynamicState->dynamicStateCount; + j++) { switch (info->pDynamicState->pDynamicStates[j]) { case VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE: has_dynamic_state.rasterizer_discard_enable = true; @@ -409,8 +410,8 @@ vn_fix_graphics_pipeline_create_info( /* TODO: Ignore VkPipelineRenderingCreateInfo when not using dynamic * rendering. This requires either a deep rewrite of - * VkGraphicsPipelineCreateInfo::pNext or a fix in the generated protocol - * code. + * VkGraphicsPipelineCreateInfo::pNext or a fix in the generated + * protocol code. * * The Vulkan spec (1.3.223) says about VkPipelineRenderingCreateInfo: * If a graphics pipeline is created with a valid VkRenderPass, @@ -427,9 +428,9 @@ vn_fix_graphics_pipeline_create_info( * * Without VK_EXT_graphics_pipeline_library, most states are * unconditionally included in the pipeline. Despite that, we still - * reference the state bools in the ignore rules because (a) it makes the - * ignore condition easier to validate against the text of the relevant - * VUs; and (b) it makes it easier to enable + * reference the state bools in the ignore rules because (a) it makes + * the ignore condition easier to validate against the text of the + * relevant VUs; and (b) it makes it easier to enable * VK_EXT_graphics_pipeline_library because we won't need to carefully * revisit the text of each VU to untangle the missing pipeline state * bools. @@ -456,9 +457,9 @@ vn_fix_graphics_pipeline_create_info( * The Vulkan spec (1.3.223) says: * If the value of [...]rasterizerDiscardEnable in the * pre-rasterization shader state is VK_FALSE or the - * VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE dynamic state is enabled - * fragment shader state and fragment output interface state is - * included in a complete graphics pipeline. + * VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE dynamic state is + * enabled fragment shader state and fragment output interface state + * is included in a complete graphics pipeline. */ const bool has_raster_state = has_dynamic_state.rasterizer_discard_enable || diff --git a/src/virtio/vulkan/vn_renderer_virtgpu.c b/src/virtio/vulkan/vn_renderer_virtgpu.c index fb876911c27..49d50916ee4 100644 --- a/src/virtio/vulkan/vn_renderer_virtgpu.c +++ b/src/virtio/vulkan/vn_renderer_virtgpu.c @@ -59,7 +59,7 @@ struct drm_virtgpu_context_init { /* XXX comment these out to really use kernel uapi */ #define SIMULATE_BO_SIZE_FIX 1 -//#define SIMULATE_CONTEXT_INIT 1 +// #define SIMULATE_CONTEXT_INIT 1 #define SIMULATE_SYNCOBJ 1 #define SIMULATE_SUBMIT 1 @@ -1578,7 +1578,7 @@ virtgpu_open_device(struct virtgpu *gpu, const drmDevicePtr dev) switch (dev->bustype) { case DRM_BUS_PCI: if (dev->deviceinfo.pci->vendor_id == VIRTGPU_PCI_VENDOR_ID && - dev->deviceinfo.pci->device_id == VIRTGPU_PCI_DEVICE_ID) + dev->deviceinfo.pci->device_id == VIRTGPU_PCI_DEVICE_ID) supported_bus = true; break; case DRM_BUS_PLATFORM: