diff options
47 files changed, 694 insertions, 713 deletions
diff --git a/.qmake.conf b/.qmake.conf index 2c01c5d2a..1a16230c8 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -4,4 +4,4 @@ DEFINES += QT_NO_FOREACH DEFINES += QT_NO_JAVA_STYLE_ITERATORS DEFINES += QT_NO_LINKED_LIST -MODULE_VERSION = 5.14.0 +MODULE_VERSION = 5.15.0 diff --git a/config.tests/dmabuf_client_buffer/dmabuf_client_buffer.pro b/config.tests/dmabuf_client_buffer/dmabuf_client_buffer.pro deleted file mode 100644 index 28dcadcbf..000000000 --- a/config.tests/dmabuf_client_buffer/dmabuf_client_buffer.pro +++ /dev/null @@ -1 +0,0 @@ -SOURCES += main.cpp diff --git a/config.tests/dmabuf_client_buffer/main.cpp b/config.tests/dmabuf_client_buffer/main.cpp deleted file mode 100644 index 71447dc8e..000000000 --- a/config.tests/dmabuf_client_buffer/main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <EGL/egl.h> -#include <EGL/eglext.h> - -//If libdrm is available, the following files should exist -#include "drm_mode.h" -#include "drm_fourcc.h" - -int main() -{ -// test if DMA BUF is supported -#ifndef EGL_LINUX_DMA_BUF_EXT -#error DMA BUF Extension not available -#endif - -// test if DMA BUF import modifier extension is supported -#ifndef EGL_EXT_image_dma_buf_import_modifiers -#error DMA BUF Import modifier extension not available -#endif - - return 0; -} diff --git a/config.tests/dmabuf_server_buffer/dmabuf_server_buffer.pro b/config.tests/dmabuf_server_buffer/dmabuf_server_buffer.pro deleted file mode 100644 index 28dcadcbf..000000000 --- a/config.tests/dmabuf_server_buffer/dmabuf_server_buffer.pro +++ /dev/null @@ -1 +0,0 @@ -SOURCES += main.cpp diff --git a/config.tests/dmabuf_server_buffer/main.cpp b/config.tests/dmabuf_server_buffer/main.cpp deleted file mode 100644 index aa04d18fd..000000000 --- a/config.tests/dmabuf_server_buffer/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <EGL/egl.h> -#include <EGL/eglext.h> -#include <drm_fourcc.h> - -int main() -{ -#ifdef EGL_LINUX_DMA_BUF_EXT - return 0; -#else -#error Requires EGL_LINUX_DMA_BUF_EXT - return 1; -#endif -} diff --git a/config.tests/drm_egl_server/drm_egl_server.pro b/config.tests/drm_egl_server/drm_egl_server.pro deleted file mode 100644 index 28dcadcbf..000000000 --- a/config.tests/drm_egl_server/drm_egl_server.pro +++ /dev/null @@ -1 +0,0 @@ -SOURCES += main.cpp diff --git a/config.tests/drm_egl_server/main.cpp b/config.tests/drm_egl_server/main.cpp deleted file mode 100644 index 0dbd42f90..000000000 --- a/config.tests/drm_egl_server/main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <EGL/egl.h> -#include <EGL/eglext.h> - -int main() -{ -#ifdef EGL_MESA_drm_image - return 0; -#else -#error Requires EGL_MESA_drm_image to be defined - return 1; -#endif -} diff --git a/config.tests/glx/glx.pro b/config.tests/glx/glx.pro deleted file mode 100644 index 28dcadcbf..000000000 --- a/config.tests/glx/glx.pro +++ /dev/null @@ -1 +0,0 @@ -SOURCES += main.cpp diff --git a/config.tests/glx/main.cpp b/config.tests/glx/main.cpp deleted file mode 100644 index c902c55d7..000000000 --- a/config.tests/glx/main.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <GL/glx.h> - -int main(int argc, char **argv) -{ - Display *dpy = XOpenDisplay(0); - - int items = 0; - GLXFBConfig *fbc = glXChooseFBConfig(dpy, DefaultScreen(dpy), 0 , &items); - return 0; -} diff --git a/config.tests/libhybris_egl_server/libhybris_egl_server.pro b/config.tests/libhybris_egl_server/libhybris_egl_server.pro deleted file mode 100644 index 28dcadcbf..000000000 --- a/config.tests/libhybris_egl_server/libhybris_egl_server.pro +++ /dev/null @@ -1 +0,0 @@ -SOURCES += main.cpp diff --git a/config.tests/libhybris_egl_server/main.cpp b/config.tests/libhybris_egl_server/main.cpp deleted file mode 100644 index 368b57a12..000000000 --- a/config.tests/libhybris_egl_server/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <EGL/egl.h> -#include <EGL/eglext.h> -#include <hybris/eglplatformcommon/hybris_nativebufferext.h> - -int main() -{ -#ifdef EGL_HYBRIS_native_buffer - return 0; -#else -#error Requires EGL_HYBRIS_native_buffer to be defined - return 1; -#endif -} diff --git a/config.tests/vulkan_server_buffer/main.cpp b/config.tests/vulkan_server_buffer/main.cpp deleted file mode 100644 index 5bd88d338..000000000 --- a/config.tests/vulkan_server_buffer/main.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <vulkan/vulkan.h> - -int main() -{ - VkExportMemoryAllocateInfoKHR exportAllocInfo = {}; - exportAllocInfo.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR; - exportAllocInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; - - return 0; -} diff --git a/config.tests/vulkan_server_buffer/vulkan_server_buffer.pro b/config.tests/vulkan_server_buffer/vulkan_server_buffer.pro deleted file mode 100644 index 28dcadcbf..000000000 --- a/config.tests/vulkan_server_buffer/vulkan_server_buffer.pro +++ /dev/null @@ -1 +0,0 @@ -SOURCES += main.cpp diff --git a/config.tests/wayland/main.cpp b/config.tests/wayland/main.cpp deleted file mode 100644 index 8cab379bf..000000000 --- a/config.tests/wayland/main.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <wayland-version.h> - -int main() -{ -#if WAYLAND_VERSION_MAJOR < 1 -# error Wayland 1.8.0 or higher required -#endif -#if WAYLAND_VERSION_MAJOR == 1 -# if WAYLAND_VERSION_MINOR < 8 -# error Wayland 1.8.0 or higher required -# endif -# if WAYLAND_VERSION_MINOR == 8 -# if WAYLAND_VERSION_MICRO < 0 -# error Wayland 1.8.0 or higher required -# endif -# endif -#endif - return 0; -} diff --git a/config.tests/wayland/wayland.pro b/config.tests/wayland/wayland.pro deleted file mode 100644 index 28dcadcbf..000000000 --- a/config.tests/wayland/wayland.pro +++ /dev/null @@ -1 +0,0 @@ -SOURCES += main.cpp diff --git a/config.tests/wayland_cursor/main.cpp b/config.tests/wayland_cursor/main.cpp deleted file mode 100644 index c9cf66196..000000000 --- a/config.tests/wayland_cursor/main.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <wayland-cursor.h> - -int main() -{ - struct wl_cursor_image *image = 0; - - return 0; -} diff --git a/config.tests/wayland_cursor/wayland_cursor.pro b/config.tests/wayland_cursor/wayland_cursor.pro deleted file mode 100644 index 28dcadcbf..000000000 --- a/config.tests/wayland_cursor/wayland_cursor.pro +++ /dev/null @@ -1 +0,0 @@ -SOURCES += main.cpp diff --git a/config.tests/wayland_egl/main.cpp b/config.tests/wayland_egl/main.cpp deleted file mode 100644 index c50056469..000000000 --- a/config.tests/wayland_egl/main.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <wayland-egl.h> - -int main() -{ - struct wl_egl_window *window = wl_egl_window_create(0,100,100); - - return 0; -} diff --git a/config.tests/wayland_egl/wayland_egl.pro b/config.tests/wayland_egl/wayland_egl.pro deleted file mode 100644 index 28dcadcbf..000000000 --- a/config.tests/wayland_egl/wayland_egl.pro +++ /dev/null @@ -1 +0,0 @@ -SOURCES += main.cpp diff --git a/config.tests/xcomposite/main.cpp b/config.tests/xcomposite/main.cpp deleted file mode 100644 index 1867b204e..000000000 --- a/config.tests/xcomposite/main.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <X11/extensions/Xcomposite.h> - -int main (int argc, char **argv) -{ - XCompositeRedirectWindow((Display *)0,(Window) 0,CompositeRedirectManual); - - return 0; -} diff --git a/config.tests/xcomposite/xcomposite.pro b/config.tests/xcomposite/xcomposite.pro deleted file mode 100644 index 28dcadcbf..000000000 --- a/config.tests/xcomposite/xcomposite.pro +++ /dev/null @@ -1 +0,0 @@ -SOURCES += main.cpp diff --git a/src/client/client.pro b/src/client/client.pro index d0ae9009e..458e49360 100644 --- a/src/client/client.pro +++ b/src/client/client.pro @@ -5,6 +5,10 @@ QT += core-private gui-private QT_FOR_PRIVATE += service_support-private QT_PRIVATE += fontdatabase_support-private eventdispatcher_support-private theme_support-private +qtConfig(vulkan) { + QT_PRIVATE += vulkan_support-private +} + # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual @@ -97,6 +101,16 @@ include(shellintegration/shellintegration.pri) include(inputdeviceintegration/inputdeviceintegration.pri) include(global/global.pri) +qtConfig(vulkan) { + HEADERS += \ + qwaylandvulkaninstance_p.h \ + qwaylandvulkanwindow_p.h + + SOURCES += \ + qwaylandvulkaninstance.cpp \ + qwaylandvulkanwindow.cpp +} + qtConfig(cursor) { QMAKE_USE += wayland-cursor diff --git a/src/client/configure.json b/src/client/configure.json index e9e16324b..f49beaf70 100644 --- a/src/client/configure.json +++ b/src/client/configure.json @@ -9,7 +9,24 @@ "libraries": { "wayland-client": { "label": "Wayland client library", - "test": "wayland", + "headers": "wayland-version.h", + "test": { + "main": [ + "#if WAYLAND_VERSION_MAJOR < 1", + "# error Wayland 1.8.0 or higher required", + "#endif", + "#if WAYLAND_VERSION_MAJOR == 1", + "# if WAYLAND_VERSION_MINOR < 8", + "# error Wayland 1.8.0 or higher required", + "# endif", + "# if WAYLAND_VERSION_MINOR == 8", + "# if WAYLAND_VERSION_MICRO < 0", + "# error Wayland 1.8.0 or higher required", + "# endif", + "# endif", + "#endif" + ] + }, "sources": [ { "type": "pkgConfig", "args": "wayland-client" }, "-lwayland-client" @@ -17,7 +34,10 @@ }, "wayland-cursor": { "label": "Wayland cursor library", - "test": "wayland_cursor", + "headers": "wayland-cursor.h", + "test": { + "main": "struct wl_cursor_image *image = 0;" + }, "use": "wayland-client", "sources": [ { "type": "pkgConfig", "args": "wayland-cursor" }, @@ -26,7 +46,10 @@ }, "wayland-egl": { "label": "Wayland EGL library", - "test": "wayland_egl", + "headers": "wayland-egl.h", + "test": { + "main": "struct wl_egl_window *window = wl_egl_window_create(0, 100, 100);" + }, "sources": [ { "type": "pkgConfig", "args": "wayland-egl" }, "-lwayland-egl", @@ -35,7 +58,11 @@ }, "xcomposite": { "label": "XComposite", - "test": "xcomposite", + "headers": "X11/extensions/Xcomposite.h", + "test": { + "main": "XCompositeRedirectWindow((Display *)0,(Window) 0, CompositeRedirectManual);" + + }, "sources": [ { "type": "pkgConfig", "args": "xcomposite" }, "-lxcomposite" @@ -43,7 +70,14 @@ }, "glx": { "label": "GLX", - "test": "glx", + "headers": "GL/glx.h", + "test": { + "main": [ + "Display *dpy = XOpenDisplay(0);", + "int items = 0;", + "GLXFBConfig *fbc = glXChooseFBConfig(dpy, DefaultScreen(dpy), 0 , &items);" + ] + }, "sources": [ { "type": "pkgConfig", "args": "x11 gl" }, "-lX11 -lGl" @@ -61,25 +95,76 @@ "drm-egl-server": { "label": "DRM EGL Server", "type": "compile", - "test": "drm_egl_server", + "test": { + "include": [ + "EGL/egl.h", + "EGL/eglext.h" + ], + "main": [ + "#ifdef EGL_MESA_drm_image", + "return 0;", + "#else", + "#error Requires EGL_MESA_drm_image to be defined", + "return 1;", + "#endif" + ] + }, "use": "egl" }, "libhybris-egl-server": { "label": "libhybris EGL Server", "type": "compile", - "test": "libhybris_egl_server", + "test": { + "include": [ + "EGL/egl.h", + "EGL/eglext.h", + "hybris/eglplatformcommon/hybris_nativebufferext.h" + ], + "main": [ + "#ifdef EGL_HYBRIS_native_buffer", + "return 0;", + "#else", + "#error Requires EGL_HYBRIS_native_buffer to be defined", + "return 1;", + "#endif" + ] + }, "use": "egl" }, "dmabuf-server-buffer": { "label": "Linux dma-buf Buffer Sharing", "type": "compile", - "test": "dmabuf_server_buffer", + "test": { + "include": [ + "EGL/egl.h", + "EGL/eglext.h", + "drm_fourcc.h" + ], + "main": [ + "#ifdef EGL_LINUX_DMA_BUF_EXT", + "return 0;", + "#else", + "#error Requires EGL_LINUX_DMA_BUF_EXT", + "return 1;", + "#endif" + ] + }, "use": "egl" }, "vulkan-server-buffer": { "label": "Vulkan Buffer Sharing", "type": "compile", - "test": "vulkan_server_buffer" + "test": { + "include": [ + "vulkan/vulkan.h" + ], + "main": [ + "VkExportMemoryAllocateInfoKHR exportAllocInfo = {};", + "exportAllocInfo.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR;", + "exportAllocInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR;", + "return 0;" + ] + } } }, diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index f6a80e18f..9bdd9cc12 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -86,7 +86,7 @@ #include "qwaylandinputdeviceintegration_p.h" #include "qwaylandinputdeviceintegrationfactory_p.h" -#ifndef QT_NO_ACCESSIBILITY_ATSPI_BRIDGE +#if QT_CONFIG(accessibility_atspi_bridge) #include <QtLinuxAccessibilitySupport/private/bridge_p.h> #endif @@ -94,41 +94,14 @@ #include <QtXkbCommonSupport/private/qxkbcommon_p.h> #endif -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -class GenericWaylandTheme: public QGenericUnixTheme -{ -public: - static QStringList themeNames() - { - QStringList result; - - if (QGuiApplication::desktopSettingsAware()) { - const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); - - if (desktopEnvironment == QByteArrayLiteral("KDE")) { -#if QT_CONFIG(settings) - result.push_back(QStringLiteral("kde")); +#if QT_CONFIG(vulkan) +#include "qwaylandvulkaninstance_p.h" +#include "qwaylandvulkanwindow_p.h" #endif - } else if (!desktopEnvironment.isEmpty() && - desktopEnvironment != QByteArrayLiteral("UNKNOWN") && - desktopEnvironment != QByteArrayLiteral("GNOME") && - desktopEnvironment != QByteArrayLiteral("UNITY") && - desktopEnvironment != QByteArrayLiteral("MATE") && - desktopEnvironment != QByteArrayLiteral("XFCE") && - desktopEnvironment != QByteArrayLiteral("LXDE")) - // Ignore X11 desktop environments - result.push_back(QString::fromLocal8Bit(desktopEnvironment.toLower())); - } - if (result.isEmpty()) - result.push_back(QLatin1String(QGenericUnixTheme::name)); +QT_BEGIN_NAMESPACE - return result; - } -}; +namespace QtWaylandClient { QWaylandIntegration::QWaylandIntegration() #if defined(Q_OS_MACOS) @@ -190,6 +163,11 @@ QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) cons && mDisplay->clientBufferIntegration()) return mDisplay->clientBufferIntegration()->createEglWindow(window); +#if QT_CONFIG(vulkan) + if (window->surfaceType() == QSurface::VulkanSurface) + return new QWaylandVulkanWindow(window); +#endif // QT_CONFIG(vulkan) + return new QWaylandShmWindow(window); } @@ -271,7 +249,7 @@ QVariant QWaylandIntegration::styleHint(StyleHint hint) const QPlatformAccessibility *QWaylandIntegration::accessibility() const { if (!mAccessibility) { -#ifndef QT_NO_ACCESSIBILITY_ATSPI_BRIDGE +#if QT_CONFIG(accessibility_atspi_bridge) Q_ASSERT_X(QCoreApplication::eventDispatcher(), "QWaylandIntegration", "Initializing accessibility without event-dispatcher!"); mAccessibility.reset(new QSpiAccessibleBridge()); @@ -302,13 +280,20 @@ QList<int> QWaylandIntegration::possibleKeys(const QKeyEvent *event) const QStringList QWaylandIntegration::themeNames() const { - return GenericWaylandTheme::themeNames(); + return QGenericUnixTheme::themeNames(); } QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) const { - return GenericWaylandTheme::createUnixTheme(name); + return QGenericUnixTheme::createUnixTheme(name); +} + +#if QT_CONFIG(vulkan) +QPlatformVulkanInstance *QWaylandIntegration::createPlatformVulkanInstance(QVulkanInstance *instance) const +{ + return new QWaylandVulkanInstance(instance); } +#endif // QT_CONFIG(vulkan) // May be called from non-GUI threads QWaylandClientBufferIntegration *QWaylandIntegration::clientBufferIntegration() const diff --git a/src/client/qwaylandintegration_p.h b/src/client/qwaylandintegration_p.h index a66999c7f..ff70ae25d 100644 --- a/src/client/qwaylandintegration_p.h +++ b/src/client/qwaylandintegration_p.h @@ -113,6 +113,10 @@ public: QPlatformTheme *createPlatformTheme(const QString &name) const override; +#if QT_CONFIG(vulkan) + QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const override; +#endif + QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, int version, uint32_t id); virtual QWaylandClientBufferIntegration *clientBufferIntegration() const; diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp index b4ecc0090..bf54a1a00 100644 --- a/src/client/qwaylandnativeinterface.cpp +++ b/src/client/qwaylandnativeinterface.cpp @@ -51,6 +51,9 @@ #include <QtGui/private/qguiapplication_p.h> #include <QtGui/QScreen> #include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h> +#if QT_CONFIG(vulkan) +#include <QtWaylandClient/private/qwaylandvulkanwindow_p.h> +#endif #include <QtPlatformHeaders/qwaylandwindowfunctions.h> @@ -117,6 +120,15 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration()) return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay); +#if QT_CONFIG(vulkan) + if (lowerCaseResource == "vksurface") { + if (window->surfaceType() == QSurface::VulkanSurface && window->handle()) { + // return a pointer to the VkSurfaceKHR value, not the value itself + return static_cast<QWaylandVulkanWindow *>(window->handle())->surface(); + } + } +#endif + if (auto shellIntegration = m_integration->shellIntegration()) return shellIntegration->nativeResourceForWindow(resourceString, window); diff --git a/src/client/qwaylandvulkaninstance.cpp b/src/client/qwaylandvulkaninstance.cpp new file mode 100644 index 000000000..5edbd4757 --- /dev/null +++ b/src/client/qwaylandvulkaninstance.cpp @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of 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$ +** +****************************************************************************/ + +#include "qwaylandvulkaninstance_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylandscreen_p.h" +#include "qwaylanddisplay_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandVulkanInstance::QWaylandVulkanInstance(QVulkanInstance *instance) + : m_instance(instance) +{ + loadVulkanLibrary(QStringLiteral("vulkan")); +} + +QWaylandVulkanInstance::~QWaylandVulkanInstance() = default; + +void QWaylandVulkanInstance::createOrAdoptInstance() +{ + QByteArrayList extraExtensions; + extraExtensions << QByteArrayLiteral("VK_KHR_wayland_surface"); + initInstance(m_instance, extraExtensions); + + if (!m_vkInst) + return; + + m_getPhysDevPresSupport = reinterpret_cast<PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR>( + m_vkGetInstanceProcAddr(m_vkInst, "vkGetPhysicalDeviceWaylandPresentationSupportKHR")); + if (!m_getPhysDevPresSupport) + qWarning() << "Failed to find vkGetPhysicalDeviceWaylandPresentationSupportKHR"; +} + +bool QWaylandVulkanInstance::supportsPresent(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + QWindow *window) +{ + if (!m_getPhysDevPresSupport || !m_getPhysDevSurfaceSupport) + return true; + + auto *w = static_cast<QWaylandWindow *>(window->handle()); + if (!w) { + qWarning() << "Attempted to call supportsPresent() without a valid platform window"; + return false; + } + wl_display *display = w->display()->wl_display(); + bool ok = m_getPhysDevPresSupport(physicalDevice, queueFamilyIndex, display); + + VkSurfaceKHR surface = QVulkanInstance::surfaceForWindow(window); + VkBool32 supported = false; + m_getPhysDevSurfaceSupport(physicalDevice, queueFamilyIndex, surface, &supported); + ok &= bool(supported); + + return ok; +} + +VkSurfaceKHR QWaylandVulkanInstance::createSurface(QWaylandWindow *window) +{ + VkSurfaceKHR surface = VK_NULL_HANDLE; + + if (!m_createSurface) { + m_createSurface = reinterpret_cast<PFN_vkCreateWaylandSurfaceKHR>( + m_vkGetInstanceProcAddr(m_vkInst, "vkCreateWaylandSurfaceKHR")); + } + if (!m_createSurface) { + qWarning() << "Failed to find vkCreateWaylandSurfaceKHR"; + return surface; + } + + VkWaylandSurfaceCreateInfoKHR surfaceInfo; + memset(&surfaceInfo, 0, sizeof(surfaceInfo)); + surfaceInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR; + surfaceInfo.display = window->display()->wl_display(); + surfaceInfo.surface = window->wlSurface(); + VkResult err = m_createSurface(m_vkInst, &surfaceInfo, nullptr, &surface); + if (err != VK_SUCCESS) + qWarning("Failed to create Vulkan surface: %d", err); + + return surface; +} + +void QWaylandVulkanInstance::presentAboutToBeQueued(QWindow *window) +{ + auto *w = static_cast<QWaylandWindow *>(window->handle()); + if (!w) { + qWarning() << "Attempted to call presentAboutToBeQueued() without a valid platform window"; + return; + } + w->handleUpdate(); +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/client/qwaylandvulkaninstance_p.h b/src/client/qwaylandvulkaninstance_p.h new file mode 100644 index 000000000..b68293b78 --- /dev/null +++ b/src/client/qwaylandvulkaninstance_p.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of 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$ +** +****************************************************************************/ + +#ifndef QWAYLANDVULKANINSTANCE_P_H +#define QWAYLANDVULKANINSTANCE_P_H + +#if defined(VULKAN_H_) && !defined(VK_USE_PLATFORM_WAYLAND_KHR) +#error "vulkan.h included without Wayland WSI" +#endif + +#define VK_USE_PLATFORM_WAYLAND_KHR + +#include <QtVulkanSupport/private/qbasicvulkanplatforminstance_p.h> +#include <QLibrary> + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandWindow; + +class QWaylandVulkanInstance : public QBasicPlatformVulkanInstance +{ +public: + explicit QWaylandVulkanInstance(QVulkanInstance *instance); + ~QWaylandVulkanInstance() override; + + void createOrAdoptInstance() override; + bool supportsPresent(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, QWindow *window) override; + void presentAboutToBeQueued(QWindow *window) override; + + VkSurfaceKHR createSurface(QWaylandWindow *window); + +private: + QVulkanInstance *m_instance = nullptr; + PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR m_getPhysDevPresSupport = nullptr; + PFN_vkCreateWaylandSurfaceKHR m_createSurface = nullptr; +}; + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif // QWAYLANDVULKANINSTANCE_P_H diff --git a/src/client/qwaylandvulkanwindow.cpp b/src/client/qwaylandvulkanwindow.cpp new file mode 100644 index 000000000..4c67b6b32 --- /dev/null +++ b/src/client/qwaylandvulkanwindow.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "qwaylandvulkanwindow_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandVulkanWindow::QWaylandVulkanWindow(QWindow *window) + : QWaylandWindow(window) +{ +} + +QWaylandVulkanWindow::~QWaylandVulkanWindow() +{ + if (m_surface) { + QVulkanInstance *inst = window()->vulkanInstance(); + if (inst) + static_cast<QWaylandVulkanInstance *>(inst->handle())->destroySurface(m_surface); + } +} + +QWaylandWindow::WindowType QWaylandVulkanWindow::windowType() const +{ + return QWaylandWindow::Vulkan; +} + +VkSurfaceKHR *QWaylandVulkanWindow::surface() +{ + if (m_surface) + return &m_surface; + + QVulkanInstance *vulkanInstance = window()->vulkanInstance(); + if (!vulkanInstance) { + qWarning() << "Attempted to create Vulkan surface without an instance; was QWindow::setVulkanInstance() called?"; + return nullptr; + } + + auto *waylandVulkanInstance = static_cast<QWaylandVulkanInstance *>(vulkanInstance->handle()); + m_surface = waylandVulkanInstance->createSurface(this); + + return &m_surface; +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/client/qwaylandvulkanwindow_p.h b/src/client/qwaylandvulkanwindow_p.h new file mode 100644 index 000000000..d0b2de75d --- /dev/null +++ b/src/client/qwaylandvulkanwindow_p.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QWAYLANDVULKANWINDOW_P_H +#define QWAYLANDVULKANWINDOW_P_H + +#include "qwaylandwindow_p.h" +#include "qwaylandvulkaninstance_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandVulkanWindow : public QWaylandWindow +{ +public: + explicit QWaylandVulkanWindow(QWindow *window); + ~QWaylandVulkanWindow() override; + + WindowType windowType() const override; + + VkSurfaceKHR *surface(); + +private: + VkSurfaceKHR m_surface = VK_NULL_HANDLE; +}; + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif // QWAYLANDVULKANWINDOW_P_H diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index 5f15ca304..c488c2e3f 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -89,7 +89,8 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformW public: enum WindowType { Shm, - Egl + Egl, + Vulkan }; QWaylandWindow(QWindow *window); diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index 52a6614bc..ae0d793d3 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -196,11 +196,11 @@ void QWaylandCompositorPrivate::init() if (!socket_name.isEmpty()) { if (wl_display_add_socket(display, socket_name.constData())) - qFatal("Fatal: Failed to open server socket\n"); + qFatal("Fatal: Failed to open server socket: \"%s\". XDG_RUNTIME_DIR is: \"%s\"\n", socket_name.constData(), getenv("XDG_RUNTIME_DIR")); } else { const char *autoSocketName = wl_display_add_socket_auto(display); if (!autoSocketName) - qFatal("Fatal: Failed to open server socket\n"); + qFatal("Fatal: Failed to open default server socket. XDG_RUNTIME_DIR is: \"%s\"\n", getenv("XDG_RUNTIME_DIR")); socket_name = autoSocketName; emit q->socketNameChanged(socket_name); } diff --git a/src/compositor/configure.json b/src/compositor/configure.json index 46caceff5..2af92ea67 100644 --- a/src/compositor/configure.json +++ b/src/compositor/configure.json @@ -9,14 +9,34 @@ "libraries": { "wayland-server": { "label": "wayland-server", - "test": "wayland", + "headers": "wayland-version.h", + "test": { + "main": [ + "#if WAYLAND_VERSION_MAJOR < 1", + "# error Wayland 1.8.0 or higher required", + "#endif", + "#if WAYLAND_VERSION_MAJOR == 1", + "# if WAYLAND_VERSION_MINOR < 8", + "# error Wayland 1.8.0 or higher required", + "# endif", + "# if WAYLAND_VERSION_MINOR == 8", + "# if WAYLAND_VERSION_MICRO < 0", + "# error Wayland 1.8.0 or higher required", + "# endif", + "# endif", + "#endif" + ] + }, "sources": [ { "type": "pkgConfig", "args": "wayland-server" }, "-lwayland-server" ] }, "wayland-egl": { - "test": "wayland_egl", + "headers": "wayland-egl.h", + "test": { + "main": "struct wl_egl_window *window = wl_egl_window_create(0, 100, 100);" + }, "sources": [ { "type": "pkgConfig", "args": "wayland-egl" }, "-lwayland-egl", @@ -45,14 +65,24 @@ ] }, "xcomposite": { - "test": "xcomposite", + "headers": "X11/extensions/Xcomposite.h", + "test": { + "main": "XCompositeRedirectWindow((Display *)0,(Window) 0, CompositeRedirectManual);" + }, "sources": [ { "type": "pkgConfig", "args": "xcomposite" }, "-lxcomposite" ] }, "glx": { - "test": "glx", + "headers": "GL/glx.h", + "test": { + "main": [ + "Display *dpy = XOpenDisplay(0);", + "int items = 0;", + "GLXFBConfig *fbc = glXChooseFBConfig(dpy, DefaultScreen(dpy), 0 , &items);" + ] + }, "sources": [ { "type": "pkgConfig", "args": "x11 gl" }, "-lX11 -lGl" @@ -68,30 +98,99 @@ }, "drm-egl-server": { "type": "compile", - "test": "drm_egl_server", + "test": { + "include": [ + "EGL/egl.h", + "EGL/eglext.h" + ], + "main": [ + "#ifdef EGL_MESA_drm_image", + "return 0;", + "#else", + "#error Requires EGL_MESA_drm_image to be defined", + "return 1;", + "#endif" + ] + }, "use": "egl" }, "libhybris-egl-server": { "type": "compile", - "test": "libhybris_egl_server", + "test": { + "include": [ + "EGL/egl.h", + "EGL/eglext.h", + "hybris/eglplatformcommon/hybris_nativebufferext.h" + ], + "main": [ + "#ifdef EGL_HYBRIS_native_buffer", + "return 0;", + "#else", + "#error Requires EGL_HYBRIS_native_buffer to be defined", + "return 1;", + "#endif" + ] + }, "use": "egl" }, "dmabuf-server-buffer": { "label": "Linux dma-buf Buffer Sharing", "type": "compile", - "test": "dmabuf_server_buffer", + "test": { + "include": [ + "EGL/egl.h", + "EGL/eglext.h", + "drm_fourcc.h" + ], + "main": [ + "#ifdef EGL_LINUX_DMA_BUF_EXT", + "return 0;", + "#else", + "#error Requires EGL_LINUX_DMA_BUF_EXT", + "return 1;", + "#endif" + ] + }, "use": "egl" }, "dmabuf-client-buffer": { "label": "Linux Client dma-buf Buffer Sharing", "type": "compile", - "test": "dmabuf_client_buffer", + "test": { + "include": [ + "EGL/egl.h", + "EGL/eglext.h", + "drm_mode.h", + "drm_fourcc.h" + ], + "main": [ + "// test if DMA BUF is supported", + "#ifndef EGL_LINUX_DMA_BUF_EXT", + "#error DMA BUF Extension not available", + "#endif", + "// test if DMA BUF import modifier extension is supported", + "#ifndef EGL_EXT_image_dma_buf_import_modifiers", + "#error DMA BUF Import modifier extension not available", + "#endif", + "return 0;" + ] + }, "use": "egl" }, "vulkan-server-buffer": { "label": "Vulkan Buffer Sharing", "type": "compile", - "test": "vulkan_server_buffer" + "test": { + "include": [ + "vulkan/vulkan.h" + ], + "main": [ + "VkExportMemoryAllocateInfoKHR exportAllocInfo = {};", + "exportAllocInfo.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR;", + "exportAllocInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR;", + "return 0;" + ] + } } }, diff --git a/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro b/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro index 53f7af8aa..c89ecec00 100644 --- a/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro +++ b/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro @@ -5,6 +5,8 @@ OTHER_FILES += brcm-egl.json SOURCES += \ main.cpp +TARGET = qt-wayland-compositor-brcm-egl + include(../../../../hardwareintegration/compositor/brcm-egl/brcm-egl.pri) PLUGIN_TYPE = wayland-graphics-integration-server diff --git a/src/plugins/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pro b/src/plugins/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pro index 1601a384c..d96e58135 100644 --- a/src/plugins/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pro +++ b/src/plugins/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pro @@ -5,7 +5,9 @@ OTHER_FILES += dmabuf-server.json SOURCES += \ main.cpp -include($PWD/../../../../../hardwareintegration/compositor/dmabuf-server/dmabuf-server.pri) +TARGET = qt-wayland-compositor-dmabuf-server-buffer + +include(../../../../hardwareintegration/compositor/dmabuf-server/dmabuf-server.pri) PLUGIN_TYPE = wayland-graphics-integration-server PLUGIN_CLASS_NAME = DmaBufServerBufferIntegrationPlugin diff --git a/src/plugins/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pro b/src/plugins/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pro index 040031122..2ba17c388 100644 --- a/src/plugins/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pro +++ b/src/plugins/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pro @@ -5,7 +5,9 @@ OTHER_FILES += drm-egl-server.json SOURCES += \ main.cpp -include($PWD/../../../../../hardwareintegration/compositor/drm-egl-server/drm-egl-server.pri) +TARGET = qt-wayland-compositor-drm-egl-server-buffer + +include(../../../../hardwareintegration/compositor/drm-egl-server/drm-egl-server.pri) PLUGIN_TYPE = wayland-graphics-integration-server PLUGIN_CLASS_NAME = DrmEglServerBufferIntegrationPlugin diff --git a/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2.pro b/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2.pro index ff16b20bf..c18884a96 100644 --- a/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2.pro +++ b/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2.pro @@ -7,7 +7,9 @@ OTHER_FILES += vsp2.json SOURCES += \ main.cpp -include($PWD/../../../../../../hardwareintegration/compositor/hardwarelayer/vsp2/vsp2.pri) +TARGET = qt-wayland-compositor-vsp2 + +include(../../../../../hardwareintegration/compositor/hardwarelayer/vsp2/vsp2.pri) PLUGIN_TYPE = wayland-hardware-layer-integration PLUGIN_CLASS_NAME = Vsp2HardwareLayerIntegrationPlugin diff --git a/src/plugins/hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pro b/src/plugins/hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pro index 9e28c7e8c..c9c3a0daf 100644 --- a/src/plugins/hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pro +++ b/src/plugins/hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pro @@ -5,7 +5,9 @@ OTHER_FILES += libhybris-egl-server.json SOURCES += \ main.cpp -include($PWD/../../../../../hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pri) +TARGET = qt-wayland-compositor-libybris-egl-server.json + +include(../../../../hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pri) PLUGIN_TYPE = wayland-graphics-integration-server PLUGIN_CLASS_NAME = LibHybrisEglServerBufferIntegrationPlugin diff --git a/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pro b/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pro index bc4311423..1f76f9f00 100644 --- a/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pro +++ b/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pro @@ -5,6 +5,8 @@ OTHER_FILES += linux-dmabuf.json SOURCES += \ main.cpp \ +TARGET = qt-wayland-compositor-linux-dmabuf-unstable-v1 + include(../../../../hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pri) PLUGIN_TYPE = wayland-graphics-integration-server diff --git a/src/plugins/hardwareintegration/compositor/shm-emulation-server/shm-emulation-server.pro b/src/plugins/hardwareintegration/compositor/shm-emulation-server/shm-emulation-server.pro index 56a1bac21..865af1a7d 100644 --- a/src/plugins/hardwareintegration/compositor/shm-emulation-server/shm-emulation-server.pro +++ b/src/plugins/hardwareintegration/compositor/shm-emulation-server/shm-emulation-server.pro @@ -5,7 +5,9 @@ OTHER_FILES += shm-emulation-server.json SOURCES += \ main.cpp -include($PWD/../../../../../hardwareintegration/compositor/shm-emulation-server/shm-emulation-server.pri) +TARGET = qt-wayland-compositor-shm-emulation-server + +include(../../../../hardwareintegration/compositor/shm-emulation-server/shm-emulation-server.pri) PLUGIN_TYPE = wayland-graphics-integration-server PLUGIN_CLASS_NAME = ShmServerBufferIntegrationPlugin diff --git a/src/plugins/hardwareintegration/compositor/vulkan-server/vulkan-server.pro b/src/plugins/hardwareintegration/compositor/vulkan-server/vulkan-server.pro index 053654218..dc82c3f26 100644 --- a/src/plugins/hardwareintegration/compositor/vulkan-server/vulkan-server.pro +++ b/src/plugins/hardwareintegration/compositor/vulkan-server/vulkan-server.pro @@ -5,7 +5,9 @@ OTHER_FILES += vulkan-server.json SOURCES += \ main.cpp -include($PWD/../../../../../hardwareintegration/compositor/vulkan-server/vulkan-server.pri) +TARGET = qt-wayland-compositor-vulkan-server + +include(../../../../hardwareintegration/compositor/vulkan-server/vulkan-server.pri) PLUGIN_TYPE = wayland-graphics-integration-server PLUGIN_CLASS_NAME = VulkanServerBufferIntegrationPlugin diff --git a/src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.pro b/src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.pro index 6aecefffd..d452220c5 100644 --- a/src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.pro +++ b/src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.pro @@ -5,7 +5,7 @@ OTHER_FILES += wayland-egl.json SOURCES += \ main.cpp -TARGET = qt-plugin-wayland-egl +TARGET = qt-wayland-compositor-wayland-egl include(../../../../hardwareintegration/compositor/wayland-egl/wayland-egl.pri) diff --git a/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pro b/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pro index f1ca7183a..6d259a687 100644 --- a/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pro +++ b/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pro @@ -5,6 +5,8 @@ OTHER_FILES += wayland-eglstream-controller.json SOURCES += \ main.cpp \ +TARGET = qt-wayland-compositor-wayland-eglstream-controller + include(../../../../hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pri) PLUGIN_TYPE = wayland-graphics-integration-server diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pro b/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pro index 7c391bd1c..298ed2fc6 100644 --- a/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pro +++ b/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pro @@ -5,6 +5,8 @@ OTHER_FILES += xcomposite-egl.json SOURCES += \ main.cpp +TARGET = qt-wayland-compositor-xcomposite-egl + include(../../../../hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri) PLUGIN_TYPE = wayland-graphics-integration-server diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pro b/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pro index 0f49471da..41e5c2ec5 100644 --- a/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pro +++ b/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pro @@ -5,6 +5,8 @@ OTHER_FILES += xcomposite-glx.json SOURCES += \ main.cpp +TARGET = qt-wayland-compositor-xcomposite-glx + include(../../../../hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri) PLUGIN_TYPE = wayland-graphics-integration-server diff --git a/src/qtwaylandscanner/qtwaylandscanner.cpp b/src/qtwaylandscanner/qtwaylandscanner.cpp index 9691b857f..24977a2f2 100644 --- a/src/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/qtwaylandscanner/qtwaylandscanner.cpp @@ -92,7 +92,7 @@ private: }; bool isServerSide(); - bool parseOption(const char *str); + bool parseOption(const QByteArray &str); QByteArray byteArrayValue(const QXmlStreamReader &xml, const char *name); int intValue(const QXmlStreamReader &xml, const char *name, int defaultValue = 0); @@ -123,29 +123,55 @@ private: QByteArray m_scannerName; QByteArray m_headerPath; QByteArray m_prefix; + QVector <QByteArray> m_includes; QXmlStreamReader *m_xml = nullptr; }; bool Scanner::parseArguments(int argc, char **argv) { - m_scannerName = argv[0]; + QVector<QByteArray> args; + args.reserve(argc); + for (int i = 0; i < argc; ++i) + args << QByteArray(argv[i]); - if (argc <= 2 || !parseOption(argv[1])) + m_scannerName = args[0]; + + if (argc <= 2 || !parseOption(args[1])) return false; - m_protocolFilePath = QByteArray(argv[2]); + m_protocolFilePath = args[2]; - if (argc >= 4) - m_headerPath = QByteArray(argv[3]); - if (argc == 5) - m_prefix = QByteArray(argv[4]); + if (argc > 3 && !args[3].startsWith('-')) { + // legacy positional arguments + m_headerPath = args[3]; + if (argc == 5) + m_prefix = args[4]; + } else { + // --header-path=<path> (14 characters) + // --prefix=<prefix> (9 characters) + // --add-include=<include> (14 characters) + for (int pos = 3; pos < argc; pos++) { + const QByteArray &option = args[pos]; + if (option.startsWith("--header-path=")) { + m_headerPath = option.mid(14); + } else if (option.startsWith("--prefix=")) { + m_prefix = option.mid(10); + } else if (option.startsWith("--add-include=")) { + auto include = option.mid(14); + if (!include.isEmpty()) + m_includes << include; + } else { + return false; + } + } + } return true; } void Scanner::printUsage() { - fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile [header-path] [prefix]\n", m_scannerName.constData()); + fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile [--header-path=<path>] [--prefix=<prefix>] [--add-include=<include>]\n", m_scannerName.constData()); } bool Scanner::isServerSide() @@ -153,15 +179,15 @@ bool Scanner::isServerSide() return m_option == ServerHeader || m_option == ServerCode; } -bool Scanner::parseOption(const char *str) +bool Scanner::parseOption(const QByteArray &str) { - if (str == QLatin1String("client-header")) + if (str == "client-header") m_option = ClientHeader; - else if (str == QLatin1String("server-header")) + else if (str == "server-header") m_option = ServerHeader; - else if (str == QLatin1String("client-code")) + else if (str == "client-code") m_option = ClientCode; - else if (str == QLatin1String("server-code")) + else if (str == "server-code") m_option = ServerCode; else return false; @@ -441,6 +467,9 @@ bool Scanner::process() if (m_xml->hasError()) return false; + for (auto b : qAsConst(m_includes)) + printf("#include %s\n", b.constData()); + if (m_option == ServerHeader) { QByteArray inclusionGuard = QByteArray("QT_WAYLAND_SERVER_") + preProcessorProtocolName.constData(); printf("#ifndef %s\n", inclusionGuard.constData()); diff --git a/tests/auto/client/inputcontext/tst_inputcontext.cpp b/tests/auto/client/inputcontext/tst_inputcontext.cpp index 3e6de4a08..1f07eb520 100644 --- a/tests/auto/client/inputcontext/tst_inputcontext.cpp +++ b/tests/auto/client/inputcontext/tst_inputcontext.cpp @@ -58,8 +58,6 @@ private: QByteArray mComposeModule = QByteArray("QComposeInputContext"); // default input context QByteArray mIbusModule = QByteArray("QIBusPlatformInputContext"); QByteArray mWaylandModule = QByteArray("QtWaylandClient::QWaylandInputContext"); - - TextInputManager *mTextInputManager = nullptr; }; void tst_inputcontext::initTestCase() |