OpenCoverage

qeglfscontext.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/eglfs/qeglfscontext.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the plugins of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
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 https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://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 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qeglfsglobal.h"-
41#include <QtGui/QSurface>-
42#include <QtPlatformSupport/private/qeglconvenience_p.h>-
43#include <QtPlatformSupport/private/qeglpbuffer_p.h>-
44-
45#include "qeglfscontext.h"-
46#include "qeglfswindow.h"-
47#include "qeglfshooks.h"-
48#include "qeglfscursor.h"-
49-
50QT_BEGIN_NAMESPACE-
51-
52QEglFSContext::QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,-
53 EGLConfig *config, const QVariant &nativeHandle)-
54 : QEGLPlatformContext(format, share, display, config, nativeHandle,-
55 qt_egl_device_integration()->supportsSurfacelessContexts() ? Flags(0) : QEGLPlatformContext::NoSurfaceless),-
56 m_tempWindow(0)-
57{-
58}
never executed: end of block
0
59-
60EGLSurface QEglFSContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface)-
61{-
62 if (surface->surface()->surfaceClass() == QSurface::Window)
surface->surfa...urface::WindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
63 return static_cast<QEglFSWindow *>(surface)->surface();
never executed: return static_cast<QEglFSWindow *>(surface)->surface();
0
64 else-
65 return static_cast<QEGLPbuffer *>(surface)->pbuffer();
never executed: return static_cast<QEGLPbuffer *>(surface)->pbuffer();
0
66}-
67-
68EGLSurface QEglFSContext::createTemporaryOffscreenSurface()-
69{-
70 if (qt_egl_device_integration()->supportsPBuffers())
qt_egl_device_...ortsPBuffers()Description
TRUEnever evaluated
FALSEnever evaluated
0
71 return QEGLPlatformContext::createTemporaryOffscreenSurface();
never executed: return QEGLPlatformContext::createTemporaryOffscreenSurface();
0
72-
73 if (!m_tempWindow) {
!m_tempWindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
74 m_tempWindow = qt_egl_device_integration()->createNativeOffscreenWindow(format());-
75 if (!m_tempWindow) {
!m_tempWindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
76 qWarning("QEglFSContext: Failed to create temporary native window");-
77 return EGL_NO_SURFACE;
never executed: return ((EGLSurface)0);
0
78 }-
79 }
never executed: end of block
0
80 EGLConfig config = q_configFromGLFormat(eglDisplay(), format());-
81 return eglCreateWindowSurface(eglDisplay(), config, m_tempWindow, 0);
never executed: return eglCreateWindowSurface(eglDisplay(), config, m_tempWindow, 0);
0
82}-
83-
84void QEglFSContext::destroyTemporaryOffscreenSurface(EGLSurface surface)-
85{-
86 if (qt_egl_device_integration()->supportsPBuffers()) {
qt_egl_device_...ortsPBuffers()Description
TRUEnever evaluated
FALSEnever evaluated
0
87 QEGLPlatformContext::destroyTemporaryOffscreenSurface(surface);-
88 } else {
never executed: end of block
0
89 eglDestroySurface(eglDisplay(), surface);-
90 qt_egl_device_integration()->destroyNativeWindow(m_tempWindow);-
91 m_tempWindow = 0;-
92 }
never executed: end of block
0
93}-
94-
95void QEglFSContext::runGLChecks()-
96{-
97 // Note that even though there is an EGL context current here,-
98 // QOpenGLContext and QOpenGLFunctions are not yet usable at this stage.-
99 const char *renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));-
100 // Be nice and warn about a common source of confusion.-
101 if (renderer && strstr(renderer, "llvmpipe"))
rendererDescription
TRUEnever evaluated
FALSEnever evaluated
strstr(renderer, "llvmpipe")Description
TRUEnever evaluated
FALSEnever evaluated
0
102 qWarning("Running on a software rasterizer (LLVMpipe), expect limited performance.");
never executed: QMessageLogger(__FILE__, 102, __PRETTY_FUNCTION__).warning("Running on a software rasterizer (LLVMpipe), expect limited performance.");
0
103}
never executed: end of block
0
104-
105void QEglFSContext::swapBuffers(QPlatformSurface *surface)-
106{-
107 // draw the cursor-
108 if (surface->surface()->surfaceClass() == QSurface::Window) {
surface->surfa...urface::WindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
109 QPlatformWindow *window = static_cast<QPlatformWindow *>(surface);-
110 if (QEglFSCursor *cursor = qobject_cast<QEglFSCursor *>(window->screen()->cursor()))
QEglFSCursor *...n()->cursor())Description
TRUEnever evaluated
FALSEnever evaluated
0
111 cursor->paintOnScreen();
never executed: cursor->paintOnScreen();
0
112 }
never executed: end of block
0
113-
114 qt_egl_device_integration()->waitForVSync(surface);-
115 QEGLPlatformContext::swapBuffers(surface);-
116 qt_egl_device_integration()->presentBuffer(surface);-
117}
never executed: end of block
0
118-
119QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9