Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qeglfscontext.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qeglfsglobal_p.h"
5#include <QtGui/QSurface>
6#include <QtGui/private/qeglconvenience_p.h>
7#include <QtGui/private/qeglpbuffer_p.h>
8
9#include "qeglfscontext_p.h"
10#include "qeglfswindow_p.h"
11#include "qeglfshooks_p.h"
12#include "qeglfscursor_p.h"
13
15
17 EGLConfig *config)
19 qt_egl_device_integration()->supportsSurfacelessContexts() ? Flags() : QEGLPlatformContext::NoSurfaceless)
20{
21}
22
24{
25 if (surface->surface()->surfaceClass() == QSurface::Window) {
26
27 QEglFSWindow *w = static_cast<QEglFSWindow *>(surface);
28 EGLSurface s = w->surface();
29 if (s == EGL_NO_SURFACE) {
30 w->resetSurface();
31 s = w->surface();
32 }
33 return s;
34
35 } else {
36 return static_cast<QEGLPbuffer *>(surface)->pbuffer();
37 }
38}
39
41{
42 if (qt_egl_device_integration()->supportsPBuffers())
44
45 if (!m_tempWindow) {
47 if (!m_tempWindow) {
48 qWarning("QEglFSContext: Failed to create temporary native window");
49 return EGL_NO_SURFACE;
50 }
51 }
53 return eglCreateWindowSurface(eglDisplay(), config, m_tempWindow, nullptr);
54}
55
57{
58 if (qt_egl_device_integration()->supportsPBuffers()) {
60 } else {
61 eglDestroySurface(eglDisplay(), surface);
63 m_tempWindow = 0;
64 }
65}
66
68{
69 // Note that even though there is an EGL context current here,
70 // QOpenGLContext and QOpenGLFunctions are not yet usable at this stage.
71 const char *renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
72 // Be nice and warn about a common source of confusion.
73 if (renderer && strstr(renderer, "llvmpipe"))
74 qWarning("Running on a software rasterizer (LLVMpipe), expect limited performance.");
75}
76
78{
79 // draw the cursor
80 if (surface->surface()->surfaceClass() == QSurface::Window) {
81 QPlatformWindow *window = static_cast<QPlatformWindow *>(surface);
82 if (QEglFSCursor *cursor = qobject_cast<QEglFSCursor *>(window->screen()->cursor()))
83 cursor->paintOnScreen();
84 }
85
89}
90
A pbuffer-based implementation of QPlatformOffscreenSurface for EGL.
An EGL context implementation.
virtual void destroyTemporaryOffscreenSurface(EGLSurface surface)
EGLDisplay eglDisplay() const
QSurfaceFormat format() const override
void swapBuffers(QPlatformSurface *surface) override
Reimplement in subclass to native swap buffers calls.
virtual EGLSurface createTemporaryOffscreenSurface()
QEglFSContext()=default
EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override
EGLSurface createTemporaryOffscreenSurface() override
void runGLChecks() override
void swapBuffers(QPlatformSurface *surface) override
Reimplement in subclass to native swap buffers calls.
void destroyTemporaryOffscreenSurface(EGLSurface surface) override
virtual void presentBuffer(QPlatformSurface *surface)
virtual void waitForVSync(QPlatformSurface *surface) const
virtual EGLNativeWindowType createNativeOffscreenWindow(const QSurfaceFormat &format)
virtual void destroyNativeWindow(EGLNativeWindowType window)
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
The QPlatformSurface class provides an abstraction for a surface.
QSurface * surface() const
The QPlatformWindow class provides an abstraction for top-level windows.
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
SurfaceClass surfaceClass() const
Returns the surface class of this surface.
Definition qsurface.cpp:121
QCursor cursor
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
EGLConfig q_configFromGLFormat(EGLDisplay display, const QSurfaceFormat &format, bool highestPixelFormat, int surfaceType)
QEglFSDeviceIntegration * qt_egl_device_integration()
EGLConfig config
typedef EGLSurface(EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy
typedef EGLDisplay(EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform
Flags
#define qWarning
Definition qlogging.h:166
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei GLenum format
GLdouble s
[6]
Definition qopenglext.h:235
aWidget window() -> setWindowTitle("New Window Title")
[2]
QSvgRenderer * renderer
[0]