From 0b5c0ad2ef49a262de5bdb18a3cdab30ae6772a2 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 24 Apr 2014 16:40:22 +0200 Subject: Support adopting an existing EGLContext in eglfs and xcb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add also a manual test application. For GLX there is an autotest since that is likely to be run on one of the CIs. For EGL and especially eglfs this is likely not the case so a manual test is better. Task-number: QTBUG-37552 Change-Id: Ib09db5d909befb68d16f69abd401a56abe55f28a Reviewed-by: Gunnar Sletta Reviewed-by: Jørgen Lind --- .../nativecontexts/nativecontexts.pri | 3 +- .../nativecontexts/qeglnativecontext.h | 73 ++++++++++++++++++++++ .../nativecontexts/qeglnativecontext.qdoc | 64 +++++++++++++++++++ 3 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 src/platformheaders/nativecontexts/qeglnativecontext.h create mode 100644 src/platformheaders/nativecontexts/qeglnativecontext.qdoc (limited to 'src/platformheaders') diff --git a/src/platformheaders/nativecontexts/nativecontexts.pri b/src/platformheaders/nativecontexts/nativecontexts.pri index dcbeae2b0f..3fe62ea6fe 100644 --- a/src/platformheaders/nativecontexts/nativecontexts.pri +++ b/src/platformheaders/nativecontexts/nativecontexts.pri @@ -1 +1,2 @@ -HEADERS += $$PWD/qglxnativecontext.h +HEADERS += $$PWD/qglxnativecontext.h \ + $$PWD/qeglnativecontext.h diff --git a/src/platformheaders/nativecontexts/qeglnativecontext.h b/src/platformheaders/nativecontexts/qeglnativecontext.h new file mode 100644 index 0000000000..7028d81347 --- /dev/null +++ b/src/platformheaders/nativecontexts/qeglnativecontext.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEGLNATIVECONTEXT_H +#define QEGLNATIVECONTEXT_H + +#include + +QT_BEGIN_NAMESPACE + +struct QEGLNativeContext +{ + QEGLNativeContext() + : m_context(0), + m_display(0) + { } + + QEGLNativeContext(EGLContext ctx, EGLDisplay dpy) + : m_context(ctx), + m_display(dpy) + { } + + EGLContext context() const { return m_context; } + EGLDisplay display() const { return m_display; } + +private: + EGLContext m_context; + EGLDisplay m_display; +}; + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QEGLNativeContext) + +#endif // QEGLNATIVECONTEXT_H diff --git a/src/platformheaders/nativecontexts/qeglnativecontext.qdoc b/src/platformheaders/nativecontexts/qeglnativecontext.qdoc new file mode 100644 index 0000000000..62b1a5482e --- /dev/null +++ b/src/platformheaders/nativecontexts/qeglnativecontext.qdoc @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \class QEGLNativeContext + \inmodule QtPlatformHeaders + \since 5.4 + + \brief A class encapsulating an EGL context and display handle + + \note As of Qt 5.4 there is no binary compatibility guarantee for this class, meaning + that an application using it is only guaranteed to work with the Qt version it was + developed against. + + \sa QOpenGLContext::setNativeHandle(), QOpenGLContext::nativeHandle() + */ + +/*! + \fn EGLContext QEGLNativeContext::context() const + + \return the EGL context. + */ + +/*! + \fn EGLDisplay QEGLNativeContext::display() const + + \return the EGL display. + */ + +/*! + \fn QEGLNativeContext::QEGLNativeContext() + + Construct a new instance with no handles. + */ + +/*! + \fn QEGLNativeContext::QEGLNativeContext(EGLContext ctx, EGLDisplay dpy) + + Constructs a new instance with the provided \a ctx and \a dpy handles. + */ -- cgit v1.2.3