summaryrefslogtreecommitdiffstats
path: root/src/gui/egl
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/egl')
-rw-r--r--src/gui/egl/qegl.cpp11
-rw-r--r--src/gui/egl/qegl_p.h3
-rw-r--r--src/gui/egl/qegl_x11.cpp23
-rw-r--r--src/gui/egl/qeglproperties.cpp25
-rw-r--r--src/gui/egl/qeglproperties_p.h1
5 files changed, 57 insertions, 6 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 89d9d1b..ebdac9a 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -400,4 +400,15 @@ void QEglContext::dumpAllConfigs()
delete [] configs;
}
+QString QEglContext::extensions()
+{
+ const char* exts = eglQueryString(dpy, EGL_EXTENSIONS);
+ return QString(QLatin1String(exts));
+}
+
+bool QEglContext::hasExtension(const char* extensionName)
+{
+ return extensions().contains(QLatin1String(extensionName));
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index ddf7d27..3ae1489 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -122,6 +122,9 @@ public:
void dumpAllConfigs();
+ QString extensions();
+ bool hasExtension(const char* extensionName);
+
private:
QEgl::API apiType;
EGLDisplay dpy;
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index be89efe..6772592 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -39,15 +39,18 @@
**
****************************************************************************/
+#include <QtCore/qdebug.h>
+
+#include <private/qt_x11_p.h>
+#include <QtGui/qx11info_x11.h>
+#include <private/qpixmapdata_p.h>
+#include <private/qpixmap_x11_p.h>
+
#include <QtGui/qpaintdevice.h>
#include <QtGui/qpixmap.h>
#include <QtGui/qwidget.h>
-#include <QtCore/qdebug.h>
#include "qegl_p.h"
-#include <QtGui/qx11info_x11.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
QT_BEGIN_NAMESPACE
@@ -125,7 +128,17 @@ void QEglProperties::setVisualFormat(const QX11Info *xinfo)
setValue(EGL_RED_SIZE, countBits(visual->red_mask));
setValue(EGL_GREEN_SIZE, countBits(visual->green_mask));
setValue(EGL_BLUE_SIZE, countBits(visual->blue_mask));
- setValue(EGL_ALPHA_SIZE, 0); // XXX
+
+ EGLint alphaBits = 0;
+#if !defined(QT_NO_XRENDER)
+ XRenderPictFormat *format;
+ format = XRenderFindVisualFormat(xinfo->display(), visual);
+ if (format && (format->type == PictTypeDirect) && format->direct.alphaMask) {
+ alphaBits = countBits(format->direct.alphaMask);
+ qDebug("QEglProperties::setVisualFormat() - visual's alphaMask is %d", alphaBits);
+ }
+#endif
+ setValue(EGL_ALPHA_SIZE, alphaBits);
}
extern const QX11Info *qt_x11Info(const QPaintDevice *pd);
diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp
index e0ae8a6..358ebcc 100644
--- a/src/gui/egl/qeglproperties.cpp
+++ b/src/gui/egl/qeglproperties.cpp
@@ -46,12 +46,26 @@ QT_BEGIN_NAMESPACE
#include <QtCore/qdebug.h>
#include <QtCore/qstringlist.h>
+#include "qegl_p.h"
+
+
// Initialize a property block.
QEglProperties::QEglProperties()
{
props.append(EGL_NONE);
}
+QEglProperties::QEglProperties(EGLConfig cfg)
+{
+ props.append(EGL_NONE);
+ for (int name = 0x3020; name <= 0x304F; ++name) {
+ EGLint value;
+ if (name != EGL_NONE && eglGetConfigAttrib(QEglContext::defaultDisplay(0), cfg, name, &value))
+ setValue(name, value);
+ }
+ eglGetError(); // Clear the error state.
+}
+
// Fetch the current value associated with a property.
int QEglProperties::value(int name) const
{
@@ -215,12 +229,21 @@ bool QEglProperties::reduceConfiguration()
removeValue(EGL_SAMPLES);
return true;
}
- if (removeValue(EGL_ALPHA_SIZE))
+ if (removeValue(EGL_ALPHA_SIZE)) {
+#if defined(EGL_BIND_TO_TEXTURE_RGBA) && defined(EGL_BIND_TO_TEXTURE_RGB)
+ if (removeValue(EGL_BIND_TO_TEXTURE_RGBA))
+ setValue(EGL_BIND_TO_TEXTURE_RGB, TRUE);
+#endif
return true;
+ }
if (removeValue(EGL_STENCIL_SIZE))
return true;
if (removeValue(EGL_DEPTH_SIZE))
return true;
+#if defined(EGL_BIND_TO_TEXTURE_RGB)
+ if (removeValue(EGL_BIND_TO_TEXTURE_RGB))
+ return true;
+#endif
return false;
}
diff --git a/src/gui/egl/qeglproperties_p.h b/src/gui/egl/qeglproperties_p.h
index 81af4cd..bcdc657 100644
--- a/src/gui/egl/qeglproperties_p.h
+++ b/src/gui/egl/qeglproperties_p.h
@@ -107,6 +107,7 @@ class Q_GUI_EXPORT QEglProperties
{
public:
QEglProperties();
+ QEglProperties(EGLConfig);
QEglProperties(const QEglProperties& other) : props(other.props) {}
~QEglProperties() {}