|
|
165ad0 |
From 3027c9659866101c06252829d99e7597cef19a40 Mon Sep 17 00:00:00 2001
|
|
|
165ad0 |
From: Paul Olav Tvete <paul.tvete@qt.io>
|
|
|
165ad0 |
Date: Mon, 6 Jul 2020 14:37:35 +0200
|
|
|
165ad0 |
Subject: [PATCH 33/40] Use wl_surface.damage_buffer on the client side
|
|
|
165ad0 |
|
|
|
165ad0 |
Prefer the newer, recommended damage_buffer when the compositor
|
|
|
165ad0 |
supports it.
|
|
|
165ad0 |
|
|
|
165ad0 |
Fixes: QTBUG-74929
|
|
|
165ad0 |
Change-Id: I9107966910b616a666931404a7b41bfac14c22c0
|
|
|
165ad0 |
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
|
|
|
165ad0 |
(cherry picked from commit 314fd6db51277224cdc799b039ef79db1101f5cd)
|
|
|
165ad0 |
---
|
|
|
165ad0 |
src/client/qwaylanddisplay.cpp | 2 +-
|
|
|
165ad0 |
src/client/qwaylandwindow.cpp | 16 +++++++++++++---
|
|
|
165ad0 |
tests/auto/client/shared/coreprotocol.h | 2 +-
|
|
|
165ad0 |
tests/auto/client/shared_old/mockcompositor.cpp | 2 +-
|
|
|
165ad0 |
tests/auto/client/shared_old/mocksurface.cpp | 10 ++++++++++
|
|
|
165ad0 |
tests/auto/client/shared_old/mocksurface.h | 2 ++
|
|
|
165ad0 |
6 files changed, 28 insertions(+), 6 deletions(-)
|
|
|
165ad0 |
|
|
|
165ad0 |
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
|
|
|
165ad0 |
index a7ce280a..6f1bada5 100644
|
|
|
165ad0 |
--- a/src/client/qwaylanddisplay.cpp
|
|
|
165ad0 |
+++ b/src/client/qwaylanddisplay.cpp
|
|
|
165ad0 |
@@ -488,7 +488,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
|
|
165ad0 |
if (interface == QStringLiteral("wl_output")) {
|
|
|
165ad0 |
mWaitingScreens << new QWaylandScreen(this, version, id);
|
|
|
165ad0 |
} else if (interface == QStringLiteral("wl_compositor")) {
|
|
|
165ad0 |
- mCompositorVersion = qMin((int)version, 3);
|
|
|
165ad0 |
+ mCompositorVersion = qMin((int)version, 4);
|
|
|
165ad0 |
mCompositor.init(registry, id, mCompositorVersion);
|
|
|
165ad0 |
} else if (interface == QStringLiteral("wl_shm")) {
|
|
|
165ad0 |
mShm.reset(new QWaylandShm(this, version, id));
|
|
|
165ad0 |
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
|
|
|
165ad0 |
index acfe390e..4c5711a0 100644
|
|
|
165ad0 |
--- a/src/client/qwaylandwindow.cpp
|
|
|
165ad0 |
+++ b/src/client/qwaylandwindow.cpp
|
|
|
165ad0 |
@@ -571,7 +571,11 @@ void QWaylandWindow::attachOffset(QWaylandBuffer *buffer)
|
|
|
165ad0 |
|
|
|
165ad0 |
void QWaylandWindow::damage(const QRect &rect)
|
|
|
165ad0 |
{
|
|
|
165ad0 |
- mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
|
|
|
165ad0 |
+ const int s = scale();
|
|
|
165ad0 |
+ if (mDisplay->compositorVersion() >= 4)
|
|
|
165ad0 |
+ mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height());
|
|
|
165ad0 |
+ else
|
|
|
165ad0 |
+ mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
|
|
|
165ad0 |
}
|
|
|
165ad0 |
|
|
|
165ad0 |
void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage)
|
|
|
165ad0 |
@@ -605,8 +609,14 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage)
|
|
|
165ad0 |
return;
|
|
|
165ad0 |
|
|
|
165ad0 |
attachOffset(buffer);
|
|
|
165ad0 |
- for (const QRect &rect: damage)
|
|
|
165ad0 |
- mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
|
|
|
165ad0 |
+ if (mDisplay->compositorVersion() >= 4) {
|
|
|
165ad0 |
+ const int s = scale();
|
|
|
165ad0 |
+ for (const QRect &rect: damage)
|
|
|
165ad0 |
+ mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height());
|
|
|
165ad0 |
+ } else {
|
|
|
165ad0 |
+ for (const QRect &rect: damage)
|
|
|
165ad0 |
+ mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
|
|
|
165ad0 |
+ }
|
|
|
165ad0 |
Q_ASSERT(!buffer->committed());
|
|
|
165ad0 |
buffer->setCommitted();
|
|
|
165ad0 |
mSurface->commit();
|
|
|
165ad0 |
diff --git a/tests/auto/client/shared/coreprotocol.h b/tests/auto/client/shared/coreprotocol.h
|
|
|
165ad0 |
index a1af137a..296dbf47 100644
|
|
|
165ad0 |
--- a/tests/auto/client/shared/coreprotocol.h
|
|
|
165ad0 |
+++ b/tests/auto/client/shared/coreprotocol.h
|
|
|
165ad0 |
@@ -158,7 +158,7 @@ class WlCompositor : public Global, public QtWaylandServer::wl_compositor
|
|
|
165ad0 |
{
|
|
|
165ad0 |
Q_OBJECT
|
|
|
165ad0 |
public:
|
|
|
165ad0 |
- explicit WlCompositor(CoreCompositor *compositor, int version = 3)
|
|
|
165ad0 |
+ explicit WlCompositor(CoreCompositor *compositor, int version = 4)
|
|
|
165ad0 |
: QtWaylandServer::wl_compositor(compositor->m_display, version)
|
|
|
165ad0 |
, m_compositor(compositor)
|
|
|
165ad0 |
{}
|
|
|
165ad0 |
diff --git a/tests/auto/client/shared_old/mockcompositor.cpp b/tests/auto/client/shared_old/mockcompositor.cpp
|
|
|
165ad0 |
index a415cbf5..b1d3d07d 100644
|
|
|
165ad0 |
--- a/tests/auto/client/shared_old/mockcompositor.cpp
|
|
|
165ad0 |
+++ b/tests/auto/client/shared_old/mockcompositor.cpp
|
|
|
165ad0 |
@@ -342,7 +342,7 @@ Compositor::Compositor(MockCompositor *mockCompositor)
|
|
|
165ad0 |
exit(EXIT_FAILURE);
|
|
|
165ad0 |
}
|
|
|
165ad0 |
|
|
|
165ad0 |
- wl_global_create(m_display, &wl_compositor_interface, 1, this, bindCompositor);
|
|
|
165ad0 |
+ wl_global_create(m_display, &wl_compositor_interface, 4, this, bindCompositor);
|
|
|
165ad0 |
|
|
|
165ad0 |
m_data_device_manager.reset(new DataDeviceManager(this, m_display));
|
|
|
165ad0 |
|
|
|
165ad0 |
diff --git a/tests/auto/client/shared_old/mocksurface.cpp b/tests/auto/client/shared_old/mocksurface.cpp
|
|
|
165ad0 |
index e9df5f90..c3246e4a 100644
|
|
|
165ad0 |
--- a/tests/auto/client/shared_old/mocksurface.cpp
|
|
|
165ad0 |
+++ b/tests/auto/client/shared_old/mocksurface.cpp
|
|
|
165ad0 |
@@ -125,6 +125,16 @@ void Surface::surface_damage(Resource *resource,
|
|
|
165ad0 |
Q_UNUSED(height);
|
|
|
165ad0 |
}
|
|
|
165ad0 |
|
|
|
165ad0 |
+void Surface::surface_damage_buffer(Resource *resource,
|
|
|
165ad0 |
+ int32_t x, int32_t y, int32_t width, int32_t height)
|
|
|
165ad0 |
+{
|
|
|
165ad0 |
+ Q_UNUSED(resource);
|
|
|
165ad0 |
+ Q_UNUSED(x);
|
|
|
165ad0 |
+ Q_UNUSED(y);
|
|
|
165ad0 |
+ Q_UNUSED(width);
|
|
|
165ad0 |
+ Q_UNUSED(height);
|
|
|
165ad0 |
+}
|
|
|
165ad0 |
+
|
|
|
165ad0 |
void Surface::surface_frame(Resource *resource,
|
|
|
165ad0 |
uint32_t callback)
|
|
|
165ad0 |
{
|
|
|
165ad0 |
diff --git a/tests/auto/client/shared_old/mocksurface.h b/tests/auto/client/shared_old/mocksurface.h
|
|
|
165ad0 |
index 949dc23d..d176837e 100644
|
|
|
165ad0 |
--- a/tests/auto/client/shared_old/mocksurface.h
|
|
|
165ad0 |
+++ b/tests/auto/client/shared_old/mocksurface.h
|
|
|
165ad0 |
@@ -65,6 +65,8 @@ protected:
|
|
|
165ad0 |
struct wl_resource *buffer, int x, int y) override;
|
|
|
165ad0 |
void surface_damage(Resource *resource,
|
|
|
165ad0 |
int32_t x, int32_t y, int32_t width, int32_t height) override;
|
|
|
165ad0 |
+ void surface_damage_buffer(Resource *resource,
|
|
|
165ad0 |
+ int32_t x, int32_t y, int32_t width, int32_t height) override;
|
|
|
165ad0 |
void surface_frame(Resource *resource,
|
|
|
165ad0 |
uint32_t callback) override;
|
|
|
165ad0 |
void surface_commit(Resource *resource) override;
|
|
|
165ad0 |
--
|
|
|
165ad0 |
2.35.1
|
|
|
165ad0 |
|