Mesa (main): vulkan/wsi/wayland: Use a single memcpy in the SW path

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 7 18:47:58 UTC 2022


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

Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date:   Tue Jul  5 17:26:18 2022 -0500

vulkan/wsi/wayland: Use a single memcpy in the SW path

The strides match.  There's no reason to loop over image height.

Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17388>

---

 src/vulkan/wsi/wsi_common_wayland.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index ae9eb18b87c..fcdf7c77ae5 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -1051,11 +1051,8 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain,
                                  image->base.memory,
                                  0, VK_WHOLE_SIZE, 0, &sptr);
 
-      for (unsigned r = 0; r < chain->extent.height; r++) {
-         memcpy(dptr, sptr, image->base.row_pitches[0]);
-         dptr += image->base.row_pitches[0];
-         sptr += image->base.row_pitches[0];
-      }
+      memcpy(dptr, sptr, image->base.row_pitches[0] * chain->extent.height);
+
       chain->base.wsi->UnmapMemory(chain->base.device,
                                    image->base.memory);
 



More information about the mesa-commit mailing list