cc8cb8db9d
If the surfaceless context extension is unsupported by the underlying platform, the QPA will use the EGLSurface of the first output to make OpenGL contexts current. If an internal window attempts to make an OpenGL context current while compositing is being restarted, for example it's typically the case with the composited outline visual, QPA will either try to make the context current with a no longer valid EGLSurface for the first output or will crash during the call to Platform::supportsSurfacelessContext(). The latter needs more explanation. After the compositingToggled() signal has been emitted, there is no scene and supportsSurfacelessContext() doesn't handle this case. In either case, we could return EGL_NO_SURFACE if compositing is being restarted, but if the underlying platform doesn't support the surfaceless context extension, then the composited outline will not be able to delete used textures, framebuffer objects, etc. This change addresses that problem by making sure that every platform window has a pbuffer allocated in case the surfaceless context extension is unsupported.
68 lines
1.5 KiB
C++
68 lines
1.5 KiB
C++
/*
|
|
KWin - the KDE window manager
|
|
This file is part of the KDE project.
|
|
|
|
SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
|
|
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
#ifndef KWIN_QPA_WINDOW_H
|
|
#define KWIN_QPA_WINDOW_H
|
|
|
|
#include <epoxy/egl.h>
|
|
#include "fixqopengl.h"
|
|
#include <fixx11h.h>
|
|
|
|
#include <QPointer>
|
|
#include <qpa/qplatformwindow.h>
|
|
|
|
class QOpenGLFramebufferObject;
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
class InternalClient;
|
|
|
|
namespace QPA
|
|
{
|
|
|
|
class Window : public QPlatformWindow
|
|
{
|
|
public:
|
|
explicit Window(QWindow *window);
|
|
~Window() override;
|
|
|
|
QSurfaceFormat format() const override;
|
|
void setVisible(bool visible) override;
|
|
void setGeometry(const QRect &rect) override;
|
|
WId winId() const override;
|
|
qreal devicePixelRatio() const override;
|
|
|
|
void bindContentFBO();
|
|
const QSharedPointer<QOpenGLFramebufferObject> &contentFBO() const;
|
|
QSharedPointer<QOpenGLFramebufferObject> swapFBO();
|
|
|
|
InternalClient *client() const;
|
|
EGLSurface eglSurface() const;
|
|
|
|
private:
|
|
void createFBO();
|
|
void createPbuffer();
|
|
void map();
|
|
void unmap();
|
|
|
|
QSurfaceFormat m_format;
|
|
QPointer<InternalClient> m_handle;
|
|
QSharedPointer<QOpenGLFramebufferObject> m_contentFBO;
|
|
EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
|
|
EGLSurface m_eglSurface = EGL_NO_SURFACE;
|
|
quint32 m_windowId;
|
|
bool m_resized = false;
|
|
int m_scale = 1;
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif
|