Merge commit '0c9d3ee3' into HEAD
android / android (push) Has been cancelled
apple / screenshots (push) Has been cancelled
apple / swift (push) Has been cancelled
arch / build-publish (push) Has been cancelled
ci / rust (push) Has been cancelled
ci / web (push) Has been cancelled
ci / docs-site (push) Has been cancelled
ci / bench (push) Has been cancelled
deb / build-publish (push) Has been cancelled
decky / build-publish (push) Has been cancelled
docker / build-push (ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Has been cancelled
docker / build-push (ci, ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Has been cancelled
docker / build-push (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Has been cancelled
docker / deploy-docs (push) Has been cancelled
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Has been cancelled
docker / build-push (--build-arg FEDORA_VERSION=44, ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm) (push) Has been cancelled
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Has been cancelled
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Has been cancelled
android / android (push) Has been cancelled
apple / screenshots (push) Has been cancelled
apple / swift (push) Has been cancelled
arch / build-publish (push) Has been cancelled
ci / rust (push) Has been cancelled
ci / web (push) Has been cancelled
ci / docs-site (push) Has been cancelled
ci / bench (push) Has been cancelled
deb / build-publish (push) Has been cancelled
decky / build-publish (push) Has been cancelled
docker / build-push (ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Has been cancelled
docker / build-push (ci, ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Has been cancelled
docker / build-push (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Has been cancelled
docker / deploy-docs (push) Has been cancelled
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Has been cancelled
docker / build-push (--build-arg FEDORA_VERSION=44, ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm) (push) Has been cancelled
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Has been cancelled
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Has been cancelled
This commit is contained in:
@@ -42,6 +42,10 @@ wayland-protocols = { version = "0.32", features = ["client", "staging"] }
|
|||||||
# delayed rendering (`WM_RENDERFORMAT`) for text / CF_HTML / RTF / PNG.
|
# delayed rendering (`WM_RENDERFORMAT`) for text / CF_HTML / RTF / PNG.
|
||||||
windows = { version = "0.62", features = [
|
windows = { version = "0.62", features = [
|
||||||
"Win32_Foundation",
|
"Win32_Foundation",
|
||||||
|
# WNDCLASSW/RegisterClassW reference HBRUSH/HICON/HCURSOR, so windows-rs only generates
|
||||||
|
# them with the Gdi feature on. The host build got it via workspace feature-unification;
|
||||||
|
# a standalone `cargo check -p pf-clipboard` didn't (E0432) — declare it honestly.
|
||||||
|
"Win32_Graphics_Gdi",
|
||||||
"Win32_System_DataExchange",
|
"Win32_System_DataExchange",
|
||||||
"Win32_System_LibraryLoader",
|
"Win32_System_LibraryLoader",
|
||||||
"Win32_System_Memory",
|
"Win32_System_Memory",
|
||||||
|
|||||||
@@ -245,8 +245,8 @@ impl WinClip {
|
|||||||
.format_for_wire(wire)
|
.format_for_wire(wire)
|
||||||
.context("unsupported wire MIME")?;
|
.context("unsupported wire MIME")?;
|
||||||
// Image fetch with no native "PNG" on the clipboard (most apps): read CF_DIB and convert.
|
// Image fetch with no native "PNG" on the clipboard (most apps): read CF_DIB and convert.
|
||||||
// SAFETY: IsClipboardFormatAvailable has no preconditions and needs no open clipboard.
|
|
||||||
let mut via_dib = false;
|
let mut via_dib = false;
|
||||||
|
// SAFETY: IsClipboardFormatAvailable has no preconditions and needs no open clipboard.
|
||||||
if wire == WIRE_PNG && unsafe { IsClipboardFormatAvailable(fmt) }.is_err() {
|
if wire == WIRE_PNG && unsafe { IsClipboardFormatAvailable(fmt) }.is_err() {
|
||||||
fmt = CF_DIB.0 as u32;
|
fmt = CF_DIB.0 as u32;
|
||||||
via_dib = true;
|
via_dib = true;
|
||||||
|
|||||||
@@ -346,9 +346,16 @@ fn auto_priority_gate(device: &ID3D11Device) {
|
|||||||
// The adapter identity this device runs on.
|
// The adapter identity this device runs on.
|
||||||
let luid = match device
|
let luid = match device
|
||||||
.cast::<IDXGIDevice>()
|
.cast::<IDXGIDevice>()
|
||||||
.and_then(|d| unsafe { d.GetAdapter() })
|
.and_then(|d| {
|
||||||
.and_then(|a| unsafe { a.GetDesc() })
|
// SAFETY: `d` is a live IDXGIDevice from the cast; GetAdapter returns an owned
|
||||||
{
|
// COM wrapper that drops with its windows-rs handle.
|
||||||
|
unsafe { d.GetAdapter() }
|
||||||
|
})
|
||||||
|
.and_then(|a| {
|
||||||
|
// SAFETY: `a` is the live adapter from GetAdapter; GetDesc fills a plain
|
||||||
|
// out-struct by value.
|
||||||
|
unsafe { a.GetDesc() }
|
||||||
|
}) {
|
||||||
Ok(desc) => desc.AdapterLuid,
|
Ok(desc) => desc.AdapterLuid,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::warn!(error = %e, "REALTIME auto-gate: no adapter LUID — staying HIGH");
|
tracing::warn!(error = %e, "REALTIME auto-gate: no adapter LUID — staying HIGH");
|
||||||
@@ -418,16 +425,17 @@ fn spawn_vram_gate(luid: LUID) {
|
|||||||
let mut realtime = false; // we start at the HIGH floor
|
let mut realtime = false; // we start at the HIGH floor
|
||||||
let mut clean_ticks = 0u32;
|
let mut clean_ticks = 0u32;
|
||||||
loop {
|
loop {
|
||||||
|
let mut mi = DXGI_QUERY_VIDEO_MEMORY_INFO::default();
|
||||||
// SAFETY: `adapter` is a live IDXGIAdapter3 owned by this thread; the query
|
// SAFETY: `adapter` is a live IDXGIAdapter3 owned by this thread; the query
|
||||||
// fills the local out-struct `mi`.
|
// fills the local out-struct `mi`.
|
||||||
let mut mi = DXGI_QUERY_VIDEO_MEMORY_INFO::default();
|
|
||||||
let info = unsafe {
|
let info = unsafe {
|
||||||
adapter.QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &mut mi)
|
adapter.QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &mut mi)
|
||||||
};
|
};
|
||||||
if info.is_ok() {
|
if info.is_ok() {
|
||||||
let (usage, budget) = (mi.CurrentUsage, mi.Budget);
|
let (usage, budget) = (mi.CurrentUsage, mi.Budget);
|
||||||
if budget > 0 {
|
// checked_div = the budget>0 guard (a fresh/lost adapter reports 0).
|
||||||
let pct = usage * 100 / budget;
|
// usage is bytes; *100 cannot overflow u64 at any real VRAM size.
|
||||||
|
if let Some(pct) = (usage * 100).checked_div(budget) {
|
||||||
if realtime && pct > VRAM_DOWNGRADE_PCT {
|
if realtime && pct > VRAM_DOWNGRADE_PCT {
|
||||||
// SAFETY: pseudo-handle + by-name gdi32 call (setter's contract).
|
// SAFETY: pseudo-handle + by-name gdi32 call (setter's contract).
|
||||||
let st = unsafe {
|
let st = unsafe {
|
||||||
|
|||||||
Reference in New Issue
Block a user