summaryrefslogtreecommitdiffstats
path: root/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp')
-rw-r--r--src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp59
1 files changed, 12 insertions, 47 deletions
diff --git a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
index d2fc1aef4..3c49f30a4 100644
--- a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
@@ -1,46 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "drmeglserverbufferintegration.h"
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
QT_BEGIN_NAMESPACE
@@ -123,7 +87,7 @@ QOpenGLTexture *DrmEglServerBuffer::toOpenGlTexture()
bool DrmEglServerBuffer::bufferInUse()
{
- return resourceMap().count() > 0;
+ return resourceMap().size() > 0;
}
DrmEglServerBufferIntegration::DrmEglServerBufferIntegration()
@@ -134,47 +98,48 @@ DrmEglServerBufferIntegration::~DrmEglServerBufferIntegration()
{
}
-void DrmEglServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
+bool DrmEglServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
{
Q_ASSERT(QGuiApplication::platformNativeInterface());
m_egl_display = static_cast<EGLDisplay>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("egldisplay"));
if (!m_egl_display) {
qWarning("Can't initialize drm egl server buffer integration. Missing egl display from platform plugin");
- return;
+ return false;
}
const char *extensionString = eglQueryString(m_egl_display, EGL_EXTENSIONS);
if (!extensionString || !strstr(extensionString, "EGL_KHR_image")) {
qWarning("Failed to initialize drm egl server buffer integration. There is no EGL_KHR_image extension.\n");
- return;
+ return false;
}
m_egl_create_image = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR"));
m_egl_destroy_image = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImageKHR"));
if (!m_egl_create_image || !m_egl_destroy_image) {
qWarning("Failed to initialize drm egl server buffer integration. Could not resolve eglCreateImageKHR or eglDestroyImageKHR");
- return;
+ return false;
}
if (!extensionString || !strstr(extensionString, "EGL_MESA_drm_image")) {
qWarning("Failed to initialize drm egl server buffer integration. There is no EGL_MESA_drm_image extension.\n");
- return;
+ return false;
}
m_egl_create_drm_image = reinterpret_cast<PFNEGLCREATEDRMIMAGEMESAPROC>(eglGetProcAddress("eglCreateDRMImageMESA"));
m_egl_export_drm_image = reinterpret_cast<PFNEGLEXPORTDRMIMAGEMESAPROC>(eglGetProcAddress("eglExportDRMImageMESA"));
if (!m_egl_create_drm_image || !m_egl_export_drm_image) {
qWarning("Failed to initialize drm egl server buffer integration. Could not find eglCreateDRMImageMESA or eglExportDRMImageMESA.\n");
- return;
+ return false;
}
m_gl_egl_image_target_texture_2d = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES"));
if (!m_gl_egl_image_target_texture_2d) {
qWarning("Failed to initialize drm egl server buffer integration. Could not find glEGLImageTargetTexture2DOES.\n");
- return;
+ return false;
}
QtWaylandServer::qt_drm_egl_server_buffer::init(compositor->display(), 1);
+ return true;
}
bool DrmEglServerBufferIntegration::supportsFormat(QtWayland::ServerBuffer::Format format) const