Mesa (master): vulkan/wsi/wayland: Pass damage through to the compositor

Jason Ekstrand jekstrand at kemper.freedesktop.org
Mon Apr 3 20:51:16 UTC 2017


Module: Mesa
Branch: master
Commit: be1ecd8c6e3fbc20f62870c52b8e95ab2a5931ee
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=be1ecd8c6e3fbc20f62870c52b8e95ab2a5931ee

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Tue Jan 24 15:29:43 2017 -0800

vulkan/wsi/wayland: Pass damage through to the compositor

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Daniel Stone <daniels at collabora.com>

---

 src/vulkan/wsi/wsi_common_wayland.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 26a137c1a0..5613283d9d 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -488,6 +488,7 @@ struct wsi_wl_swapchain {
    struct wsi_wl_display *                      display;
    struct wl_event_queue *                      queue;
    struct wl_surface *                          surface;
+   uint32_t                                     surface_version;
 
    VkExtent2D                                   extent;
    VkFormat                                     vk_format;
@@ -594,7 +595,19 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain,
 
    assert(image_index < chain->base.image_count);
    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->surface_version >= 4 && damage &&
+       damage->pRectangles && damage->rectangleCount > 0) {
+      for (unsigned i = 0; i < damage->rectangleCount; i++) {
+         const VkRectLayerKHR *rect = &damage->pRectangles[i];
+         assert(rect->layer == 0);
+         wl_surface_damage_buffer(chain->surface,
+                                  rect->offset.x, rect->offset.y,
+                                  rect->extent.width, rect->extent.height);
+      }
+   } else {
+      wl_surface_damage(chain->surface, 0, 0, INT32_MAX, INT32_MAX);
+   }
 
    if (chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR) {
       struct wl_callback *frame = wl_surface_frame(chain->surface);
@@ -731,6 +744,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
    chain->base.image_count = num_images;
    chain->base.needs_linear_copy = false;
    chain->surface = surface->surface;
+   chain->surface_version = wl_proxy_get_version((void *)surface->surface);
    chain->extent = pCreateInfo->imageExtent;
    chain->vk_format = pCreateInfo->imageFormat;
    chain->drm_format = wl_drm_format_for_vk_format(chain->vk_format, alpha);




More information about the mesa-commit mailing list