diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2023-03-22 14:22:54 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2023-04-04 09:00:09 +0000 |
commit | caf5f383ac53401dc2749f43ce46a208fe8738c9 (patch) | |
tree | 83c5829aa0e9df218c59e45383dc846496cfc778 /src | |
parent | fb64f8720e291d3c56778fafd8cc6d7fe3fb15ea (diff) | |
download | qtwebengine-caf5f383ac53401dc2749f43ce46a208fe8738c9.tar.gz |
Fix building on Windows and macOS with chromium EGL
Pick-to: 6.5
Change-Id: I6c7b37d7c53ff9ed872f5f95660c6cf7520e6bda
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/compositor/vulkan_implementation_qt.cpp | 2 | ||||
-rw-r--r-- | src/core/ozone/gl_context_qt.cpp | 11 | ||||
-rw-r--r-- | src/core/ozone/gl_surface_egl_qt.cpp | 14 | ||||
-rw-r--r-- | src/core/ozone/gl_surface_qt.cpp | 64 |
4 files changed, 34 insertions, 57 deletions
diff --git a/src/core/compositor/vulkan_implementation_qt.cpp b/src/core/compositor/vulkan_implementation_qt.cpp index 1d8187334..e18841e90 100644 --- a/src/core/compositor/vulkan_implementation_qt.cpp +++ b/src/core/compositor/vulkan_implementation_qt.cpp @@ -133,7 +133,7 @@ SemaphoreHandle VulkanImplementationQt::GetSemaphoreHandle(VkDevice vk_device, VkExternalMemoryHandleTypeFlagBits VulkanImplementationQt::GetExternalImageHandleType() { -#ifdef BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_WIN) return VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT; #else return VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; diff --git a/src/core/ozone/gl_context_qt.cpp b/src/core/ozone/gl_context_qt.cpp index 08d626063..40fa92b99 100644 --- a/src/core/ozone/gl_context_qt.cpp +++ b/src/core/ozone/gl_context_qt.cpp @@ -174,20 +174,15 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, GLSurface* compatible_surface, const GLContextAttribs& attribs) { - scoped_refptr<GLContext> context; if (GetGLImplementation() == kGLImplementationDesktopGL) { - context = new GLContextWGL(share_group); + scoped_refptr<GLContext> context = new GLContextWGL(share_group); if (!context->Initialize(compatible_surface, attribs)) return nullptr; return context; - } else { - context = new GLContextEGL(share_group); } - if (!GLContextHelper::initializeContext(context.get(), compatible_surface, attribs)) - return nullptr; - - return context; + return InitializeGLContext(new GLContextEGL(share_group), + compatible_surface, attribs); } } // namespace init diff --git a/src/core/ozone/gl_surface_egl_qt.cpp b/src/core/ozone/gl_surface_egl_qt.cpp index de973e390..b83f8f506 100644 --- a/src/core/ozone/gl_surface_egl_qt.cpp +++ b/src/core/ozone/gl_surface_egl_qt.cpp @@ -15,12 +15,7 @@ #include "ui/gl/gl_surface_egl.h" #include "ui/gl/init/gl_factory.h" -#if !BUILDFLAG(IS_MAC) -// From ANGLE's egl/eglext.h. -#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle -#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1 -#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200 -#endif +#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_WIN) using ui::GetLastEGLErrorString; @@ -270,11 +265,6 @@ void* GLSurfacelessQtEGL::GetShareHandle() return NULL; } -} // namespace gl -#endif // !BUILDFLAG(IS_MAC) - -namespace gl { - std::string DisplayExtensionsEGL::GetPlatformExtensions(EGLDisplay) { EGLDisplay display = GLContextHelper::getEGLDisplay(); @@ -284,4 +274,6 @@ std::string DisplayExtensionsEGL::GetPlatformExtensions(EGLDisplay) const char* str = eglQueryString(display, EGL_EXTENSIONS); return str ? std::string(str) : ""; } + } // namespace gl +#endif // !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_WIN) diff --git a/src/core/ozone/gl_surface_qt.cpp b/src/core/ozone/gl_surface_qt.cpp index fad3ccc11..b6242b427 100644 --- a/src/core/ozone/gl_surface_qt.cpp +++ b/src/core/ozone/gl_surface_qt.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2023 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. @@ -19,8 +19,11 @@ #include "ozone/gl_surface_egl_qt.h" #include "gpu/ipc/service/image_transport_surface.h" +#include "ui/gl/direct_composition_support.h" +#include "ui/gl/gl_display.h" #include "ui/gl/gl_implementation.h" -#include "ui/gl/direct_composition_surface_win.h" +#include "ui/gl/gl_surface_egl.h" +#include "ui/gl/gl_utils.h" #include "ui/gl/vsync_provider_win.h" #endif @@ -93,13 +96,26 @@ gl::GLDisplay *InitializeGLOneOffPlatform(uint64_t system_device_id) { VSyncProviderWin::InitializeOneOff(); - if (GetGLImplementation() == kGLImplementationEGLGLES2 || GetGLImplementation() == kGLImplementationEGLANGLE) - return GLSurfaceEGLQt::InitializeOneOff(system_device_id); - if (GetGLImplementation() == kGLImplementationDesktopGL || GetGLImplementation() == kGLImplementationDesktopGLCoreProfile) return GLSurfaceWGLQt::InitializeOneOff(system_device_id); - return nullptr; + GLDisplayEGL *display = GetDisplayEGL(system_device_id); + switch (GetGLImplementation()) { + case kGLImplementationEGLANGLE: + case kGLImplementationEGLGLES2: + if (!display->Initialize(EGLDisplayPlatform(GetDC(nullptr)))) { + LOG(ERROR) << "GLDisplayEGL::Initialize failed."; + return nullptr; + } + InitializeDirectComposition(display); + break; + case kGLImplementationMockGL: + case kGLImplementationStubGL: + break; + default: + NOTREACHED(); + } + return display; } bool usingSoftwareDynamicGL() @@ -125,21 +141,10 @@ CreateOffscreenGLSurfaceWithFormat(GLDisplay *display, const gfx::Size& size, GL } case kGLImplementationEGLANGLE: case kGLImplementationEGLGLES2: { - surface = new GLSurfaceEGLQt(static_cast<gl::GLDisplayEGL*>(display), size); - if (surface->Initialize(format)) - return surface; - - // Surfaceless context will be used ONLY if pseudo surfaceless context - // is not available since some implementations of surfaceless context - // have problems. (e.g. QTBUG-57290) - if (GLSurfaceEGLQt::g_egl_surfaceless_context_supported) { - surface = new GLSurfacelessQtEGL(static_cast<gl::GLDisplayEGL*>(display), size); - if (surface->Initialize(format)) - return surface; - } - LOG(ERROR) << "eglCreatePbufferSurface failed and surfaceless context not available"; - LOG(WARNING) << "Failed to create offscreen GL surface"; - break; + GLDisplayEGL *display_egl = display->GetAs<gl::GLDisplayEGL>(); + if (display_egl->IsEGLSurfacelessContextSupported() && size.width() == 0 && size.height() == 0) + return InitializeGLSurfaceWithFormat(new SurfacelessEGL(display_egl, size), format); + return InitializeGLSurfaceWithFormat(new PbufferGLSurfaceEGL(display_egl, size), format); } default: break; @@ -150,9 +155,8 @@ CreateOffscreenGLSurfaceWithFormat(GLDisplay *display, const gfx::Size& size, GL } scoped_refptr<GLSurface> -CreateViewGLSurface(gfx::AcceleratedWidget window) +CreateViewGLSurface(GLDisplay *display, gfx::AcceleratedWidget window) { - QT_NOT_USED return nullptr; } @@ -160,18 +164,4 @@ CreateViewGLSurface(gfx::AcceleratedWidget window) #endif // BUILDFLAG(IS_WIN) } // namespace gl -#if BUILDFLAG(IS_WIN) -namespace gpu { -class GpuCommandBufferStub; -class GpuChannelManager; -scoped_refptr<gl::GLSurface> ImageTransportSurface::CreateNativeSurface(gl::GLDisplay *, - base::WeakPtr<ImageTransportSurfaceDelegate>, - SurfaceHandle, gl::GLSurfaceFormat) -{ - QT_NOT_USED - return scoped_refptr<gl::GLSurface>(); -} -} // namespace gpu -#endif // BUILDFLAG(IS_WIN) - #endif // !defined(Q_OS_MACOS) |