diff --git a/src/backends/drm/drm_egl_backend.h b/src/backends/drm/drm_egl_backend.h index c0df7c9231..8a572b4f47 100644 --- a/src/backends/drm/drm_egl_backend.h +++ b/src/backends/drm/drm_egl_backend.h @@ -86,7 +86,7 @@ public: private: bool initializeEgl(); - bool initBufferConfigs(); + bool initBufferConfigs() override; bool initRenderingContext(); DrmBackend *m_backend; diff --git a/src/backends/virtual/virtual_egl_backend.cpp b/src/backends/virtual/virtual_egl_backend.cpp index e0e5678fba..f4e1f0f97f 100644 --- a/src/backends/virtual/virtual_egl_backend.cpp +++ b/src/backends/virtual/virtual_egl_backend.cpp @@ -150,39 +150,6 @@ void VirtualEglBackend::removeOutput(Output *output) m_outputs.erase(output); } -bool VirtualEglBackend::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) { - return false; - } - if (count != 1) { - return false; - } - setConfig(configs[0]); - - return true; -} - std::unique_ptr VirtualEglBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) { return std::make_unique(this, pixmap); diff --git a/src/backends/virtual/virtual_egl_backend.h b/src/backends/virtual/virtual_egl_backend.h index ac5ccd1b55..d084a5f418 100644 --- a/src/backends/virtual/virtual_egl_backend.h +++ b/src/backends/virtual/virtual_egl_backend.h @@ -56,7 +56,6 @@ public: private: bool initializeEgl(); - bool initBufferConfigs(); bool initRenderingContext(); void addOutput(Output *output); diff --git a/src/backends/wayland/wayland_egl_backend.cpp b/src/backends/wayland/wayland_egl_backend.cpp index 135730992c..5f8f7df2b0 100644 --- a/src/backends/wayland/wayland_egl_backend.cpp +++ b/src/backends/wayland/wayland_egl_backend.cpp @@ -384,41 +384,6 @@ bool WaylandEglBackend::initRenderingContext() return makeCurrent(); } -bool WaylandEglBackend::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_WAYLAND_BACKEND) << "choose config failed"; - return false; - } - if (count != 1) { - qCCritical(KWIN_WAYLAND_BACKEND) << "choose config did not return a config" << count; - return false; - } - setConfig(configs[0]); - - return true; -} - std::shared_ptr WaylandEglBackend::textureForOutput(KWin::Output *output) const { auto texture = std::make_unique(GL_RGBA8, output->pixelSize()); diff --git a/src/backends/wayland/wayland_egl_backend.h b/src/backends/wayland/wayland_egl_backend.h index 0ea98b2929..18d1b6e0d8 100644 --- a/src/backends/wayland/wayland_egl_backend.h +++ b/src/backends/wayland/wayland_egl_backend.h @@ -143,7 +143,6 @@ public: private: bool initializeEgl(); - bool initBufferConfigs(); bool initRenderingContext(); bool createEglWaylandOutput(Output *output); void cleanupSurfaces() override; diff --git a/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp b/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp index fe433ce436..c5a1448d90 100644 --- a/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp +++ b/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp @@ -477,4 +477,39 @@ QHash> AbstractEglBackend::supportedFormats() const return RenderBackend::supportedFormats(); } } + +bool 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 false; + } + if (count != 1) { + qCCritical(KWIN_OPENGL) << "choose config did not return a config" << count; + return false; + } + setConfig(configs[0]); + + return true; +} } diff --git a/src/platformsupport/scenes/opengl/abstract_egl_backend.h b/src/platformsupport/scenes/opengl/abstract_egl_backend.h index 5f4d0869fe..5bab630500 100644 --- a/src/platformsupport/scenes/opengl/abstract_egl_backend.h +++ b/src/platformsupport/scenes/opengl/abstract_egl_backend.h @@ -87,6 +87,7 @@ protected: bool hasClientExtension(const QByteArray &ext) const; bool isOpenGLES() const; bool createContext(); + virtual bool initBufferConfigs(); private: EGLContext ensureGlobalShareContext();