Bug 1972160 - fix(webgpu): backport wgpu_hal::vulkan::drm OpenBSD fix for ESR140 a=pascalc

Backports //just// the changes made in [wgpu#7810](https://github.com/gfx-rs/wgpu/pull/7810), but on the current base for WGPU being consumed by ESR 140. The commit hash is anchored forever to the official WGPU repository via [wgpu#7896](https://github.com/gfx-rs/wgpu/pull/7896).

This WGPU change was introduced into Nightly with bug 1974058, among others.

Differential Revision: https://phabricator.services.mozilla.com/D256450
This commit is contained in:
Erich Gubler
2025-07-09 08:59:38 +00:00
committed by pchevrel@mozilla.com
parent 52cfa926a3
commit c12adce63b
8 changed files with 50 additions and 59 deletions

View File

@@ -40,9 +40,9 @@ git = "https://github.com/franziskuskiefer/cose-rust"
rev = "43c22248d136c8b38fe42ea709d08da6355cf04b" rev = "43c22248d136c8b38fe42ea709d08da6355cf04b"
replace-with = "vendored-sources" replace-with = "vendored-sources"
[source."git+https://github.com/gfx-rs/wgpu?rev=85001b2436f686451d6d783225311c06b60e6680"] [source."git+https://github.com/gfx-rs/wgpu?rev=88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"]
git = "https://github.com/gfx-rs/wgpu" git = "https://github.com/gfx-rs/wgpu"
rev = "85001b2436f686451d6d783225311c06b60e6680" rev = "88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
replace-with = "vendored-sources" replace-with = "vendored-sources"
[source."git+https://github.com/glandium/rust-objc?rev=4de89f5aa9851ceca4d40e7ac1e2759410c04324"] [source."git+https://github.com/glandium/rust-objc?rev=4de89f5aa9851ceca4d40e7ac1e2759410c04324"]

12
Cargo.lock generated
View File

@@ -4654,7 +4654,7 @@ checksum = "a2983372caf4480544083767bf2d27defafe32af49ab4df3a0b7fc90793a3664"
[[package]] [[package]]
name = "naga" name = "naga"
version = "25.0.0" version = "25.0.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=85001b2436f686451d6d783225311c06b60e6680#85001b2436f686451d6d783225311c06b60e6680" source = "git+https://github.com/gfx-rs/wgpu?rev=88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc#88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
@@ -7611,7 +7611,7 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core" name = "wgpu-core"
version = "25.0.0" version = "25.0.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=85001b2436f686451d6d783225311c06b60e6680#85001b2436f686451d6d783225311c06b60e6680" source = "git+https://github.com/gfx-rs/wgpu?rev=88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc#88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
@@ -7641,7 +7641,7 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core-deps-apple" name = "wgpu-core-deps-apple"
version = "25.0.0" version = "25.0.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=85001b2436f686451d6d783225311c06b60e6680#85001b2436f686451d6d783225311c06b60e6680" source = "git+https://github.com/gfx-rs/wgpu?rev=88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc#88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
dependencies = [ dependencies = [
"wgpu-hal", "wgpu-hal",
] ]
@@ -7649,7 +7649,7 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core-deps-windows-linux-android" name = "wgpu-core-deps-windows-linux-android"
version = "25.0.0" version = "25.0.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=85001b2436f686451d6d783225311c06b60e6680#85001b2436f686451d6d783225311c06b60e6680" source = "git+https://github.com/gfx-rs/wgpu?rev=88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc#88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
dependencies = [ dependencies = [
"wgpu-hal", "wgpu-hal",
] ]
@@ -7657,7 +7657,7 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-hal" name = "wgpu-hal"
version = "25.0.0" version = "25.0.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=85001b2436f686451d6d783225311c06b60e6680#85001b2436f686451d6d783225311c06b60e6680" source = "git+https://github.com/gfx-rs/wgpu?rev=88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc#88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
dependencies = [ dependencies = [
"android_system_properties", "android_system_properties",
"arrayvec", "arrayvec",
@@ -7693,7 +7693,7 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-types" name = "wgpu-types"
version = "25.0.0" version = "25.0.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=85001b2436f686451d6d783225311c06b60e6680#85001b2436f686451d6d783225311c06b60e6680" source = "git+https://github.com/gfx-rs/wgpu?rev=88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc#88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
dependencies = [ dependencies = [
"bitflags 2.9.0", "bitflags 2.9.0",
"bytemuck", "bytemuck",

View File

@@ -17,7 +17,7 @@ default = []
[dependencies.wgc] [dependencies.wgc]
package = "wgpu-core" package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu" git = "https://github.com/gfx-rs/wgpu"
rev = "85001b2436f686451d6d783225311c06b60e6680" rev = "88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
# TODO: remove the replay feature on the next update containing https://github.com/gfx-rs/wgpu/pull/5182 # TODO: remove the replay feature on the next update containing https://github.com/gfx-rs/wgpu/pull/5182
features = [ features = [
"serde", "serde",
@@ -33,32 +33,32 @@ features = [
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgc] [target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgc]
package = "wgpu-core" package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu" git = "https://github.com/gfx-rs/wgpu"
rev = "85001b2436f686451d6d783225311c06b60e6680" rev = "88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
features = ["metal"] features = ["metal"]
# We want the wgpu-core Direct3D backends on Windows. # We want the wgpu-core Direct3D backends on Windows.
[target.'cfg(windows)'.dependencies.wgc] [target.'cfg(windows)'.dependencies.wgc]
package = "wgpu-core" package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu" git = "https://github.com/gfx-rs/wgpu"
rev = "85001b2436f686451d6d783225311c06b60e6680" rev = "88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
features = ["dx12"] features = ["dx12"]
# We want the wgpu-core Vulkan backend on Linux and Windows. # We want the wgpu-core Vulkan backend on Linux and Windows.
[target.'cfg(any(windows, all(unix, not(any(target_os = "macos", target_os = "ios")))))'.dependencies.wgc] [target.'cfg(any(windows, all(unix, not(any(target_os = "macos", target_os = "ios")))))'.dependencies.wgc]
package = "wgpu-core" package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu" git = "https://github.com/gfx-rs/wgpu"
rev = "85001b2436f686451d6d783225311c06b60e6680" rev = "88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
features = ["vulkan"] features = ["vulkan"]
[dependencies.wgt] [dependencies.wgt]
package = "wgpu-types" package = "wgpu-types"
git = "https://github.com/gfx-rs/wgpu" git = "https://github.com/gfx-rs/wgpu"
rev = "85001b2436f686451d6d783225311c06b60e6680" rev = "88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
[dependencies.wgh] [dependencies.wgh]
package = "wgpu-hal" package = "wgpu-hal"
git = "https://github.com/gfx-rs/wgpu" git = "https://github.com/gfx-rs/wgpu"
rev = "85001b2436f686451d6d783225311c06b60e6680" rev = "88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
features = ["device_lost_panic", "internal_error_panic"] features = ["device_lost_panic", "internal_error_panic"]
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]

View File

@@ -8,8 +8,8 @@ origin:
name: wgpu name: wgpu
description: A cross-platform pure-Rust graphics API, modeled on the WebGPU standard description: A cross-platform pure-Rust graphics API, modeled on the WebGPU standard
url: https://github.com/gfx-rs/wgpu url: https://github.com/gfx-rs/wgpu
release: 85001b2436f686451d6d783225311c06b60e6680 (Tue May 13 22:52:49 2025 -0400) release: 88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc (2025-07-08T13:16:29Z).
revision: 85001b2436f686451d6d783225311c06b60e6680 revision: 88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc
license: ['MIT', 'Apache-2.0'] license: ['MIT', 'Apache-2.0']
updatebot: updatebot:

View File

@@ -3806,11 +3806,11 @@ delta = "24.0.0 -> 25.0.0"
[[audits.naga]] [[audits.naga]]
who = [ who = [
"Teodor Tanasoaia <ttanasoaia@mozilla.com>", "Teodor Tanasoaia <ttanasoaia@mozilla.com>",
"Erich Gubler <erichdongubler@gmail.com>",
"Jim Blandy <jimb@red-bean.com>", "Jim Blandy <jimb@red-bean.com>",
"Erich Gubler <erichdongubler@gmail.com>",
] ]
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
delta = "25.0.0 -> 25.0.0@git:85001b2436f686451d6d783225311c06b60e6680" delta = "25.0.0 -> 25.0.0@git:88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
importable = false importable = false
[[audits.net2]] [[audits.net2]]
@@ -6106,11 +6106,11 @@ delta = "24.0.0 -> 25.0.0"
[[audits.wgpu-core]] [[audits.wgpu-core]]
who = [ who = [
"Teodor Tanasoaia <ttanasoaia@mozilla.com>", "Teodor Tanasoaia <ttanasoaia@mozilla.com>",
"Erich Gubler <erichdongubler@gmail.com>",
"Jim Blandy <jimb@red-bean.com>", "Jim Blandy <jimb@red-bean.com>",
"Erich Gubler <erichdongubler@gmail.com>",
] ]
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
delta = "25.0.0 -> 25.0.0@git:85001b2436f686451d6d783225311c06b60e6680" delta = "25.0.0 -> 25.0.0@git:88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
importable = false importable = false
[[audits.wgpu-core-deps-apple]] [[audits.wgpu-core-deps-apple]]
@@ -6121,11 +6121,11 @@ version = "25.0.0"
[[audits.wgpu-core-deps-apple]] [[audits.wgpu-core-deps-apple]]
who = [ who = [
"Teodor Tanasoaia <ttanasoaia@mozilla.com>", "Teodor Tanasoaia <ttanasoaia@mozilla.com>",
"Erich Gubler <erichdongubler@gmail.com>",
"Jim Blandy <jimb@red-bean.com>", "Jim Blandy <jimb@red-bean.com>",
"Erich Gubler <erichdongubler@gmail.com>",
] ]
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
delta = "25.0.0 -> 25.0.0@git:85001b2436f686451d6d783225311c06b60e6680" delta = "25.0.0 -> 25.0.0@git:88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
importable = false importable = false
[[audits.wgpu-core-deps-windows-linux-android]] [[audits.wgpu-core-deps-windows-linux-android]]
@@ -6136,11 +6136,11 @@ version = "25.0.0"
[[audits.wgpu-core-deps-windows-linux-android]] [[audits.wgpu-core-deps-windows-linux-android]]
who = [ who = [
"Teodor Tanasoaia <ttanasoaia@mozilla.com>", "Teodor Tanasoaia <ttanasoaia@mozilla.com>",
"Erich Gubler <erichdongubler@gmail.com>",
"Jim Blandy <jimb@red-bean.com>", "Jim Blandy <jimb@red-bean.com>",
"Erich Gubler <erichdongubler@gmail.com>",
] ]
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
delta = "25.0.0 -> 25.0.0@git:85001b2436f686451d6d783225311c06b60e6680" delta = "25.0.0 -> 25.0.0@git:88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
importable = false importable = false
[[audits.wgpu-hal]] [[audits.wgpu-hal]]
@@ -6229,11 +6229,11 @@ delta = "24.0.0 -> 25.0.0"
[[audits.wgpu-hal]] [[audits.wgpu-hal]]
who = [ who = [
"Teodor Tanasoaia <ttanasoaia@mozilla.com>", "Teodor Tanasoaia <ttanasoaia@mozilla.com>",
"Erich Gubler <erichdongubler@gmail.com>",
"Jim Blandy <jimb@red-bean.com>", "Jim Blandy <jimb@red-bean.com>",
"Erich Gubler <erichdongubler@gmail.com>",
] ]
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
delta = "25.0.0 -> 25.0.0@git:85001b2436f686451d6d783225311c06b60e6680" delta = "25.0.0 -> 25.0.0@git:88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
importable = false importable = false
[[audits.wgpu-types]] [[audits.wgpu-types]]
@@ -6317,11 +6317,11 @@ delta = "24.0.0 -> 25.0.0"
[[audits.wgpu-types]] [[audits.wgpu-types]]
who = [ who = [
"Teodor Tanasoaia <ttanasoaia@mozilla.com>", "Teodor Tanasoaia <ttanasoaia@mozilla.com>",
"Erich Gubler <erichdongubler@gmail.com>",
"Jim Blandy <jimb@red-bean.com>", "Jim Blandy <jimb@red-bean.com>",
"Erich Gubler <erichdongubler@gmail.com>",
] ]
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
delta = "25.0.0 -> 25.0.0@git:85001b2436f686451d6d783225311c06b60e6680" delta = "25.0.0 -> 25.0.0@git:88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
importable = false importable = false
[[audits.whatsys]] [[audits.whatsys]]

View File

@@ -927,36 +927,12 @@ start = "2020-01-14"
end = "2025-07-30" end = "2025-07-30"
notes = "I am an author of this crate" notes = "I am an author of this crate"
[[audits.bytecode-alliance.wildcard-audits.wasm-encoder]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy"
user-id = 73222 # wasmtime-publish
start = "2023-01-01"
end = "2025-05-08"
notes = """
The Bytecode Alliance uses the `wasmtime-publish` crates.io account to automate
publication of this crate from CI. This repository requires all PRs are reviewed
by a Bytecode Alliance maintainer and it owned by the Bytecode Alliance itself.
"""
[[audits.bytecode-alliance.wildcard-audits.wasmparser]] [[audits.bytecode-alliance.wildcard-audits.wasmparser]]
who = "Alex Crichton <alex@alexcrichton.com>" who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
user-id = 73222 # wasmtime-publish user-id = 73222 # wasmtime-publish
start = "2023-01-01" start = "2023-01-01"
end = "2025-05-08" end = "2026-06-03"
notes = """
The Bytecode Alliance uses the `wasmtime-publish` crates.io account to automate
publication of this crate from CI. This repository requires all PRs are reviewed
by a Bytecode Alliance maintainer and it owned by the Bytecode Alliance itself.
"""
[[audits.bytecode-alliance.wildcard-audits.wast]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy"
user-id = 73222 # wasmtime-publish
start = "2023-01-01"
end = "2025-05-08"
notes = """ notes = """
The Bytecode Alliance uses the `wasmtime-publish` crates.io account to automate The Bytecode Alliance uses the `wasmtime-publish` crates.io account to automate
publication of this crate from CI. This repository requires all PRs are reviewed publication of this crate from CI. This repository requires all PRs are reviewed
@@ -968,7 +944,7 @@ who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
user-id = 73222 # wasmtime-publish user-id = 73222 # wasmtime-publish
start = "2023-01-01" start = "2023-01-01"
end = "2025-05-08" end = "2026-06-03"
notes = """ notes = """
The Bytecode Alliance uses the `wasmtime-publish` crates.io account to automate The Bytecode Alliance uses the `wasmtime-publish` crates.io account to automate
publication of this crate from CI. This repository requires all PRs are reviewed publication of this crate from CI. This repository requires all PRs are reviewed

File diff suppressed because one or more lines are too long

View File

@@ -5,6 +5,15 @@ use core::mem::MaybeUninit;
use ash::{ext, khr, vk}; use ash::{ext, khr, vk};
macro_rules! to_u64 {
($expr:expr) => {{
#[allow(trivial_numeric_casts)]
let expr = $expr as u64;
assert!(size_of_val(&expr) <= size_of::<u64>());
expr
}};
}
impl super::Instance { impl super::Instance {
/// Creates a new surface from the given drm configuration. /// Creates a new surface from the given drm configuration.
/// ///
@@ -77,12 +86,18 @@ impl super::Instance {
let render_devid = let render_devid =
libc::makedev(drm_props.render_major as _, drm_props.render_minor as _); libc::makedev(drm_props.render_major as _, drm_props.render_minor as _);
// Various platforms use different widths between `dev_t` and `c_int`, so just // On most platforms, both `*_devid`s and `st_rdev` are `dev_t`s (which is generally
// force-convert to `u64` to keep things portable. // observed to be an unsigned integral type no greater than 64 bits). However, on some
// platforms, there divergences from this pattern:
//
// - `armv7-linux-androideabi`: `dev_t` is `c_ulong`, and `*_devid`s are `dev_t`, but
// `st_rdev` is `c_ulonglong`. So, we can't just do a `==` comparison.
// - OpenBSD has `dev_t` on both sides, but is `i32` (N.B., unsigned). Therefore, we
// can't just use `u64::from`.
#[allow(clippy::useless_conversion)] #[allow(clippy::useless_conversion)]
if [primary_devid, render_devid] if [primary_devid, render_devid]
.map(u64::from) .map(|devid| to_u64!(devid))
.contains(&drm_stat.st_rdev) .contains(&to_u64!(drm_stat.st_rdev))
{ {
physical_device = Some(device) physical_device = Some(device)
} }