diff options
Diffstat (limited to 'src/core/ozone')
-rw-r--r-- | src/core/ozone/gl_ozone_egl_qt.cpp | 10 | ||||
-rw-r--r-- | src/core/ozone/gl_ozone_egl_qt.h | 4 | ||||
-rw-r--r-- | src/core/ozone/gl_ozone_glx_qt.cpp | 12 | ||||
-rw-r--r-- | src/core/ozone/gl_ozone_glx_qt.h | 6 | ||||
-rw-r--r-- | src/core/ozone/gl_surface_egl_qt.cpp | 109 | ||||
-rw-r--r-- | src/core/ozone/gl_surface_egl_qt.h | 2 | ||||
-rw-r--r-- | src/core/ozone/gl_surface_glx_qt.cpp | 16 | ||||
-rw-r--r-- | src/core/ozone/gl_surface_glx_qt.h | 2 | ||||
-rw-r--r-- | src/core/ozone/platform_window_qt.cpp | 14 | ||||
-rw-r--r-- | src/core/ozone/platform_window_qt.h | 10 |
10 files changed, 90 insertions, 95 deletions
diff --git a/src/core/ozone/gl_ozone_egl_qt.cpp b/src/core/ozone/gl_ozone_egl_qt.cpp index 02c3666b4..efb1dd962 100644 --- a/src/core/ozone/gl_ozone_egl_qt.cpp +++ b/src/core/ozone/gl_ozone_egl_qt.cpp @@ -48,16 +48,12 @@ bool GLOzoneEGLQt::LoadGLES2Bindings(const gl::GLImplementationParts & /*impleme return true; } -bool GLOzoneEGLQt::InitializeGLOneOffPlatform() +gl::GLDisplay *GLOzoneEGLQt::InitializeGLOneOffPlatform(uint64_t system_device_id) { - if (!gl::GLSurfaceEGLQt::InitializeOneOff()) { - LOG(ERROR) << "GLOzoneEGLQt::InitializeOneOff failed."; - return false; - } - return true; + return gl::GLSurfaceEGLQt::InitializeOneOff(system_device_id); } -bool GLOzoneEGLQt::InitializeExtensionSettingsOneOffPlatform() +bool GLOzoneEGLQt::InitializeExtensionSettingsOneOffPlatform(gl::GLDisplay *display) { return gl::GLSurfaceEGLQt::InitializeExtensionSettingsOneOff(); } diff --git a/src/core/ozone/gl_ozone_egl_qt.h b/src/core/ozone/gl_ozone_egl_qt.h index 089e6ba17..59f25a724 100644 --- a/src/core/ozone/gl_ozone_egl_qt.h +++ b/src/core/ozone/gl_ozone_egl_qt.h @@ -12,8 +12,8 @@ namespace ui { class GLOzoneEGLQt : public GLOzoneEGL { public: - bool InitializeGLOneOffPlatform() override; - bool InitializeExtensionSettingsOneOffPlatform() override; + gl::GLDisplay *InitializeGLOneOffPlatform(uint64_t system_device_id) override; + bool InitializeExtensionSettingsOneOffPlatform(gl::GLDisplay *display) override; scoped_refptr<gl::GLSurface> CreateViewGLSurface( gfx::AcceleratedWidget window) override; scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface( diff --git a/src/core/ozone/gl_ozone_glx_qt.cpp b/src/core/ozone/gl_ozone_glx_qt.cpp index 4c4822944..fa42facac 100644 --- a/src/core/ozone/gl_ozone_glx_qt.cpp +++ b/src/core/ozone/gl_ozone_glx_qt.cpp @@ -16,12 +16,8 @@ namespace ui { -bool GLOzoneGLXQt::InitializeGLOneOffPlatform() { - if (!gl::GLSurfaceGLXQt::InitializeOneOff()) { - LOG(ERROR) << "GLSurfaceGLXQt::InitializeOneOff failed."; - return false; - } - return true; +gl::GLDisplay *GLOzoneGLXQt::InitializeGLOneOffPlatform(uint64_t system_device_id) { + return gl::GLSurfaceGLXQt::InitializeOneOff(system_device_id); } bool GLOzoneGLXQt::InitializeStaticGLBindings( @@ -65,7 +61,7 @@ void GLOzoneGLXQt::SetDisabledExtensionsPlatform( gl::SetDisabledExtensionsGLX(disabled_extensions); } -void GLOzoneGLXQt::ShutdownGL() { +void GLOzoneGLXQt::ShutdownGL(gl::GLDisplay *) { gl::ClearBindingsGL(); gl::ClearBindingsGLX(); } @@ -104,7 +100,7 @@ scoped_refptr<gl::GLSurface> GLOzoneGLXQt::CreateOffscreenGLSurface( return nullptr; } -bool GLOzoneGLXQt::InitializeExtensionSettingsOneOffPlatform() +bool GLOzoneGLXQt::InitializeExtensionSettingsOneOffPlatform(gl::GLDisplay *) { return gl::GLSurfaceGLXQt::InitializeExtensionSettingsOneOff(); } diff --git a/src/core/ozone/gl_ozone_glx_qt.h b/src/core/ozone/gl_ozone_glx_qt.h index 77d639a88..ca9ff47a3 100644 --- a/src/core/ozone/gl_ozone_glx_qt.h +++ b/src/core/ozone/gl_ozone_glx_qt.h @@ -15,10 +15,10 @@ public: GLOzoneGLXQt() {} ~GLOzoneGLXQt() override {} - bool InitializeGLOneOffPlatform() override; + gl::GLDisplay *InitializeGLOneOffPlatform(uint64_t system_device_id) override; bool InitializeStaticGLBindings(const gl::GLImplementationParts &implementation) override; - bool InitializeExtensionSettingsOneOffPlatform() override; - void ShutdownGL() override; + bool InitializeExtensionSettingsOneOffPlatform(gl::GLDisplay *display) override; + void ShutdownGL(gl::GLDisplay *display) override; void SetDisabledExtensionsPlatform( const std::string& disabled_extensions) override; bool GetGLWindowSystemBindingInfo( diff --git a/src/core/ozone/gl_surface_egl_qt.cpp b/src/core/ozone/gl_surface_egl_qt.cpp index bd9ec060e..163d9242d 100644 --- a/src/core/ozone/gl_surface_egl_qt.cpp +++ b/src/core/ozone/gl_surface_egl_qt.cpp @@ -25,139 +25,144 @@ using ui::GetLastEGLErrorString; namespace gl { -bool GLSurfaceEGL::InitializeExtensionSettingsOneOff() +bool GLSurfaceEGL::InitializeExtensionSettingsOneOff(GLDisplayEGL* display) { return GLSurfaceEGLQt::InitializeExtensionSettingsOneOff(); } -EGLDisplay GLSurfaceEGL::GetHardwareDisplay() +EGLDisplay GLDisplayEGL::GetHardwareDisplay() { return GLSurfaceQt::g_display ? static_cast<EGLDisplay>(GLSurfaceQt::g_display->GetDisplay()) : EGL_NO_DISPLAY; } -bool GLSurfaceEGL::IsCreateContextRobustnessSupported() +bool GLDisplayEGL::IsCreateContextRobustnessSupported() { return GLContextHelper::isCreateContextRobustnessSupported() && HasEGLExtension("EGL_EXT_create_context_robustness"); } -bool GLSurfaceEGL::IsCreateContextBindGeneratesResourceSupported() +bool GLDisplayEGL::IsCreateContextBindGeneratesResourceSupported() { return false; } -bool GLSurfaceEGL::IsCreateContextWebGLCompatabilitySupported() +bool GLDisplayEGL::IsCreateContextWebGLCompatabilitySupported() { return false; } -bool GLSurfaceEGL::IsEGLSurfacelessContextSupported() +bool GLDisplayEGL::IsEGLSurfacelessContextSupported() { return GLSurfaceEGLQt::g_egl_surfaceless_context_supported; } -bool GLSurfaceEGL::IsEGLContextPrioritySupported() +bool GLDisplayEGL::IsEGLContextPrioritySupported() { return false; } -bool GLSurfaceEGL::IsRobustResourceInitSupported() +bool GLDisplayEGL::IsRobustResourceInitSupported() { return false; } -bool GLSurfaceEGL::IsDisplayTextureShareGroupSupported() +bool GLDisplayEGL::IsDisplayTextureShareGroupSupported() { return false; } -bool GLSurfaceEGL::IsCreateContextClientArraysSupported() +bool GLDisplayEGL::IsCreateContextClientArraysSupported() { return false; } -bool GLSurfaceEGL::IsPixelFormatFloatSupported() +bool GLDisplayEGL::IsPixelFormatFloatSupported() { return false; } -bool GLSurfaceEGL::IsANGLEFeatureControlSupported() +bool GLDisplayEGL::IsANGLEFeatureControlSupported() { return false; } -bool GLSurfaceEGL::IsANGLEPowerPreferenceSupported() +bool GLDisplayEGL::IsANGLEPowerPreferenceSupported() { return false; } -bool GLSurfaceEGL::IsANGLEExternalContextAndSurfaceSupported() +bool GLDisplayEGL::IsANGLEExternalContextAndSurfaceSupported() { return false; } -bool GLSurfaceEGL::IsDisplaySemaphoreShareGroupSupported() +bool GLDisplayEGL::IsDisplaySemaphoreShareGroupSupported() { return false; } -bool GLSurfaceEGL::IsRobustnessVideoMemoryPurgeSupported() +bool GLDisplayEGL::IsRobustnessVideoMemoryPurgeSupported() { return false; } -bool GLSurfaceEGL::IsANGLEContextVirtualizationSupported() +bool GLDisplayEGL::IsANGLEContextVirtualizationSupported() { return false; } -bool GLSurfaceEGL::IsANGLEVulkanImageSupported() +bool GLDisplayEGL::IsANGLEVulkanImageSupported() { return false; } -bool GLSurfaceEGL::IsEGLQueryDeviceSupported() +bool GLDisplayEGL::IsEGLQueryDeviceSupported() { return false; } -void GLSurfaceEGL::ShutdownOneOff() +void GLSurfaceEGL::ShutdownOneOff(GLDisplayEGL *) { } -const char *GLSurfaceEGL::GetEGLClientExtensions() +const char *GetEGLClientExtensions() { return GLSurfaceQt::g_client_extensions.c_str(); } -const char *GLSurfaceEGL::GetEGLExtensions() +const char *GetEGLExtensions() { return GLSurfaceQt::g_extensions.c_str(); } -bool GLSurfaceEGL::HasEGLClientExtension(const char *name) +bool GLDisplayEGL::HasEGLClientExtension(const char *name) { - return ExtensionsContain(GetEGLClientExtensions(), name); + return GLSurface::ExtensionsContain(GetEGLClientExtensions(), name); } -bool GLSurfaceEGL::HasEGLExtension(const char *name) +bool GLDisplayEGL::HasEGLExtension(const char *name) { - return ExtensionsContain(GetEGLExtensions(), name); + return GLSurface::ExtensionsContain(GetEGLExtensions(), name); } -bool GLSurfaceEGL::InitializeOneOff(gl::EGLDisplayPlatform /*native_display*/, uint64_t) +GLDisplayEGL *GLSurfaceEGL::InitializeOneOff(gl::EGLDisplayPlatform /*native_display*/, uint64_t system_id) { - return GLSurfaceEGLQt::InitializeOneOff(); + return static_cast<GLDisplayEGL *>(GLSurfaceEGLQt::InitializeOneOff(system_id)); } -bool GLSurfaceEGL::IsEGLNoConfigContextSupported() +bool GLDisplayEGL::IsEGLNoConfigContextSupported() { return false; } -bool GLSurfaceEGL::IsAndroidNativeFenceSyncSupported() +bool GLDisplayEGL::IsAndroidNativeFenceSyncSupported() { return false; } -DisplayType GLSurfaceEGL::GetDisplayType() +GLDisplayEGL *GLSurfaceEGL::GetGLDisplayEGL() +{ + return static_cast<GLDisplayEGL *>(GLSurfaceEGLQt::g_display); +} + +DisplayType GLDisplayEGL::GetDisplayType() { return DisplayType::DEFAULT; } @@ -181,31 +186,28 @@ GLSurfaceEGLQt::~GLSurfaceEGLQt() Destroy(); } -bool GLSurfaceEGLQt::InitializeOneOff() +gl::GLDisplay *GLSurfaceEGLQt::InitializeOneOff(uint64_t system_device_id) { if (s_initialized) - return true; - - // Must be called before initializing the display. - g_driver_egl.InitializeClientExtensionBindings(); + return g_display; - auto *egl_display = new GLDisplayEGL(); + auto *egl_display = new GLDisplayEGL(system_device_id); g_display = egl_display; egl_display->SetDisplay(GLContextHelper::getEGLDisplay()); if (!g_display->GetDisplay()) { LOG(ERROR) << "GLContextHelper::getEGLDisplay() failed."; - return false; + return nullptr; } g_config = GLContextHelper::getEGLConfig(); if (!g_config) { LOG(ERROR) << "GLContextHelper::getEGLConfig() failed."; - return false; + return nullptr; } if (!eglInitialize(g_display->GetDisplay(), NULL, NULL)) { LOG(ERROR) << "eglInitialize failed with error " << GetLastEGLErrorString(); - return false; + return nullptr; } g_client_extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); @@ -228,11 +230,8 @@ bool GLSurfaceEGLQt::InitializeOneOff() } } - // Must be called after initializing the display. - g_driver_egl.InitializeExtensionBindings(); - s_initialized = true; - return true; + return g_display; } bool GLSurfaceEGLQt::InitializeExtensionSettingsOneOff() @@ -348,26 +347,18 @@ void* GLSurfacelessQtEGL::GetShareHandle() return NULL; } -std::string DriverEGL::GetPlatformExtensions() +} // namespace gl +#endif // !BUILDFLAG(IS_MAC) + +namespace gl { + +std::string DisplayExtensionsEGL::GetPlatformExtensions(void*) { EGLDisplay display = GLContextHelper::getEGLDisplay(); if (display == EGL_NO_DISPLAY) return ""; - DCHECK(g_driver_egl.fn.eglQueryStringFn); - const char* str = g_driver_egl.fn.eglQueryStringFn(display, EGL_EXTENSIONS); + const char* str = eglQueryString(display, EGL_EXTENSIONS); return str ? std::string(str) : ""; } } // namespace gl -#else -namespace gl { -struct GL_EXPORT DriverEGL { - static std::string GetPlatformExtensions(); -}; - -std::string DriverEGL::GetPlatformExtensions() -{ - return ""; -} -} // namespace gl -#endif // !BUILDFLAG(IS_MAC) diff --git a/src/core/ozone/gl_surface_egl_qt.h b/src/core/ozone/gl_surface_egl_qt.h index 8a799b847..2444ebd4a 100644 --- a/src/core/ozone/gl_surface_egl_qt.h +++ b/src/core/ozone/gl_surface_egl_qt.h @@ -14,7 +14,7 @@ class GLSurfaceEGLQt: public GLSurfaceQt { public: explicit GLSurfaceEGLQt(const gfx::Size& size); - static bool InitializeOneOff(); + static gl::GLDisplay *InitializeOneOff(uint64_t system_device_id); static bool InitializeExtensionSettingsOneOff(); bool Initialize(GLSurfaceFormat format) override; diff --git a/src/core/ozone/gl_surface_glx_qt.cpp b/src/core/ozone/gl_surface_glx_qt.cpp index f97f3de1e..1028f3235 100644 --- a/src/core/ozone/gl_surface_glx_qt.cpp +++ b/src/core/ozone/gl_surface_glx_qt.cpp @@ -86,37 +86,37 @@ GLSurfaceGLXQt::~GLSurfaceGLXQt() Destroy(); } -bool GLSurfaceGLXQt::InitializeOneOff() +GLDisplay *GLSurfaceGLXQt::InitializeOneOff(uint64_t system_device_id) { if (s_initialized) - return true; + return g_display; - g_display = new GLDisplayX11(); + g_display = new GLDisplayX11(system_device_id); if (!g_display->GetDisplay()) { LOG(ERROR) << "GLContextHelper::getXDisplay() failed."; - return false; + return nullptr; } g_config = GLContextHelper::getGlXConfig(); if (!g_config) { LOG(ERROR) << "GLContextHelper::getGlxConfig() failed."; - return false; + return nullptr; } Display* display = static_cast<Display*>(g_display->GetDisplay()); int major, minor; if (!glXQueryVersion(display, &major, &minor)) { LOG(ERROR) << "glxQueryVersion failed."; - return false; + return nullptr; } if (major == 1 && minor < 3) { LOG(ERROR) << "GLX 1.3 or later is required."; - return false; + return nullptr; } s_initialized = true; - return true; + return g_display; } diff --git a/src/core/ozone/gl_surface_glx_qt.h b/src/core/ozone/gl_surface_glx_qt.h index 6312f6b74..f81f6e9df 100644 --- a/src/core/ozone/gl_surface_glx_qt.h +++ b/src/core/ozone/gl_surface_glx_qt.h @@ -12,7 +12,7 @@ class GLSurfaceGLXQt: public GLSurfaceQt { public: explicit GLSurfaceGLXQt(const gfx::Size& size); - static bool InitializeOneOff(); + static gl::GLDisplay *InitializeOneOff(uint64_t system_device_id); static bool InitializeExtensionSettingsOneOff(); bool Initialize(GLSurfaceFormat format) override; diff --git a/src/core/ozone/platform_window_qt.cpp b/src/core/ozone/platform_window_qt.cpp index 01b0ae139..4a6331c61 100644 --- a/src/core/ozone/platform_window_qt.cpp +++ b/src/core/ozone/platform_window_qt.cpp @@ -24,7 +24,7 @@ PlatformWindowQt::~PlatformWindowQt() ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); } -gfx::Rect PlatformWindowQt::GetBounds() const +gfx::Rect PlatformWindowQt::GetBoundsInPixels() const { return bounds_; } @@ -34,7 +34,7 @@ void PlatformWindowQt::Close() delegate_->OnClosed(); } -void PlatformWindowQt::SetBounds(const gfx::Rect& bounds) +void PlatformWindowQt::SetBoundsInPixels(const gfx::Rect& bounds) { if (bounds == bounds_) return; @@ -47,6 +47,16 @@ bool PlatformWindowQt::CanDispatchEvent(const ui::PlatformEvent& /*ne*/) return true; } +gfx::Rect PlatformWindowQt::GetBoundsInDIP() const +{ + return delegate_->ConvertRectToDIP(bounds_); +} + +void PlatformWindowQt::SetBoundsInDIP(const gfx::Rect &bounds_in_dip) +{ + SetBoundsInPixels(delegate_->ConvertRectToPixels(bounds_in_dip)); +} + uint32_t PlatformWindowQt::DispatchEvent(const ui::PlatformEvent& native_event) { DispatchEventFromNativeUiEvent( diff --git a/src/core/ozone/platform_window_qt.h b/src/core/ozone/platform_window_qt.h index fee4728cf..0d1743f68 100644 --- a/src/core/ozone/platform_window_qt.h +++ b/src/core/ozone/platform_window_qt.h @@ -21,8 +21,10 @@ public: PlatformWindowQt(PlatformWindowDelegate* delegate, const gfx::Rect& bounds); ~PlatformWindowQt() override; // PlatformWindow: - gfx::Rect GetBounds() const override; - void SetBounds(const gfx::Rect& bounds) override; + gfx::Rect GetBoundsInPixels() const override; + void SetBoundsInPixels(const gfx::Rect& bounds) override; + gfx::Rect GetBoundsInDIP() const override; + void SetBoundsInDIP(const gfx::Rect& bounds) override; void Show(bool inactive = false) override { } void Hide() override { } void Close() override; @@ -39,8 +41,8 @@ public: void SetCursor(scoped_refptr<PlatformCursor>) override { } void MoveCursorTo(const gfx::Point&) override { } void ConfineCursorToBounds(const gfx::Rect&) override { } - void SetRestoredBoundsInPixels(const gfx::Rect& bounds) override { } - gfx::Rect GetRestoredBoundsInPixels() const override { return gfx::Rect(); } + void SetRestoredBoundsInDIP(const gfx::Rect& bounds) override { } + gfx::Rect GetRestoredBoundsInDIP() const override { return gfx::Rect(); } void Activate() override { } void Deactivate() override { } void SetUseNativeFrame(bool use_native_frame) override { } |