diff options
Diffstat (limited to 'src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp')
-rw-r--r-- | src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp | 62 |
1 files changed, 13 insertions, 49 deletions
diff --git a/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp b/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp index 4b2be50e6..8f1ff9a46 100644 --- a/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp +++ b/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp @@ -1,47 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 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) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "vulkanserverbufferintegration.h" #include <QtWaylandClient/private/qwaylanddisplay_p.h> #include <QDebug> +#include <QtOpenGL/QOpenGLTexture> #include <QtGui/QOpenGLContext> -#include <QtGui/QOpenGLTexture> #include <QtGui/qopengl.h> #include <QtGui/QImage> #include <QtCore/QCoreApplication> @@ -50,7 +14,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -static constexpr bool extraDebug = +static constexpr bool sbiExtraDebug = #ifdef VULKAN_SERVER_BUFFER_EXTRA_DEBUG true; #else @@ -124,7 +88,7 @@ VulkanServerBuffer::~VulkanServerBuffer() if (m_texture) { //only do gl cleanup if import has been called m_integration->deleteGLTextureWhenPossible(m_texture); - if (extraDebug) qDebug() << "glDeleteMemoryObjectsEXT" << m_memoryObject; + if (sbiExtraDebug) qDebug() << "glDeleteMemoryObjectsEXT" << m_memoryObject; funcs->glDeleteMemoryObjectsEXT(1, &m_memoryObject); } qt_server_buffer_release(m_server_buffer); @@ -136,7 +100,7 @@ void VulkanServerBuffer::import() if (m_texture) return; - if (extraDebug) qDebug() << "importing" << m_fd << hex << glGetError(); + if (sbiExtraDebug) qDebug() << "importing" << m_fd << Qt::hex << glGetError(); auto *glContext = QOpenGLContext::currentContext(); if (!glContext) @@ -146,21 +110,21 @@ void VulkanServerBuffer::import() return; funcs->glCreateMemoryObjectsEXT(1, &m_memoryObject); - if (extraDebug) qDebug() << "glCreateMemoryObjectsEXT" << hex << glGetError(); + if (sbiExtraDebug) qDebug() << "glCreateMemoryObjectsEXT" << Qt::hex << glGetError(); funcs->glImportMemoryFdEXT(m_memoryObject, m_memorySize, GL_HANDLE_TYPE_OPAQUE_FD_EXT, m_fd); - if (extraDebug) qDebug() << "glImportMemoryFdEXT" << hex << glGetError(); + if (sbiExtraDebug) qDebug() << "glImportMemoryFdEXT" << Qt::hex << glGetError(); m_texture = new QOpenGLTexture(QOpenGLTexture::Target2D); m_texture->create(); - if (extraDebug) qDebug() << "created texture" << m_texture->textureId() << hex << glGetError(); + if (sbiExtraDebug) qDebug() << "created texture" << m_texture->textureId() << Qt::hex << glGetError(); m_texture->bind(); - if (extraDebug) qDebug() << "bound texture" << hex << glGetError(); + if (sbiExtraDebug) qDebug() << "bound texture" << Qt::hex << glGetError(); funcs->glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, m_internalFormat, m_size.width(), m_size.height(), m_memoryObject, 0 ); - if (extraDebug) qDebug() << "glTexStorageMem2DEXT" << hex << glGetError(); - if (extraDebug) qDebug() << "format" << hex << m_internalFormat << GL_RGBA8; + if (sbiExtraDebug) qDebug() << "glTexStorageMem2DEXT" << Qt::hex << glGetError(); + if (sbiExtraDebug) qDebug() << "format" << Qt::hex << m_internalFormat << GL_RGBA8; } QOpenGLTexture *VulkanServerBuffer::toOpenGlTexture() @@ -193,7 +157,7 @@ void VulkanServerBufferIntegration::wlDisplayHandleGlobal(void *data, ::wl_regis void VulkanServerBufferIntegration::zqt_vulkan_server_buffer_v1_server_buffer_created(qt_server_buffer *id, int32_t fd, uint32_t width, uint32_t height, uint32_t memory_size, uint32_t format) { - if (extraDebug) qDebug() << "vulkan_server_buffer_server_buffer_created" << fd; + if (sbiExtraDebug) qDebug() << "vulkan_server_buffer_server_buffer_created" << fd; auto *server_buffer = new VulkanServerBuffer(this, id, fd, width, height, memory_size, format); qt_server_buffer_set_user_data(id, server_buffer); } |