summaryrefslogtreecommitdiffstats
path: root/src/openvg
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-11-26 06:24:32 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-11-26 06:24:32 (GMT)
commit88c9a52646ef1c695ef0a7461ed1f6a7ce923375 (patch)
treeaf1d082a1216e495ef48ac633c2adc5efb966253 /src/openvg
parenta0b17797b0d3ae5716d83eea36ea1adf51406730 (diff)
downloadQt-88c9a52646ef1c695ef0a7461ed1f6a7ce923375.zip
Qt-88c9a52646ef1c695ef0a7461ed1f6a7ce923375.tar.gz
Qt-88c9a52646ef1c695ef0a7461ed1f6a7ce923375.tar.bz2
QT_VG_EGL_CONFIG env var to specify explicit EGL configs for OpenVG
Reviewed-by: Sarah Smith
Diffstat (limited to 'src/openvg')
-rw-r--r--src/openvg/qwindowsurface_vgegl.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp
index e7d8113..62871cf 100644
--- a/src/openvg/qwindowsurface_vgegl.cpp
+++ b/src/openvg/qwindowsurface_vgegl.cpp
@@ -200,6 +200,42 @@ static QEglContext *createContext(QPaintDevice *device)
else
eglSwapInterval(context->display(), 1);
+#ifdef EGL_RENDERABLE_TYPE
+ // Has the user specified an explicit EGL configuration to use?
+ QByteArray configId = qgetenv("QT_VG_EGL_CONFIG");
+ if (!configId.isEmpty()) {
+ EGLint cfgId = configId.toInt();
+ EGLint properties[] = {
+ EGL_CONFIG_ID, cfgId,
+ EGL_NONE
+ };
+ EGLint matching = 0;
+ EGLConfig cfg;
+ if (eglChooseConfig
+ (context->display(), properties, &cfg, 1, &matching) &&
+ matching > 0) {
+ // Check that the selected configuration actually supports OpenVG
+ // and then create the context with it.
+ EGLint id = 0;
+ EGLint type = 0;
+ eglGetConfigAttrib
+ (context->display(), cfg, EGL_CONFIG_ID, &id);
+ eglGetConfigAttrib
+ (context->display(), cfg, EGL_RENDERABLE_TYPE, &type);
+ if (cfgId == id && (type & EGL_OPENVG_BIT) != 0) {
+ context->setConfig(cfg);
+ if (!context->createContext()) {
+ delete context;
+ return 0;
+ }
+ return context;
+ } else {
+ qWarning("QT_VG_EGL_CONFIG: %d is not a valid OpenVG configuration", int(cfgId));
+ }
+ }
+ }
+#endif
+
// Choose an appropriate configuration for rendering into the device.
QEglProperties configProps;
configProps.setPaintDeviceFormat(device);