diff options
Diffstat (limited to 'src/plugins/platforms/wayland/gl_integration')
51 files changed, 0 insertions, 4100 deletions
diff --git a/src/plugins/platforms/wayland/gl_integration/gl_integration.pri b/src/plugins/platforms/wayland/gl_integration/gl_integration.pri deleted file mode 100644 index 20c3aa0bd9..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/gl_integration.pri +++ /dev/null @@ -1,62 +0,0 @@ -contains(QT_CONFIG, opengl) { - DEFINES += QT_WAYLAND_GL_SUPPORT - QT += opengl - -HEADERS += \ - $$PWD/qwaylandglintegration.h - -SOURCES += \ - $$PWD/qwaylandglintegration.cpp - - QT_WAYLAND_GL_CONFIG = $$(QT_WAYLAND_GL_CONFIG) - contains(QT_CONFIG, opengles2) { - isEqual(QT_WAYLAND_GL_CONFIG, wayland_egl) { - QT_WAYLAND_GL_INTEGRATION = $$QT_WAYLAND_GL_CONFIG - CONFIG += wayland_egl - } else:isEqual(QT_WAYLAND_GL_CONFIG,readback) { - QT_WAYLAND_GL_INTEGRATION = readback_egl - CONFIG += readback_egl - } else { - QT_WAYLAND_GL_INTEGRATION = xcomposite_egl - CONFIG += xcomposite_egl - } - } else:mac { - QT_WAYLAND_GL_INTEGRATION = readback_cgl - CONFIG += readback_cgl - } else { - isEqual(QT_WAYLAND_GL_CONFIG, readback) { - QT_WAYLAND_GL_INTEGRATION = readback_glx - CONFIG += readback_glx - } else { - QT_WAYLAND_GL_INTEGRATION = xcomposite_glx - CONFIG += xcomposite_glx - } - } - - message("Wayland GL Integration: $$QT_WAYLAND_GL_INTEGRATION") -} - - -wayland_egl { - include ($$PWD/wayland_egl/wayland_egl.pri) -} - -readback_egl { - include ($$PWD/readback_egl/readback_egl.pri) -} - -readback_glx { - include ($$PWD/readback_glx/readback_glx.pri) -} - -readback_cgl { - include ($$PWD/readback_cgl/readback_cgl.pri) -} - -xcomposite_glx { - include ($$PWD/xcomposite_glx/xcomposite_glx.pri) -} - -xcomposite_egl { - include ($$PWD/xcomposite_egl/xcomposite_egl.pri) -} diff --git a/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.cpp b/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.cpp deleted file mode 100644 index dedd86bbb8..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandglintegration.h" - -QWaylandGLIntegration::QWaylandGLIntegration() -{ - -} - -QWaylandGLIntegration::~QWaylandGLIntegration() -{ - -} diff --git a/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h b/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h deleted file mode 100644 index 4f688e41d8..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDGLINTEGRATION_H -#define QWAYLANDGLINTEGRATION_H - -class QWaylandWindow; -class QWaylandDisplay; -class QWindow; - -class QPlatformOpenGLContext; -class QSurfaceFormat; - -class QWaylandGLIntegration -{ -public: - QWaylandGLIntegration(); - virtual ~QWaylandGLIntegration(); - - virtual void initialize() = 0; - - virtual QWaylandWindow *createEglWindow(QWindow *window) = 0; - virtual QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const = 0; - - static QWaylandGLIntegration *createGLIntegration(QWaylandDisplay *waylandDisplay); -}; - -#endif // QWAYLANDGLINTEGRATION_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.cpp deleted file mode 100644 index 5f7663ef55..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandreadbackcglcontext.h" - -#include "qwaylandshmbackingstore.h" -#include "qwaylandreadbackcglwindow.h" - -#include <QtGui/QOpenGLContext> -#include <QtCore/QDebug> - -#include <OpenGL/OpenGL.h> -#include <OpenGL/glext.h> -#include <OpenGL/glu.h> - -#include <QtPlatformSupport/private/cglconvenience_p.h> - -QWaylandReadbackCGLContext::QWaylandReadbackCGLContext(QPlatformOpenGLContext *share) - : QPlatformOpenGLContext() -{ - Q_UNUSED(share); - m_glContext = qcgl_createGlContext(); -} - -QSurfaceFormat QWaylandReadbackCGLContext::format() const -{ - return qcgl_surfaceFormat(); -} - -bool QWaylandReadbackCGLContext::makeCurrent(QPlatformSurface *surface) -{ - QWaylandReadbackCGLWindow *window = static_cast<QWaylandReadbackCGLWindow *>(surface); - CGLSetPBuffer(m_glContext, window->pixelBuffer(), 0, 0, 0); - CGLSetCurrentContext(m_glContext); - return true; -} - -void QWaylandReadbackCGLContext::doneCurrent() -{ - CGLSetCurrentContext(0); -} - -void QWaylandReadbackCGLContext::swapBuffers(QPlatformSurface *surface) -{ - Q_UNUSED(surface); - - if (QOpenGLContext::currentContext()->handle() != this) { - makeCurrent(surface); - } - CGLFlushDrawable(m_glContext); - - QWaylandReadbackCGLWindow *window = static_cast<QWaylandReadbackCGLWindow *>(surface); - QSize size = window->geometry().size(); - - uchar *dstBits = const_cast<uchar *>(window->buffer()); - glReadPixels(0,0, size.width(), size.height(), GL_BGRA,GL_UNSIGNED_BYTE, dstBits); - - window->damage(QRect(QPoint(0,0),size)); - - // ### Should sync here but this call deadlocks with the server. - //window->waitForFrameSync(); -} - -void (*QWaylandReadbackCGLContext::getProcAddress(const QByteArray &procName)) () -{ - return qcgl_getProcAddress(procName); -} - diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.h b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.h deleted file mode 100644 index eb065c3f69..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDREADBACKCGLCONTEXT_H -#define QWAYLANDREADBACKCGLCONTEXT_H - -#include <QPlatformOpenGLContext> - -#include "qwaylandreadbackcglintegration.h" - -#include <OpenGL/OpenGL.h> - -class QWaylandReadbackCGLWindow; -class QWaylandShmBuffer; - -class QWaylandReadbackCGLContext : public QPlatformOpenGLContext -{ -public: - QWaylandReadbackCGLContext(QPlatformOpenGLContext *share); - - QSurfaceFormat format() const; - - bool makeCurrent(QPlatformSurface *surface); - void doneCurrent(); - void swapBuffers(QPlatformSurface *surface); - void (*getProcAddress(const QByteArray &procName)) (); - - void geometryChanged(); - -private: - CGLContextObj m_glContext; -}; - -#endif // QWAYLANDREADBACKCGLCONTEXT_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.cpp b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.cpp deleted file mode 100644 index 2878f9e292..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandreadbackcglintegration.h" -#include "qwaylandreadbackcglcontext.h" -#include "qwaylandreadbackcglwindow.h" - -#include <QtCore/QDebug> - -QWaylandGLIntegration * QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay) -{ - return new QWaylandReadbackCGLIntegration(waylandDisplay); -} - -QWaylandReadbackCGLIntegration::QWaylandReadbackCGLIntegration(QWaylandDisplay * waylandDispaly) - : QWaylandGLIntegration() - , mWaylandDisplay(waylandDispaly) -{ - qDebug() << "Using Readback-CGL"; -} - -QWaylandReadbackCGLIntegration::~QWaylandReadbackCGLIntegration() -{ - -} - -void QWaylandReadbackCGLIntegration::initialize() -{ -} - -QWaylandWindow * QWaylandReadbackCGLIntegration::createEglWindow(QWindow *window) -{ - return new QWaylandReadbackCGLWindow(window,this); -} - -QPlatformOpenGLContext *QWaylandReadbackCGLIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const -{ - return new QWaylandReadbackCGLContext(share); -} - -QWaylandDisplay * QWaylandReadbackCGLIntegration::waylandDisplay() const -{ - return mWaylandDisplay; -} diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.h b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.h deleted file mode 100644 index 34c8d00a7c..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDREADBACKGLXINTEGRATION_H -#define QWAYLANDREADBACKGLXINTEGRATION_H - -#include "gl_integration/qwaylandglintegration.h" - -#include <QtCore/QTextStream> -#include <QtCore/QDataStream> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> -#include <QtGui/QWindow> - -#include <X11/Xlib.h> - -class QWaylandReadbackCGLIntegration : public QWaylandGLIntegration -{ -public: - QWaylandReadbackCGLIntegration(QWaylandDisplay * waylandDispaly); - ~QWaylandReadbackCGLIntegration(); - - void initialize(); - - QWaylandWindow *createEglWindow(QWindow *window); - QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; - QWaylandDisplay *waylandDisplay() const; - -private: - QWaylandDisplay *mWaylandDisplay; -}; - -#endif // QWAYLANDREADBACKGLXINTEGRATION_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.cpp b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.cpp deleted file mode 100644 index 9e7f8520c9..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandreadbackcglwindow.h" -#include "qwaylandshmbackingstore.h" - -#include <OpenGL/OpenGL.h> -#include <OpenGL/glext.h> - -QWaylandReadbackCGLWindow::QWaylandReadbackCGLWindow(QWindow *window, QWaylandReadbackCGLIntegration *cglIntegration) - : QWaylandShmWindow(window) - , m_CglIntegration(cglIntegration) - , mContext(0) - , m_buffer(0) - , m_pixelBuffer(0) -{ -} - -QWaylandWindow::WindowType QWaylandReadbackCGLWindow::windowType() const -{ - //yeah. this type needs a new name - return QWaylandWindow::Egl; -} - - -void QWaylandReadbackCGLWindow::setGeometry(const QRect &rect) -{ - QWaylandShmWindow::setGeometry(rect); - - if (m_buffer) { - delete m_buffer; - m_buffer = 0; - - CGLDestroyPBuffer(m_pixelBuffer); - m_pixelBuffer = 0; - } -} - -CGLPBufferObj QWaylandReadbackCGLWindow::pixelBuffer() -{ - if (!m_pixelBuffer) - createSurface(); - - return m_pixelBuffer; -} - -uchar *QWaylandReadbackCGLWindow::buffer() -{ - return m_buffer->image()->bits(); -} - -void QWaylandReadbackCGLWindow::createSurface() -{ - QSize size(geometry().size()); - if (size.isEmpty()) { - //QGLWidget wants a context for a window without geometry - size = QSize(1,1); - } - - waitForFrameSync(); - - CGLCreatePBuffer(size.width(), size.height(), GL_TEXTURE_RECTANGLE_ARB, GL_BGRA, 0, &m_pixelBuffer); - - delete m_buffer; - m_buffer = new QWaylandShmBuffer(m_CglIntegration->waylandDisplay(),size,QImage::Format_ARGB32); - attach(m_buffer); -} - diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.h b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.h deleted file mode 100644 index 0598cf9037..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDREADBACKGLXWINDOW_H -#define QWAYLANDREADBACKGLXWINDOW_H - -#include "qwaylandshmwindow.h" -#include "qwaylandreadbackcglintegration.h" -#include "qwaylandreadbackcglcontext.h" - -#include <OpenGL/OpenGL.h> - -class QWaylandReadbackCGLWindow : public QWaylandShmWindow -{ -public: - QWaylandReadbackCGLWindow(QWindow *window, QWaylandReadbackCGLIntegration *cglIntegration); - WindowType windowType() const; - - void setGeometry(const QRect &rect); - CGLPBufferObj pixelBuffer(); - uchar *buffer(); -private: - void createSurface(); - - QWaylandReadbackCGLIntegration *m_CglIntegration; - QWaylandReadbackCGLContext *mContext; - - QWaylandShmBuffer *m_buffer; - CGLPBufferObj m_pixelBuffer; -}; - -#endif // QWAYLANDREADBACKGLXWINDOW_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/readback_cgl.pri b/src/plugins/platforms/wayland/gl_integration/readback_cgl/readback_cgl.pri deleted file mode 100644 index 91cb90a30c..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/readback_cgl.pri +++ /dev/null @@ -1,10 +0,0 @@ -HEADERS += \ - $$PWD/qwaylandreadbackcglintegration.h \ - $$PWD/qwaylandreadbackcglwindow.h \ - $$PWD/qwaylandreadbackcglcontext.h - -SOURCES += \ - $$PWD/qwaylandreadbackcglintegration.cpp \ - $$PWD/qwaylandreadbackcglwindow.cpp \ - $$PWD/qwaylandreadbackcglcontext.cpp - diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.cpp deleted file mode 100644 index c03e8a9444..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandreadbackeglcontext.h" - -#include <QPlatformSupport/eglconvenience/qeglconvenience_p.h> - -#include <QtCore/QDebug> -#include <QtGui/QWindowContext> - -#include <QtOpenGL/QGLContext> -#include <QtOpenGL/private/qglextensions_p.h> - -#include "qwaylandshmsurface.h" - - -static inline void qgl_byteSwapImage(QImage &img, GLenum pixel_type) -{ - const int width = img.width(); - const int height = img.height(); - - if (pixel_type == GL_UNSIGNED_INT_8_8_8_8_REV - || (pixel_type == GL_UNSIGNED_BYTE && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) - { - for (int i = 0; i < height; ++i) { - uint *p = (uint *) img.scanLine(i); - for (int x = 0; x < width; ++x) - p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00); - } - } else { - for (int i = 0; i < height; ++i) { - uint *p = (uint *) img.scanLine(i); - for (int x = 0; x < width; ++x) - p[x] = (p[x] << 8) | ((p[x] >> 24) & 0xff); - } - } -} - -QWaylandReadbackEglContext::QWaylandReadbackEglContext(QWaylandReadbackEglIntegration *eglIntegration, QWaylandReadbackEglWindow *window) - : mEglIntegration(eglIntegration) - , mWindow(window) - , mBuffer(0) - , mPixmap(0) - , mConfig(q_configFromQWindowFormat(eglIntegration->eglDisplay(),window->window()->requestedWindowFormat(),true,EGL_PIXMAP_BIT)) - , mPixmapSurface(EGL_NO_SURFACE) -{ - QVector<EGLint> eglContextAttrs; - eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); - eglContextAttrs.append(2); - eglContextAttrs.append(EGL_NONE); - - mContext = eglCreateContext(eglIntegration->eglDisplay(),mConfig,0,eglContextAttrs.constData()); - - geometryChanged(); -} - -QWaylandReadbackEglContext::~QWaylandReadbackEglContext() -{ - eglDestroyContext(mEglIntegration->eglDisplay(),mContext); -} - -void QWaylandReadbackEglContext::makeCurrent() -{ - mWindow->waitForFrameSync(); - - eglMakeCurrent(mEglIntegration->eglDisplay(),mPixmapSurface,mPixmapSurface,mContext); -} - -void QWaylandReadbackEglContext::doneCurrent() -{ - QPlatformOpenGLContext::doneCurrent(); - eglMakeCurrent(mEglIntegration->eglDisplay(),EGL_NO_SURFACE,EGL_NO_SURFACE,EGL_NO_CONTEXT); -} - -void QWaylandReadbackEglContext::swapBuffers() -{ - eglSwapBuffers(mEglIntegration->eglDisplay(),mPixmapSurface); - - if (QWindowContext::currentContext()->handle() != this) { - makeCurrent(); - } - - QSize size = mWindow->geometry().size(); - - QImage img(size,QImage::Format_ARGB32); - const uchar *constBits = img.bits(); - void *pixels = const_cast<uchar *>(constBits); - - glReadPixels(0,0, size.width(), size.height(), GL_RGBA,GL_UNSIGNED_BYTE, pixels); - - img = img.mirrored(); - qgl_byteSwapImage(img,GL_UNSIGNED_INT_8_8_8_8_REV); - constBits = img.bits(); - - const uchar *constDstBits = mBuffer->image()->bits(); - uchar *dstBits = const_cast<uchar *>(constDstBits); - memcpy(dstBits,constBits,(img.width()*4) * img.height()); - - - mWindow->damage(QRegion(QRect(QPoint(0,0),size))); -} - -void * QWaylandReadbackEglContext::getProcAddress(const QString &procName) -{ - return (void *) eglGetProcAddress(procName.toLatin1().data()); -} - -QWindowFormat QWaylandReadbackEglContext::windowFormat() const -{ - return q_windowFormatFromConfig(mEglIntegration->eglDisplay(),mConfig); -} - -void QWaylandReadbackEglContext::geometryChanged() -{ - QSize size(mWindow->geometry().size()); - if (size.isEmpty()) { - //QGLWidget wants a context for a window without geometry - size = QSize(1,1); - } - - mWindow->waitForFrameSync(); - - delete mBuffer; - if (mPixmap) - XFreePixmap(mEglIntegration->xDisplay(),mPixmap); - - mBuffer = new QWaylandShmBuffer(mEglIntegration->waylandDisplay(),size,QImage::Format_ARGB32); - mWindow->attach(mBuffer); - mPixmap = XCreatePixmap(mEglIntegration->xDisplay(),mEglIntegration->rootWindow(),size.width(),size.height(),mEglIntegration->depth()); - XSync(mEglIntegration->xDisplay(),False); - - mPixmapSurface = eglCreatePixmapSurface(mEglIntegration->eglDisplay(),mConfig,mPixmap,0); - if (mPixmapSurface == EGL_NO_SURFACE) { - qDebug() << "Could not make egl surface out of pixmap :("; - } -} diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.h b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.h deleted file mode 100644 index 75755fbd1a..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDREADBACKEGLGLCONTEXT_H -#define QWAYLANDREADBACKEGLGLCONTEXT_H - -#include <QPlatformOpenGLContext> - -#include "qwaylandreadbackeglintegration.h" -#include "qwaylandreadbackeglwindow.h" - -class QWaylandShmBuffer; - -class QWaylandReadbackEglContext : public QPlatformOpenGLContext -{ -public: - QWaylandReadbackEglContext(QWaylandReadbackEglIntegration *eglIntegration, QWaylandReadbackEglWindow *window); - ~QWaylandReadbackEglContext(); - - void makeCurrent(); - void doneCurrent(); - void swapBuffers(); - void* getProcAddress(const QString& procName); - - virtual QWindowFormat windowFormat() const; - - void geometryChanged(); - -private: - QWaylandReadbackEglIntegration *mEglIntegration; - QWaylandReadbackEglWindow *mWindow; - QWaylandShmBuffer *mBuffer; - - Pixmap mPixmap; - - EGLConfig mConfig; - EGLContext mContext; - EGLSurface mPixmapSurface; -}; - -#endif // QWAYLANDREADBACKEGLGLCONTEXT_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp deleted file mode 100644 index 39fa3d589c..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandreadbackeglintegration.h" - -#include <QDebug> - -#include "qwaylandreadbackeglwindow.h" - -QWaylandReadbackEglIntegration::QWaylandReadbackEglIntegration(QWaylandDisplay *display) - : QWaylandGLIntegration() - , mWaylandDisplay(display) -{ - qDebug() << "Using Readback-EGL"; - char *display_name = getenv("DISPLAY"); - mDisplay = XOpenDisplay(display_name); - mScreen = XDefaultScreen(mDisplay); - mRootWindow = XDefaultRootWindow(mDisplay); - XSync(mDisplay, False); -} - -QWaylandReadbackEglIntegration::~QWaylandReadbackEglIntegration() -{ - XCloseDisplay(mDisplay); -} - - -QWaylandGLIntegration *QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay) -{ - return new QWaylandReadbackEglIntegration(waylandDisplay); -} - -void QWaylandReadbackEglIntegration::initialize() -{ - eglBindAPI(EGL_OPENGL_ES_API); - mEglDisplay = eglGetDisplay(mDisplay); - EGLint major, minor; - EGLBoolean initialized = eglInitialize(mEglDisplay,&major,&minor); - if (initialized) { - qDebug() << "EGL initialized successfully" << major << "," << minor; - } else { - qDebug() << "EGL could not initialized. All EGL and GL operations will fail"; - } -} - -QWaylandWindow * QWaylandReadbackEglIntegration::createEglWindow(QWindow *window) -{ - return new QWaylandReadbackEglWindow(window, this); -} - -QPlatformOpenGLContext *QWaylandReadbackEglWindow::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const -{ - return new QWaylandReadbackEglContext(glFormat, share, this); -} - -EGLDisplay QWaylandReadbackEglIntegration::eglDisplay() -{ - return mEglDisplay; -} - -Window QWaylandReadbackEglIntegration::rootWindow() const -{ - return mRootWindow; -} - -int QWaylandReadbackEglIntegration::depth() const -{ - return XDefaultDepth(mDisplay,mScreen); -} - -Display * QWaylandReadbackEglIntegration::xDisplay() const -{ - return mDisplay; -} - -QWaylandDisplay * QWaylandReadbackEglIntegration::waylandDisplay() const -{ - return mWaylandDisplay; -} diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h deleted file mode 100644 index 0d6aa55e4e..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDREADBACKEGLINTEGRATION_H -#define QWAYLANDREADBACKEGLINTEGRATION_H - -#include "gl_integration/qwaylandglintegration.h" - -#include <QtCore/QTextStream> -#include <QtCore/QDataStream> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> -#include <QtCore/QEvent> -#include <QtGui/QCursor> - -#include <X11/Xlib.h> - -#include <EGL/egl.h> - -class QWaylandReadbackEglIntegration : public QWaylandGLIntegration -{ -public: - QWaylandReadbackEglIntegration(QWaylandDisplay *display); - ~QWaylandReadbackEglIntegration(); - - void initialize(); - QWaylandWindow *createEglWindow(QWindow *window); - QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; - - QWaylandDisplay *waylandDisplay() const; - Display *xDisplay() const; - Window rootWindow() const; - int depth() const; - - EGLDisplay eglDisplay(); - -private: - QWaylandDisplay *mWaylandDisplay; - Display *mDisplay; - int mScreen; - Window mRootWindow; - EGLDisplay mEglDisplay; - -}; - -#endif // QWAYLANDREADBACKEGLINTEGRATION_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.cpp b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.cpp deleted file mode 100644 index f4bc6379d6..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandreadbackeglwindow.h" - -#include "qwaylandreadbackeglcontext.h" - -QWaylandReadbackEglWindow::QWaylandReadbackEglWindow(QWindow *window, QWaylandReadbackEglIntegration *eglIntegration) - : QWaylandShmWindow(window) - , mEglIntegration(eglIntegration) - , mContext(0) -{ -} - -QWaylandWindow::WindowType QWaylandReadbackEglWindow::windowType() const -{ - //We'r lying, maybe we should add a type, but for now it will do - //since this is primarly used by the windowsurface. - return QWaylandWindow::Egl; -} - -QPlatformOpenGLContext *QWaylandReadbackEglWindow::glContext() const -{ - if (!mContext) { - QWaylandReadbackEglWindow *that = const_cast<QWaylandReadbackEglWindow *>(this); - that->mContext = new QWaylandReadbackEglContext(mEglIntegration,that); - } - return mContext; -} - -void QWaylandReadbackEglWindow::setGeometry(const QRect &rect) -{ - QPlatformWindow::setGeometry(rect); - - if (mContext) - mContext->geometryChanged(); -} - diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.h b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.h deleted file mode 100644 index 0852a8ee66..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDREADBACKEGLWINDOW_H -#define QWAYLANDREADBACKEGLWINDOW_H - -#include "qwaylandshmwindow.h" -#include "qwaylandreadbackeglintegration.h" - -class QWaylandReadbackEglContext; - -class QWaylandReadbackEglWindow : public QWaylandShmWindow -{ -public: - QWaylandReadbackEglWindow(QWindow *window, QWaylandReadbackEglIntegration *eglIntegration); - - WindowType windowType() const; - - QPlatformOpenGLContext *glContext() const; - - void setGeometry(const QRect &rect); - -private: - QWaylandReadbackEglIntegration *mEglIntegration; - QWaylandReadbackEglContext *mContext; -}; - -#endif // QWAYLANDREADBACKEGLWINDOW_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/readback_egl.pri b/src/plugins/platforms/wayland/gl_integration/readback_egl/readback_egl.pri deleted file mode 100644 index 3325fe8ec9..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/readback_egl.pri +++ /dev/null @@ -1,12 +0,0 @@ -LIBS += -lX11 -lXext -lEGL - -load(qpa/egl/convenience) -HEADERS += \ - $$PWD/qwaylandreadbackeglintegration.h \ - $$PWD/qwaylandreadbackeglcontext.h \ - $$PWD/qwaylandreadbackeglwindow.h \ - -SOURCES += \ - $$PWD/qwaylandreadbackeglintegration.cpp \ - $$PWD/qwaylandreadbackeglwindow.cpp \ - $$PWD/qwaylandreadbackeglcontext.cpp \ diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp deleted file mode 100644 index 850e7bb0ac..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandreadbackglxcontext.h" - -#include "qwaylandshmbackingstore.h" -#include "qwaylandreadbackglxwindow.h" - -#include <QtGui/QOpenGLContext> -#include <QtCore/QDebug> - -static inline void qgl_byteSwapImage(QImage &img, GLenum pixel_type) -{ - const int width = img.width(); - const int height = img.height(); - - if (pixel_type == GL_UNSIGNED_INT_8_8_8_8_REV - || (pixel_type == GL_UNSIGNED_BYTE && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) - { - for (int i = 0; i < height; ++i) { - uint *p = (uint *) img.scanLine(i); - for (int x = 0; x < width; ++x) - p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00); - } - } else { - for (int i = 0; i < height; ++i) { - uint *p = (uint *) img.scanLine(i); - for (int x = 0; x < width; ++x) - p[x] = (p[x] << 8) | ((p[x] >> 24) & 0xff); - } - } -} - -QWaylandReadbackGlxContext::QWaylandReadbackGlxContext(const QSurfaceFormat &format, - QPlatformOpenGLContext *share, Display *display, int screen) - : m_display(display) -{ - GLXFBConfig config = qglx_findConfig(display, screen, format, GLX_PIXMAP_BIT); - - GLXContext shareContext = share ? static_cast<QWaylandReadbackGlxContext *>(share)->m_context : 0; - - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(display, config); - m_context = glXCreateContext(display, visualInfo, shareContext, TRUE); - m_format = qglx_surfaceFormatFromGLXFBConfig(display, config, m_context); -} - -QSurfaceFormat QWaylandReadbackGlxContext::format() const -{ - return m_format; -} - -bool QWaylandReadbackGlxContext::makeCurrent(QPlatformSurface *surface) -{ - GLXPixmap glxPixmap = static_cast<QWaylandReadbackGlxWindow *>(surface)->glxPixmap(); - - return glXMakeCurrent(m_display, glxPixmap, m_context); -} - -void QWaylandReadbackGlxContext::doneCurrent() -{ - glXMakeCurrent(m_display, 0, 0); -} - -void QWaylandReadbackGlxContext::swapBuffers(QPlatformSurface *surface) -{ - // #### makeCurrent() directly on the platform context doesn't update QOpenGLContext::currentContext() - if (QOpenGLContext::currentContext()->handle() != this) - makeCurrent(surface); - - QWaylandReadbackGlxWindow *w = static_cast<QWaylandReadbackGlxWindow *>(surface); - - QSize size = w->geometry().size(); - - QImage img(size, QImage::Format_ARGB32); - const uchar *constBits = img.bits(); - void *pixels = const_cast<uchar *>(constBits); - - glReadPixels(0, 0, size.width(), size.height(), GL_RGBA,GL_UNSIGNED_BYTE, pixels); - - img = img.mirrored(); - qgl_byteSwapImage(img, GL_UNSIGNED_INT_8_8_8_8_REV); - constBits = img.bits(); - - const uchar *constDstBits = w->buffer(); - uchar *dstBits = const_cast<uchar *>(constDstBits); - memcpy(dstBits, constBits, (img.width() * 4) * img.height()); - - w->damage(QRect(QPoint(), size)); - - w->waitForFrameSync(); -} - -void (*QWaylandReadbackGlxContext::getProcAddress(const QByteArray &procName)) () -{ - return glXGetProcAddress(reinterpret_cast<const GLubyte *>(procName.constData())); -} diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.h b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.h deleted file mode 100644 index 7b5eeece93..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDREADBACKGLXCONTEXT_H -#define QWAYLANDREADBACKGLXCONTEXT_H - -#include <QPlatformOpenGLContext> -#include <QSurfaceFormat> - -#include "qwaylandreadbackglxintegration.h" - -#include <QtPlatformSupport/private/qglxconvenience_p.h> - -class QWaylandReadbackGlxWindow; -class QWaylandShmBuffer; - -class QWaylandReadbackGlxContext : public QPlatformOpenGLContext -{ -public: - QWaylandReadbackGlxContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, Display *display, int screen); - - QSurfaceFormat format() const; - - void swapBuffers(QPlatformSurface *surface); - - bool makeCurrent(QPlatformSurface *surface); - void doneCurrent(); - - void (*getProcAddress(const QByteArray &procName)) (); - -private: - GLXContext m_context; - - Display *m_display; - QSurfaceFormat m_format; -}; - -#endif // QWAYLANDREADBACKGLXCONTEXT_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp deleted file mode 100644 index 752bb06a43..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandreadbackglxintegration.h" - -#include "qwaylandreadbackglxwindow.h" - -#include <QtCore/QDebug> - -QWaylandReadbackGlxIntegration::QWaylandReadbackGlxIntegration(QWaylandDisplay * waylandDispaly) - : QWaylandGLIntegration() - , mWaylandDisplay(waylandDispaly) -{ - qDebug() << "Using Readback-GLX"; - char *display_name = getenv("DISPLAY"); - mDisplay = XOpenDisplay(display_name); - mScreen = XDefaultScreen(mDisplay); - mRootWindow = XDefaultRootWindow(mDisplay); - XSync(mDisplay, False); -} - -QWaylandReadbackGlxIntegration::~QWaylandReadbackGlxIntegration() -{ - XCloseDisplay(mDisplay); -} - -void QWaylandReadbackGlxIntegration::initialize() -{ -} - -QWaylandWindow * QWaylandReadbackGlxIntegration::createEglWindow(QWindow *window) -{ - return new QWaylandReadbackGlxWindow(window,this); -} - -QPlatformOpenGLContext *QWaylandReadbackGlxIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const -{ - return new QWaylandReadbackGlxContext(glFormat, share, mDisplay, mScreen); -} - -QWaylandGLIntegration * QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay) -{ - return new QWaylandReadbackGlxIntegration(waylandDisplay); -} - -Display * QWaylandReadbackGlxIntegration::xDisplay() const -{ - return mDisplay; -} - -int QWaylandReadbackGlxIntegration::screen() const -{ - return mScreen; -} - -Window QWaylandReadbackGlxIntegration::rootWindow() const -{ - return mRootWindow; -} - -QWaylandDisplay * QWaylandReadbackGlxIntegration::waylandDisplay() const -{ - return mWaylandDisplay; -} diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h deleted file mode 100644 index ee50d74ebd..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDREADBACKGLXINTEGRATION_H -#define QWAYLANDREADBACKGLXINTEGRATION_H - -#include "gl_integration/qwaylandglintegration.h" - -#include <QtCore/QTextStream> -#include <QtCore/QDataStream> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> -#include <QtGui/QWindow> - -#include <X11/Xlib.h> - -class QWaylandReadbackGlxIntegration : public QWaylandGLIntegration -{ -public: - QWaylandReadbackGlxIntegration(QWaylandDisplay * waylandDispaly); - ~QWaylandReadbackGlxIntegration(); - - void initialize(); - - QWaylandWindow *createEglWindow(QWindow *window); - QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; - - QWaylandDisplay *waylandDisplay() const; - - Display *xDisplay() const; - int screen() const; - Window rootWindow() const; - -private: - QWaylandDisplay *mWaylandDisplay; - - Display *mDisplay; - int mScreen; - Window mRootWindow; - -}; - -#endif // QWAYLANDREADBACKGLXINTEGRATION_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp deleted file mode 100644 index 35c3ca3154..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtDebug> - -#include "qwaylandreadbackglxwindow.h" -#include "qwaylandshmbackingstore.h" - -QWaylandReadbackGlxWindow::QWaylandReadbackGlxWindow(QWindow *window, QWaylandReadbackGlxIntegration *glxIntegration) - : QWaylandShmWindow(window) - , m_glxIntegration(glxIntegration) - , m_buffer(0) - , m_pixmap(0) - , m_config(0) - , m_glxPixmap(0) - , m_window(window) -{ -} - -QWaylandWindow::WindowType QWaylandReadbackGlxWindow::windowType() const -{ - //yeah. this type needs a new name - return QWaylandWindow::Egl; -} - -void QWaylandReadbackGlxWindow::setGeometry(const QRect &rect) -{ - QWaylandShmWindow::setGeometry(rect); - - if (m_pixmap) { - delete mBuffer; - //XFreePixmap deletes the glxPixmap as well - XFreePixmap(m_glxIntegration->xDisplay(), m_pixmap); - m_pixmap = 0; - } -} - -GLXPixmap QWaylandReadbackGlxWindow::glxPixmap() const -{ - if (!m_pixmap) - const_cast<QWaylandReadbackGlxWindow *>(this)->createSurface(); - - return m_glxPixmap; -} - -uchar *QWaylandReadbackGlxWindow::buffer() -{ - return m_buffer->image()->bits(); -} - -void QWaylandReadbackGlxWindow::createSurface() -{ - QSize size(geometry().size()); - if (size.isEmpty()) { - //QGLWidget wants a context for a window without geometry - size = QSize(1,1); - } - - waitForFrameSync(); - - m_buffer = new QWaylandShmBuffer(m_glxIntegration->waylandDisplay(), size, QImage::Format_ARGB32); - attach(m_buffer); - - int depth = XDefaultDepth(m_glxIntegration->xDisplay(), m_glxIntegration->screen()); - m_pixmap = XCreatePixmap(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(), size.width(), size.height(), depth); - XSync(m_glxIntegration->xDisplay(), False); - - if (!m_config) - m_config = qglx_findConfig(m_glxIntegration->xDisplay(), m_glxIntegration->screen(), m_window->format()); - - m_glxPixmap = glXCreatePixmap(m_glxIntegration->xDisplay(), m_config, m_pixmap,0); - - if (!m_glxPixmap) - qDebug() << "Could not make glx surface out of pixmap :("; -} - diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h deleted file mode 100644 index c92646c80d..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDREADBACKGLXWINDOW_H -#define QWAYLANDREADBACKGLXWINDOW_H - -#include "qwaylandshmwindow.h" -#include "qwaylandreadbackglxintegration.h" -#include "qwaylandreadbackglxcontext.h" - -class QWaylandReadbackGlxWindow : public QWaylandShmWindow -{ -public: - QWaylandReadbackGlxWindow(QWindow *window, QWaylandReadbackGlxIntegration *glxIntegration); - WindowType windowType() const; - - void setGeometry(const QRect &rect); - - Pixmap glxPixmap() const; - - uchar *buffer(); - -private: - void createSurface(); - - QWaylandReadbackGlxIntegration *m_glxIntegration; - QWaylandShmBuffer *m_buffer; - - Pixmap m_pixmap; - GLXFBConfig m_config; - GLXPixmap m_glxPixmap; - QWindow *m_window; -}; - -#endif // QWAYLANDREADBACKGLXWINDOW_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/readback_glx.pri b/src/plugins/platforms/wayland/gl_integration/readback_glx/readback_glx.pri deleted file mode 100644 index 746d594fa2..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/readback_glx.pri +++ /dev/null @@ -1,11 +0,0 @@ -HEADERS += \ - $$PWD/qwaylandreadbackglxintegration.h \ - $$PWD/qwaylandreadbackglxwindow.h \ - $$PWD/qwaylandreadbackglxcontext.h - -SOURCES += \ - $$PWD/qwaylandreadbackglxintegration.cpp \ - $$PWD/qwaylandreadbackglxwindow.cpp \ - $$PWD/qwaylandreadbackglxcontext.cpp - -LIBS += -lX11 diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglinclude.h b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglinclude.h deleted file mode 100644 index 7130054e17..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglinclude.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDEGLINCLUDE_H -#define QWAYLANDEGLINCLUDE_H - -#include <wayland-client.h> - -#include <wayland-egl.h> - -#define GL_GLEXT_PROTOTYPES -#include <GLES2/gl2.h> -#include <GLES2/gl2ext.h> - -#define EGL_EGLEXT_PROTOTYPES -#include <EGL/egl.h> -#include <EGL/eglext.h> - -#endif // QWAYLANDEGLINCLUDE_H diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.cpp deleted file mode 100644 index 27f17a6153..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandeglintegration.h" - -#include "gl_integration/qwaylandglintegration.h" - -#include "qwaylandeglwindow.h" -#include "qwaylandglcontext.h" - -#include <QtCore/QDebug> - -QWaylandEglIntegration::QWaylandEglIntegration(struct wl_display *waylandDisplay) - : m_waylandDisplay(waylandDisplay) -{ - qDebug() << "Using Wayland-EGL"; -} - - -QWaylandEglIntegration::~QWaylandEglIntegration() -{ - eglTerminate(m_eglDisplay); -} - -void QWaylandEglIntegration::initialize() -{ - QByteArray eglPlatform = qgetenv("EGL_PLATFORM"); - if (eglPlatform.isEmpty()) { - setenv("EGL_PLATFORM","wayland",true); - } - - EGLint major,minor; - m_eglDisplay = eglGetDisplay(m_waylandDisplay); - if (m_eglDisplay == NULL) { - qWarning("EGL not available"); - } else { - if (!eglInitialize(m_eglDisplay, &major, &minor)) { - qWarning("failed to initialize EGL display"); - return; - } - } -} - -QWaylandWindow *QWaylandEglIntegration::createEglWindow(QWindow *window) -{ - return new QWaylandEglWindow(window); -} - -QPlatformOpenGLContext *QWaylandEglIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const -{ - return new QWaylandGLContext(m_eglDisplay, glFormat, share); -} - -EGLDisplay QWaylandEglIntegration::eglDisplay() const -{ - return m_eglDisplay; -} - -QWaylandGLIntegration *QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay) -{ - return new QWaylandEglIntegration(waylandDisplay->wl_display()); -} diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.h b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.h deleted file mode 100644 index 7a26c57658..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDEGLINTEGRATION_H -#define QWAYLANDEGLINTEGRATION_H - -#include "gl_integration/qwaylandglintegration.h" - -#include "qwaylandeglinclude.h" - -class QWaylandWindow; -class QWindow; - -class QWaylandEglIntegration : public QWaylandGLIntegration -{ -public: - QWaylandEglIntegration(struct wl_display *waylandDisplay); - ~QWaylandEglIntegration(); - - void initialize(); - - QWaylandWindow *createEglWindow(QWindow *window); - QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; - - EGLDisplay eglDisplay() const; - -private: - struct wl_display *m_waylandDisplay; - - EGLDisplay m_eglDisplay; -}; - -#endif // QWAYLANDEGLINTEGRATION_H diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp deleted file mode 100644 index e0e1f772b9..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandeglwindow.h" - -#include "qwaylandscreen.h" -#include "qwaylandglcontext.h" - -#include <QtPlatformSupport/private/qeglconvenience_p.h> - -#include <QtGui/QWindow> -#include <QtGui/QWindowSystemInterface> - -QWaylandEglWindow::QWaylandEglWindow(QWindow *window) - : QWaylandWindow(window) - , m_waylandEglWindow(0) - , m_eglSurface(0) - , m_eglConfig(0) - , m_format(window->format()) -{ - m_eglIntegration = static_cast<QWaylandEglIntegration *>(mDisplay->eglIntegration()); - - //super creates a new surface - newSurfaceCreated(); -} - -QWaylandEglWindow::~QWaylandEglWindow() -{ - if (m_eglSurface) { - eglDestroySurface(m_eglIntegration->eglDisplay(), m_eglSurface); - m_eglSurface = 0; - } -} - -QWaylandWindow::WindowType QWaylandEglWindow::windowType() const -{ - return QWaylandWindow::Egl; -} - -void QWaylandEglWindow::setGeometry(const QRect &rect) -{ - QWaylandWindow::setGeometry(rect); - if (m_waylandEglWindow){ - wl_egl_window_resize(m_waylandEglWindow, rect.width(), rect.height(), 0, 0); - QWindowSystemInterface::handleGeometryChange(window(), rect); - } -} - -void QWaylandEglWindow::newSurfaceCreated() -{ - if (m_waylandEglWindow) - wl_egl_window_destroy(m_waylandEglWindow); - - wl_visual *visual = QWaylandScreen::waylandScreenFromWindow(window())->visual(); - QSize size = geometry().size(); - if (!size.isValid()) - size = QSize(0,0); - - if (m_eglSurface) { - eglDestroySurface(m_eglIntegration->eglDisplay(), m_eglSurface); - m_eglSurface = 0; - } - - m_waylandEglWindow = wl_egl_window_create(mSurface, size.width(), size.height(), visual); -} - -QSurfaceFormat QWaylandEglWindow::format() const -{ - return m_format; -} - -EGLSurface QWaylandEglWindow::eglSurface() const -{ - if (!m_waylandEglWindow) - return 0; - - if (!m_eglSurface) { - if (!m_eglConfig) - m_eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), window()->format(), true); - - EGLNativeWindowType window = m_waylandEglWindow; - m_eglSurface = eglCreateWindowSurface(m_eglIntegration->eglDisplay(), m_eglConfig, window, 0); - } - - return m_eglSurface; -} - diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h deleted file mode 100644 index d435a511c4..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDEGLWINDOW_H -#define QWAYLANDEGLWINDOW_H - -#include "qwaylandwindow.h" -#include "qwaylandeglinclude.h" -#include "qwaylandeglintegration.h" - -class QWaylandGLContext; - -class QWaylandEglWindow : public QWaylandWindow -{ -public: - QWaylandEglWindow(QWindow *window); - ~QWaylandEglWindow(); - WindowType windowType() const; - void setGeometry(const QRect &rect); - - EGLSurface eglSurface() const; - - QSurfaceFormat format() const; - -protected: - void newSurfaceCreated(); - -private: - QWaylandEglIntegration *m_eglIntegration; - struct wl_egl_window *m_waylandEglWindow; - - const QWaylandWindow *m_parentWindow; - - mutable EGLSurface m_eglSurface; - mutable EGLConfig m_eglConfig; - - QSurfaceFormat m_format; -}; - -#endif // QWAYLANDEGLWINDOW_H diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp deleted file mode 100644 index aa61405eb6..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandglcontext.h" - -#include "qwaylanddisplay.h" -#include "qwaylandwindow.h" -#include "qwaylandeglwindow.h" - -#include <QtPlatformSupport/private/qeglconvenience_p.h> - -#include <QtGui/QPlatformOpenGLContext> -#include <QtGui/QSurfaceFormat> -#include <QtCore/QMutex> - -QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share) - : QPlatformOpenGLContext() - , m_eglDisplay(eglDisplay) - , m_config(q_configFromGLFormat(m_eglDisplay, format, true)) - , m_format(q_glFormatFromConfig(m_eglDisplay, m_config)) -{ - EGLContext shareEGLContext = share ? static_cast<QWaylandGLContext *>(share)->eglContext() : EGL_NO_CONTEXT; - - eglBindAPI(EGL_OPENGL_ES_API); - - QVector<EGLint> eglContextAttrs; - eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); - eglContextAttrs.append(2); - eglContextAttrs.append(EGL_NONE); - - m_context = eglCreateContext(m_eglDisplay, m_config, shareEGLContext, eglContextAttrs.constData()); -} - -QWaylandGLContext::~QWaylandGLContext() -{ - eglDestroyContext(m_eglDisplay, m_context); -} - -bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface) -{ - EGLSurface eglSurface = static_cast<QWaylandEglWindow *>(surface)->eglSurface(); - return eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context); -} - -void QWaylandGLContext::doneCurrent() -{ - eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); -} - -void QWaylandGLContext::swapBuffers(QPlatformSurface *surface) -{ - EGLSurface eglSurface = static_cast<QWaylandEglWindow *>(surface)->eglSurface(); - eglSwapBuffers(m_eglDisplay, eglSurface); -} - -void (*QWaylandGLContext::getProcAddress(const QByteArray &procName)) () -{ - return eglGetProcAddress(procName.constData()); -} - -EGLConfig QWaylandGLContext::eglConfig() const -{ - return m_config; -} - diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h deleted file mode 100644 index 16d9fa4ada..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDGLCONTEXT_H -#define QWAYLANDGLCONTEXT_H - -#include "qwaylanddisplay.h" - -#include <QtGui/QPlatformOpenGLContext> - -#include "qwaylandeglinclude.h" - -class QWaylandWindow; -class QWaylandGLWindowSurface; - -class QWaylandGLContext : public QPlatformOpenGLContext { -public: - QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share); - ~QWaylandGLContext(); - - void swapBuffers(QPlatformSurface *surface); - - bool makeCurrent(QPlatformSurface *surface); - void doneCurrent(); - - void (*getProcAddress(const QByteArray &procName)) (); - - QSurfaceFormat format() const { return m_format; } - - EGLConfig eglConfig() const; - EGLContext eglContext() const { return m_context; } - -private: - EGLDisplay m_eglDisplay; - - EGLContext m_context; - EGLConfig m_config; - QSurfaceFormat m_format; -}; - - -#endif // QWAYLANDGLCONTEXT_H diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/wayland_egl.pri b/src/plugins/platforms/wayland/gl_integration/wayland_egl/wayland_egl.pri deleted file mode 100644 index 8b4b163b03..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/wayland_egl.pri +++ /dev/null @@ -1,9 +0,0 @@ -LIBS += -lwayland-egl -lEGL -INCLUDEPATH += $$PWD -SOURCES += $$PWD/qwaylandeglintegration.cpp \ - $$PWD/qwaylandglcontext.cpp \ - $$PWD/qwaylandeglwindow.cpp - -HEADERS += $$PWD/qwaylandeglintegration.h \ - $$PWD/qwaylandglcontext.h \ - $$PWD/qwaylandeglwindow.h diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp deleted file mode 100644 index f2f9d1ceb6..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxcompositeeglcontext.h" - -#include "qwaylandxcompositeeglwindow.h" - -#include <QtCore/QDebug> -#include <QtGui/QRegion> - -#include <QtPlatformSupport/private/qeglconvenience_p.h> - -QWaylandXCompositeEGLContext::QWaylandXCompositeEGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display) - : QEGLPlatformContext(format, share, display) -{ -} - -void QWaylandXCompositeEGLContext::swapBuffers(QPlatformSurface *surface) -{ - QEGLPlatformContext::swapBuffers(surface); - - QWaylandXCompositeEGLWindow *w = - static_cast<QWaylandXCompositeEGLWindow *>(surface); - - QSize size = w->geometry().size(); - - w->damage(QRect(QPoint(), size)); - w->waitForFrameSync(); -} - -EGLSurface QWaylandXCompositeEGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) -{ - return static_cast<QWaylandXCompositeEGLWindow *>(surface)->eglSurface(); -} diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.h deleted file mode 100644 index 8420f2be13..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXCOMPOSITEEGLCONTEXT_H -#define QWAYLANDXCOMPOSITEEGLCONTEXT_H - -#include <QtGui/QPlatformOpenGLContext> - -#include "qwaylandxcompositeeglintegration.h" - -#include <QtPlatformSupport/private/qeglplatformcontext_p.h> - -class QWaylandXCompositeEGLWindow; - -class QWaylandXCompositeEGLContext : public QEGLPlatformContext -{ -public: - QWaylandXCompositeEGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display); - - void swapBuffers(QPlatformSurface *surface); - -private: - EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface); -}; - -#endif // QWAYLANDXCOMPOSITEEGLCONTEXT_H diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp deleted file mode 100644 index d7e37f8e70..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxcompositeeglintegration.h" - -#include "qwaylandxcompositeeglwindow.h" - -#include <QtCore/QDebug> - -#include "wayland-xcomposite-client-protocol.h" - -QWaylandGLIntegration * QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay) -{ - return new QWaylandXCompositeEGLIntegration(waylandDisplay); -} - -QWaylandXCompositeEGLIntegration::QWaylandXCompositeEGLIntegration(QWaylandDisplay * waylandDispaly) - : QWaylandGLIntegration() - , mWaylandDisplay(waylandDispaly) -{ - qDebug() << "Using XComposite-EGL"; - wl_display_add_global_listener(mWaylandDisplay->wl_display(), QWaylandXCompositeEGLIntegration::wlDisplayHandleGlobal, - this); -} - -QWaylandXCompositeEGLIntegration::~QWaylandXCompositeEGLIntegration() -{ - XCloseDisplay(mDisplay); -} - -void QWaylandXCompositeEGLIntegration::initialize() -{ -} - -QWaylandWindow * QWaylandXCompositeEGLIntegration::createEglWindow(QWindow *window) -{ - return new QWaylandXCompositeEGLWindow(window,this); -} - -QPlatformOpenGLContext *QWaylandXCompositeEGLIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const -{ - return new QWaylandXCompositeEGLContext(glFormat, share, eglDisplay()); -} - -Display * QWaylandXCompositeEGLIntegration::xDisplay() const -{ - return mDisplay; -} - -EGLDisplay QWaylandXCompositeEGLIntegration::eglDisplay() const -{ - return mEglDisplay; -} - -int QWaylandXCompositeEGLIntegration::screen() const -{ - return mScreen; -} - -Window QWaylandXCompositeEGLIntegration::rootWindow() const -{ - return mRootWindow; -} - -QWaylandDisplay * QWaylandXCompositeEGLIntegration::waylandDisplay() const -{ - return mWaylandDisplay; -} -wl_xcomposite * QWaylandXCompositeEGLIntegration::waylandXComposite() const -{ - return mWaylandComposite; -} - -const struct wl_xcomposite_listener QWaylandXCompositeEGLIntegration::xcomposite_listener = { - QWaylandXCompositeEGLIntegration::rootInformation -}; - -void QWaylandXCompositeEGLIntegration::wlDisplayHandleGlobal(wl_display *display, uint32_t id, const char *interface, uint32_t version, void *data) -{ - Q_UNUSED(version); - if (strcmp(interface, "wl_xcomposite") == 0) { - QWaylandXCompositeEGLIntegration *integration = static_cast<QWaylandXCompositeEGLIntegration *>(data); - integration->mWaylandComposite = wl_xcomposite_create(display,id,1); - wl_xcomposite_add_listener(integration->mWaylandComposite,&xcomposite_listener,integration); - } - -} - -void QWaylandXCompositeEGLIntegration::rootInformation(void *data, wl_xcomposite *xcomposite, const char *display_name, uint32_t root_window) -{ - Q_UNUSED(xcomposite); - QWaylandXCompositeEGLIntegration *integration = static_cast<QWaylandXCompositeEGLIntegration *>(data); - - integration->mDisplay = XOpenDisplay(display_name); - integration->mRootWindow = (Window) root_window; - integration->mScreen = XDefaultScreen(integration->mDisplay); - integration->mEglDisplay = eglGetDisplay(integration->mDisplay); - eglBindAPI(EGL_OPENGL_ES_API); - EGLint minor,major; - if (!eglInitialize(integration->mEglDisplay,&major,&minor)) { - qFatal("Failed to initialize EGL"); - } - eglSwapInterval(integration->eglDisplay(),0); - qDebug() << "ROOT INFORMATION" << integration->mDisplay << integration->mRootWindow << integration->mScreen; -} - diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h deleted file mode 100644 index 74ea930e9a..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXCOMPOSITEEGLINTEGRATION_H -#define QWAYLANDXCOMPOSITEEGLINTEGRATION_H - -#include "gl_integration/qwaylandglintegration.h" -#include "wayland-client.h" - -#include <QtCore/QTextStream> -#include <QtCore/QDataStream> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> -#include <QtGui/QWindow> - -#include <QPlatformOpenGLContext> - -#include <QWaitCondition> - -#include <X11/Xlib.h> -#include <EGL/egl.h> - -struct wl_xcomposite; - -class QWaylandXCompositeEGLIntegration : public QWaylandGLIntegration -{ -public: - QWaylandXCompositeEGLIntegration(QWaylandDisplay * waylandDispaly); - ~QWaylandXCompositeEGLIntegration(); - - void initialize(); - - QWaylandWindow *createEglWindow(QWindow *window); - QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; - - QWaylandDisplay *waylandDisplay() const; - struct wl_xcomposite *waylandXComposite() const; - - Display *xDisplay() const; - EGLDisplay eglDisplay() const; - int screen() const; - Window rootWindow() const; - -private: - QWaylandDisplay *mWaylandDisplay; - struct wl_xcomposite *mWaylandComposite; - - Display *mDisplay; - EGLDisplay mEglDisplay; - int mScreen; - Window mRootWindow; - - static void wlDisplayHandleGlobal(struct wl_display *display, uint32_t id, - const char *interface, uint32_t version, void *data); - - static const struct wl_xcomposite_listener xcomposite_listener; - static void rootInformation(void *data, - struct wl_xcomposite *xcomposite, - const char *display_name, - uint32_t root_window); -}; - -#endif // QWAYLANDXCOMPOSITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp deleted file mode 100644 index 6e5afb5713..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxcompositeeglwindow.h" -#include "qwaylandxcompositebuffer.h" - -#include <QtPlatformSupport/private/qeglconvenience_p.h> -#include <QtPlatformSupport/private/qxlibeglintegration_p.h> - -#include "wayland-xcomposite-client-protocol.h" - -#include <X11/extensions/Xcomposite.h> -#include "qwaylandxcompositeeglintegration.h" -#include "windowmanager_integration/qwaylandwindowmanagerintegration.h" - -#include <QtCore/QDebug> - -QWaylandXCompositeEGLWindow::QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLIntegration *glxIntegration) - : QWaylandWindow(window) - , m_glxIntegration(glxIntegration) - , m_context(0) - , m_buffer(0) - , m_xWindow(0) - , m_config(q_configFromGLFormat(glxIntegration->eglDisplay(), window->format(), true, EGL_WINDOW_BIT | EGL_PIXMAP_BIT)) - , m_surface(0) - , m_waitingForSync(false) -{ -} - -QWaylandWindow::WindowType QWaylandXCompositeEGLWindow::windowType() const -{ - //yeah. this type needs a new name - return QWaylandWindow::Egl; -} - -void QWaylandXCompositeEGLWindow::setGeometry(const QRect &rect) -{ - QWaylandWindow::setGeometry(rect); - - if (m_surface) { - eglDestroySurface(m_glxIntegration->eglDisplay(), m_surface); - m_surface = 0; - } -} - -EGLSurface QWaylandXCompositeEGLWindow::eglSurface() const -{ - if (!m_surface) - const_cast<QWaylandXCompositeEGLWindow *>(this)->createEglSurface(); - return m_surface; -} - -void QWaylandXCompositeEGLWindow::createEglSurface() -{ - QSize size(geometry().size()); - if (size.isEmpty()) { - // QGLWidget wants a context for a window without geometry - size = QSize(1,1); - } - - delete m_buffer; - //XFreePixmap deletes the glxPixmap as well - if (m_xWindow) { - XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow); - } - - VisualID visualId = QXlibEglIntegration::getCompatibleVisualId(m_glxIntegration->xDisplay(), m_glxIntegration->eglDisplay(), m_config); - - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = visualId; - - int matchingCount = 0; - XVisualInfo *visualInfo = XGetVisualInfo(m_glxIntegration->xDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount); - - Colormap cmap = XCreateColormap(m_glxIntegration->xDisplay(),m_glxIntegration->rootWindow(),visualInfo->visual,AllocNone); - - XSetWindowAttributes a; - a.colormap = cmap; - m_xWindow = XCreateWindow(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(),0, 0, size.width(), size.height(), - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); - - XCompositeRedirectWindow(m_glxIntegration->xDisplay(), m_xWindow, CompositeRedirectManual); - XMapWindow(m_glxIntegration->xDisplay(), m_xWindow); - - m_surface = eglCreateWindowSurface(m_glxIntegration->eglDisplay(), m_config, m_xWindow,0); - if (m_surface == EGL_NO_SURFACE) { - qFatal("Could not make eglsurface"); - } - - XSync(m_glxIntegration->xDisplay(),False); - m_buffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(), - (uint32_t)m_xWindow, - size, - m_glxIntegration->waylandDisplay()->argbVisual()); - attach(m_buffer); - wl_display_sync_callback(m_glxIntegration->waylandDisplay()->wl_display(), - QWaylandXCompositeEGLWindow::sync_function, - this); - - m_waitingForSync = true; - wl_display_sync(m_glxIntegration->waylandDisplay()->wl_display(),0); - m_glxIntegration->waylandDisplay()->flushRequests(); - while (m_waitingForSync) - m_glxIntegration->waylandDisplay()->readEvents(); -} - -void QWaylandXCompositeEGLWindow::sync_function(void *data) -{ - QWaylandXCompositeEGLWindow *that = static_cast<QWaylandXCompositeEGLWindow *>(data); - that->m_waitingForSync = false; -} - -void QWaylandXCompositeEGLWindow::requestActivateWindow() -{ -#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT - mDisplay->windowManagerIntegration()->authenticateWithToken(); -#endif - - QWaylandWindow::requestActivateWindow(); -} diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h deleted file mode 100644 index b2f8fbe6c4..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXCOMPOSITEEGLWINDOW_H -#define QWAYLANDXCOMPOSITEEGLWINDOW_H - -#include "qwaylandwindow.h" -#include "qwaylandbuffer.h" - -#include "qwaylandxcompositeeglintegration.h" -#include "qwaylandxcompositeeglcontext.h" - -class QWaylandXCompositeEGLWindow : public QWaylandWindow -{ -public: - QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLIntegration *glxIntegration); - WindowType windowType() const; - - void setGeometry(const QRect &rect); - void requestActivateWindow(); - - EGLSurface eglSurface() const; - -private: - void createEglSurface(); - - QWaylandXCompositeEGLIntegration *m_glxIntegration; - QWaylandXCompositeEGLContext *m_context; - QWaylandBuffer *m_buffer; - - Window m_xWindow; - EGLConfig m_config; - EGLSurface m_surface; - - bool m_waitingForSync; - - static void sync_function(void *data); -}; - -#endif // QWAYLANDXCOMPOSITEEGLWINDOW_H diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/xcomposite_egl.pri b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/xcomposite_egl.pri deleted file mode 100644 index 5f86bd9588..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/xcomposite_egl.pri +++ /dev/null @@ -1,13 +0,0 @@ -include (../xcomposite_share/xcomposite_share.pri) - -LIBS += -lXcomposite -lEGL - -SOURCES += \ - $$PWD/qwaylandxcompositeeglcontext.cpp \ - $$PWD/qwaylandxcompositeeglintegration.cpp \ - $$PWD/qwaylandxcompositeeglwindow.cpp - -HEADERS += \ - $$PWD/qwaylandxcompositeeglcontext.h \ - $$PWD/qwaylandxcompositeeglintegration.h \ - $$PWD/qwaylandxcompositeeglwindow.h diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp deleted file mode 100644 index 75881a7fdd..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtCore/QDebug> - -#include "qwaylandxcompositeglxcontext.h" - -#include "qwaylandxcompositeglxwindow.h" - -#include <QRegion> - -QWaylandXCompositeGLXContext::QWaylandXCompositeGLXContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, Display *display, int screen) - : m_display(display) -{ - qDebug("creating XComposite-GLX context"); - GLXContext shareContext = share ? static_cast<QWaylandXCompositeGLXContext *>(share)->m_context : 0; - GLXFBConfig config = qglx_findConfig(display, screen, format); - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(display, config); - m_context = glXCreateContext(display, visualInfo, shareContext, true); - m_format = qglx_surfaceFormatFromGLXFBConfig(display, config, m_context); -} - -bool QWaylandXCompositeGLXContext::makeCurrent(QPlatformSurface *surface) -{ - Window xWindow = static_cast<QWaylandXCompositeGLXWindow *>(surface)->xWindow(); - - return glXMakeCurrent(m_display, xWindow, m_context); -} - -void QWaylandXCompositeGLXContext::doneCurrent() -{ - glXMakeCurrent(m_display, 0, 0); -} - -void QWaylandXCompositeGLXContext::swapBuffers(QPlatformSurface *surface) -{ - QWaylandXCompositeGLXWindow *w = static_cast<QWaylandXCompositeGLXWindow *>(surface); - - QSize size = w->geometry().size(); - - glXSwapBuffers(m_display, w->xWindow()); - - w->damage(QRect(QPoint(), size)); - w->waitForFrameSync(); -} - -void (*QWaylandXCompositeGLXContext::getProcAddress(const QByteArray &procName)) () -{ - return glXGetProcAddress(reinterpret_cast<const GLubyte *>(procName.constData())); -} - -QSurfaceFormat QWaylandXCompositeGLXContext::format() const -{ - return m_format; -} - diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h deleted file mode 100644 index 3364d88ec4..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXCOMPOSITEGLXCONTEXT_H -#define QWAYLANDXCOMPOSITEGLXCONTEXT_H - -#include <QtGui/QPlatformOpenGLContext> - -#include "qwaylandxcompositeglxintegration.h" -#include <QtPlatformSupport/private/qglxconvenience_p.h> - -class QWaylandXCompositeGLXWindow; -class QWaylandShmBuffer; - -class QWaylandXCompositeGLXContext : public QPlatformOpenGLContext -{ -public: - QWaylandXCompositeGLXContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, Display *display, int screen); - - QSurfaceFormat format() const; - - void swapBuffers(QPlatformSurface *surface); - - bool makeCurrent(QPlatformSurface *surface); - void doneCurrent(); - - void (*getProcAddress(const QByteArray &procName)) (); - -private: - GLXContext m_context; - - Display *m_display; - QSurfaceFormat m_format; -}; - -#endif // QWAYLANDXCOMPOSITEGLXCONTEXT_H diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp deleted file mode 100644 index e1eb2e635a..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxcompositeglxintegration.h" - -#include "qwaylandxcompositeglxwindow.h" - -#include <QtCore/QDebug> - -#include "wayland-xcomposite-client-protocol.h" - -QWaylandGLIntegration * QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay) -{ - return new QWaylandXCompositeGLXIntegration(waylandDisplay); -} - -QWaylandXCompositeGLXIntegration::QWaylandXCompositeGLXIntegration(QWaylandDisplay *waylandDisplay) - : mWaylandDisplay(waylandDisplay) - , mWaylandComposite(0) - , mDisplay(0) - , mScreen(0) - , mRootWindow(0) -{ - qDebug() << "Using XComposite-GLX"; - wl_display_add_global_listener(waylandDisplay->wl_display(), QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal, - this); -} - -QWaylandXCompositeGLXIntegration::~QWaylandXCompositeGLXIntegration() -{ - XCloseDisplay(mDisplay); -} - -void QWaylandXCompositeGLXIntegration::initialize() -{ -} - -QWaylandWindow * QWaylandXCompositeGLXIntegration::createEglWindow(QWindow *window) -{ - return new QWaylandXCompositeGLXWindow(window, this); -} - -QPlatformOpenGLContext *QWaylandXCompositeGLXIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const -{ - return new QWaylandXCompositeGLXContext(glFormat, share, mDisplay, mScreen); -} - -Display * QWaylandXCompositeGLXIntegration::xDisplay() const -{ - return mDisplay; -} - -int QWaylandXCompositeGLXIntegration::screen() const -{ - return mScreen; -} - -Window QWaylandXCompositeGLXIntegration::rootWindow() const -{ - return mRootWindow; -} - -QWaylandDisplay * QWaylandXCompositeGLXIntegration::waylandDisplay() const -{ - return mWaylandDisplay; -} -wl_xcomposite * QWaylandXCompositeGLXIntegration::waylandXComposite() const -{ - return mWaylandComposite; -} - -const struct wl_xcomposite_listener QWaylandXCompositeGLXIntegration::xcomposite_listener = { - QWaylandXCompositeGLXIntegration::rootInformation -}; - -void QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal(wl_display *display, uint32_t id, const char *interface, uint32_t version, void *data) -{ - Q_UNUSED(version); - if (strcmp(interface, "wl_xcomposite") == 0) { - qDebug("XComposite-GLX: got wl_xcomposite global"); - QWaylandXCompositeGLXIntegration *integration = static_cast<QWaylandXCompositeGLXIntegration *>(data); - integration->mWaylandComposite = wl_xcomposite_create(display,id,1); - wl_xcomposite_add_listener(integration->mWaylandComposite,&xcomposite_listener,integration); - } - -} - -void QWaylandXCompositeGLXIntegration::rootInformation(void *data, wl_xcomposite *xcomposite, const char *display_name, uint32_t root_window) -{ - Q_UNUSED(xcomposite); - QWaylandXCompositeGLXIntegration *integration = static_cast<QWaylandXCompositeGLXIntegration *>(data); - - qDebug("XComposite-GLX: xcomposite listener callback"); - - integration->mDisplay = XOpenDisplay(display_name); - integration->mRootWindow = (Window) root_window; - integration->mScreen = XDefaultScreen(integration->mDisplay); -} - diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h deleted file mode 100644 index b028067d8e..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXCOMPOSITEGLXINTEGRATION_H -#define QWAYLANDXCOMPOSITEGLXINTEGRATION_H - -#include "gl_integration/qwaylandglintegration.h" -#include "wayland-client.h" - -#include <QtCore/QTextStream> -#include <QtCore/QDataStream> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> -#include <QtGui/QWindow> - -#include <X11/Xlib.h> - -struct wl_xcomposite; - -class QWaylandXCompositeGLXIntegration : public QWaylandGLIntegration -{ -public: - QWaylandXCompositeGLXIntegration(QWaylandDisplay * waylandDispaly); - ~QWaylandXCompositeGLXIntegration(); - - void initialize(); - - QWaylandWindow *createEglWindow(QWindow *window); - QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; - - QWaylandDisplay *waylandDisplay() const; - struct wl_xcomposite *waylandXComposite() const; - - Display *xDisplay() const; - int screen() const; - Window rootWindow() const; - -private: - QWaylandDisplay *mWaylandDisplay; - struct wl_xcomposite *mWaylandComposite; - - Display *mDisplay; - int mScreen; - Window mRootWindow; - - static void wlDisplayHandleGlobal(struct wl_display *display, uint32_t id, - const char *interface, uint32_t version, void *data); - - static const struct wl_xcomposite_listener xcomposite_listener; - static void rootInformation(void *data, - struct wl_xcomposite *xcomposite, - const char *display_name, - uint32_t root_window); -}; - -#endif // QWAYLANDXCOMPOSITEGLXINTEGRATION_H diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp deleted file mode 100644 index ea03d1991e..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxcompositeglxwindow.h" -#include "qwaylandxcompositebuffer.h" - -#include <QtCore/QDebug> - -#include "wayland-xcomposite-client-protocol.h" -#include <QtGui/QRegion> - -#include <X11/extensions/Xcomposite.h> - - -QWaylandXCompositeGLXWindow::QWaylandXCompositeGLXWindow(QWindow *window, QWaylandXCompositeGLXIntegration *glxIntegration) - : QWaylandWindow(window) - , m_glxIntegration(glxIntegration) - , m_xWindow(0) - , m_config(qglx_findConfig(glxIntegration->xDisplay(), glxIntegration->screen(), window->format(), GLX_WINDOW_BIT | GLX_PIXMAP_BIT)) - , m_buffer(0) - , m_waitingForSync(false) -{ -} - -QWaylandWindow::WindowType QWaylandXCompositeGLXWindow::windowType() const -{ - //yeah. this type needs a new name - return QWaylandWindow::Egl; -} - -void QWaylandXCompositeGLXWindow::setGeometry(const QRect &rect) -{ - QWaylandWindow::setGeometry(rect); - - if (m_xWindow) { - delete m_buffer; - - XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow); - m_xWindow = 0; - } -} - -Window QWaylandXCompositeGLXWindow::xWindow() const -{ - if (!m_xWindow) - const_cast<QWaylandXCompositeGLXWindow *>(this)->createSurface(); - - return m_xWindow; -} - -void QWaylandXCompositeGLXWindow::waitForSync() -{ - wl_display_sync_callback(m_glxIntegration->waylandDisplay()->wl_display(), - QWaylandXCompositeGLXWindow::sync_function, - this); - m_waitingForSync= true; - wl_display_sync(m_glxIntegration->waylandDisplay()->wl_display(), 0); - m_glxIntegration->waylandDisplay()->flushRequests(); - while (m_waitingForSync) - m_glxIntegration->waylandDisplay()->readEvents(); -} - - -void QWaylandXCompositeGLXWindow::createSurface() -{ - QSize size(geometry().size()); - if (size.isEmpty()) { - //QGLWidget wants a context for a window without geometry - size = QSize(1,1); - } - - if (!m_glxIntegration->xDisplay()) { - qWarning("XCompositeGLXWindow: X display still null?!"); - return; - } - - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(m_glxIntegration->xDisplay(), m_config); - Colormap cmap = XCreateColormap(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(), - visualInfo->visual, AllocNone); - - XSetWindowAttributes a; - a.background_pixel = WhitePixel(m_glxIntegration->xDisplay(), m_glxIntegration->screen()); - a.border_pixel = BlackPixel(m_glxIntegration->xDisplay(), m_glxIntegration->screen()); - a.colormap = cmap; - m_xWindow = XCreateWindow(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(),0, 0, size.width(), size.height(), - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWBackPixel|CWBorderPixel|CWColormap, &a); - - XCompositeRedirectWindow(m_glxIntegration->xDisplay(), m_xWindow, CompositeRedirectManual); - XMapWindow(m_glxIntegration->xDisplay(), m_xWindow); - - XSync(m_glxIntegration->xDisplay(), False); - m_buffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(), - (uint32_t)m_xWindow, - size, - m_glxIntegration->waylandDisplay()->argbVisual()); - attach(m_buffer); - waitForSync(); -} - -void QWaylandXCompositeGLXWindow::sync_function(void *data) -{ - QWaylandXCompositeGLXWindow *that = static_cast<QWaylandXCompositeGLXWindow *>(data); - that->m_waitingForSync = false; -} - diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h deleted file mode 100644 index acf6c8e63e..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXCOMPOSITEGLXWINDOW_H -#define QWAYLANDXCOMPOSITEGLXWINDOW_H - -#include "qwaylandwindow.h" -#include "qwaylandxcompositeglxintegration.h" -#include "qwaylandxcompositeglxcontext.h" - -#include <QtCore/QWaitCondition> - -#include "qwaylandbuffer.h" - -class QWaylandXCompositeGLXWindow : public QWaylandWindow -{ -public: - QWaylandXCompositeGLXWindow(QWindow *window, QWaylandXCompositeGLXIntegration *glxIntegration); - WindowType windowType() const; - - void setGeometry(const QRect &rect); - - Window xWindow() const; - -private: - void createSurface(); - - QWaylandXCompositeGLXIntegration *m_glxIntegration; - - Window m_xWindow; - GLXFBConfig m_config; - - QWaylandBuffer *m_buffer; - - void waitForSync(); - bool m_waitingForSync; - - static void sync_function(void *data); -}; - -#endif // QWAYLANDXCOMPOSITEGLXWINDOW_H diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/xcomposite_glx.pri b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/xcomposite_glx.pri deleted file mode 100644 index bbd6c12e42..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/xcomposite_glx.pri +++ /dev/null @@ -1,12 +0,0 @@ -include (../xcomposite_share/xcomposite_share.pri) - -LIBS += -lXcomposite -SOURCES += \ - $$PWD/qwaylandxcompositeglxcontext.cpp \ - $$PWD/qwaylandxcompositeglxintegration.cpp \ - $$PWD/qwaylandxcompositeglxwindow.cpp - -HEADERS += \ - $$PWD/qwaylandxcompositeglxcontext.h \ - $$PWD/qwaylandxcompositeglxintegration.h \ - $$PWD/qwaylandxcompositeglxwindow.h diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp deleted file mode 100644 index f4bacc3c1f..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxcompositebuffer.h" - -#include "wayland-client.h" -#include "wayland-xcomposite-client-protocol.h" - -QWaylandXCompositeBuffer::QWaylandXCompositeBuffer(wl_xcomposite *xcomposite, uint32_t window, const QSize &size, wl_visual *visual) - :mSize(size) -{ - mBuffer = wl_xcomposite_create_buffer(xcomposite, - window, - size.width(), - size.height(), - visual); -} - -QSize QWaylandXCompositeBuffer::size() const -{ - return mSize; -} diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h deleted file mode 100644 index 02176d7850..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXCOMPOSITEBUFFER_H -#define QWAYLANDXCOMPOSITEBUFFER_H - -#include "qwaylandbuffer.h" -#include <stdint.h> - -struct wl_xcomposite; -struct wl_visual; - -class QWaylandXCompositeBuffer : public QWaylandBuffer -{ -public: - QWaylandXCompositeBuffer(struct wl_xcomposite *xcomposite, - uint32_t window, - const QSize &size, - struct wl_visual *visual); - - QSize size() const; -private: - QSize mSize; -}; - -#endif // QWAYLANDXCOMPOSITEBUFFER_H diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/wayland-xcomposite-client-protocol.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/wayland-xcomposite-client-protocol.h deleted file mode 100644 index 309252aa61..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/wayland-xcomposite-client-protocol.h +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef XCOMPOSITE_CLIENT_PROTOCOL_H -#define XCOMPOSITE_CLIENT_PROTOCOL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> -#include <stddef.h> -#include "wayland-util.h" - -struct wl_client; - -struct wl_xcomposite; - -extern const struct wl_interface wl_xcomposite_interface; - -struct wl_xcomposite_listener { - void (*root)(void *data, - struct wl_xcomposite *wl_xcomposite, - const char *display_name, - uint32_t root_window); -}; - -static inline int -wl_xcomposite_add_listener(struct wl_xcomposite *wl_xcomposite, - const struct wl_xcomposite_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) wl_xcomposite, - (void (**)(void)) listener, data); -} - -#define WL_XCOMPOSITE_CREATE_BUFFER 0 - -static inline struct wl_xcomposite * -wl_xcomposite_create(struct wl_display *display, uint32_t id, uint32_t version) -{ - wl_display_bind(display, id, "wl_xcomposite", version); - - return (struct wl_xcomposite *) - wl_proxy_create_for_id(display, &wl_xcomposite_interface, id); -} - -static inline void -wl_xcomposite_set_user_data(struct wl_xcomposite *wl_xcomposite, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_xcomposite, user_data); -} - -static inline void * -wl_xcomposite_get_user_data(struct wl_xcomposite *wl_xcomposite) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_xcomposite); -} - -static inline void -wl_xcomposite_destroy(struct wl_xcomposite *wl_xcomposite) -{ - wl_proxy_destroy((struct wl_proxy *) wl_xcomposite); -} - -static inline struct wl_buffer * -wl_xcomposite_create_buffer(struct wl_xcomposite *wl_xcomposite, uint32_t x_window, int width, int height, struct wl_visual *visual) -{ - struct wl_proxy *id; - - id = wl_proxy_create((struct wl_proxy *) wl_xcomposite, - &wl_buffer_interface); - if (!id) - return NULL; - - wl_proxy_marshal((struct wl_proxy *) wl_xcomposite, - WL_XCOMPOSITE_CREATE_BUFFER, id, x_window, width, height, visual); - - return (struct wl_buffer *) id; -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/wayland-xcomposite-protocol.c b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/wayland-xcomposite-protocol.c deleted file mode 100644 index f79b510719..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/wayland-xcomposite-protocol.c +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <stdlib.h> -#include <stdint.h> -#include "wayland-util.h" - -static const struct wl_message wl_xcomposite_requests[] = { - { "create_buffer", "nuiio" }, -}; - -static const struct wl_message wl_xcomposite_events[] = { - { "root", "su" }, -}; - -WL_EXPORT const struct wl_interface wl_xcomposite_interface = { - "wl_xcomposite", 1, - ARRAY_LENGTH(wl_xcomposite_requests), wl_xcomposite_requests, - ARRAY_LENGTH(wl_xcomposite_events), wl_xcomposite_events, -}; - diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/xcomposite_share.pri b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/xcomposite_share.pri deleted file mode 100644 index 03b3521e86..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/xcomposite_share.pri +++ /dev/null @@ -1,9 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += \ - $$PWD/wayland-xcomposite-client-protocol.h \ - gl_integration/xcomposite_share/qwaylandxcompositebuffer.h - -SOURCES += \ - $$PWD/wayland-xcomposite-protocol.c \ - gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp |