diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2012-05-10 17:50:12 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2012-05-10 18:05:25 +0200 |
commit | bce79256f32e1e14858d4a63d17e000fd78a8a0f (patch) | |
tree | 10166b2795f0561cd49b712dee2fe59cc4baefd6 /src/compositor/wayland_wrapper | |
parent | e14b1548b7d1211201b138bc077353cdbc0d0bed (diff) |
Inform the platform plugin when direct rendering is active
Change-Id: I58f7e65dc755c99f5bb83dae2c68254727653a1c
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src/compositor/wayland_wrapper')
-rw-r--r-- | src/compositor/wayland_wrapper/wlcompositor.cpp | 14 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/wlcompositor.h | 2 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/wlsurface.cpp | 1 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/compositor/wayland_wrapper/wlcompositor.cpp b/src/compositor/wayland_wrapper/wlcompositor.cpp index d43b402a9..df1969802 100644 --- a/src/compositor/wayland_wrapper/wlcompositor.cpp +++ b/src/compositor/wayland_wrapper/wlcompositor.cpp @@ -125,6 +125,7 @@ Compositor::Compositor(WaylandCompositor *qt_compositor) , m_orientation(Qt::PrimaryOrientation) , m_directRenderSurface(0) , m_directRenderContext(0) + , m_directRenderActive(false) #if defined (QT_COMPOSITOR_WAYLAND_GL) , m_graphics_hw_integration(0) #endif @@ -340,6 +341,9 @@ bool Compositor::setDirectRenderSurface(Surface *surface, QOpenGLContext *contex m_pageFlipper = QGuiApplication::primaryScreen()->handle()->pageFlipper(); } + if (!surface) + setDirectRenderingActive(false); + if (m_graphics_hw_integration && m_graphics_hw_integration->setDirectRenderSurface(surface ? surface->waylandSurface() : 0)) { m_directRenderSurface = surface; m_directRenderContext = context; @@ -351,6 +355,16 @@ bool Compositor::setDirectRenderSurface(Surface *surface, QOpenGLContext *contex return false; } +void Compositor::setDirectRenderingActive(bool active) +{ + if (m_directRenderActive == active) + return; + m_directRenderActive = active; + + if (m_pageFlipper) + QMetaObject::invokeMethod(m_pageFlipper, "setDirectRenderingActive", Q_ARG(bool, active)); +} + QList<struct wl_client *> Compositor::clients() const { QList<struct wl_client *> list; diff --git a/src/compositor/wayland_wrapper/wlcompositor.h b/src/compositor/wayland_wrapper/wlcompositor.h index 7712485ba..c0c177276 100644 --- a/src/compositor/wayland_wrapper/wlcompositor.h +++ b/src/compositor/wayland_wrapper/wlcompositor.h @@ -108,6 +108,7 @@ public: Surface *directRenderSurface() const {return m_directRenderSurface;} QOpenGLContext *directRenderContext() const {return m_directRenderContext;} QPlatformScreenPageFlipper *pageFlipper() const { return m_pageFlipper; } + void setDirectRenderingActive(bool active); QList<Surface*> surfaces() const { return m_surfaces; } QList<Surface*> surfacesForClient(wl_client* client); @@ -181,6 +182,7 @@ private: Surface *m_directRenderSurface; QOpenGLContext *m_directRenderContext; + bool m_directRenderActive; #ifdef QT_COMPOSITOR_WAYLAND_GL GraphicsHardwareIntegration *m_graphics_hw_integration; diff --git a/src/compositor/wayland_wrapper/wlsurface.cpp b/src/compositor/wayland_wrapper/wlsurface.cpp index a02739718..f0dca7714 100644 --- a/src/compositor/wayland_wrapper/wlsurface.cpp +++ b/src/compositor/wayland_wrapper/wlsurface.cpp @@ -381,6 +381,7 @@ bool Surface::postBuffer() { if (surfaceBuffer && m_compositor->pageFlipper()) { if (m_compositor->pageFlipper()->displayBuffer(surfaceBuffer)) { surfaceBuffer->setPageFlipperHasBuffer(true); + m_compositor->setDirectRenderingActive(true); return true; } else { qDebug() << "could not post buffer"; |