diff options
4 files changed, 25 insertions, 3 deletions
diff --git a/src/qt-compositor/hardware_integration/wayland_egl/waylandeglintegration.cpp b/src/qt-compositor/hardware_integration/wayland_egl/waylandeglintegration.cpp index e20c262c..497c7eb7 100644 --- a/src/qt-compositor/hardware_integration/wayland_egl/waylandeglintegration.cpp +++ b/src/qt-compositor/hardware_integration/wayland_egl/waylandeglintegration.cpp @@ -43,6 +43,7 @@ #include <QtGui/QPlatformNativeInterface> #include <QtGui/QGuiApplication> #include <QtGui/QOpenGLContext> +#include <QtGui/QPlatformScreen> #define EGL_EGLEXT_PROTOTYPES #include <EGL/egl.h> @@ -51,6 +52,7 @@ #define GL_GLEXT_PROTOTYPES #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> +#include <QDebug> GraphicsHardwareIntegration * GraphicsHardwareIntegration::createGraphicsHardwareIntegration(WaylandCompositor *compositor) { @@ -124,3 +126,18 @@ GLuint WaylandEglIntegration::createTextureFromBuffer(wl_buffer *buffer) return textureId; } + +bool WaylandEglIntegration::setDirectRenderSurface(WaylandSurface *) +{ + QPlatformScreen *screen = QPlatformScreen::platformScreenForWindow(m_compositor->window()); + return screen && screen->pageFlipper(); +} + + +bool WaylandEglIntegration::postBuffer(struct wl_buffer *buffer) +{ + QPlatformScreen *screen = QPlatformScreen::platformScreenForWindow(m_compositor->window()); + QPlatformScreenPageFlipper *flipper = screen->pageFlipper(); + + return flipper ? flipper->displayBuffer(buffer) : false; +} diff --git a/src/qt-compositor/hardware_integration/wayland_egl/waylandeglintegration.h b/src/qt-compositor/hardware_integration/wayland_egl/waylandeglintegration.h index f727051e..4e98d18b 100644 --- a/src/qt-compositor/hardware_integration/wayland_egl/waylandeglintegration.h +++ b/src/qt-compositor/hardware_integration/wayland_egl/waylandeglintegration.h @@ -56,6 +56,9 @@ public: GLuint createTextureFromBuffer(wl_buffer *buffer); + bool setDirectRenderSurface(WaylandSurface *); + bool postBuffer(struct wl_buffer *); + private: Q_DISABLE_COPY(WaylandEglIntegration) QScopedPointer<WaylandEglIntegrationPrivate> d_ptr; diff --git a/src/qt-compositor/wayland_wrapper/wlcompositor.cpp b/src/qt-compositor/wayland_wrapper/wlcompositor.cpp index 453a9ac2..1bab0774 100644 --- a/src/qt-compositor/wayland_wrapper/wlcompositor.cpp +++ b/src/qt-compositor/wayland_wrapper/wlcompositor.cpp @@ -360,6 +360,8 @@ void Compositor::surfaceDestroyed(Surface *surface) setKeyFocus(0); if (m_pointerFocusSurface == surface) setPointerFocus(0); + if (m_directRenderSurface == surface) + setDirectRenderSurface(0); } void Compositor::markSurfaceAsDirty(Wayland::Surface *surface) diff --git a/src/qt-compositor/wayland_wrapper/wlsurface.cpp b/src/qt-compositor/wayland_wrapper/wlsurface.cpp index dc01c0a2..cf8a443c 100644 --- a/src/qt-compositor/wayland_wrapper/wlsurface.cpp +++ b/src/qt-compositor/wayland_wrapper/wlsurface.cpp @@ -99,7 +99,7 @@ public: void attach(struct wl_buffer *buffer) { bool emitMap = !surfaceBuffer; - if (surfaceBuffer && ! textureCreatedForBuffer) { + if (surfaceBuffer && ! textureCreatedForBuffer && surfaceBuffer != directRenderBuffer) { qWarning() << "### WaylandSurface::attach() releasing undisplayed buffer ###"; wl_client_post_event(client,&surfaceBuffer->resource.object,WL_BUFFER_RELEASE); } @@ -216,12 +216,12 @@ void Surface::damage(const QRect &rect) if (d->previousBuffer) { wl_client_post_event(d->client,&d->previousBuffer->resource.object,WL_BUFFER_RELEASE); } - d->previousBuffer = d->buffer(); + d->directRenderBuffer = d->previousBuffer = d->buffer(); return; } } #endif - + d->directRenderBuffer = 0; d->compositor->markSurfaceAsDirty(this); emit d->qtSurface->damaged(rect); |