summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2024-01-17 09:18:24 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-03-06 21:02:32 +0000
commitf23d604b7b4fd06c6cd2f97ae05934d294c8c443 (patch)
treedf04655cde70c8f9d133c6b01e7903a9cc09a737
parentc732837107e3d4fb172ce0a7d4cf4831b312922e (diff)
Fix Vulkan rendering with disabled VAAPI
NativePixmap and GPU memory buffer support was only used by VAAPI. After "b79349aad Move Vulkan support to NativeSkiaOutputDevice", vulkan rendering also relies on NativePixmap. Remove VAAPI guards around NativePixmap usage. Change-Id: I7958bab100869dc5d6da07ad4c78998ec34f4a2a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 501155b9ec907574776a382fed2c187a426fdd94) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/core/configure/BUILD.root.gn.in24
-rw-r--r--src/core/ozone/gl_ozone_egl_qt.cpp13
-rw-r--r--src/core/ozone/ozone_platform_qt.cpp21
-rw-r--r--src/core/ozone/surface_factory_qt.cpp8
4 files changed, 21 insertions, 45 deletions
diff --git a/src/core/configure/BUILD.root.gn.in b/src/core/configure/BUILD.root.gn.in
index eeab54ab4..43b9faa3a 100644
--- a/src/core/configure/BUILD.root.gn.in
+++ b/src/core/configure/BUILD.root.gn.in
@@ -371,21 +371,23 @@ source_set("qtwebengine_sources") {
"//components/embedder_support/user_agent_utils.cc",
"//components/embedder_support/user_agent_utils.h",
]
- if (use_vaapi_x11) {
- deps += [
- "//ui/base/x:gl",
- "//ui/gfx/linux:gpu_memory_buffer_support_x11",
- ]
- sources += [
- "//ui/ozone/platform/x11/gl_egl_utility_x11.cc",
- "//ui/ozone/platform/x11/gl_egl_utility_x11.h",
- ]
- }
- if (use_vaapi) {
+ if (use_ozone) {
sources += [
"//ui/ozone/platform/wayland/gpu/wayland_gl_egl_utility.cc",
"//ui/ozone/platform/wayland/gpu/wayland_gl_egl_utility.h",
]
+
+ if (ozone_platform_x11) {
+ deps += [
+ "//ui/base/x:gl",
+ "//ui/gfx/linux:gpu_memory_buffer_support_x11",
+ ]
+
+ sources += [
+ "//ui/ozone/platform/x11/gl_egl_utility_x11.cc",
+ "//ui/ozone/platform/x11/gl_egl_utility_x11.h",
+ ]
+ }
}
if (enable_extensions) {
deps += [
diff --git a/src/core/ozone/gl_ozone_egl_qt.cpp b/src/core/ozone/gl_ozone_egl_qt.cpp
index 7b27fb921..26d11df31 100644
--- a/src/core/ozone/gl_ozone_egl_qt.cpp
+++ b/src/core/ozone/gl_ozone_egl_qt.cpp
@@ -81,11 +81,7 @@ gl::EGLDisplayPlatform GLOzoneEGLQt::GetNativeDisplay()
bool GLOzoneEGLQt::CanImportNativePixmap()
{
-#if BUILDFLAG(USE_VAAPI)
return gl::GLSurfaceEGL::GetGLDisplayEGL()->ext->b_EGL_EXT_image_dma_buf_import;
-#else
- return false;
-#endif
}
std::unique_ptr<NativePixmapGLBinding> GLOzoneEGLQt::ImportNativePixmap(
@@ -97,13 +93,8 @@ std::unique_ptr<NativePixmapGLBinding> GLOzoneEGLQt::ImportNativePixmap(
GLenum target,
GLuint texture_id)
{
-#if BUILDFLAG(USE_VAAPI)
- return NativePixmapEGLBinding::Create(pixmap, plane_format, plane,
- plane_size, color_space, target,
- texture_id);
-#else
- return nullptr;
-#endif
+ return NativePixmapEGLBinding::Create(pixmap, plane_format, plane, plane_size, color_space,
+ target, texture_id);
}
} // namespace ui
diff --git a/src/core/ozone/ozone_platform_qt.cpp b/src/core/ozone/ozone_platform_qt.cpp
index 12a204f20..cc56b1c09 100644
--- a/src/core/ozone/ozone_platform_qt.cpp
+++ b/src/core/ozone/ozone_platform_qt.cpp
@@ -39,9 +39,11 @@
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>
#include <filesystem>
+#endif // BUILDFLAG(USE_XKBCOMMON)
+#if BUILDFLAG(OZONE_PLATFORM_X11)
extern void *GetQtXDisplay();
-#endif // BUILDFLAG(USE_XKBCOMMON)
+#endif
namespace ui {
@@ -68,9 +70,8 @@ public:
const PlatformRuntimeProperties &GetPlatformRuntimeProperties() override
{
static OzonePlatform::PlatformRuntimeProperties properties;
-#if BUILDFLAG(USE_VAAPI)
if (has_initialized_gpu()) {
-#if BUILDFLAG(USE_VAAPI_X11)
+#if BUILDFLAG(OZONE_PLATFORM_X11)
if (GetQtXDisplay()) {
// This property is set when the GetPlatformRuntimeProperties is
// called on the gpu process side.
@@ -79,7 +80,6 @@ public:
#endif
properties.supports_native_pixmaps = true; // buffer_manager_->GetGbmDevice() != nullptr
}
-#endif
return properties;
}
bool IsNativePixmapConfigSupported(gfx::BufferFormat format, gfx::BufferUsage usage) const override;
@@ -239,7 +239,7 @@ void OzonePlatformQt::InitializeGPU(const ui::OzonePlatform::InitParams &params)
{
surface_factory_ozone_.reset(new QtWebEngineCore::SurfaceFactoryQt());
-#if BUILDFLAG(OZONE_PLATFORM_X11) && BUILDFLAG(USE_VAAPI_X11)
+#if BUILDFLAG(OZONE_PLATFORM_X11)
if (params.enable_native_gpu_memory_buffers) {
base::ThreadPool::PostTask(FROM_HERE,
base::BindOnce([]()
@@ -258,16 +258,11 @@ std::unique_ptr<InputMethod> OzonePlatformQt::CreateInputMethod(ImeKeyEventDispa
bool OzonePlatformQt::IsNativePixmapConfigSupported(gfx::BufferFormat format, gfx::BufferUsage usage) const
{
-#if BUILDFLAG(USE_VAAPI)
return gfx::ClientNativePixmapDmaBuf::IsConfigurationSupported(format, usage);
-#else
- return false;
-#endif
}
PlatformGLEGLUtility *OzonePlatformQt::GetPlatformGLEGLUtility()
{
-#if BUILDFLAG(USE_VAAPI)
if (!gl_egl_utility_) {
#if BUILDFLAG(OZONE_PLATFORM_X11)
if (GetQtXDisplay())
@@ -276,22 +271,16 @@ PlatformGLEGLUtility *OzonePlatformQt::GetPlatformGLEGLUtility()
#endif
gl_egl_utility_ = std::make_unique<WaylandGLEGLUtility>();
}
-#endif
return gl_egl_utility_.get();
}
-
} // namespace
OzonePlatform* CreateOzonePlatformQt() { return new OzonePlatformQt; }
gfx::ClientNativePixmapFactory *CreateClientNativePixmapFactoryQt()
{
-#if BUILDFLAG(USE_VAAPI)
return gfx::CreateClientNativePixmapFactoryDmabuf();
-#else
- return CreateStubClientNativePixmapFactory();
-#endif
}
} // namespace ui
diff --git a/src/core/ozone/surface_factory_qt.cpp b/src/core/ozone/surface_factory_qt.cpp
index 1b37c4a68..0043cd70b 100644
--- a/src/core/ozone/surface_factory_qt.cpp
+++ b/src/core/ozone/surface_factory_qt.cpp
@@ -68,15 +68,11 @@ SurfaceFactoryQt::CreateVulkanImplementation(bool /*allow_protected_memory*/,
bool SurfaceFactoryQt::CanCreateNativePixmapForFormat(gfx::BufferFormat format)
{
-#if BUILDFLAG(USE_VAAPI)
#if defined(USE_GLX)
if (GLContextHelper::getGlxPlatformInterface())
return ui::GpuMemoryBufferSupportX11::GetInstance()->CanCreateNativePixmapForFormat(format);
#endif
return ui::SurfaceFactoryOzone::CanCreateNativePixmapForFormat(format);
-#else // !BUILDFLAG(USE_VAAPI)
- return false;
-#endif // BUILDFLAG(USE_VAAPI)
}
scoped_refptr<gfx::NativePixmap> SurfaceFactoryQt::CreateNativePixmap(
@@ -89,7 +85,7 @@ scoped_refptr<gfx::NativePixmap> SurfaceFactoryQt::CreateNativePixmap(
{
if (framebuffer_size && !gfx::Rect(size).Contains(gfx::Rect(*framebuffer_size)))
return nullptr;
-#if defined(USE_GLX) && BUILDFLAG(USE_VAAPI)
+#if defined(USE_GLX)
if (GLContextHelper::getGlxPlatformInterface()) {
scoped_refptr<gfx::NativePixmapDmaBuf> pixmap;
auto buffer = ui::GpuMemoryBufferSupportX11::GetInstance()->CreateBuffer(format, size, usage);
@@ -126,7 +122,6 @@ SurfaceFactoryQt::CreateNativePixmapFromHandle(
gfx::BufferFormat format,
gfx::NativePixmapHandle handle)
{
-#if BUILDFLAG(USE_VAAPI)
#if defined(USE_GLX)
if (GLContextHelper::getGlxPlatformInterface()) {
scoped_refptr<gfx::NativePixmapDmaBuf> pixmap;
@@ -140,7 +135,6 @@ SurfaceFactoryQt::CreateNativePixmapFromHandle(
#endif
if (GLContextHelper::getEglPlatformInterface())
return base::MakeRefCounted<gfx::NativePixmapDmaBuf>(size, format, std::move(handle));
-#endif
return nullptr;
}