7#include <QtGui/private/qeglconvenience_p.h>
9# include <QtGui/private/qeglplatformcontext_p.h>
14#include <KD/NV_initialize.h>
43 , m_format(
QImage::Format_Invalid)
47#ifdef QEGL_EXTRA_DEBUG
53 if (
Q_UNLIKELY(!eglBindAPI(EGL_OPENGL_ES_API))) {
54 qWarning(
"Could not bind GL_ES API\n");
60 qWarning(
"Could not open egl display\n");
63 qWarning(
"Opened display %p\n", m_dpy);
65 if (
Q_UNLIKELY(!eglInitialize(m_dpy, &major, &minor))) {
66 qWarning(
"Could not initialize egl display\n");
70 qWarning(
"Initialized display %d %d\n", major, minor);
76 eglDestroySurface(m_dpy, m_surface);
81void QMinimalEglScreen::createAndSetPlatformContext()
const {
85void QMinimalEglScreen::createAndSetPlatformContext()
90 if (depthString.
toInt() == 16) {
112 EGLNativeWindowType eglWindow = 0;
114 if (
Q_UNLIKELY(kdInitializeNV() == KD_ENOTINITIALIZED))
115 qFatal(
"Did not manage to initialize openkode");
119 kdRealizeWindow(
window,&eglWindow);
122#ifdef QEGL_EXTRA_DEBUG
126 m_surface = eglCreateWindowSurface(m_dpy,
config, eglWindow,
nullptr);
127 if (
Q_UNLIKELY(m_surface == EGL_NO_SURFACE)) {
128 qWarning(
"Could not create the egl surface: error = 0x%x\n", eglGetError());
139 eglQuerySurface(m_dpy, m_surface, EGL_WIDTH, &
w);
140 eglQuerySurface(m_dpy, m_surface, EGL_HEIGHT, &
h);
148 if (m_geometry.
isNull()) {
149 createAndSetPlatformContext();
162 createAndSetPlatformContext();
168 if (!m_platformContext) {
170 that->createAndSetPlatformContext();
172 return m_platformContext;
int toInt(bool *ok=nullptr, int base=10) const
Returns the byte array converted to an int using base base, which is ten by default.
An EGL context implementation.
Format
The following image formats are available in Qt.
EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override
QMinimalEglContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display)
QMinimalEglScreen(EGLNativeDisplayType display)
QImage::Format format() const override
Reimplement in subclass to return the image format which corresponds to the screen format.
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
QPlatformOpenGLContext * platformContext() const
int depth() const override
Reimplement in subclass to return current depth of the screen.
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
\inmodule QtCore\reentrant
constexpr bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
struct wl_display * display
Combined button and popup list for selecting options.
EGLConfig q_configFromGLFormat(EGLDisplay display, const QSurfaceFormat &format, bool highestPixelFormat, int surfaceType)
void q_printEglConfig(EGLDisplay display, EGLConfig config)
typedef EGLSurface(EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy
typedef EGLDisplay(EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat GLfloat GLfloat h
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) noexcept