diff --git a/config.tests/unix/openvg/openvg.cpp b/config.tests/unix/openvg/openvg.cpp new file mode 100644 index 0000000000..f9cf7786ab --- /dev/null +++ b/config.tests/unix/openvg/openvg.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + + +int main(int, char **) +{ + VGint i; + i = 2; + vgFlush(); + return 0; +} diff --git a/config.tests/unix/openvg/openvg.pro b/config.tests/unix/openvg/openvg.pro new file mode 100644 index 0000000000..1933e3789c --- /dev/null +++ b/config.tests/unix/openvg/openvg.pro @@ -0,0 +1,3 @@ +SOURCES += openvg.cpp + +CONFIG -= qt diff --git a/mkspecs/features/unix/openvg.prf b/mkspecs/features/unix/openvg.prf deleted file mode 100644 index 500dfc50c6..0000000000 --- a/mkspecs/features/unix/openvg.prf +++ /dev/null @@ -1,15 +0,0 @@ -!isEmpty(QMAKE_INCDIR_OPENVG): INCLUDEPATH += $$QMAKE_INCDIR_OPENVG -!isEmpty(QMAKE_LIBDIR_OPENVG): QMAKE_LIBDIR += -L$$QMAKE_LIBDIR_OPENVG -!isEmpty(QMAKE_LIBS_OPENVG): LIBS += $$QMAKE_LIBS_OPENVG - -qtConfig(egl) { - !isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL - !isEmpty(QMAKE_LIBDIR_EGL): LIBS += -L$$QMAKE_LIBDIR_EGL - !isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL -} - -qtConfig(openvg_on_opengl) { - !isEmpty(QMAKE_INCDIR_OPENGL): INCLUDEPATH += $$QMAKE_INCDIR_OPENGL - !isEmpty(QMAKE_LIBDIR_OPENGL): QMAKE_LIBDIR += -L$$QMAKE_LIBDIR_OPENGL - !isEmpty(QMAKE_LIBS_OPENGL): LIBS += $$QMAKE_LIBS_OPENGL -} diff --git a/mkspecs/features/win32/openvg.prf b/mkspecs/features/win32/openvg.prf deleted file mode 100644 index 9d9a49d856..0000000000 --- a/mkspecs/features/win32/openvg.prf +++ /dev/null @@ -1,7 +0,0 @@ -QMAKE_LIBS += $$QMAKE_LIBS_OPENVG -QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENVG - -qtConfig(openvg_on_opengl) { - QMAKE_LIBS += $$QMAKE_LIBS_OPENGL - QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL -} 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 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(static_cast(window->handle())->eglWindow()); break; + case EglSurface: + if (window && window->handle()) + result = reinterpret_cast(static_cast(window->handle())->surface()); + break; default: break; }