| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/eglfs/qeglfscontext.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||
| 2 | ** | - | ||||||||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||
| 5 | ** | - | ||||||||||||
| 6 | ** This file is part of the plugins of the Qt Toolkit. | - | ||||||||||||
| 7 | ** | - | ||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||
| 16 | ** | - | ||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||
| 19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||
| 25 | ** | - | ||||||||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||
| 29 | ** | - | ||||||||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||||||||
| 31 | ** | - | ||||||||||||
| 32 | ****************************************************************************/ | - | ||||||||||||
| 33 | - | |||||||||||||
| 34 | #include "qeglfsglobal.h" | - | ||||||||||||
| 35 | #include <QtGui/QSurface> | - | ||||||||||||
| 36 | #include <QtPlatformSupport/private/qeglconvenience_p.h> | - | ||||||||||||
| 37 | #include <QtPlatformSupport/private/qeglpbuffer_p.h> | - | ||||||||||||
| 38 | - | |||||||||||||
| 39 | #include "qeglfscontext.h" | - | ||||||||||||
| 40 | #include "qeglfswindow.h" | - | ||||||||||||
| 41 | #include "qeglfshooks.h" | - | ||||||||||||
| 42 | #include "qeglfscursor.h" | - | ||||||||||||
| 43 | - | |||||||||||||
| 44 | QT_BEGIN_NAMESPACE | - | ||||||||||||
| 45 | - | |||||||||||||
| 46 | QEglFSContext::QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, | - | ||||||||||||
| 47 | EGLConfig *config, const QVariant &nativeHandle) | - | ||||||||||||
| 48 | : QEGLPlatformContext(format, share, display, config, nativeHandle, | - | ||||||||||||
| 49 | qt_egl_device_integration()->supportsSurfacelessContexts() ? Flags(0) : QEGLPlatformContext::NoSurfaceless), | - | ||||||||||||
| 50 | m_tempWindow(0) | - | ||||||||||||
| 51 | { | - | ||||||||||||
| 52 | } never executed: end of block | 0 | ||||||||||||
| 53 | - | |||||||||||||
| 54 | EGLSurface QEglFSContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) | - | ||||||||||||
| 55 | { | - | ||||||||||||
| 56 | if (surface->surface()->surfaceClass() == QSurface::Window)
| 0 | ||||||||||||
| 57 | return static_cast<QEglFSWindow *>(surface)->surface(); never executed: return static_cast<QEglFSWindow *>(surface)->surface(); | 0 | ||||||||||||
| 58 | else | - | ||||||||||||
| 59 | return static_cast<QEGLPbuffer *>(surface)->pbuffer(); never executed: return static_cast<QEGLPbuffer *>(surface)->pbuffer(); | 0 | ||||||||||||
| 60 | } | - | ||||||||||||
| 61 | - | |||||||||||||
| 62 | EGLSurface QEglFSContext::createTemporaryOffscreenSurface() | - | ||||||||||||
| 63 | { | - | ||||||||||||
| 64 | if (qt_egl_device_integration()->supportsPBuffers())
| 0 | ||||||||||||
| 65 | return QEGLPlatformContext::createTemporaryOffscreenSurface(); never executed: return QEGLPlatformContext::createTemporaryOffscreenSurface(); | 0 | ||||||||||||
| 66 | - | |||||||||||||
| 67 | if (!m_tempWindow) {
| 0 | ||||||||||||
| 68 | m_tempWindow = qt_egl_device_integration()->createNativeOffscreenWindow(format()); | - | ||||||||||||
| 69 | if (!m_tempWindow) {
| 0 | ||||||||||||
| 70 | qWarning("QEglFSContext: Failed to create temporary native window"); | - | ||||||||||||
| 71 | return EGL_NO_SURFACE; never executed: return ((EGLSurface)0); | 0 | ||||||||||||
| 72 | } | - | ||||||||||||
| 73 | } never executed: end of block | 0 | ||||||||||||
| 74 | EGLConfig config = q_configFromGLFormat(eglDisplay(), format()); | - | ||||||||||||
| 75 | return eglCreateWindowSurface(eglDisplay(), config, m_tempWindow, 0); never executed: return eglCreateWindowSurface(eglDisplay(), config, m_tempWindow, 0); | 0 | ||||||||||||
| 76 | } | - | ||||||||||||
| 77 | - | |||||||||||||
| 78 | void QEglFSContext::destroyTemporaryOffscreenSurface(EGLSurface surface) | - | ||||||||||||
| 79 | { | - | ||||||||||||
| 80 | if (qt_egl_device_integration()->supportsPBuffers()) {
| 0 | ||||||||||||
| 81 | QEGLPlatformContext::destroyTemporaryOffscreenSurface(surface); | - | ||||||||||||
| 82 | } else { never executed: end of block | 0 | ||||||||||||
| 83 | eglDestroySurface(eglDisplay(), surface); | - | ||||||||||||
| 84 | qt_egl_device_integration()->destroyNativeWindow(m_tempWindow); | - | ||||||||||||
| 85 | m_tempWindow = 0; | - | ||||||||||||
| 86 | } never executed: end of block | 0 | ||||||||||||
| 87 | } | - | ||||||||||||
| 88 | - | |||||||||||||
| 89 | void QEglFSContext::runGLChecks() | - | ||||||||||||
| 90 | { | - | ||||||||||||
| 91 | // Note that even though there is an EGL context current here, | - | ||||||||||||
| 92 | // QOpenGLContext and QOpenGLFunctions are not yet usable at this stage. | - | ||||||||||||
| 93 | const char *renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER)); | - | ||||||||||||
| 94 | // Be nice and warn about a common source of confusion. | - | ||||||||||||
| 95 | if (renderer && strstr(renderer, "llvmpipe"))
| 0 | ||||||||||||
| 96 | qWarning("Running on a software rasterizer (LLVMpipe), expect limited performance."); never executed: QMessageLogger(__FILE__, 96, __PRETTY_FUNCTION__).warning("Running on a software rasterizer (LLVMpipe), expect limited performance."); | 0 | ||||||||||||
| 97 | } never executed: end of block | 0 | ||||||||||||
| 98 | - | |||||||||||||
| 99 | void QEglFSContext::swapBuffers(QPlatformSurface *surface) | - | ||||||||||||
| 100 | { | - | ||||||||||||
| 101 | // draw the cursor | - | ||||||||||||
| 102 | if (surface->surface()->surfaceClass() == QSurface::Window) {
| 0 | ||||||||||||
| 103 | QPlatformWindow *window = static_cast<QPlatformWindow *>(surface); | - | ||||||||||||
| 104 | if (QEglFSCursor *cursor = qobject_cast<QEglFSCursor *>(window->screen()->cursor()))
| 0 | ||||||||||||
| 105 | cursor->paintOnScreen(); never executed: cursor->paintOnScreen(); | 0 | ||||||||||||
| 106 | } never executed: end of block | 0 | ||||||||||||
| 107 | - | |||||||||||||
| 108 | qt_egl_device_integration()->waitForVSync(surface); | - | ||||||||||||
| 109 | QEGLPlatformContext::swapBuffers(surface); | - | ||||||||||||
| 110 | qt_egl_device_integration()->presentBuffer(surface); | - | ||||||||||||
| 111 | } never executed: end of block | 0 | ||||||||||||
| 112 | - | |||||||||||||
| 113 | QT_END_NAMESPACE | - | ||||||||||||
| Source code | Switch to Preprocessed file |