From 88c9a52646ef1c695ef0a7461ed1f6a7ce923375 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 26 Nov 2009 16:24:32 +1000 Subject: QT_VG_EGL_CONFIG env var to specify explicit EGL configs for OpenVG Reviewed-by: Sarah Smith --- src/openvg/qwindowsurface_vgegl.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) 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); -- cgit v0.12