A Scene doesn't need to use an X11 Overlay Window
Only the X based Scenes need an overlay window, so the Compositor doesn't need to check for it in the Wayland case. OverlayWindow is moved from OpenGLBackend to the sub classes which need to provide it.
This commit is contained in:
parent
c9779825d1
commit
b28effff23
13 changed files with 82 additions and 16 deletions
|
@ -539,7 +539,7 @@ void Compositor::lastFrameRendered()
|
||||||
|
|
||||||
void Compositor::performCompositing()
|
void Compositor::performCompositing()
|
||||||
{
|
{
|
||||||
if (!isOverlayWindowVisible())
|
if (m_scene->usesOverlayWindow() && !isOverlayWindowVisible())
|
||||||
return; // nothing is visible anyway
|
return; // nothing is visible anyway
|
||||||
if (!m_scene->isLastFrameRendered()) {
|
if (!m_scene->isLastFrameRendered()) {
|
||||||
m_waitingForFrameRendered = true;
|
m_waitingForFrameRendered = true;
|
||||||
|
@ -706,7 +706,7 @@ void Compositor::checkUnredirect()
|
||||||
// force is needed when the list of windows changes (e.g. a window goes away)
|
// force is needed when the list of windows changes (e.g. a window goes away)
|
||||||
void Compositor::checkUnredirect(bool force)
|
void Compositor::checkUnredirect(bool force)
|
||||||
{
|
{
|
||||||
if (!hasScene() || m_scene->overlayWindow()->window() == None || !options->isUnredirectFullscreen())
|
if (!hasScene() || !m_scene->overlayWindow() || m_scene->overlayWindow()->window() == None || !options->isUnredirectFullscreen())
|
||||||
return;
|
return;
|
||||||
if (force)
|
if (force)
|
||||||
forceUnredirectCheck = true;
|
forceUnredirectCheck = true;
|
||||||
|
@ -716,7 +716,7 @@ void Compositor::checkUnredirect(bool force)
|
||||||
|
|
||||||
void Compositor::delayedCheckUnredirect()
|
void Compositor::delayedCheckUnredirect()
|
||||||
{
|
{
|
||||||
if (!hasScene() || m_scene->overlayWindow()->window() == None || !(options->isUnredirectFullscreen() || sender() == options))
|
if (!hasScene() || !m_scene->overlayWindow() || m_scene->overlayWindow()->window() == None || !(options->isUnredirectFullscreen() || sender() == options))
|
||||||
return;
|
return;
|
||||||
ToplevelList list;
|
ToplevelList list;
|
||||||
bool changed = forceUnredirectCheck;
|
bool changed = forceUnredirectCheck;
|
||||||
|
|
|
@ -369,6 +369,11 @@ void EglWaylandBackend::lastFrameRendered()
|
||||||
Compositor::self()->lastFrameRendered();
|
Compositor::self()->lastFrameRendered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EglWaylandBackend::usesOverlayWindow() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
* EglTexture
|
* EglTexture
|
||||||
************************************************/
|
************************************************/
|
||||||
|
|
|
@ -69,6 +69,7 @@ public:
|
||||||
virtual bool isLastFrameRendered() const override;
|
virtual bool isLastFrameRendered() const override;
|
||||||
Xcb::Shm *shm();
|
Xcb::Shm *shm();
|
||||||
void lastFrameRendered();
|
void lastFrameRendered();
|
||||||
|
virtual bool usesOverlayWindow() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void present();
|
virtual void present();
|
||||||
|
|
|
@ -35,6 +35,7 @@ namespace KWin
|
||||||
|
|
||||||
EglOnXBackend::EglOnXBackend()
|
EglOnXBackend::EglOnXBackend()
|
||||||
: OpenGLBackend()
|
: OpenGLBackend()
|
||||||
|
, m_overlayWindow(new OverlayWindow())
|
||||||
, ctx(EGL_NO_CONTEXT)
|
, ctx(EGL_NO_CONTEXT)
|
||||||
, surfaceHasSubPost(0)
|
, surfaceHasSubPost(0)
|
||||||
, m_bufferAge(0)
|
, m_bufferAge(0)
|
||||||
|
@ -46,6 +47,9 @@ EglOnXBackend::EglOnXBackend()
|
||||||
|
|
||||||
EglOnXBackend::~EglOnXBackend()
|
EglOnXBackend::~EglOnXBackend()
|
||||||
{
|
{
|
||||||
|
if (isFailed()) {
|
||||||
|
m_overlayWindow->destroy();
|
||||||
|
}
|
||||||
cleanupGL();
|
cleanupGL();
|
||||||
doneCurrent();
|
doneCurrent();
|
||||||
eglDestroyContext(dpy, ctx);
|
eglDestroyContext(dpy, ctx);
|
||||||
|
@ -55,6 +59,7 @@ EglOnXBackend::~EglOnXBackend()
|
||||||
if (overlayWindow()->window()) {
|
if (overlayWindow()->window()) {
|
||||||
overlayWindow()->destroy();
|
overlayWindow()->destroy();
|
||||||
}
|
}
|
||||||
|
delete m_overlayWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool gs_tripleBufferUndetected = true;
|
static bool gs_tripleBufferUndetected = true;
|
||||||
|
@ -420,6 +425,16 @@ void EglOnXBackend::doneCurrent()
|
||||||
eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EglOnXBackend::usesOverlayWindow() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
OverlayWindow* EglOnXBackend::overlayWindow()
|
||||||
|
{
|
||||||
|
return m_overlayWindow;
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
* EglTexture
|
* EglTexture
|
||||||
************************************************/
|
************************************************/
|
||||||
|
|
|
@ -38,6 +38,8 @@ public:
|
||||||
virtual void endRenderingFrame(const QRegion &damage, const QRegion &damagedRegion);
|
virtual void endRenderingFrame(const QRegion &damage, const QRegion &damagedRegion);
|
||||||
virtual bool makeCurrent() override;
|
virtual bool makeCurrent() override;
|
||||||
virtual void doneCurrent() override;
|
virtual void doneCurrent() override;
|
||||||
|
virtual OverlayWindow* overlayWindow() override;
|
||||||
|
virtual bool usesOverlayWindow() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void present();
|
virtual void present();
|
||||||
|
@ -46,6 +48,10 @@ private:
|
||||||
void init();
|
void init();
|
||||||
bool initBufferConfigs();
|
bool initBufferConfigs();
|
||||||
bool initRenderingContext();
|
bool initRenderingContext();
|
||||||
|
/**
|
||||||
|
* @brief The OverlayWindow used by this Backend.
|
||||||
|
**/
|
||||||
|
OverlayWindow *m_overlayWindow;
|
||||||
EGLDisplay dpy;
|
EGLDisplay dpy;
|
||||||
EGLConfig config;
|
EGLConfig config;
|
||||||
EGLSurface surface;
|
EGLSurface surface;
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace KWin
|
||||||
{
|
{
|
||||||
GlxBackend::GlxBackend()
|
GlxBackend::GlxBackend()
|
||||||
: OpenGLBackend()
|
: OpenGLBackend()
|
||||||
|
, m_overlayWindow(new OverlayWindow())
|
||||||
, window(None)
|
, window(None)
|
||||||
, fbconfig(NULL)
|
, fbconfig(NULL)
|
||||||
, glxWindow(None)
|
, glxWindow(None)
|
||||||
|
@ -54,6 +55,9 @@ GlxBackend::GlxBackend()
|
||||||
|
|
||||||
GlxBackend::~GlxBackend()
|
GlxBackend::~GlxBackend()
|
||||||
{
|
{
|
||||||
|
if (isFailed()) {
|
||||||
|
m_overlayWindow->destroy();
|
||||||
|
}
|
||||||
// TODO: cleanup in error case
|
// TODO: cleanup in error case
|
||||||
// do cleanup after initBuffer()
|
// do cleanup after initBuffer()
|
||||||
cleanupGL();
|
cleanupGL();
|
||||||
|
@ -70,6 +74,7 @@ GlxBackend::~GlxBackend()
|
||||||
|
|
||||||
overlayWindow()->destroy();
|
overlayWindow()->destroy();
|
||||||
checkGLError("Cleanup");
|
checkGLError("Cleanup");
|
||||||
|
delete m_overlayWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool gs_tripleBufferUndetected = true;
|
static bool gs_tripleBufferUndetected = true;
|
||||||
|
@ -593,6 +598,16 @@ void GlxBackend::doneCurrent()
|
||||||
glXMakeCurrent(display(), None, nullptr);
|
glXMakeCurrent(display(), None, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OverlayWindow* GlxBackend::overlayWindow()
|
||||||
|
{
|
||||||
|
return m_overlayWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GlxBackend::usesOverlayWindow() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* GlxTexture
|
* GlxTexture
|
||||||
*******************************************************/
|
*******************************************************/
|
||||||
|
|
|
@ -48,6 +48,8 @@ public:
|
||||||
virtual void endRenderingFrame(const QRegion &damage, const QRegion &damagedRegion);
|
virtual void endRenderingFrame(const QRegion &damage, const QRegion &damagedRegion);
|
||||||
virtual bool makeCurrent() override;
|
virtual bool makeCurrent() override;
|
||||||
virtual void doneCurrent() override;
|
virtual void doneCurrent() override;
|
||||||
|
virtual OverlayWindow* overlayWindow() override;
|
||||||
|
virtual bool usesOverlayWindow() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void present();
|
virtual void present();
|
||||||
|
@ -61,6 +63,10 @@ private:
|
||||||
bool initFbConfig();
|
bool initFbConfig();
|
||||||
void setSwapInterval(int interval);
|
void setSwapInterval(int interval);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The OverlayWindow used by this Backend.
|
||||||
|
**/
|
||||||
|
OverlayWindow *m_overlayWindow;
|
||||||
Window window;
|
Window window;
|
||||||
FBConfigInfo fbcdrawableinfo[ 32 + 1 ];
|
FBConfigInfo fbcdrawableinfo[ 32 + 1 ];
|
||||||
GLXFBConfig fbconfig;
|
GLXFBConfig fbconfig;
|
||||||
|
|
|
@ -619,6 +619,9 @@ bool Scene::syncsToVBlank() const
|
||||||
|
|
||||||
void Scene::screenGeometryChanged(const QSize &size)
|
void Scene::screenGeometryChanged(const QSize &size)
|
||||||
{
|
{
|
||||||
|
if (!overlayWindow()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
overlayWindow()->resize(size);
|
overlayWindow()->resize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
scene.h
4
scene.h
|
@ -121,6 +121,10 @@ public:
|
||||||
virtual bool makeOpenGLContextCurrent();
|
virtual bool makeOpenGLContextCurrent();
|
||||||
virtual void doneOpenGLContextCurrent();
|
virtual void doneOpenGLContextCurrent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the Scene uses an X11 overlay window to perform compositing.
|
||||||
|
*/
|
||||||
|
virtual bool usesOverlayWindow() const = 0;
|
||||||
/**
|
/**
|
||||||
* @brief Allows the Compositor to delay the rendering of the next frame until the last one
|
* @brief Allows the Compositor to delay the rendering of the next frame until the last one
|
||||||
* has been rendered. This is mostly interesting in case that the system compositor is not able
|
* has been rendered. This is mostly interesting in case that the system compositor is not able
|
||||||
|
|
|
@ -79,8 +79,7 @@ extern int currentRefreshRate();
|
||||||
// SceneOpenGL
|
// SceneOpenGL
|
||||||
//****************************************
|
//****************************************
|
||||||
OpenGLBackend::OpenGLBackend()
|
OpenGLBackend::OpenGLBackend()
|
||||||
: m_overlayWindow(new OverlayWindow()) // TODO: maybe create only if needed?
|
: m_syncsToVBlank(false)
|
||||||
, m_syncsToVBlank(false)
|
|
||||||
, m_blocksForRetrace(false)
|
, m_blocksForRetrace(false)
|
||||||
, m_directRendering(false)
|
, m_directRendering(false)
|
||||||
, m_haveBufferAge(false)
|
, m_haveBufferAge(false)
|
||||||
|
@ -90,10 +89,6 @@ OpenGLBackend::OpenGLBackend()
|
||||||
|
|
||||||
OpenGLBackend::~OpenGLBackend()
|
OpenGLBackend::~OpenGLBackend()
|
||||||
{
|
{
|
||||||
if (isFailed()) {
|
|
||||||
m_overlayWindow->destroy();
|
|
||||||
}
|
|
||||||
delete m_overlayWindow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLBackend::setFailed(const QString &reason)
|
void OpenGLBackend::setFailed(const QString &reason)
|
||||||
|
@ -138,6 +133,11 @@ bool OpenGLBackend::isLastFrameRendered() const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OverlayWindow* OpenGLBackend::overlayWindow()
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
* SceneOpenGL
|
* SceneOpenGL
|
||||||
***********************************************/
|
***********************************************/
|
||||||
|
|
|
@ -52,6 +52,7 @@ public:
|
||||||
virtual Shadow *createShadow(Toplevel *toplevel);
|
virtual Shadow *createShadow(Toplevel *toplevel);
|
||||||
virtual void screenGeometryChanged(const QSize &size);
|
virtual void screenGeometryChanged(const QSize &size);
|
||||||
virtual OverlayWindow *overlayWindow();
|
virtual OverlayWindow *overlayWindow();
|
||||||
|
virtual bool usesOverlayWindow() const;
|
||||||
virtual bool blocksForRetrace() const;
|
virtual bool blocksForRetrace() const;
|
||||||
virtual bool syncsToVBlank() const;
|
virtual bool syncsToVBlank() const;
|
||||||
virtual bool makeOpenGLContextCurrent() override;
|
virtual bool makeOpenGLContextCurrent() override;
|
||||||
|
@ -483,6 +484,7 @@ public:
|
||||||
* frame got rendered. If a backend needs more control it needs to implement this method.
|
* frame got rendered. If a backend needs more control it needs to implement this method.
|
||||||
*/
|
*/
|
||||||
virtual bool isLastFrameRendered() const;
|
virtual bool isLastFrameRendered() const;
|
||||||
|
virtual bool usesOverlayWindow() const = 0;
|
||||||
/**
|
/**
|
||||||
* @brief Compositor is going into idle mode, flushes any pending paints.
|
* @brief Compositor is going into idle mode, flushes any pending paints.
|
||||||
**/
|
**/
|
||||||
|
@ -504,9 +506,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return :OverlayWindow*
|
* @return :OverlayWindow*
|
||||||
**/
|
**/
|
||||||
OverlayWindow *overlayWindow() {
|
virtual OverlayWindow *overlayWindow();
|
||||||
return m_overlayWindow;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @brief Whether the creation of the Backend failed.
|
* @brief Whether the creation of the Backend failed.
|
||||||
*
|
*
|
||||||
|
@ -635,10 +635,6 @@ protected:
|
||||||
SwapProfiler m_swapProfiler;
|
SwapProfiler m_swapProfiler;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
|
||||||
* @brief The OverlayWindow used by this Backend.
|
|
||||||
**/
|
|
||||||
OverlayWindow *m_overlayWindow;
|
|
||||||
/**
|
/**
|
||||||
* @brief Whether VSync is available and used, defaults to @c false.
|
* @brief Whether VSync is available and used, defaults to @c false.
|
||||||
**/
|
**/
|
||||||
|
@ -683,6 +679,11 @@ inline bool SceneOpenGL::isLastFrameRendered() const
|
||||||
return m_backend->isLastFrameRendered();
|
return m_backend->isLastFrameRendered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool SceneOpenGL::usesOverlayWindow() const
|
||||||
|
{
|
||||||
|
return m_backend->usesOverlayWindow();
|
||||||
|
}
|
||||||
|
|
||||||
inline SceneOpenGL::Texture* OpenGLWindowPixmap::texture() const
|
inline SceneOpenGL::Texture* OpenGLWindowPixmap::texture() const
|
||||||
{
|
{
|
||||||
return m_texture.data();
|
return m_texture.data();
|
||||||
|
|
|
@ -243,6 +243,11 @@ void X11XRenderBackend::screenGeometryChanged(const QSize &size)
|
||||||
init(false);
|
init(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool X11XRenderBackend::usesOverlayWindow() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//****************************************
|
//****************************************
|
||||||
// SceneXrender
|
// SceneXrender
|
||||||
//****************************************
|
//****************************************
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
* @return :OverlayWindow*
|
* @return :OverlayWindow*
|
||||||
**/
|
**/
|
||||||
virtual OverlayWindow *overlayWindow();
|
virtual OverlayWindow *overlayWindow();
|
||||||
|
virtual bool usesOverlayWindow() const = 0;
|
||||||
/**
|
/**
|
||||||
* @brief Shows the Overlay Window
|
* @brief Shows the Overlay Window
|
||||||
*
|
*
|
||||||
|
@ -136,6 +137,7 @@ public:
|
||||||
virtual OverlayWindow* overlayWindow();
|
virtual OverlayWindow* overlayWindow();
|
||||||
virtual void showOverlay();
|
virtual void showOverlay();
|
||||||
virtual void screenGeometryChanged(const QSize &size);
|
virtual void screenGeometryChanged(const QSize &size);
|
||||||
|
virtual bool usesOverlayWindow() const;
|
||||||
private:
|
private:
|
||||||
void init(bool createOverlay);
|
void init(bool createOverlay);
|
||||||
void createBuffer();
|
void createBuffer();
|
||||||
|
@ -163,6 +165,9 @@ public:
|
||||||
virtual OverlayWindow *overlayWindow() {
|
virtual OverlayWindow *overlayWindow() {
|
||||||
return m_backend->overlayWindow();
|
return m_backend->overlayWindow();
|
||||||
}
|
}
|
||||||
|
virtual bool usesOverlayWindow() const {
|
||||||
|
return m_backend->usesOverlayWindow();
|
||||||
|
}
|
||||||
virtual bool isLastFrameRendered() const {
|
virtual bool isLastFrameRendered() const {
|
||||||
return m_backend->isLastFrameRendered();
|
return m_backend->isLastFrameRendered();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue