summaryrefslogtreecommitdiffstats
path: root/src/gui/egl
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/egl')
-rw-r--r--src/gui/egl/qegl.cpp44
-rw-r--r--src/gui/egl/qegl_p.h1
-rw-r--r--src/gui/egl/qegl_stub.cpp17
-rw-r--r--src/gui/egl/qegl_x11.cpp5
-rw-r--r--src/gui/egl/qeglcontext_p.h1
5 files changed, 67 insertions, 1 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index e57cc3f..0419b62 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -515,6 +515,31 @@ bool QEglContext::swapBuffers(EGLSurface surface)
return ok;
}
+bool QEglContext::swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region) {
+ QVector<QRect> qrects = region->rects();
+ EGLint *gl_rects;
+ uint count;
+ uint i;
+
+ count = qrects.size();
+ QVarLengthArray <EGLint> arr(4 * count);
+ gl_rects = arr.data();
+ for (i = 0; i < count; i++) {
+ QRect qrect = qrects[i];
+
+ gl_rects[4 * i + 0] = qrect.x();
+ gl_rects[4 * i + 1] = qrect.y();
+ gl_rects[4 * i + 2] = qrect.width();
+ gl_rects[4 * i + 3] = qrect.height();
+ }
+
+ bool ok = QEgl::eglSwapBuffersRegion2NOK(QEgl::display(), surface, count, gl_rects);
+
+ if (!ok)
+ qWarning() << "QEglContext::swapBuffersRegion2NOK():" << QEgl::errorString();
+ return ok;
+}
+
int QEglContext::configAttrib(int name) const
{
EGLint value;
@@ -532,6 +557,9 @@ typedef EGLBoolean (EGLAPIENTRY *_eglDestroyImageKHR)(EGLDisplay, EGLImageKHR);
static _eglCreateImageKHR qt_eglCreateImageKHR = 0;
static _eglDestroyImageKHR qt_eglDestroyImageKHR = 0;
+typedef EGLBoolean (EGLAPIENTRY *_eglSwapBuffersRegion2NOK)(EGLDisplay, EGLSurface, EGLint, const EGLint*);
+
+static _eglSwapBuffersRegion2NOK qt_eglSwapBuffersRegion2NOK = 0;
EGLDisplay QEgl::display()
{
@@ -560,6 +588,10 @@ EGLDisplay QEgl::display()
qt_eglDestroyImageKHR = (_eglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR");
}
#endif
+
+ if (QEgl::hasExtension("EGL_NOK_swap_region2")) {
+ qt_eglSwapBuffersRegion2NOK = (_eglSwapBuffersRegion2NOK) eglGetProcAddress("eglSwapBuffersRegion2NOK");
+ }
}
return dpy;
@@ -591,6 +623,18 @@ EGLBoolean QEgl::eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
return 0;
}
+EGLBoolean QEgl::eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EGLint count, const EGLint *rects)
+{
+ if (qt_eglSwapBuffersRegion2NOK)
+ return qt_eglSwapBuffersRegion2NOK(dpy, surface, count, rects);
+
+ QEgl::display(); // Initialises function pointers
+ if (qt_eglSwapBuffersRegion2NOK)
+ return qt_eglSwapBuffersRegion2NOK(dpy, surface, count, rects);
+
+ qWarning("QEgl::eglSwapBuffersRegion2NOK() called but EGL_NOK_swap_region2 extension not present");
+ return 0;
+}
#ifndef Q_WS_X11
EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties)
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index 4fc1338..c214e88 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -224,6 +224,7 @@ namespace QEgl {
// Extension functions
Q_GUI_EXPORT EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
Q_GUI_EXPORT EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img);
+ Q_GUI_EXPORT EGLBoolean eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EGLint count, const EGLint *rects);
#ifdef Q_WS_X11
Q_GUI_EXPORT VisualID getCompatibleVisualId(EGLConfig config);
diff --git a/src/gui/egl/qegl_stub.cpp b/src/gui/egl/qegl_stub.cpp
index 86a7aab..1adb56c 100644
--- a/src/gui/egl/qegl_stub.cpp
+++ b/src/gui/egl/qegl_stub.cpp
@@ -176,6 +176,14 @@ bool QEglContext::swapBuffers(EGLSurface surface)
return false;
}
+bool QEglContext::swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region)
+{
+ Q_UNUSED(surface)
+ Q_UNUSED(region)
+ NOEGL
+ return false;
+}
+
int QEglContext::configAttrib(int name) const
{
Q_UNUSED(name)
@@ -208,6 +216,15 @@ EGLBoolean QEgl::eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
return 0;
}
+EGLBoolean QEgl::eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EGLint count, const EGLint *rects)
+{
+ Q_UNUSED(dpy);
+ Q_UNUSED(surface);
+ Q_UNUSED(count);
+ Q_UNUSED(rects);
+ NOEGL
+ return 0;
+}
#ifndef Q_WS_X11
EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties)
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index 969acc4..fea6e8d 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -415,7 +415,10 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg
// At this point, the widget's window should be created and have the correct visual. Now we
// just need to create the EGL surface for it:
- return eglCreateWindowSurface(QEgl::display(), config, (EGLNativeWindowType)widget->winId(), 0);
+ EGLSurface surf = eglCreateWindowSurface(QEgl::display(), config, (EGLNativeWindowType)widget->winId(), 0);
+ if (surf == EGL_NO_SURFACE)
+ qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError());
+ return surf;
}
if (x11PixmapData) {
diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h
index ccde00d..cae8164 100644
--- a/src/gui/egl/qeglcontext_p.h
+++ b/src/gui/egl/qeglcontext_p.h
@@ -84,6 +84,7 @@ public:
bool doneCurrent();
bool lazyDoneCurrent();
bool swapBuffers(EGLSurface surface);
+ bool swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region);
int configAttrib(int name) const;