From 36770adfcec4dc333f10e5d3dde9461ad6697d58 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Tue, 12 Nov 2024 18:26:14 +0300 Subject: [PATCH 1/5] egl/display: workaround gbm platforms on EGL 1.4 Some EGL drivers report the KHR extension with EGL 1.4, which doesn't make any sense, however given that the constant for MESA and KHR is the same, we can check for KHR in MESA branch, but still use the Ext functions. Fixes #1708. --- CHANGELOG.md | 1 + glutin/src/api/egl/display.rs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bed8265ab8..7177cc5b55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Added `NotCurrentContext::make_current_surfaceless(self)` and `PossiblyCurrentContext::make_current_surfaceless(&self)` in the `Wgl` implementation to allow the use of surfaceless contexts with WGL. +- Added workaround for EGL drivers reporting KHR_platform_gbm with EGL 1.4. # Version 0.32.1 diff --git a/glutin/src/api/egl/display.rs b/glutin/src/api/egl/display.rs index 4c2454d467..7b5d2cd08e 100644 --- a/glutin/src/api/egl/display.rs +++ b/glutin/src/api/egl/display.rs @@ -362,7 +362,18 @@ impl Display { handle.connection.map_or(egl::DEFAULT_DISPLAY as *mut _, |c| c.as_ptr()), ) }, - RawDisplayHandle::Gbm(handle) if extensions.contains("EGL_MESA_platform_gbm") => { + RawDisplayHandle::Gbm(handle) + // NOTE: Some drivers report that they support KHR extension with 1.4 EGL display, so + // workaround here by checking the KHR gbm display as well. The MESA and KHR has + // the same constant values, thus it'll work regardless. + // + // They do require EXT during the runtime as well, so we don't change the display + // to Khr here. + // + // See https://github.com/rust-windowing/glutin/issues/1708. + if extensions.contains("EGL_MESA_platform_gbm") + || extensions.contains("EGL_KHR_platform_gbm") => + { (egl::PLATFORM_GBM_MESA, handle.gbm_device.as_ptr()) }, RawDisplayHandle::Drm(_) => { From f42bbc57f77bcb043e0ebeba07c759aa24384ca6 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Tue, 12 Nov 2024 19:05:16 +0300 Subject: [PATCH 2/5] Update glutin/src/api/egl/display.rs Co-authored-by: Marijn Suijten --- glutin/src/api/egl/display.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glutin/src/api/egl/display.rs b/glutin/src/api/egl/display.rs index 7b5d2cd08e..77dd6ed13a 100644 --- a/glutin/src/api/egl/display.rs +++ b/glutin/src/api/egl/display.rs @@ -363,8 +363,8 @@ impl Display { ) }, RawDisplayHandle::Gbm(handle) - // NOTE: Some drivers report that they support KHR extension with 1.4 EGL display, so - // workaround here by checking the KHR gbm display as well. The MESA and KHR has + // NOTE: Some drivers report that they support the KHR GBM extension without EGL 1.5 client, so + // work around that here by checking the KHR GBM extension as well. The MESA and KHR extensions have // the same constant values, thus it'll work regardless. // // They do require EXT during the runtime as well, so we don't change the display From 99ff8e1824fda66232c6f4beb143376a682890b1 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Tue, 12 Nov 2024 19:05:28 +0300 Subject: [PATCH 3/5] Update CHANGELOG.md Co-authored-by: Marijn Suijten --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7177cc5b55..2e117c8426 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ - Added `NotCurrentContext::make_current_surfaceless(self)` and `PossiblyCurrentContext::make_current_surfaceless(&self)` in the `Wgl` implementation to allow the use of surfaceless contexts with WGL. -- Added workaround for EGL drivers reporting KHR_platform_gbm with EGL 1.4. +- Added workaround for EGL drivers reporting `EGL_KHR_platform_gbm` with EGL 1.4. # Version 0.32.1 From 1d39edd990140683a16187d0ad198933036bdf24 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Tue, 12 Nov 2024 20:20:30 +0300 Subject: [PATCH 4/5] docs: clean comment --- glutin/src/api/egl/display.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/glutin/src/api/egl/display.rs b/glutin/src/api/egl/display.rs index 77dd6ed13a..f392fce848 100644 --- a/glutin/src/api/egl/display.rs +++ b/glutin/src/api/egl/display.rs @@ -363,12 +363,10 @@ impl Display { ) }, RawDisplayHandle::Gbm(handle) - // NOTE: Some drivers report that they support the KHR GBM extension without EGL 1.5 client, so - // work around that here by checking the KHR GBM extension as well. The MESA and KHR extensions have - // the same constant values, thus it'll work regardless. - // - // They do require EXT during the runtime as well, so we don't change the display - // to Khr here. + // NOTE: Some drivers report that they support the KHR GBM extension without EGL + // 1.5 client, so work around that here by checking the KHR GBM extension as well. + // The MESA and KHR extensions have the same constant values, thus it'll work + // regardless. // // See https://github.com/rust-windowing/glutin/issues/1708. if extensions.contains("EGL_MESA_platform_gbm") From 316a8f7a8e9c6759b53ed1945c611b4fd9fa46cd Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Wed, 13 Nov 2024 01:00:48 +0300 Subject: [PATCH 5/5] Update CHANGELOG.md Co-authored-by: Marijn Suijten --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e117c8426..c4428df67e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ - Added `NotCurrentContext::make_current_surfaceless(self)` and `PossiblyCurrentContext::make_current_surfaceless(&self)` in the `Wgl` implementation to allow the use of surfaceless contexts with WGL. -- Added workaround for EGL drivers reporting `EGL_KHR_platform_gbm` with EGL 1.4. +- Added workaround for EGL drivers reporting `EGL_KHR_platform_gbm` without EGL 1.5 client. # Version 0.32.1