diff options
author | Andy Nichols <andy.nichols@qt.io> | 2016-09-16 11:26:15 +0200 |
---|---|---|
committer | Andy Nichols <andy.nichols@qt.io> | 2016-11-17 15:00:00 +0000 |
commit | dafd0955c601fc00f9164f9b955ec9f28b627565 (patch) | |
tree | 16c4c64e9e98d8999880c61728ac30d98ed5ced8 /src | |
parent | 1b905b3fa4955e26b39aaa51b0ca47e9c05e680b (diff) |
Enable support for OpenVG
This commit re-enables support for OpenVG in Qt, but not in the
same way as in Qt 4.8. The first part is about adding a test
and using the new configure system to enable OpenVG.
There is still support code in Qt for setting up EGL to provide a
surface and context for rendering with the OpenVG API, this commit
enables a path to do so.
Normally to get access to an EGLContext from a QWindow you do so via
QOpenGLContext, but in setups without OpenGL but with EGL and OpenVG
this doesn't make sense (there would be no QOpenGLContext). So the
intended way is to use a QWindow to get an EGLSurface, then create
an EGLContext directly (without going through QPA).
Change-Id: I0f75aadbaa3cd006deb7e6fd12cfbb574870fba4
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/configure.json | 19 | ||||
-rw-r--r-- | src/gui/kernel/qsurface.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qsurface.h | 3 | ||||
-rw-r--r-- | src/platformsupport/eglconvenience/qeglconvenience.cpp | 18 | ||||
-rw-r--r-- | src/platformsupport/eglconvenience/qeglplatformcontext.cpp | 7 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfsintegration.cpp | 10 |
6 files changed, 48 insertions, 11 deletions
diff --git a/src/gui/configure.json b/src/gui/configure.json index f4f099cc23..cc2f0f303b 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -32,6 +32,7 @@ "opengl": { "type": "optionalString", "values": [ "no", "yes", "desktop", "es2", "dynamic" ] }, "opengl-es-2": { "type": "void", "name": "opengl", "value": "es2" }, "opengles3": "boolean", + "openvg": "boolean", "qpa": { "type": "string", "name": "qpa_default_platform" }, "qpa-platform-guard": "boolean", "sm": { "type": "boolean", "name": "sessionmanager" }, @@ -193,6 +194,14 @@ { "type": "makeSpec", "spec": "OPENGL_ES2" } ] }, + "openvg": { + "label": "OpenVG", + "test": "unix/openvg", + "sources": [ + { "type": "pkgConfig", "args": "vg" }, + { "type": "makeSpec", "spec": "OPENVG" } + ] + }, "tslib": { "label": "tslib", "test": "unix/tslib", @@ -588,9 +597,14 @@ "condition": "features.opengl-desktop || features.opengl-dynamic || features.opengles2", "output": [ "publicFeature", "feature" ] }, + "openvg": { + "label": "OpenVG", + "condition": "libs.openvg", + "output": [ "publicFeature" ] + }, "egl": { "label": "EGL", - "condition": "features.opengl && (features.angle || libs.egl)", + "condition": "(features.opengl || features.openvg) && (features.angle || libs.egl)", "output": [ "privateFeature", "feature" ] }, "egl_x11": { @@ -1030,6 +1044,8 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla "gif", "ico", "jpeg", "system-jpeg", "png", "system-png" ] }, + "egl", + "openvg", { "section": "OpenGL", "entries": [ @@ -1038,7 +1054,6 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla "args": "angle", "condition": "config.win32" }, - "egl", "opengl-desktop", { "type": "feature", diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp index afe4cf93e1..3cdd11de8c 100644 --- a/src/gui/kernel/qsurface.cpp +++ b/src/gui/kernel/qsurface.cpp @@ -76,6 +76,8 @@ QT_BEGIN_NAMESPACE \value RasterGLSurface The surface can be rendered to using a software rasterizer, and also supports OpenGL. This surface type is intended for internal Qt use, and requires the use of private API. + \value OpenVGSurface The surface is an OpenVG compatible surface and can be used + in conjunction with OpenVG contexts. */ diff --git a/src/gui/kernel/qsurface.h b/src/gui/kernel/qsurface.h index d9ccdc096d..a96b7a6422 100644 --- a/src/gui/kernel/qsurface.h +++ b/src/gui/kernel/qsurface.h @@ -64,7 +64,8 @@ public: enum SurfaceType { RasterSurface, OpenGLSurface, - RasterGLSurface + RasterGLSurface, + OpenVGSurface, }; virtual ~QSurface(); diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp index da41cfeabf..020d035bf7 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp @@ -100,18 +100,24 @@ QVector<EGLint> q_createConfigAttributesFromFormat(const QSurfaceFormat &format) configAttributes.append(EGL_ALPHA_SIZE); configAttributes.append(alphaSize > 0 ? alphaSize : 0); - configAttributes.append(EGL_DEPTH_SIZE); - configAttributes.append(depthSize > 0 ? depthSize : 0); - - configAttributes.append(EGL_STENCIL_SIZE); - configAttributes.append(stencilSize > 0 ? stencilSize : 0); - configAttributes.append(EGL_SAMPLES); configAttributes.append(sampleCount > 0 ? sampleCount : 0); configAttributes.append(EGL_SAMPLE_BUFFERS); configAttributes.append(sampleCount > 0); + if (format.renderableType() != QSurfaceFormat::OpenVG) { + configAttributes.append(EGL_DEPTH_SIZE); + configAttributes.append(depthSize > 0 ? depthSize : 0); + + configAttributes.append(EGL_STENCIL_SIZE); + configAttributes.append(stencilSize > 0 ? stencilSize : 0); + } else { + // OpenVG needs alpha mask for clipping + configAttributes.append(EGL_ALPHA_MASK_SIZE); + configAttributes.append(8); + } + return configAttributes; } diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index 6a3bc25418..2d3d91b4fa 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -167,6 +167,13 @@ void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLCont : EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR); } } + + // Special Options for OpenVG surfaces + if (m_format.renderableType() == QSurfaceFormat::OpenVG) { + contextAttrs.append(EGL_ALPHA_MASK_SIZE); + contextAttrs.append(8); + } + contextAttrs.append(EGL_NONE); m_contextAttrs = contextAttrs; diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index 7f1da614eb..586c9b2855 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -279,7 +279,8 @@ enum ResourceType { EglConfig, NativeDisplay, XlibDisplay, - WaylandDisplay + WaylandDisplay, + EglSurface }; static int resourceType(const QByteArray &key) @@ -291,7 +292,8 @@ static int resourceType(const QByteArray &key) QByteArrayLiteral("eglconfig"), QByteArrayLiteral("nativedisplay"), QByteArrayLiteral("display"), - QByteArrayLiteral("server_wl_display") + QByteArrayLiteral("server_wl_display"), + QByteArrayLiteral("eglsurface") }; const QByteArray *end = names + sizeof(names) / sizeof(names[0]); const QByteArray *result = std::find(names, end, key); @@ -353,6 +355,10 @@ void *QEglFSIntegration::nativeResourceForWindow(const QByteArray &resource, QWi if (window && window->handle()) result = reinterpret_cast<void*>(static_cast<QEglFSWindow *>(window->handle())->eglWindow()); break; + case EglSurface: + if (window && window->handle()) + result = reinterpret_cast<void*>(static_cast<QEglFSWindow *>(window->handle())->surface()); + break; default: break; } |