platformsupport: remove initBufferConfigs
Instead, rely on EGL_KHR_no_config_context everywhere except the standalone x11 backend
This commit is contained in:
parent
57c7eccb32
commit
94ac8d235b
9 changed files with 12 additions and 50 deletions
|
@ -107,10 +107,10 @@ void EglGbmBackend::init()
|
|||
|
||||
bool EglGbmBackend::initRenderingContext()
|
||||
{
|
||||
return createContext(initBufferConfigs()) && makeCurrent();
|
||||
return initBufferConfigs() && createContext(EGL_NO_CONFIG_KHR) && makeCurrent();
|
||||
}
|
||||
|
||||
EGLConfig EglGbmBackend::initBufferConfigs()
|
||||
bool EglGbmBackend::initBufferConfigs()
|
||||
{
|
||||
const EGLint config_attribs[] = {
|
||||
EGL_SURFACE_TYPE,
|
||||
|
@ -136,7 +136,7 @@ EGLConfig EglGbmBackend::initBufferConfigs()
|
|||
sizeof(configs) / sizeof(EGLConfig),
|
||||
&count)) {
|
||||
qCCritical(KWIN_DRM) << "eglChooseConfig failed:" << getEglErrorString();
|
||||
return EGL_NO_CONFIG_KHR;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Loop through all configs, choosing the first one that has suitable format.
|
||||
|
@ -159,7 +159,7 @@ EGLConfig EglGbmBackend::initBufferConfigs()
|
|||
m_formats[gbmFormat] = format;
|
||||
}
|
||||
if (!m_formats.isEmpty()) {
|
||||
return EGL_NO_CONFIG_KHR;
|
||||
return true;
|
||||
}
|
||||
|
||||
qCCritical(KWIN_DRM, "Choosing EGL config did not return a supported config. There were %u configs", count);
|
||||
|
@ -174,7 +174,7 @@ EGLConfig EglGbmBackend::initBufferConfigs()
|
|||
gbm_format_get_name(gbmFormat, &name);
|
||||
qCCritical(KWIN_DRM, "EGL config %d has format %s with %d,%d,%d,%d bits for r,g,b,a", i, name.name, redSize, greenSize, blueSize, alphaSize);
|
||||
}
|
||||
return EGL_NO_CONFIG_KHR;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> EglGbmBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
|
||||
private:
|
||||
bool initializeEgl();
|
||||
EGLConfig initBufferConfigs() override;
|
||||
bool initBufferConfigs();
|
||||
bool initRenderingContext();
|
||||
|
||||
DrmBackend *m_backend;
|
||||
|
|
|
@ -137,11 +137,7 @@ void VirtualEglBackend::init()
|
|||
|
||||
bool VirtualEglBackend::initRenderingContext()
|
||||
{
|
||||
if (!createContext(initBufferConfigs())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return makeCurrent();
|
||||
return createContext(EGL_NO_CONFIG_KHR) && makeCurrent();
|
||||
}
|
||||
|
||||
void VirtualEglBackend::addOutput(Output *output)
|
||||
|
|
|
@ -382,7 +382,7 @@ void WaylandEglBackend::init()
|
|||
|
||||
bool WaylandEglBackend::initRenderingContext()
|
||||
{
|
||||
if (!createContext(initBufferConfigs())) {
|
||||
if (!createContext(EGL_NO_CONFIG_KHR)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ bool EglBackend::initRenderingContext()
|
|||
|
||||
setEglDisplay(display);
|
||||
|
||||
if (!createContext(initBufferConfigs())) {
|
||||
if (!createContext(chooseBufferConfig())) {
|
||||
qCCritical(KWIN_CORE) << "Create OpenGL context failed";
|
||||
return false;
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ EGLSurface EglBackend::createSurface(xcb_window_t window)
|
|||
return surface;
|
||||
}
|
||||
|
||||
EGLConfig EglBackend::initBufferConfigs()
|
||||
EGLConfig EglBackend::chooseBufferConfig()
|
||||
{
|
||||
const EGLint config_attribs[] = {
|
||||
EGL_SURFACE_TYPE,
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
OutputLayer *primaryLayer(Output *output) override;
|
||||
|
||||
protected:
|
||||
EGLConfig initBufferConfigs() override;
|
||||
EGLConfig chooseBufferConfig();
|
||||
bool initRenderingContext();
|
||||
|
||||
private:
|
||||
|
|
|
@ -305,7 +305,7 @@ bool X11WindowedEglBackend::initializeEgl()
|
|||
|
||||
bool X11WindowedEglBackend::initRenderingContext()
|
||||
{
|
||||
if (!createContext(initBufferConfigs())) {
|
||||
if (!createContext(EGL_NO_CONFIG_KHR)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -356,39 +356,6 @@ QHash<uint32_t, QVector<uint64_t>> AbstractEglBackend::supportedFormats() const
|
|||
return m_supportedFormats;
|
||||
}
|
||||
|
||||
EGLConfig AbstractEglBackend::initBufferConfigs()
|
||||
{
|
||||
const EGLint config_attribs[] = {
|
||||
EGL_SURFACE_TYPE,
|
||||
EGL_WINDOW_BIT,
|
||||
EGL_RED_SIZE,
|
||||
1,
|
||||
EGL_GREEN_SIZE,
|
||||
1,
|
||||
EGL_BLUE_SIZE,
|
||||
1,
|
||||
EGL_ALPHA_SIZE,
|
||||
0,
|
||||
EGL_RENDERABLE_TYPE,
|
||||
isOpenGLES() ? EGL_OPENGL_ES2_BIT : EGL_OPENGL_BIT,
|
||||
EGL_CONFIG_CAVEAT,
|
||||
EGL_NONE,
|
||||
EGL_NONE,
|
||||
};
|
||||
|
||||
EGLint count;
|
||||
EGLConfig configs[1024];
|
||||
if (eglChooseConfig(eglDisplay(), config_attribs, configs, 1, &count) == EGL_FALSE) {
|
||||
qCCritical(KWIN_OPENGL) << "choose config failed";
|
||||
return EGL_NO_CONFIG_KHR;
|
||||
}
|
||||
if (count != 1) {
|
||||
qCCritical(KWIN_OPENGL) << "choose config did not return a config" << count;
|
||||
return EGL_NO_CONFIG_KHR;
|
||||
}
|
||||
return configs[0];
|
||||
}
|
||||
|
||||
::EGLDisplay AbstractEglBackend::eglDisplay() const
|
||||
{
|
||||
return m_display->handle();
|
||||
|
|
|
@ -77,7 +77,6 @@ protected:
|
|||
bool hasClientExtension(const QByteArray &ext) const;
|
||||
bool isOpenGLES() const;
|
||||
bool createContext(EGLConfig config);
|
||||
virtual EGLConfig initBufferConfigs();
|
||||
|
||||
private:
|
||||
bool ensureGlobalShareContext(EGLConfig config);
|
||||
|
|
Loading…
Reference in a new issue