summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2018-09-11 13:19:20 +0200
committerPaul Olav Tvete <paul.tvete@qt.io>2018-09-21 07:00:54 +0000
commit6c0b10e53ba1ecba8b4da9eefb9bd6b1693cc72f (patch)
tree205cc8d20271743471a776cd1d8dbb1868395f49
parent89c38de88d9eda9f4f02a8a54f2de33406221d15 (diff)
Add virtual QtWayland::ServerBuffer::bufferInUse()
This allows the compositor to reclaim unused graphics memory when a buffer is no longer used by clients. Change-Id: Ia0269608019c5120da8c091c81e165411b563554 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegration_p.h1
-rw-r--r--src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp5
-rw-r--r--src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h1
-rw-r--r--src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp4
-rw-r--r--src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h1
5 files changed, 12 insertions, 0 deletions
diff --git a/src/compositor/hardware_integration/qwlserverbufferintegration_p.h b/src/compositor/hardware_integration/qwlserverbufferintegration_p.h
index c27fd4e44..7d8901d58 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegration_p.h
+++ b/src/compositor/hardware_integration/qwlserverbufferintegration_p.h
@@ -82,6 +82,7 @@ public:
virtual ~ServerBuffer();
virtual struct ::wl_resource *resourceForClient(struct ::wl_client *) = 0;
+ virtual bool bufferInUse() { return true; }
virtual QOpenGLTexture *toOpenGlTexture() = 0;
diff --git a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
index ef14aa2a2..d2fc1aef4 100644
--- a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
@@ -121,6 +121,11 @@ QOpenGLTexture *DrmEglServerBuffer::toOpenGlTexture()
return m_texture;
}
+bool DrmEglServerBuffer::bufferInUse()
+{
+ return resourceMap().count() > 0;
+}
+
DrmEglServerBufferIntegration::DrmEglServerBufferIntegration()
{
}
diff --git a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
index 472f569ba..ff329c1a1 100644
--- a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
@@ -80,6 +80,7 @@ public:
DrmEglServerBuffer(DrmEglServerBufferIntegration *integration, const QImage &qimage, QtWayland::ServerBuffer::Format format);
struct ::wl_resource *resourceForClient(struct ::wl_client *) override;
+ bool bufferInUse() override;
QOpenGLTexture *toOpenGlTexture() override;
private:
diff --git a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp
index 1dd037adc..d4ec709bf 100644
--- a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp
@@ -102,6 +102,10 @@ struct ::wl_resource *ShmServerBuffer::resourceForClient(struct ::wl_client *cli
return bufferResource->handle;
}
+bool ShmServerBuffer::bufferInUse()
+{
+ return resourceMap().count() > 0;
+}
QOpenGLTexture *ShmServerBuffer::toOpenGlTexture()
{
diff --git a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h
index 77e4353ca..0ea78c9c2 100644
--- a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h
@@ -64,6 +64,7 @@ public:
~ShmServerBuffer() override;
struct ::wl_resource *resourceForClient(struct ::wl_client *) override;
+ bool bufferInUse() override;
QOpenGLTexture *toOpenGlTexture() override;
private: