[Mesa-dev] [PATCH 1/2] vulkan/wsi: store present mode in swapchain base class

Jason Ekstrand jason at jlekstrand.net
Wed Oct 26 04:34:59 UTC 2016


Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

On Tue, Oct 25, 2016 at 8:13 PM, Dave Airlie <airlied at gmail.com> wrote:

> From: Dave Airlie <airlied at redhat.com>
>
> This just moves this up a level as x11 will need it to
> implement things properly.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/vulkan/wsi/wsi_common.h         | 1 +
>  src/vulkan/wsi/wsi_common_wayland.c | 6 +++---
>  src/vulkan/wsi/wsi_common_x11.c     | 1 +
>  3 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
> index ee67511..a1f5a40 100644
> --- a/src/vulkan/wsi/wsi_common.h
> +++ b/src/vulkan/wsi/wsi_common.h
> @@ -53,6 +53,7 @@ struct wsi_swapchain {
>     VkAllocationCallbacks alloc;
>     const struct wsi_image_fns *image_fns;
>     VkFence fences[3];
> +   VkPresentModeKHR present_mode;
>
>     VkResult (*destroy)(struct wsi_swapchain *swapchain,
>                         const VkAllocationCallbacks *pAllocator);
> diff --git a/src/vulkan/wsi/wsi_common_wayland.c
> b/src/vulkan/wsi/wsi_common_wayland.c
> index fc13bde..75af4cf 100644
> --- a/src/vulkan/wsi/wsi_common_wayland.c
> +++ b/src/vulkan/wsi/wsi_common_wayland.c
> @@ -559,7 +559,7 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain
> *wsi_chain,
>  {
>     struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
>
> -   if (chain->present_mode == VK_PRESENT_MODE_FIFO_KHR) {
> +   if (chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR) {
>        while (!chain->fifo_ready) {
>           int ret = wl_display_dispatch_queue(chain->display->display,
>                                               chain->queue);
> @@ -572,7 +572,7 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain
> *wsi_chain,
>     wl_surface_attach(chain->surface, chain->images[image_index].buffer,
> 0, 0);
>     wl_surface_damage(chain->surface, 0, 0, INT32_MAX, INT32_MAX);
>
> -   if (chain->present_mode == VK_PRESENT_MODE_FIFO_KHR) {
> +   if (chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR) {
>        struct wl_callback *frame = wl_surface_frame(chain->surface);
>        wl_proxy_set_queue((struct wl_proxy *)frame, chain->queue);
>        wl_callback_add_listener(frame, &frame_listener, chain);
> @@ -708,12 +708,12 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase
> *icd_surface,
>     chain->base.acquire_next_image = wsi_wl_swapchain_acquire_next_image;
>     chain->base.queue_present = wsi_wl_swapchain_queue_present;
>     chain->base.image_fns = image_fns;
> +   chain->base.present_mode = pCreateInfo->presentMode;
>     chain->surface = surface->surface;
>     chain->extent = pCreateInfo->imageExtent;
>     chain->vk_format = pCreateInfo->imageFormat;
>     chain->drm_format = wl_drm_format_for_vk_format(chain->vk_format,
> false);
>
> -   chain->present_mode = pCreateInfo->presentMode;
>     chain->fifo_ready = true;
>
>     chain->image_count = num_images;
> diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_
> x11.c
> index 76c147e..bae1d18 100644
> --- a/src/vulkan/wsi/wsi_common_x11.c
> +++ b/src/vulkan/wsi/wsi_common_x11.c
> @@ -815,6 +815,7 @@ x11_surface_create_swapchain(VkIcdSurfaceBase
> *icd_surface,
>     chain->base.acquire_next_image = x11_acquire_next_image;
>     chain->base.queue_present = x11_queue_present;
>     chain->base.image_fns = image_fns;
> +   chain->base.present_mode = pCreateInfo->presentMode;
>     chain->conn = x11_surface_get_connection(icd_surface);
>     chain->window = x11_surface_get_window(icd_surface);
>     chain->extent = pCreateInfo->imageExtent;
> --
> 2.5.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161025/30a1d959/attachment.html>


More information about the mesa-dev mailing list