Use wl_surface.damage_buffer on the client side
Prefer the newer, recommended damage_buffer when the compositor supports it. Fixes: QTBUG-74929 Change-Id: I9107966910b616a666931404a7b41bfac14c22c0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
4189b0b2a2
commit
7eea720dbd
@ -314,7 +314,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
|||||||
if (interface == QStringLiteral("wl_output")) {
|
if (interface == QStringLiteral("wl_output")) {
|
||||||
mWaitingScreens << new QWaylandScreen(this, version, id);
|
mWaitingScreens << new QWaylandScreen(this, version, id);
|
||||||
} else if (interface == QStringLiteral("wl_compositor")) {
|
} else if (interface == QStringLiteral("wl_compositor")) {
|
||||||
mCompositorVersion = qMin((int)version, 3);
|
mCompositorVersion = qMin((int)version, 4);
|
||||||
mCompositor.init(registry, id, mCompositorVersion);
|
mCompositor.init(registry, id, mCompositorVersion);
|
||||||
} else if (interface == QStringLiteral("wl_shm")) {
|
} else if (interface == QStringLiteral("wl_shm")) {
|
||||||
mShm.reset(new QWaylandShm(this, version, id));
|
mShm.reset(new QWaylandShm(this, version, id));
|
||||||
|
@ -541,7 +541,11 @@ void QWaylandWindow::attachOffset(QWaylandBuffer *buffer)
|
|||||||
|
|
||||||
void QWaylandWindow::damage(const QRect &rect)
|
void QWaylandWindow::damage(const QRect &rect)
|
||||||
{
|
{
|
||||||
mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
|
const int s = scale();
|
||||||
|
if (mDisplay->compositorVersion() >= 4)
|
||||||
|
mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height());
|
||||||
|
else
|
||||||
|
mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage)
|
void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage)
|
||||||
@ -575,8 +579,14 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
attachOffset(buffer);
|
attachOffset(buffer);
|
||||||
for (const QRect &rect: damage)
|
if (mDisplay->compositorVersion() >= 4) {
|
||||||
mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
|
const int s = scale();
|
||||||
|
for (const QRect &rect: damage)
|
||||||
|
mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height());
|
||||||
|
} else {
|
||||||
|
for (const QRect &rect: damage)
|
||||||
|
mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
|
||||||
|
}
|
||||||
Q_ASSERT(!buffer->committed());
|
Q_ASSERT(!buffer->committed());
|
||||||
buffer->setCommitted();
|
buffer->setCommitted();
|
||||||
mSurface->commit();
|
mSurface->commit();
|
||||||
|
@ -143,7 +143,7 @@ class WlCompositor : public Global, public QtWaylandServer::wl_compositor
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit WlCompositor(CoreCompositor *compositor, int version = 3)
|
explicit WlCompositor(CoreCompositor *compositor, int version = 4)
|
||||||
: QtWaylandServer::wl_compositor(compositor->m_display, version)
|
: QtWaylandServer::wl_compositor(compositor->m_display, version)
|
||||||
, m_compositor(compositor)
|
, m_compositor(compositor)
|
||||||
{}
|
{}
|
||||||
|
@ -342,7 +342,7 @@ Compositor::Compositor(MockCompositor *mockCompositor)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_global_create(m_display, &wl_compositor_interface, 1, this, bindCompositor);
|
wl_global_create(m_display, &wl_compositor_interface, 4, this, bindCompositor);
|
||||||
|
|
||||||
m_data_device_manager.reset(new DataDeviceManager(this, m_display));
|
m_data_device_manager.reset(new DataDeviceManager(this, m_display));
|
||||||
|
|
||||||
|
@ -125,6 +125,16 @@ void Surface::surface_damage(Resource *resource,
|
|||||||
Q_UNUSED(height);
|
Q_UNUSED(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Surface::surface_damage_buffer(Resource *resource,
|
||||||
|
int32_t x, int32_t y, int32_t width, int32_t height)
|
||||||
|
{
|
||||||
|
Q_UNUSED(resource);
|
||||||
|
Q_UNUSED(x);
|
||||||
|
Q_UNUSED(y);
|
||||||
|
Q_UNUSED(width);
|
||||||
|
Q_UNUSED(height);
|
||||||
|
}
|
||||||
|
|
||||||
void Surface::surface_frame(Resource *resource,
|
void Surface::surface_frame(Resource *resource,
|
||||||
uint32_t callback)
|
uint32_t callback)
|
||||||
{
|
{
|
||||||
|
@ -65,6 +65,8 @@ protected:
|
|||||||
struct wl_resource *buffer, int x, int y) override;
|
struct wl_resource *buffer, int x, int y) override;
|
||||||
void surface_damage(Resource *resource,
|
void surface_damage(Resource *resource,
|
||||||
int32_t x, int32_t y, int32_t width, int32_t height) override;
|
int32_t x, int32_t y, int32_t width, int32_t height) override;
|
||||||
|
void surface_damage_buffer(Resource *resource,
|
||||||
|
int32_t x, int32_t y, int32_t width, int32_t height) override;
|
||||||
void surface_frame(Resource *resource,
|
void surface_frame(Resource *resource,
|
||||||
uint32_t callback) override;
|
uint32_t callback) override;
|
||||||
void surface_commit(Resource *resource) override;
|
void surface_commit(Resource *resource) override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user