Remove DRI2/OpenGL code paths from xcb plugin.
These were used to test QtWayland, but there are other options available for that now. The DRI2 code hasn't been maintained and doesn't even compile at the moment, so let's just remove it to de-clutter the source. Change-Id: I7db0f4db82348497b9f4d6c2dcf2e13f3ab14a76 Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
9b2e4cd5a8
commit
39eaff6773
@ -1,273 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qdri2context.h"
|
||||
|
||||
#include "qxcbwindow.h"
|
||||
#include "qxcbconnection.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtWidgets/QWidget>
|
||||
|
||||
#include <xcb/dri2.h>
|
||||
#include <xcb/xfixes.h>
|
||||
|
||||
#define MESA_EGL_NO_X11_HEADERS
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDri2ContextPrivate
|
||||
{
|
||||
public:
|
||||
QDri2ContextPrivate(QXcbWindow *window)
|
||||
: qXcbWindow(window)
|
||||
, windowFormat(window->widget()->platformWindowFormat())
|
||||
, image(0)
|
||||
{
|
||||
}
|
||||
|
||||
xcb_window_t xcbWindow() { return qXcbWindow->window(); }
|
||||
xcb_connection_t *xcbConnection() { return qXcbWindow->xcb_connection(); }
|
||||
|
||||
QXcbWindow *qXcbWindow;
|
||||
QPlatformWindowFormat windowFormat;
|
||||
|
||||
EGLContext eglContext;
|
||||
|
||||
EGLImageKHR image;
|
||||
|
||||
GLuint fbo;
|
||||
GLuint rbo;
|
||||
GLuint depth;
|
||||
|
||||
QSize size;
|
||||
};
|
||||
|
||||
QDri2Context::QDri2Context(QXcbWindow *window)
|
||||
: d_ptr(new QDri2ContextPrivate(window))
|
||||
{
|
||||
Q_D(QDri2Context);
|
||||
|
||||
static const EGLint contextAttribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
EGLContext shareContext = EGL_NO_CONTEXT;
|
||||
if (window->widget()->platformWindowFormat().sharedGLContext()) {
|
||||
QDri2Context *context = static_cast<QDri2Context *>(window->widget()->platformWindowFormat().sharedGLContext());
|
||||
shareContext = context->d_func()->eglContext;
|
||||
}
|
||||
d->eglContext = eglCreateContext(EGL_DISPLAY_FROM_XCB(d->qXcbWindow), NULL,
|
||||
shareContext, contextAttribs);
|
||||
|
||||
if (d->eglContext == EGL_NO_CONTEXT) {
|
||||
qDebug() << "No eglContext!" << eglGetError();
|
||||
}
|
||||
|
||||
EGLBoolean makeCurrentSuccess = eglMakeCurrent(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),EGL_NO_SURFACE,EGL_NO_SURFACE,d->eglContext);
|
||||
if (!makeCurrentSuccess) {
|
||||
qDebug() << "eglMakeCurrent failed!" << eglGetError();
|
||||
}
|
||||
|
||||
xcb_dri2_create_drawable (d->xcbConnection(), d->xcbWindow());
|
||||
|
||||
glGenFramebuffers(1,&d->fbo);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER,d->fbo);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
glGenRenderbuffers(1, &d->rbo);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, d->rbo);
|
||||
|
||||
glGenRenderbuffers(1,&d->depth);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, d->depth);
|
||||
|
||||
resize(d->qXcbWindow->widget()->geometry().size());
|
||||
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, d->rbo);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERER,d->depth);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERER,d->depth);
|
||||
|
||||
//restore the old current context
|
||||
const QPlatformOpenGLContext *currentContext = QPlatformOpenGLContext::currentContext();
|
||||
if (currentContext)
|
||||
const_cast<QPlatformOpenGLContext*>(currentContext)->makeCurrent();
|
||||
}
|
||||
|
||||
QDri2Context::~QDri2Context()
|
||||
{
|
||||
//cleanup
|
||||
}
|
||||
|
||||
void QDri2Context::makeCurrent()
|
||||
{
|
||||
Q_D(QDri2Context);
|
||||
|
||||
eglMakeCurrent(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),EGL_NO_SURFACE,EGL_NO_SURFACE,d->eglContext);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER,d->fbo);
|
||||
|
||||
}
|
||||
|
||||
void QDri2Context::doneCurrent()
|
||||
{
|
||||
Q_D(QDri2Context);
|
||||
eglMakeCurrent(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),EGL_NO_SURFACE,EGL_NO_SURFACE,EGL_NO_CONTEXT);
|
||||
}
|
||||
|
||||
void QDri2Context::swapBuffers()
|
||||
{
|
||||
Q_D(QDri2Context);
|
||||
xcb_rectangle_t rectangle;
|
||||
rectangle.x = 0;
|
||||
rectangle.y = 0;
|
||||
rectangle.width = d->qXcbWindow->widget()->geometry().width();
|
||||
rectangle.height = d->qXcbWindow->widget()->geometry().height();
|
||||
|
||||
xcb_xfixes_region_t xfixesRegion = xcb_generate_id(d->xcbConnection());
|
||||
xcb_xfixes_create_region(d->xcbConnection(), xfixesRegion,
|
||||
1, &rectangle);
|
||||
|
||||
xcb_dri2_copy_region_cookie_t cookie = xcb_dri2_copy_region_unchecked(d->xcbConnection(),
|
||||
d->qXcbWindow->window(),
|
||||
xfixesRegion,
|
||||
XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT,
|
||||
XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT);
|
||||
|
||||
xcb_dri2_copy_region_reply_t *reply = xcb_dri2_copy_region_reply(d->xcbConnection(),cookie,NULL);
|
||||
|
||||
//cleanup
|
||||
delete reply;
|
||||
xcb_xfixes_destroy_region(d->xcbConnection(), xfixesRegion);
|
||||
|
||||
}
|
||||
|
||||
void * QDri2Context::getProcAddress(const QString &procName)
|
||||
{
|
||||
return (void *)eglGetProcAddress(qPrintable(procName));
|
||||
}
|
||||
|
||||
void QDri2Context::resize(const QSize &size)
|
||||
{
|
||||
Q_D(QDri2Context);
|
||||
d->size= size;
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER,d->fbo);
|
||||
|
||||
xcb_dri2_dri2_buffer_t *backBfr = backBuffer();
|
||||
|
||||
if (d->image) {
|
||||
qDebug() << "destroing image";
|
||||
eglDestroyImageKHR(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),d->image);
|
||||
}
|
||||
|
||||
EGLint imgAttribs[] = {
|
||||
EGL_WIDTH, d->size.width(),
|
||||
EGL_HEIGHT, d->size.height(),
|
||||
EGL_DRM_BUFFER_STRIDE_MESA, backBfr->pitch /4,
|
||||
EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
d->image = eglCreateImageKHR(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),
|
||||
EGL_NO_CONTEXT,
|
||||
EGL_DRM_BUFFER_MESA,
|
||||
(EGLClientBuffer) backBfr->name,
|
||||
imgAttribs);
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, d->rbo);
|
||||
glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER,
|
||||
d->image);
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, d->depth);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER,GL_DEPTH24_STENCIL8_OES,d->size.width(), d->size.height());
|
||||
|
||||
}
|
||||
|
||||
QPlatformWindowFormat QDri2Context::platformWindowFormat() const
|
||||
{
|
||||
Q_D(const QDri2Context);
|
||||
return d->windowFormat;
|
||||
}
|
||||
|
||||
xcb_dri2_dri2_buffer_t * QDri2Context::backBuffer()
|
||||
{
|
||||
Q_D(QDri2Context);
|
||||
|
||||
unsigned int backBufferAttachment = XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT;
|
||||
xcb_dri2_get_buffers_cookie_t cookie = xcb_dri2_get_buffers_unchecked (d->xcbConnection(),
|
||||
d->xcbWindow(),
|
||||
1, 1, &backBufferAttachment);
|
||||
|
||||
xcb_dri2_get_buffers_reply_t *reply = xcb_dri2_get_buffers_reply (d->xcbConnection(), cookie, NULL);
|
||||
if (!reply) {
|
||||
qDebug() << "failed to get buffers reply";
|
||||
return 0;
|
||||
}
|
||||
|
||||
xcb_dri2_dri2_buffer_t *buffers = xcb_dri2_get_buffers_buffers (reply);
|
||||
if (!buffers) {
|
||||
qDebug() << "failed to get buffers";
|
||||
return 0;
|
||||
}
|
||||
|
||||
Q_ASSERT(reply->count == 1);
|
||||
|
||||
delete reply;
|
||||
|
||||
return buffers;
|
||||
}
|
||||
|
||||
void * QDri2Context::eglContext() const
|
||||
{
|
||||
Q_D(const QDri2Context);
|
||||
return d->eglContext;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -1,81 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QDRI2CONTEXT_H
|
||||
#define QDRI2CONTEXT_H
|
||||
|
||||
#include <qpa/qplatformopenglcontext.h>
|
||||
|
||||
struct xcb_dri2_dri2_buffer_t;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QXcbWindow;
|
||||
class QDri2ContextPrivate;
|
||||
|
||||
class QDri2Context : public QPlatformOpenGLContext
|
||||
{
|
||||
Q_DECLARE_PRIVATE(QDri2Context);
|
||||
public:
|
||||
QDri2Context(QXcbWindow *window);
|
||||
~QDri2Context();
|
||||
|
||||
void makeCurrent();
|
||||
void doneCurrent();
|
||||
void swapBuffers();
|
||||
void* getProcAddress(const QString& procName);
|
||||
|
||||
void resize(const QSize &size);
|
||||
|
||||
QPlatformWindowFormat platformWindowFormat() const;
|
||||
|
||||
void *eglContext() const;
|
||||
|
||||
protected:
|
||||
xcb_dri2_dri2_buffer_t *backBuffer();
|
||||
QScopedPointer<QDri2ContextPrivate> d_ptr;
|
||||
private:
|
||||
Q_DISABLE_COPY(QDri2Context)
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QDRI2CONTEXT_H
|
@ -82,17 +82,6 @@
|
||||
#include <EGL/egl.h>
|
||||
#endif
|
||||
|
||||
#ifdef XCB_USE_DRI2
|
||||
#include <xcb/dri2.h>
|
||||
extern "C" {
|
||||
#include <xf86drm.h>
|
||||
}
|
||||
#define MESA_EGL_NO_X11_HEADERS
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#endif
|
||||
|
||||
#if defined(XCB_USE_XINPUT2) || defined(XCB_USE_XINPUT2_MAEMO)
|
||||
#include <X11/extensions/XInput2.h>
|
||||
#include <X11/extensions/XI2proto.h>
|
||||
@ -260,12 +249,6 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char
|
||||
, m_nativeInterface(nativeInterface)
|
||||
#ifdef XCB_USE_XINPUT2_MAEMO
|
||||
, m_xinputData(0)
|
||||
#endif
|
||||
#ifdef XCB_USE_DRI2
|
||||
, m_dri2_major(0)
|
||||
, m_dri2_minor(0)
|
||||
, m_dri2_support_probed(false)
|
||||
, m_has_support_for_dri2(false)
|
||||
#endif
|
||||
, xfixes_first_event(0)
|
||||
, xrandr_first_event(0)
|
||||
@ -359,9 +342,6 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char
|
||||
m_drag = new QXcbDrag(this);
|
||||
#endif
|
||||
|
||||
#ifdef XCB_USE_DRI2
|
||||
initializeDri2();
|
||||
#endif
|
||||
sync();
|
||||
}
|
||||
|
||||
@ -1410,94 +1390,6 @@ bool QXcbConnection::hasEgl() const
|
||||
}
|
||||
#endif // defined(XCB_USE_EGL)
|
||||
|
||||
#ifdef XCB_USE_DRI2
|
||||
void QXcbConnection::initializeDri2()
|
||||
{
|
||||
xcb_dri2_connect_cookie_t connect_cookie = xcb_dri2_connect_unchecked (m_connection,
|
||||
m_screens[0]->root(),
|
||||
XCB_DRI2_DRIVER_TYPE_DRI);
|
||||
|
||||
xcb_dri2_connect_reply_t *connect = xcb_dri2_connect_reply (m_connection,
|
||||
connect_cookie, NULL);
|
||||
|
||||
if (! connect || connect->driver_name_length + connect->device_name_length == 0) {
|
||||
qWarning("QXcbConnection: Failed to connect to DRI2");
|
||||
return;
|
||||
}
|
||||
|
||||
m_dri2_device_name = QByteArray(xcb_dri2_connect_device_name (connect),
|
||||
xcb_dri2_connect_device_name_length (connect));
|
||||
delete connect;
|
||||
|
||||
int fd = open(m_dri2_device_name.constData(), O_RDWR);
|
||||
if (fd < 0) {
|
||||
qWarning() << "QXcbConnection: Couldn't open DRI2 device" << m_dri2_device_name;
|
||||
m_dri2_device_name = QByteArray();
|
||||
return;
|
||||
}
|
||||
|
||||
drm_magic_t magic;
|
||||
if (drmGetMagic(fd, &magic)) {
|
||||
qWarning("QXcbConnection: Failed to get drmMagic");
|
||||
return;
|
||||
}
|
||||
|
||||
xcb_dri2_authenticate_cookie_t authenticate_cookie = xcb_dri2_authenticate_unchecked(m_connection,
|
||||
m_screens[0]->root(), magic);
|
||||
xcb_dri2_authenticate_reply_t *authenticate = xcb_dri2_authenticate_reply(m_connection,
|
||||
authenticate_cookie, NULL);
|
||||
if (authenticate == NULL || !authenticate->authenticated) {
|
||||
qWarning("QXcbConnection: DRI2: failed to authenticate");
|
||||
free(authenticate);
|
||||
return;
|
||||
}
|
||||
|
||||
delete authenticate;
|
||||
|
||||
EGLDisplay display = eglGetDRMDisplayMESA(fd);
|
||||
if (!display) {
|
||||
qWarning("QXcbConnection: Failed to create EGL display using DRI2");
|
||||
return;
|
||||
}
|
||||
|
||||
m_egl_display = display;
|
||||
EGLint major,minor;
|
||||
if (!eglInitialize(display, &major, &minor)) {
|
||||
qWarning("QXcbConnection: Failed to initialize EGL display using DRI2");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool QXcbConnection::hasSupportForDri2() const
|
||||
{
|
||||
if (!m_dri2_support_probed) {
|
||||
xcb_generic_error_t *error = 0;
|
||||
|
||||
xcb_prefetch_extension_data (m_connection, &xcb_dri2_id);
|
||||
|
||||
xcb_dri2_query_version_cookie_t dri2_query_cookie = xcb_dri2_query_version (m_connection,
|
||||
XCB_DRI2_MAJOR_VERSION,
|
||||
XCB_DRI2_MINOR_VERSION);
|
||||
|
||||
xcb_dri2_query_version_reply_t *dri2_query = xcb_dri2_query_version_reply (m_connection,
|
||||
dri2_query_cookie, &error);
|
||||
if (!dri2_query || error) {
|
||||
delete error;
|
||||
delete dri2_query;
|
||||
return false;
|
||||
}
|
||||
|
||||
QXcbConnection *that = const_cast<QXcbConnection *>(this);
|
||||
that->m_dri2_major = dri2_query->major_version;
|
||||
that->m_dri2_minor = dri2_query->minor_version;
|
||||
|
||||
that->m_has_support_for_dri2 = true;
|
||||
that->m_dri2_support_probed = true;
|
||||
}
|
||||
return m_has_support_for_dri2;
|
||||
}
|
||||
#endif //XCB_USE_DRI2
|
||||
|
||||
#if defined(XCB_USE_XINPUT2) || defined(XCB_USE_XINPUT2_MAEMO)
|
||||
// Borrowed from libXi.
|
||||
int QXcbConnection::xi2CountBits(unsigned char *ptr, int len)
|
||||
|
@ -338,14 +338,10 @@ public:
|
||||
void *xlib_display() const { return m_xlib_display; }
|
||||
#endif
|
||||
|
||||
#ifdef XCB_USE_DRI2
|
||||
bool hasSupportForDri2() const;
|
||||
QByteArray dri2DeviceName() const { return m_dri2_device_name; }
|
||||
#endif
|
||||
#ifdef XCB_USE_EGL
|
||||
bool hasEgl() const;
|
||||
#endif
|
||||
#if defined(XCB_USE_EGL) || defined(XCB_USE_DRI2)
|
||||
#if defined(XCB_USE_EGL)
|
||||
void *egl_display() const { return m_egl_display; }
|
||||
#endif
|
||||
#ifdef XCB_USE_XINPUT2_MAEMO
|
||||
@ -393,9 +389,6 @@ private:
|
||||
void initializeXRender();
|
||||
void initializeXRandr();
|
||||
void initializeXShape();
|
||||
#ifdef XCB_USE_DRI2
|
||||
void initializeDri2();
|
||||
#endif
|
||||
#ifdef XCB_USE_XINPUT2_MAEMO
|
||||
void initializeXInput2Maemo();
|
||||
void finalizeXInput2Maemo();
|
||||
@ -478,14 +471,7 @@ private:
|
||||
QHash<int, QWindowSystemInterface::TouchPoint> m_touchPoints;
|
||||
QHash<int, XInput2DeviceData*> m_touchDevices;
|
||||
#endif
|
||||
#ifdef XCB_USE_DRI2
|
||||
uint32_t m_dri2_major;
|
||||
uint32_t m_dri2_minor;
|
||||
bool m_dri2_support_probed;
|
||||
bool m_has_support_for_dri2;
|
||||
QByteArray m_dri2_device_name;
|
||||
#endif
|
||||
#if defined(XCB_USE_EGL) || defined(XCB_USE_DRI2)
|
||||
#if defined(XCB_USE_EGL)
|
||||
void *m_egl_display;
|
||||
bool m_has_egl;
|
||||
#endif
|
||||
@ -552,9 +538,9 @@ cookie_t q_xcb_call_template(const cookie_t &cookie, QXcbConnection *connection,
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(XCB_USE_DRI2) || defined(XCB_USE_EGL)
|
||||
#if defined(XCB_USE_EGL)
|
||||
#define EGL_DISPLAY_FROM_XCB(object) ((EGLDisplay)(object->connection()->egl_display()))
|
||||
#endif //endifXCB_USE_DRI2
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -190,11 +190,9 @@ QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLCont
|
||||
#elif defined(XCB_USE_EGL)
|
||||
return new QEGLXcbPlatformContext(context->format(), context->shareHandle(),
|
||||
screen->connection()->egl_display(), screen->connection());
|
||||
#elif defined(XCB_USE_DRI2)
|
||||
return new QDri2Context(context->format(), context->shareHandle());
|
||||
#else
|
||||
Q_UNUSED(screen);
|
||||
qWarning("QXcbIntegration: Cannot create platform OpenGL context, none of GLX, EGL, or DRI2 are enabled");
|
||||
qWarning("QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
@ -211,7 +209,7 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||
case ThreadedPixmaps: return true;
|
||||
#if defined(XCB_USE_GLX)
|
||||
case OpenGL: return m_connections.at(0)->hasGLX();
|
||||
#elif defined(XCB_USE_EGL) || defined(XCB_USE_DRI2)
|
||||
#elif defined(XCB_USE_EGL)
|
||||
case OpenGL: return true;
|
||||
#else
|
||||
case OpenGL: return false;
|
||||
|
@ -53,8 +53,6 @@
|
||||
|
||||
#if defined(XCB_USE_EGL)
|
||||
#include "QtPlatformSupport/private/qeglplatformcontext_p.h"
|
||||
#elif defined (XCB_USE_DRI2)
|
||||
#include "qdri2context.h"
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -69,7 +67,6 @@ public:
|
||||
insert("egldisplay",QXcbNativeInterface::EglDisplay);
|
||||
insert("connection",QXcbNativeInterface::Connection);
|
||||
insert("screen",QXcbNativeInterface::Screen);
|
||||
insert("graphicsdevice",QXcbNativeInterface::GraphicsDevice);
|
||||
insert("eglcontext",QXcbNativeInterface::EglContext);
|
||||
}
|
||||
};
|
||||
@ -122,9 +119,6 @@ void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceStr
|
||||
case Screen:
|
||||
result = qPlatformScreenForWindow(window);
|
||||
break;
|
||||
case GraphicsDevice:
|
||||
result = graphicsDeviceForWindow(window);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -165,7 +159,7 @@ void *QXcbNativeInterface::displayForWindow(QWindow *window)
|
||||
|
||||
void *QXcbNativeInterface::eglDisplayForWindow(QWindow *window)
|
||||
{
|
||||
#if defined(XCB_USE_DRI2) || defined(XCB_USE_EGL)
|
||||
#if defined(XCB_USE_EGL)
|
||||
QXcbScreen *screen = qPlatformScreenForWindow(window);
|
||||
return screen->connection()->egl_display();
|
||||
#else
|
||||
@ -186,19 +180,6 @@ void *QXcbNativeInterface::screenForWindow(QWindow *window)
|
||||
return screen->screen();
|
||||
}
|
||||
|
||||
void *QXcbNativeInterface::graphicsDeviceForWindow(QWindow *window)
|
||||
{
|
||||
#if defined(XCB_USE_DRI2)
|
||||
QXcbScreen *screen = qPlatformScreenForWindow(window);
|
||||
QByteArray deviceName = screen->connection()->dri2DeviceName();
|
||||
return deviceName.data();
|
||||
#else
|
||||
Q_UNUSED(window);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void * QXcbNativeInterface::eglContextForContext(QOpenGLContext *context)
|
||||
{
|
||||
Q_ASSERT(context);
|
||||
@ -206,27 +187,6 @@ void * QXcbNativeInterface::eglContextForContext(QOpenGLContext *context)
|
||||
QEGLPlatformContext *eglPlatformContext = static_cast<QEGLPlatformContext *>(context->handle());
|
||||
return eglPlatformContext->eglContext();
|
||||
#endif
|
||||
#if 0
|
||||
Q_ASSERT(window);
|
||||
QPlatformOpenGLContext *platformContext = window->glContext()->handle();
|
||||
if (!platformContext) {
|
||||
qDebug() << "QWindow" << window << "does not have a glContext"
|
||||
<< "cannot return EGLContext";
|
||||
return 0;
|
||||
}
|
||||
#if defined(XCB_USE_EGL)
|
||||
QEGLPlatformContext *eglPlatformContext = static_cast<QEGLPlatformContext *>(platformContext);
|
||||
return eglPlatformContext->eglContext();
|
||||
#elif defined (XCB_USE_DRI2)
|
||||
QDri2Context *dri2Context = static_cast<QDri2Context *>(platformContext);
|
||||
return dri2Context->eglContext();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#else
|
||||
Q_UNUSED(context)
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -55,10 +55,6 @@
|
||||
|
||||
#include <qpa/qplatformintegration.h>
|
||||
|
||||
#ifdef XCB_USE_DRI2
|
||||
#include "qdri2context.h"
|
||||
#endif
|
||||
|
||||
// FIXME This workaround can be removed for xcb-icccm > 3.8
|
||||
#define class class_name
|
||||
#include <xcb/xcb_icccm.h>
|
||||
@ -1391,11 +1387,6 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
|
||||
}
|
||||
|
||||
m_dirtyFrameMargins = true;
|
||||
|
||||
#if XCB_USE_DRI2
|
||||
if (m_context)
|
||||
static_cast<QDri2Context *>(m_context)->resize(rect.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
bool QXcbWindow::isExposed() const
|
||||
|
@ -74,17 +74,7 @@ contains(QT_CONFIG, xcb-render) {
|
||||
|
||||
!contains(DEFINES, QT_NO_SHAPE):LIBS += -lxcb-shape
|
||||
|
||||
# DEFINES += XCB_USE_DRI2
|
||||
contains(DEFINES, XCB_USE_DRI2) {
|
||||
LIBS += -lxcb-dri2 -lEGL
|
||||
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG += libdrm
|
||||
|
||||
HEADERS += qdri2context.h
|
||||
SOURCES += qdri2context.cpp
|
||||
|
||||
} else:contains(QT_CONFIG, opengl) {
|
||||
contains(QT_CONFIG, opengl) {
|
||||
contains(QT_CONFIG, opengles2) {
|
||||
DEFINES += XCB_USE_EGL
|
||||
LIBS += -lEGL
|
||||
|
Loading…
Reference in New Issue
Block a user