summaryrefslogtreecommitdiff
path: root/src/client/qwaylandshmbackingstore.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2018-06-19 14:51:08 +0200
committerPaul Olav Tvete <paul.tvete@qt.io>2018-08-08 10:44:40 +0000
commit3c072f46b17a195daf1901d0c9f9410b4007b0a7 (patch)
treedaf02d062051f0f445d226d4fa708a6c5271335c /src/client/qwaylandshmbackingstore.cpp
parent19001dc7c28c750d3dbf0086f5bcac2d11ad592f (diff)
downloadqtwayland-3c072f46b17a195daf1901d0c9f9410b4007b0a7.tar.gz
Don't commit same buffer multiple times
In Qt we call flush() when we think the window might need to be updated. It is also possible to trigger a flush while painting. Two fixes: 1) If there are attempted flushes between beginPaint() and endPaint, queue them up, and do them in endPaint(). 2) Make sure we only commit the buffer once: after that the compositor owns the buffer, and it can repaint on its own. Change-Id: Ibf61068fa95760eb67dbc0b1d0534854114ea528 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/client/qwaylandshmbackingstore.cpp')
-rw-r--r--src/client/qwaylandshmbackingstore.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp
index dde01357..ecb03c0d 100644
--- a/src/client/qwaylandshmbackingstore.cpp
+++ b/src/client/qwaylandshmbackingstore.cpp
@@ -48,7 +48,6 @@
#include <QtCore/qtemporaryfile.h>
#include <QtGui/QPainter>
#include <QMutexLocker>
-#include <QLoggingCategory>
#include <wayland-client.h>
#include <wayland-client-protocol.h>
@@ -68,10 +67,6 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-Q_DECLARE_LOGGING_CATEGORY(lcWaylandBackingstore)
-
-Q_LOGGING_CATEGORY(lcWaylandBackingstore, "qt.qpa.wayland.backingstore")
-
QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display,
const QSize &size, QImage::Format format, int scale)
{
@@ -199,6 +194,8 @@ void QWaylandShmBackingStore::beginPaint(const QRegion &region)
void QWaylandShmBackingStore::endPaint()
{
mPainting = false;
+ if (mPendingFlush)
+ flush(window(), mPendingRegion, QPoint());
waylandWindow()->setCanResize(true);
}
@@ -218,9 +215,19 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion &region, cons
// called instead. The default implementation from QPlatformBackingStore is sufficient
// however so no need to reimplement that.
+
Q_UNUSED(window);
Q_UNUSED(offset);
+ if (mPainting) {
+ mPendingRegion |= region;
+ mPendingFlush = true;
+ return;
+ }
+
+ mPendingFlush = false;
+ mPendingRegion = QRegion();
+
if (windowDecoration() && windowDecoration()->isDirty())
updateDecorations();