From e4632beaa2e7411595bc4398bba3882668cf3851 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 11 Apr 2024 13:56:51 +0200 Subject: Fix -no-opengl build Pick-to: 6.7 Change-Id: Ibb6cb75a25f9b6d69ec03bc2c6734a869ab21899 Reviewed-by: Allan Sandfeld Jensen --- src/core/ozone/gl_context_qt.cpp | 4 ++-- src/core/ozone/gl_context_qt.h | 7 ++++--- src/core/ozone/surface_factory_qt.cpp | 15 ++++++++++++++- 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/core/ozone/gl_context_qt.cpp b/src/core/ozone/gl_context_qt.cpp index 608d5c21a..0042f2bce 100644 --- a/src/core/ozone/gl_context_qt.cpp +++ b/src/core/ozone/gl_context_qt.cpp @@ -175,7 +175,7 @@ bool GLContextHelper::isCreateContextRobustnessSupported() return contextHelper->m_robustness; } -#if defined(USE_OZONE) +#if QT_CONFIG(opengl) && defined(USE_OZONE) class ScopedGLContext { public: @@ -363,7 +363,7 @@ bool EGLHelper::isDmaBufSupported() close(fd); return true; } -#endif // defined(USE_OZONE) +#endif // QT_CONFIG(opengl) && defined(USE_OZONE) QT_END_NAMESPACE diff --git a/src/core/ozone/gl_context_qt.h b/src/core/ozone/gl_context_qt.h index c1524abf2..bd1137053 100644 --- a/src/core/ozone/gl_context_qt.h +++ b/src/core/ozone/gl_context_qt.h @@ -6,10 +6,11 @@ #include #include +#include #include "ui/gl/gl_context.h" -#if defined(USE_OZONE) +#if QT_CONFIG(opengl) && defined(USE_OZONE) #include #include #endif @@ -45,7 +46,7 @@ private: bool m_robustness = false; }; -#if defined(USE_OZONE) +#if QT_CONFIG(opengl) && defined(USE_OZONE) #undef eglCreateImage #undef eglDestroyImage #undef eglExportDMABUFImageMESA @@ -81,7 +82,7 @@ private: QScopedPointer m_functions; bool m_isDmaBufSupported = false; }; -#endif // defined(USE_OZONE) +#endif // QT_CONFIG(opengl) && defined(USE_OZONE) QT_END_NAMESPACE diff --git a/src/core/ozone/surface_factory_qt.cpp b/src/core/ozone/surface_factory_qt.cpp index 374f870e2..204f4d62d 100644 --- a/src/core/ozone/surface_factory_qt.cpp +++ b/src/core/ozone/surface_factory_qt.cpp @@ -16,6 +16,7 @@ #include "ui/ozone/buildflags.h" #include +#include #if BUILDFLAG(OZONE_PLATFORM_X11) #include "ozone/gl_ozone_glx_qt.h" @@ -92,6 +93,8 @@ scoped_refptr SurfaceFactoryQt::CreateNativePixmap( absl::optional framebuffer_size) { Q_ASSERT(SupportsNativePixmaps()); + +#if QT_CONFIG(opengl) if (framebuffer_size && !gfx::Rect(size).Contains(gfx::Rect(*framebuffer_size))) return nullptr; @@ -125,6 +128,9 @@ scoped_refptr SurfaceFactoryQt::CreateNativePixmap( } return base::MakeRefCounted(size, format, std::move(handle)); +#else + return nullptr; +#endif // QT_CONFIG(opengl) } void SurfaceFactoryQt::CreateNativePixmapAsync( @@ -149,6 +155,8 @@ SurfaceFactoryQt::CreateNativePixmapFromHandle( gfx::NativePixmapHandle handle) { Q_ASSERT(SupportsNativePixmaps()); + +#if QT_CONFIG(opengl) gfx::NativePixmapHandle bufferHandle; #if BUILDFLAG(OZONE_PLATFORM_X11) @@ -228,17 +236,22 @@ SurfaceFactoryQt::CreateNativePixmapFromHandle( } return base::MakeRefCounted(size, format, std::move(bufferHandle)); +#else + return nullptr; +#endif // QT_CONFIG(opengl) } bool SurfaceFactoryQt::SupportsNativePixmaps() const { +#if QT_CONFIG(opengl) #if BUILDFLAG(OZONE_PLATFORM_X11) if (GLContextHelper::getGlxPlatformInterface()) return ui::GpuMemoryBufferSupportX11::GetInstance()->has_gbm_device(); -#endif +#endif // BUILDFLAG(OZONE_PLATFORM_X11) if (GLContextHelper::getEglPlatformInterface()) return EGLHelper::instance()->isDmaBufSupported(); +#endif // QT_CONFIG(opengl) return false; } -- cgit v1.2.3