[neon/qt6/qt6-base/Neon/release] debian/patches: add 0003-qwaylandshmbackingstore.diff @Kai's request

Carlos De Maine null at kde.org
Wed May 13 22:16:14 BST 2026


Git commit 08349eda8340cc293304b44e0b34bd4d538cbc11 by Carlos De Maine.
Committed on 13/05/2026 at 21:16.
Pushed by carlosdem into branch 'Neon/release'.

add 0003-qwaylandshmbackingstore.diff @Kai's request

A  +35   -0    debian/patches/0003-qwaylandshmbackingstore.diff
M  +2    -0    debian/patches/series

https://invent.kde.org/neon/qt6/qt6-base/-/commit/08349eda8340cc293304b44e0b34bd4d538cbc11

diff --git a/debian/patches/0003-qwaylandshmbackingstore.diff b/debian/patches/0003-qwaylandshmbackingstore.diff
new file mode 100644
index 0000000..9534e96
--- /dev/null
+++ b/debian/patches/0003-qwaylandshmbackingstore.diff
@@ -0,0 +1,35 @@
+diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp
+index 58bc75d5853..9e0b8ef758a 100644
+--- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp
++++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp
+@@ -50,12 +50,28 @@ extern void qt_scrollRectInImage(QImage &, const QRect &, const QPoint &);
+ 
+ namespace QtWaylandClient {
+ 
++static int alignTo(int input, int alignment)
++{
++    Q_ASSERT(alignment > 0);
++    if (int remainder = input % alignment)
++        return input + (alignment - remainder);
++    else
++        return input;
++}
++
+ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display,
+                                      const QSize &size, QImage::Format format, qreal scale, wl_event_queue *customEventQueue)
+     : mDirtyRegion(QRect(QPoint(0, 0), size / scale))
+ {
+-    int stride = size.width() * 4;
+-    int alloc = stride * size.height();
++    // This alignment of stride and size is done to improve performance of
++    // buffer accesses on the compositor side.
++    // Aligning the size of the shm pool to pages means the buffer can be
++    // imported as a udmabuf, and if the stride is additionally compatible with
++    // the GPU, that udmabuf can be used directly for rendering instead of needing
++    // to first copy to a GPU-accessible buffer.
++    // The 256 bytes stride alignment used here is what all common GPUs can read from.
++    const int stride = alignTo(size.width() * 4, 256);
++    const int alloc = alignTo(stride * size.height(), getpagesize());
+     int fd = -1;
+ 
+ #ifdef SYS_memfd_creategenerated by cgit v1.2.3 (git 2.25.1) at 2026-05-13 21:13:31 +0000
diff --git a/debian/patches/series b/debian/patches/series
index 576cbcf..113f896 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,6 +1,8 @@
 # Neon added
 0001-fix-slow-scrolling-on-wayland.patch
 0002-c93008e4d06abb0072e0e5e57d84a4ae182ecfc0.patch
+0003-qwaylandshmbackingstore.diff
+
 # Needs to be fixed upstream.
 Add-SH-detection.patch
 


More information about the Neon-commits mailing list