servoshell: Remove duplicate egl bindings on android/ohos (#34716)

- The default value for SwapInterval is 1,
  so setting it to 1 changes nothing
- We don't clear the screen immediately anymore, which was the only
  useage of the egl bindings

this saves us from duplicated EGL bindings.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
Jonathan Schwender 2024-12-20 16:08:09 +01:00 committed by GitHub
parent 65c65c9a6a
commit 0dd8798148
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 6 additions and 110 deletions

View file

@ -7,19 +7,8 @@ use std::fs::File;
use std::io::Write;
use std::path::Path;
use gl_generator::{Api, Fallbacks, Profile, Registry};
use vergen_git2::{Emitter, Git2Builder};
// We can make this configurable in the future if different platforms start to have
// different needs.
fn generate_egl_bindings(out_dir: &Path) {
let mut file = File::create(out_dir.join("egl_bindings.rs")).unwrap();
Registry::new(Api::Egl, (1, 5), Profile::Core, Fallbacks::All, [])
.write_bindings(gl_generator::StaticStructGenerator, &mut file)
.unwrap();
println!("cargo:rustc-link-lib=EGL");
}
fn emit_git_sha() -> Result<(), String> {
let git_options = Git2Builder::default()
.sha(true /* short */)
@ -55,7 +44,6 @@ fn main() -> Result<(), Box<dyn Error>> {
// Note: We can't use `#[cfg(windows)]`, since that would check the host platform
// and not the target platform
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
let target_env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap();
if target_os == "windows" {
#[cfg(windows)]
@ -72,8 +60,6 @@ fn main() -> Result<(), Box<dyn Error>> {
.file("platform/macos/count_threads.c")
.compile("count_threads");
} else if target_os == "android" {
generate_egl_bindings(out);
// FIXME: We need this workaround since jemalloc-sys still links
// to libgcc instead of libunwind, but Android NDK 23c and above
// don't have libgcc. We can't disable jemalloc for Android as
@ -83,8 +69,6 @@ fn main() -> Result<(), Box<dyn Error>> {
let mut libgcc = File::create(out.join("libgcc.a")).unwrap();
libgcc.write_all(b"INPUT(-lunwind)").unwrap();
println!("cargo:rustc-link-search=native={}", out.display());
} else if target_env == "ohos" {
generate_egl_bindings(out);
}
if let Err(error) = emit_git_sha() {