summaryrefslogtreecommitdiffstats
path: root/src/core/ozone
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2022-10-27 14:33:16 +0200
committerPeter Varga <pvarga@inf.u-szeged.hu>2022-11-10 09:42:16 +0100
commitb32f5e5b495ef73f25d3156d24a83fffd33f02be (patch)
tree5651504ad55f3609163c85879e0ac6d726c6db27 /src/core/ozone
parent6fb80f47941b555f1a9455d3bd3d189b90092b60 (diff)
Add Vulkan rendering support
Updates 3rdparty: * 8b7ce4ef70d Make GrVkImage external Task-number: QTBUG-107669 Change-Id: If7fbe1f20538598dd1d4f3a67be17c9f7d06a3cd Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/ozone')
-rw-r--r--src/core/ozone/ozone_platform_qt.cpp17
-rw-r--r--src/core/ozone/surface_factory_qt.cpp19
-rw-r--r--src/core/ozone/surface_factory_qt.h4
3 files changed, 39 insertions, 1 deletions
diff --git a/src/core/ozone/ozone_platform_qt.cpp b/src/core/ozone/ozone_platform_qt.cpp
index 8ab3aa1a7..71315a049 100644
--- a/src/core/ozone/ozone_platform_qt.cpp
+++ b/src/core/ozone/ozone_platform_qt.cpp
@@ -4,6 +4,7 @@
#include "ozone_platform_qt.h"
#if defined(USE_OZONE)
+#include "base/no_destructor.h"
#include "ui/base/buildflags.h"
#include "ui/base/ime/input_method.h"
#include "ui/display/types/native_display_delegate.h"
@@ -52,6 +53,8 @@ public:
ui::OverlayManagerOzone* GetOverlayManager() override;
std::unique_ptr<InputMethod> CreateInputMethod(internal::InputMethodDelegate *delegate, gfx::AcceleratedWidget widget) override;
std::unique_ptr<ui::PlatformScreen> CreateScreen() override { return nullptr; }
+ const PlatformProperties &GetPlatformProperties() override;
+
private:
bool InitializeUI(const ui::OzonePlatform::InitParams &) override;
void InitializeGPU(const ui::OzonePlatform::InitParams &) override;
@@ -76,6 +79,20 @@ OzonePlatformQt::OzonePlatformQt() {}
OzonePlatformQt::~OzonePlatformQt() {}
+const ui::OzonePlatform::PlatformProperties &OzonePlatformQt::GetPlatformProperties()
+{
+ static base::NoDestructor<ui::OzonePlatform::PlatformProperties> properties;
+ static bool initialized = false;
+ if (!initialized) {
+ properties->uses_external_vulkan_image_factory = true;
+ properties->fetch_buffer_formats_for_gmb_on_gpu = true;
+
+ initialized = true;
+ }
+
+ return *properties;
+}
+
ui::SurfaceFactoryOzone* OzonePlatformQt::GetSurfaceFactoryOzone()
{
return surface_factory_ozone_.get();
diff --git a/src/core/ozone/surface_factory_qt.cpp b/src/core/ozone/surface_factory_qt.cpp
index 33164d076..13c1a7b11 100644
--- a/src/core/ozone/surface_factory_qt.cpp
+++ b/src/core/ozone/surface_factory_qt.cpp
@@ -10,6 +10,12 @@
#include "ozone/gl_ozone_glx_qt.h"
#endif
+#include "qtwebenginecoreglobal_p.h"
+
+#if QT_CONFIG(webengine_vulkan)
+#include "compositor/vulkan_implementation_qt.h"
+#endif
+
namespace QtWebEngineCore {
SurfaceFactoryQt::SurfaceFactoryQt()
@@ -27,7 +33,6 @@ SurfaceFactoryQt::SurfaceFactoryQt()
gl::GLImplementationParts(gl::kGLImplementationDisabled) };
m_ozone.reset(new ui::GLOzoneEGLQt());
} else {
- qWarning("No suitable graphics backend found\n");
m_impl = { gl::GLImplementationParts(gl::kGLImplementationDisabled) };
}
}
@@ -41,6 +46,18 @@ ui::GLOzone *SurfaceFactoryQt::GetGLOzone(const gl::GLImplementationParts &imple
{
return m_ozone.get();
}
+#if BUILDFLAG(ENABLE_VULKAN)
+std::unique_ptr<gpu::VulkanImplementation>
+SurfaceFactoryQt::CreateVulkanImplementation(bool /*allow_protected_memory*/,
+ bool /*enforce_protected_memory*/)
+{
+#if QT_CONFIG(webengine_vulkan)
+ return std::make_unique<gpu::VulkanImplementationQt>();
+#else
+ return nullptr;
+#endif
+}
+#endif
} // namespace QtWebEngineCore
#endif // defined(USE_OZONE)
diff --git a/src/core/ozone/surface_factory_qt.h b/src/core/ozone/surface_factory_qt.h
index 767b69b85..bfcfa014b 100644
--- a/src/core/ozone/surface_factory_qt.h
+++ b/src/core/ozone/surface_factory_qt.h
@@ -16,6 +16,10 @@ public:
SurfaceFactoryQt();
std::vector<gl::GLImplementationParts> GetAllowedGLImplementations() override;
ui::GLOzone *GetGLOzone(const gl::GLImplementationParts &implementation) override;
+#if BUILDFLAG(ENABLE_VULKAN)
+ std::unique_ptr<gpu::VulkanImplementation>
+ CreateVulkanImplementation(bool allow_protected_memory, bool enforce_protected_memory) override;
+#endif
private:
std::vector<gl::GLImplementationParts> m_impl;
std::unique_ptr<ui::GLOzone> m_ozone;