Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 51 additions & 8 deletions apps/app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,37 @@ impl PrefsWriter {
}
}

/// The program that opens `url` in the default browser.
fn open_url_command(url: &str) -> std::process::Command {
if cfg!(target_os = "macos") {
let mut c = std::process::Command::new("open");
c.arg(url);
c
} else if cfg!(target_os = "windows") {
windows_open_url_command(url)
} else {
let mut c = std::process::Command::new("xdg-open");
c.arg(url);
c
}
}

/// Start `cmd` without waiting for it: a launcher such as `xdg-open` can stay attached to the browser, and
/// waiting for it froze the window. The child is reaped on its own thread (adapted from upstream #4033).
fn launch(mut cmd: std::process::Command) -> Result<(), String> {
let program = cmd.get_program().to_string_lossy().into_owned();
let mut child = cmd.spawn().map_err(|e| format!("{program}: {e}"))?;
let reaper = std::thread::Builder::new().name("lc-open-url".into()).spawn(move || match child.wait() {
Ok(s) if s.success() => {}
Ok(s) => log::warn!("{program} exited with {s}"),
Err(e) => log::warn!("{program}: {e}"),
});
if let Err(e) = reaper {
log::warn!("could not watch the link opener: {e}");
}
Ok(())
}

/// The Windows command that opens `url` in the default browser. `explorer <url>` opened File
/// Explorer instead for links with a query or fragment, like the Map button's OpenStreetMap link
/// (issue #234). The URL protocol handler hands the URL to the browser as is; no shell runs, so
Expand Down Expand Up @@ -747,14 +778,7 @@ fn services(cc: &eframe::CreationContext<'_>, log_file: Option<&std::path::Path>
open_url: Some(Box::new(|url: &str| {
// https links, plus the local page Preview in Browser generates (nothing else)
lcc_ui_egui::links::check_browser_url(url)?;
let status = if cfg!(target_os = "macos") {
std::process::Command::new("open").arg(url).status()
} else if cfg!(target_os = "windows") {
windows_open_url_command(url).status()
} else {
std::process::Command::new("xdg-open").arg(url).status()
};
status.map(|_| ()).map_err(|e| e.to_string())
launch(open_url_command(url))
})),
reveal: Some(Box::new(|path: &str| {
let status = if cfg!(target_os = "macos") {
Expand Down Expand Up @@ -1739,6 +1763,25 @@ fn startup_failed(error: &str, log_file: Option<&std::path::Path>) {
mod tests {
use super::*;

/// A link opener that stays running (xdg-open attached to the browser) must not hold the caller; a missing one is an error naming it.
#[cfg(unix)]
#[test]
fn a_link_opener_is_not_waited_for() {
let mut slow = std::process::Command::new("sleep");
slow.arg("3");
let t = std::time::Instant::now();
launch(slow).unwrap();
assert!(t.elapsed() < std::time::Duration::from_secs(2));
let err = launch(std::process::Command::new("definitely-not-a-launcher")).unwrap_err();
assert!(err.contains("definitely-not-a-launcher"), "{err}");
}

#[test]
fn the_link_opener_gets_the_url_last() {
let c = open_url_command("https://example.org/");
assert_eq!(c.get_args().last().and_then(|a| a.to_str()).map(|a| a.contains("example.org")), Some(true));
}

/// The HDR window guard (ported from OneSlips): an HDR monitor keeps the window's device from the
/// renderer only where the guard holds (Linux / BSD); `<PREFIX>_GPU_WINDOW` decides over both.
#[test]
Expand Down
32 changes: 29 additions & 3 deletions crates/gpu/src/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,16 @@ impl Gpu {
}
let generation = NEXT_GENERATION.fetch_add(1, Ordering::Relaxed);
let lost = Arc::new(AtomicBool::new(false));
// Errors outside a render's error scopes (see `ErrorScopes`): log, and replace the device.
// Errors outside a render's error scopes (see `ErrorScopes`): log, and replace the device,
// unless it is the window's own surface failing on the window's device (adapted from upstream #4032).
device.on_uncaptured_error(std::sync::Arc::new(move |e| {
log::error!("gpu: {e}");
crate::mark_broken(generation, &format!("device error: {e}"));
let text = e.to_string();
if stops_renderer(window, &text) {
log::error!("gpu: {text}");
crate::mark_broken(generation, &format!("device error: {text}"));
} else {
log::warn!("gpu: the window's surface: {text}");
}
}));
// wgpu reports a lost device (driver reset, GPU hang, watchdog) only here — never as an
// error — so without this callback a lost device went unnoticed. (A device dropped after
Expand Down Expand Up @@ -1244,8 +1250,28 @@ pub fn groups1(n: usize) -> [u32; 3] {
[x as u32, g.div_ceil(x) as u32, 1]
}

/// Whether an uncaptured error on the renderer's device stops the GPU renderer. The renderer's own
/// work runs inside error scopes, so on the window's device ([`Gpu::adopt`]) an uncaptured error
/// naming a `Surface` is the window's swapchain: one failed `Surface::configure` (a resize or desktop
/// switch) leaves the device fine, and eframe configures it again. A device that is really gone is
/// reported by the device-lost callback.
pub(crate) fn stops_renderer(window: bool, error: &str) -> bool {
!(window && error.contains("Surface::"))
}

#[cfg(test)]
mod tests {
/// On the window's device, the window's surface failing to configure is logged, not a reason to stop the GPU
/// renderer; any other uncaptured error still stops it, and on a device of the renderer's own every one does.
#[test]
fn only_the_window_surface_failing_leaves_the_renderer_on_the_gpu() {
let surface =
"Validation Error\n\nCaused by:\n In Surface::configure\n Failed to wait for GPU to come idle before reconfiguring the Surface";
assert!(!super::stops_renderer(true, surface));
assert!(super::stops_renderer(false, surface));
assert!(super::stops_renderer(true, "Validation Error\n In Queue::submit\n Buffer is destroyed"));
}

#[test]
fn limits_override_is_in_mebibytes_and_never_overflows() {
assert_eq!(super::parse_limits("512MiB"), Some((512 << 20, 1024 << 20)));
Expand Down
16 changes: 16 additions & 0 deletions crates/pipeline/src/tests_geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,3 +612,19 @@ fn a_render_with_lightrooms_matrix_shows_lightrooms_frame() {
assert!(ncc > 0.8, "the render follows Lightroom's stored correction: NCC {ncc:.3}");
assert_eq!(blank, 0, "Lightroom's crop shows no blank corner");
}

/// Decoding keeps negative channels (upstream #2278); Upright's line finding still sees the source clipped at zero.
#[test]
fn upright_analysis_clips_negative_channels_first() {
let mut img = keystoned_grid(300, 200, lcc_geom::Homography::IDENTITY, 20.0);
for (i, p) in img.data.iter_mut().enumerate() {
if i % 7 == 0 {
p[0] = -0.2;
}
}
let clipped = img.map(|p| p.map(|v| v.max(0.0)));
let s = DevelopSettings::default();
let a = crate::upright::analysis_luminance(&img, &SourceInfo::default(), &s, 200);
let b = crate::upright::analysis_luminance(&clipped, &SourceInfo::default(), &s, 200);
assert!(a.data == b.data, "negative channels changed the analysis plane");
}
8 changes: 8 additions & 0 deletions crates/pipeline/src/upright.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,14 @@ pub const STRAIGHTEN_MIN_LINES: usize = 3;
/// The plane Upright looks for lines in: the lens-corrected photo (optics and orientation applied, no
/// perspective or crop) at `long` px on its long edge, as perceptual lightness normalized to its bright end.
pub fn analysis_luminance(src: &Rgb32f, info: &SourceInfo, s: &DevelopSettings, long: usize) -> Plane {
// Decoding keeps negative channels (upstream #2278); line finding sees the source clipped at zero, as before.
let clipped;
let src = if src.data.iter().any(|p| p.iter().any(|v| *v < 0.0)) {
clipped = src.map(|p| p.map(|v| v.max(0.0)));
&clipped
} else {
src
};
let mut base = s.clone();
base.geometry = Geometry::default();
base.crop = Crop::default();
Expand Down
27 changes: 27 additions & 0 deletions docs/upstream-pr-reviews/ledger.md
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,32 @@ PR head or commit SHA. A pipe inside a cell is escaped with a backslash.
| #4001 | open | chore(deps): bump the cargo-dependencies group across 1 directory with 10 updates | SKIP | - | Dependabot bump of upstream's lockfile (candle 0.9 to 0.11, jixel 0.3 to 0.5, quick-xml, harfrust, brotli); Chromaforge manages its own dependencies and a major candle/jixel jump is a decode and model risk with no measurements. | `03050341ab` | 2026-11-09 @ f6b57b0b59 | - |
| #3995 | merged | Updates: the updater reports installing, ready, installed and failed, and installs at exit | SKIP | - | Chromaforge has its own `crates/updater`, not craft-update; the change is a craft-update pin bump plus apps/ and ui-egui (fork-owned) updater dialogs. | `e62efc0af2` | 2026-11-09 @ f6b57b0b59 | - |
| #3996 | merged | Updates: take craft-update from craft-libs main at 1b34eba41 | SKIP | - | Bumps craft-update in Cargo.toml; Chromaforge has no craft-update dependency (own updater). | `c31f91c8fe` | 2026-11-09 @ f6b57b0b59 | - |
| #309 | closed | native_menu: leave P and U flagging shortcuts to egui (#283) | SKIP | - | Closed upstream; #261 covers macOS single-key shortcuts and the fork delivers only chords to the menu bar. | `5cf2eb918e` | 2026-11-10 @ e9c29e2c5c | - |
| #924 | open | Camera database (camdb): per-model colour data with provenance | SKIP | - | Fork already has crates/camdb as a superset (extract, show, provenance refusals, docs). | `f1ede6107c` | 2026-11-10 @ e9c29e2c5c | - |
| #1169 | closed | Import from cameras that don't mount as a disk (PTP/MTP) on Windows (#1005) | SKIP | - | Closed upstream in favour of #1635 (WATCH row); no WPD import or COM unsafe crate here. | `d15dd02bd5` | 2026-11-10 @ e9c29e2c5c | - |
| #2016 | open | LR-BEHAV-LOCALIZE: menu paths with →, not the ▸ no UI font has (#1950) | LEARN | next round | Right fix (▸ has no glyph, fork catalogs already use →) but ~45 source literals plus key renames in 18 locales and a guard test: follow-up sweep, not done this round. | `025dd072e4` | 2026-11-10 @ e9c29e2c5c | - |
| #2092 | open | LR-PROF-CAMERACOLOR: color and tone in pushed shadows | LEARN | next round | Fork ported the base (#258); four later upstream look fixes (negative-channel luminance, with_pooled_tone, tone samples, thinned_knots) change tone and need LOOK_VERSION and before/after numbers: unmeasured, kept out. | `9bdb1f4d68` | 2026-11-10 @ e9c29e2c5c | - |
| #2278 | open | LR-PROF-CAMERACOLOR: raw decoding keeps negative channels | ADOPT | - | Core already ported; added the missing Upright delta (analysis sees source clipped at zero) with its test. | `c82e898b0a` | 2026-11-10 @ e9c29e2c5c | `e13c976c6` |
| #2485 | open | catalog.query / library.filter: an unknown filter key is an error, not a silent whole-library match (#2241) | SKIP | - | Fork already has deny_unknown_fields on Filter (crates/catalog/src/query.rs). | `d253f742be` | 2026-11-10 @ e9c29e2c5c | - |
| #2533 | open | M12: SAM 3 accelerator plumbing (1/5 of #2167): backend choice, CPU fallback and the AI masks setting | SKIP | - | Part 1 of a 5-part SAM 3 accelerator stack; fork has its own segment worker. Whole-stack decision deferred. | `559c61eadd` | 2026-11-10 @ e9c29e2c5c | - |
| #2535 | open | M12: SAM 3 necks on the GPU (3/5 of #2167) | SKIP | - | Part 3 of the SAM 3 stack (needs sam3 WGSL kernels the fork lacks); not standalone. See #2533. | `b9f50fc7f4` | 2026-11-10 @ e9c29e2c5c | - |
| #2599 | merged | LRC-LIB-CATALOG-IMPORT: import Lightroom catalog backup zips directly (#2592) | LEARN | next round | Lightroom backup .zip import is wanted (hardened ZIP/ZIP64 reader, new module, CatalogImport changes, tests); too large to port safely this round. | `4ecbd194fd` | 2026-11-10 @ e9c29e2c5c | - |
| #4004 | open | Merge release 0.20.0 back into main | SKIP | - | Release merge-back; upstream-only. | `ef0e8707d0` | 2026-11-10 @ e9c29e2c5c | - |
| #4006 | open | LR-MASK-BRUSH: a Density slider for the brush | SKIP | - | Fork already has the brush Density slider, presets and stroke density. | `4dd03eab39` | 2026-11-10 @ e9c29e2c5c | - |
| #4007 | open | Lens refresh: search the database once per camera and lens pair in a sweep | SKIP | - | Fork has no library-wide lens_refresh sweep (see #3867). | `b585e51135` | 2026-11-10 @ e9c29e2c5c | - |
| #4020 | open | Low-disk notice: warn under 20 GB free, not under 10 % of the drive (#4013) | SKIP | - | Fork has no low-disk notice (LOW_FREE_PERCENT absent). | `9b2b2de8d2` | 2026-11-10 @ e9c29e2c5c | - |
| #4021 | open | Crop tool: clip the crop box to the loupe, not over the filmstrip (#3966) | SKIP | - | Upstream-owned paths only (crop tool UI). | `88f6e67f58` | 2026-11-10 @ e9c29e2c5c | - |
| #4027 | open | Tests: the second folder drop waits for the Missing Photos count (#3822) | SKIP | - | Upstream-owned paths only (a UI test). | `96c0ca4db2` | 2026-11-10 @ e9c29e2c5c | - |
| #4030 | open | Sidebar: a photo moved during a Missing Photos count isn't counted at its old place (#4028) | SKIP | - | Upstream-owned paths only (sidebar). | `35edfc33f5` | 2026-11-10 @ e9c29e2c5c | - |
| #4031 | open | Issue #4017: raws develop on the web again (the hot-pixel timer panicked on wasm32) | SKIP | - | Fork has no hot-pixel timer (wasm Instant panic path absent). | `aaa4585169` | 2026-11-10 @ e9c29e2c5c | - |
| #4032 | open | GPU: the window's surface failing to configure no longer sends rendering to the CPU (#4029) | ADOPT | - | Window surface-configure failure on the window's device is logged, not a reason to drop to the CPU; adapted with its test. | `9d765ad2b1` | 2026-11-10 @ e9c29e2c5c | `7e94d1156` |
| #4033 | open | Desktop: opening a link no longer waits for the browser launcher | ADOPT | - | Opening a link no longer blocks the UI thread on the browser launcher; ported keeping the fork link check, with test. | `88b006f8e5` | 2026-11-10 @ e9c29e2c5c | `d58337988` |
| #4034 | open | LR-IMP: the import review remembers where copies go (#3951) | LEARN | next round | Remember import copy destination/organize/templates per library: engine part ports closely, UI part is a rewrite of the fork import screen; follow-up. | `06719278cd` | 2026-11-10 @ e9c29e2c5c | - |
| #4035 | open | LR-LIB-DELETE: permanently delete originals from disk | SKIP | - | Draft, UI-only and irreversible; fork already has photo.deleteFromDisk to the trash. | `fea7b94abc` | 2026-11-10 @ e9c29e2c5c | - |
| #4046 | open | LR-IMP-RAWJPEG: treat a JPEG next to a raw as one photo (stacked pair) | PENDING | upstream approval | Draft RAW+JPEG stack pairing touching catalog; upstream may replace it with the companion model (#332). | `e021731052` | 2026-11-10 @ e9c29e2c5c | - |
| #4047 | open | LR-MASK-BRUSH: Flow as in Lightroom (process V8): coverage per brush radius travelled | LEARN | next round | Flow as coverage per radius travelled is worth taking, but fork V8 is taken and the Lightroom-model brush path is untouched by the patch; needs own V9 and measurement. | `fb2085c77e` | 2026-11-10 @ e9c29e2c5c | - |
| #4048 | open | CI: release workflow grants write permissions to the release job only | SKIP | - | Upstream CI workflow permissions. | `993af1c343` | 2026-11-10 @ e9c29e2c5c | - |
| #4050 | open | chore(deps): bump the cargo-dependencies group across 1 directory with 11 updates | SKIP | - | Dependabot bump of upstream lockfile. | `34c2b047bd` | 2026-11-10 @ e9c29e2c5c | - |

## Run log

Expand All @@ -848,3 +874,4 @@ PR head or commit SHA. A pipe inside a cell is escaped with a backslash.
| round 2 port pass | 2026-11-08 | `b3b49987d4` | 33 PENDING/LEARN/WATCH rows hand-ported where safe | 13 new: #3906, #3882, #3881, #3812 (availability part), #3904, #3808, #3828, #3821, #3758, #3756, #3933, #2676 (tie-break), #3798; #3143 row corrected (already in the fork) | the rest stay as they were (too large, stacked, drafts, or need numbers or a maintainer decision) | (this PR) |
| round 3 | 2026-11-09 | `7e2b8a6b27` | 23 new PRs read in full in three batches, plus 25 rows whose head or state moved | 11: #3958, #3969, #3977, #3978, #3989, #3993 (new); #3284 (review fixes), #3628, #3939, #3798, #3833 (moved/merged); #3423 taken in own form | 3985/3986/3987, 1231, 1958, 3972, 3982, 3992 PENDING; 3964 LEARN; 587, 2328, 3963, 3971, 3975, 3984, 3988, 3991 SKIP | (this PR) |
| 3 | 2026-11-09 | `f6b57b0b59` | 251 candidates (most already had rows; every row re-stamped against the live head) | 3: #3697 `8bbc9c81c` (FIFO fix), #3912 `b3eb269f6` (PNG bound follow-up), #3624 `aef212c5e` (hide-rejected guard) | #3922 moved to PENDING (needs portrait-raw numbers); #3989 web probe follow-up not ported | (this PR) |
| round 4 | 2026-11-10 | `e9c29e2c5c` | 26 new PRs, all read (batch reviews, diffs skimmed for the SAM 3 stack and long tests) | 3: #4032 `7e94d1156`, #4033 `d58337988`, #2278 delta `e13c976c6` | 5 LEARN, 1 PENDING, 17 SKIP | (this PR) |
3 changes: 3 additions & 0 deletions docs/whats-new/2026-11-10-gpu-surface-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### A failed window resize no longer drops rendering to the CPU

- When the window's own swap chain fails to reconfigure once (for example when switching virtual desktops under load), the GPU renderer now keeps running and the window configures it again on the next frame. Other GPU errors still stop it.
3 changes: 3 additions & 0 deletions docs/whats-new/2026-11-10-open-link-no-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Opening a link no longer freezes the window

- Links open in your browser without the app waiting for the browser launcher, so the window stays responsive while the browser starts.
3 changes: 3 additions & 0 deletions docs/whats-new/2026-11-10-upright-negative-channels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Upright is unaffected by negative colour values

- Auto-straightening (Upright) analyses the photo exactly as before, even though raw decoding now keeps slightly negative channel values.