16QEglFSContext::QEglFSContext(
const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
18 : QEGLPlatformContext(format, share, display, config,
19 qt_egl_device_integration()->supportsSurfacelessContexts() ? Flags() : QEGLPlatformContext::NoSurfaceless)
23EGLSurface QEglFSContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface)
25 if (surface->surface()->surfaceClass() == QSurface::Window) {
27 QEglFSWindow *w =
static_cast<QEglFSWindow *>(surface);
28 EGLSurface s = w->surface();
29 if (s == EGL_NO_SURFACE) {
36 return static_cast<QEGLPbuffer *>(surface)->pbuffer();
40EGLSurface QEglFSContext::createTemporaryOffscreenSurface()
42 if (qt_egl_device_integration()->supportsPBuffers())
43 return QEGLPlatformContext::createTemporaryOffscreenSurface();
46 m_tempWindow = qt_egl_device_integration()->createNativeOffscreenWindow(format());
48 qWarning(
"QEglFSContext: Failed to create temporary native window");
49 return EGL_NO_SURFACE;
52 EGLConfig config = q_configFromGLFormat(eglDisplay(), format());
53 return eglCreateWindowSurface(eglDisplay(), config, m_tempWindow,
nullptr);
56void QEglFSContext::destroyTemporaryOffscreenSurface(EGLSurface surface)
58 if (qt_egl_device_integration()->supportsPBuffers()) {
59 QEGLPlatformContext::destroyTemporaryOffscreenSurface(surface);
61 eglDestroySurface(eglDisplay(), surface);
62 qt_egl_device_integration()->destroyNativeWindow(m_tempWindow);
77void QEglFSContext::swapBuffers(QPlatformSurface *surface)
80 if (surface->surface()->surfaceClass() == QSurface::Window) {
81 QPlatformWindow *window =
static_cast<QPlatformWindow *>(surface);
82 if (QPlatformScreen *screen = window->screen()) {
83 if (QEglFSCursor *cursor = qobject_cast<QEglFSCursor *>(screen->cursor()))
84 cursor->paintOnScreen();
88 qt_egl_device_integration()->waitForVSync(surface);
89 QEGLPlatformContext::swapBuffers(surface);
90 qt_egl_device_integration()->presentBuffer(surface);