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"
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"
rev = "85001b2436f686451d6d783225311c06b60e6680"
rev = "88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
replace-with = "vendored-sources"
[source."git+https://github.com/glandium/rust-objc?rev=4de89f5aa9851ceca4d40e7ac1e2759410c04324"]

12
Cargo.lock generated
View File

@@ -4654,7 +4654,7 @@ checksum = "a2983372caf4480544083767bf2d27defafe32af49ab4df3a0b7fc90793a3664"
[[package]]
name = "naga"
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 = [
"arrayvec",
"bit-set",
@@ -7611,7 +7611,7 @@ dependencies = [
[[package]]
name = "wgpu-core"
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 = [
"arrayvec",
"bit-set",
@@ -7641,7 +7641,7 @@ dependencies = [
[[package]]
name = "wgpu-core-deps-apple"
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 = [
"wgpu-hal",
]
@@ -7649,7 +7649,7 @@ dependencies = [
[[package]]
name = "wgpu-core-deps-windows-linux-android"
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 = [
"wgpu-hal",
]
@@ -7657,7 +7657,7 @@ dependencies = [
[[package]]
name = "wgpu-hal"
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 = [
"android_system_properties",
"arrayvec",
@@ -7693,7 +7693,7 @@ dependencies = [
[[package]]
name = "wgpu-types"
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 = [
"bitflags 2.9.0",
"bytemuck",

View File

@@ -17,7 +17,7 @@ default = []
[dependencies.wgc]
package = "wgpu-core"
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
features = [
"serde",
@@ -33,32 +33,32 @@ features = [
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "85001b2436f686451d6d783225311c06b60e6680"
rev = "88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
features = ["metal"]
# We want the wgpu-core Direct3D backends on Windows.
[target.'cfg(windows)'.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "85001b2436f686451d6d783225311c06b60e6680"
rev = "88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
features = ["dx12"]
# 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]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "85001b2436f686451d6d783225311c06b60e6680"
rev = "88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
features = ["vulkan"]
[dependencies.wgt]
package = "wgpu-types"
git = "https://github.com/gfx-rs/wgpu"
rev = "85001b2436f686451d6d783225311c06b60e6680"
rev = "88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
[dependencies.wgh]
package = "wgpu-hal"
git = "https://github.com/gfx-rs/wgpu"
rev = "85001b2436f686451d6d783225311c06b60e6680"
rev = "88862f1fa3fd0f0c1010e9fc999dcfe47b5ae8fc"
features = ["device_lost_panic", "internal_error_panic"]
[target.'cfg(windows)'.dependencies]

View File

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

View File

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

View File

@@ -927,36 +927,12 @@ start = "2020-01-14"
end = "2025-07-30"
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]]
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.wast]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy"
user-id = 73222 # wasmtime-publish
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
@@ -968,7 +944,7 @@ who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy"
user-id = 73222 # wasmtime-publish
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

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};
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 {
/// Creates a new surface from the given drm configuration.
///
@@ -77,12 +86,18 @@ impl super::Instance {
let render_devid =
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
// force-convert to `u64` to keep things portable.
// On most platforms, both `*_devid`s and `st_rdev` are `dev_t`s (which is generally
// 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)]
if [primary_devid, render_devid]
.map(u64::from)
.contains(&drm_stat.st_rdev)
.map(|devid| to_u64!(devid))
.contains(&to_u64!(drm_stat.st_rdev))
{
physical_device = Some(device)
}