From 05ed116d012d5e5fb2738552b951bfb39413f7ab Mon Sep 17 00:00:00 2001 From: Leandro Ribeiro Date: Wed, 19 Oct 2022 10:51:01 -0300 Subject: [PATCH] vulkan/wsi/wayland: move some structs to beginning of code There are some structs defined in the middle of the code. Move them closer to where the other structs are defined. This makes the code easier to read and also will help us in the next commits, in which we add dma-buf feedback support. Reviewed-by: Simon Ser Signed-off-by: Leandro Ribeiro Part-of: --- src/vulkan/wsi/wsi_common_wayland.c | 82 ++++++++++++++--------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index 3c012d44d02..2f0e506d9c1 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -86,6 +86,47 @@ struct wsi_wayland { VkPhysicalDevice physical_device; }; +struct wsi_wl_image { + struct wsi_image base; + struct wl_buffer * buffer; + bool busy; + int shm_fd; + void * shm_ptr; + unsigned shm_size; +}; + +enum wsi_wl_buffer_type { + WSI_WL_BUFFER_NATIVE, + WSI_WL_BUFFER_GPU_SHM, + WSI_WL_BUFFER_SHM_MEMCPY, +}; + +struct wsi_wl_swapchain { + struct wsi_swapchain base; + + struct wsi_wl_display *display; + + struct wl_surface * surface; + + struct wl_callback * frame; + + VkExtent2D extent; + VkFormat vk_format; + enum wsi_wl_buffer_type buffer_type; + uint32_t drm_format; + enum wl_shm_format shm_format; + + uint32_t num_drm_modifiers; + const uint64_t * drm_modifiers; + + VkPresentModeKHR present_mode; + bool fifo_ready; + + struct wsi_wl_image images[0]; +}; +VK_DEFINE_NONDISP_HANDLE_CASTS(wsi_wl_swapchain, base.base, VkSwapchainKHR, + VK_OBJECT_TYPE_SWAPCHAIN_KHR) + enum wsi_wl_fmt_flag { WSI_WL_FMT_ALPHA = 1 << 0, WSI_WL_FMT_OPAQUE = 1 << 1, @@ -905,47 +946,6 @@ wsi_CreateWaylandSurfaceKHR(VkInstance _instance, return VK_SUCCESS; } -struct wsi_wl_image { - struct wsi_image base; - struct wl_buffer * buffer; - bool busy; - int shm_fd; - void * shm_ptr; - unsigned shm_size; -}; - -enum wsi_wl_buffer_type { - WSI_WL_BUFFER_NATIVE, - WSI_WL_BUFFER_GPU_SHM, - WSI_WL_BUFFER_SHM_MEMCPY, -}; - -struct wsi_wl_swapchain { - struct wsi_swapchain base; - - struct wsi_wl_display *display; - - struct wl_surface * surface; - - struct wl_callback * frame; - - VkExtent2D extent; - VkFormat vk_format; - enum wsi_wl_buffer_type buffer_type; - uint32_t drm_format; - enum wl_shm_format shm_format; - - uint32_t num_drm_modifiers; - const uint64_t * drm_modifiers; - - VkPresentModeKHR present_mode; - bool fifo_ready; - - struct wsi_wl_image images[0]; -}; -VK_DEFINE_NONDISP_HANDLE_CASTS(wsi_wl_swapchain, base.base, VkSwapchainKHR, - VK_OBJECT_TYPE_SWAPCHAIN_KHR) - static struct wsi_image * wsi_wl_swapchain_get_wsi_image(struct wsi_swapchain *wsi_chain, uint32_t image_index)